Files
FluidSimCpp/include/FluidSim/ScenarioSnapshot.hpp

70 lines
3.2 KiB
C++

#pragma once
#include "FluidSim/EngineConfig.hpp"
#include "FluidSim/Fluid.hpp"
#include "FluidSim/OutdoorAudio.hpp"
#include "FluidSim/Silencer.hpp"
#include <array>
#include <cstdint>
#include <string>
#include <vector>
#include <memory>
namespace fluidsim::port {
struct ScenarioSnapshot {
struct StorageVolume {std::string id;GeometryBox box;float pressure{};};
struct PipeHousing {std::size_t pipe{};float start{},length{},diameter{};};
std::shared_ptr<const PhysicalGeometry> geometry;
std::vector<StorageVolume> storage_volumes;
std::vector<PipeHousing> pipe_housings;
float cylinder_bore{},cylinder_stroke{},cylinder_rod{},cylinder_clearance{};
float intake_valve_diameter{},exhaust_valve_diameter{};
std::string example_name;
float cells_per_meter{};
EngineLayout layout{EngineLayout::Inline};
float bank_angle{};
bool v8_headers{};
bool staged_headers{}, dual_exhaust{};
PipeSolver pipe_solver{PipeSolver::Rusanov};
int cylinder_count{2};
float rev_limit_rpm{10000};
std::array<float, 12> cylinder_angles{};
std::array<float, 12> cylinder_pressures{}, piston_fractions{}, intake_areas{}, exhaust_areas{};
std::array<float,12> intake_lifts{},exhaust_lifts{};
std::uint64_t junction_fallbacks{}, junction_iterations{}, boundary_limited_fluxes{}, junction_limited_fluxes{};
std::uint64_t solver_substeps{}, boundary_iterations{}, pipe_positivity_repairs{};
float rpm{}, speed_kmh{}, kinetic_energy{}, average_power{}, average_torque{};
float cylinder_pressure1{}, cylinder_pressure2{};
float cylinder_temperature1{}, cylinder_temperature2{};
float cylinder_piston_fraction1{}, cylinder_piston_fraction2{};
float valve1_intake_area{}, valve1_exhaust_area{}, valve2_intake_area{}, valve2_exhaust_area{};
float intake_pressure{}, exhaust_pressure{}, second_bank_pressure{};
std::array<float,2> crossover_pressures{};
float throttle{}, pedal{}, target_afr{}, clutch{}, intake_flow{}, exhaust_flow{};
bool idle_control{}, fuel_cut{}, ignition_cut{}, two_stroke{}, reed_open{};
bool valve_float{};
// Cylinder 1 lift over the most recently sampled 720 degree cycle (4 degree bins, metres).
std::array<float,181> intake_cam_lifts{},exhaust_cam_lifts{},intake_lift_trace{},exhaust_lift_trace{};
float intake_lift{},exhaust_lift{},valve_contact_impulse{};
bool racing_exhaust{};
bool silencers{}, h_pipe{};
ExhaustConfig exhaust_config{};
float crankcase_pressure{};
OutdoorScene audio_scene{OutdoorScene::Wall};
int gear{};
bool rev_limit1{}, rev_limit2{};
std::array<std::vector<GasState>, 32> pipe_states;
std::array<std::vector<float>, 32> pipe_areas, pipe_lengths;
void capture_pipes(const std::vector<Pipe1D>& pipes) {
for (std::size_t k = 0; k < pipes.size(); ++k) {
pipe_positivity_repairs += pipes[k].positivity_repairs;
pipe_areas[k] = pipes[k].cell_areas;
pipe_lengths[k] = pipes[k].cell_lengths;
pipe_states[k].reserve(pipes[k].cells.size());
for (std::size_t i = 0; i < pipes[k].cells.size(); ++i)
pipe_states[k].push_back(pipes[k].state(static_cast<int>(i)));
}
}
};
}