Add American V8 preset, carb fuel transport, and adaptive desktop audio
This commit is contained in:
46
include/FluidSim/Carburetor.hpp
Normal file
46
include/FluidSim/Carburetor.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
namespace fluidsim::port {
|
||||
|
||||
// Lumped slide-carburetor model for the crankcase-scavenged two-stroke. The
|
||||
// jets use liquid-orifice flow from a float bowl into the measured venturi
|
||||
// depression. Delivered fuel is injected into the downstream fluid volume and
|
||||
// is then transported as a conserved species; this class never doses a cylinder.
|
||||
class Carburetor {
|
||||
public:
|
||||
float fuel_density{740.0f};
|
||||
float pilot_jet_diameter{0.00040f}, main_jet_diameter{0.00150f};
|
||||
float needle_jet_diameter{0.00190f};
|
||||
float pilot_discharge_coefficient{0.62f}, main_discharge_coefficient{0.72f};
|
||||
float bowl_head_pressure{};
|
||||
float film_fraction{0.28f}, film_time_constant{0.11f};
|
||||
float bowl_capacity{0.008f}, bowl_refill_rate{0.0025f}; // kg, kg/s
|
||||
float overrun_rpm{4200.0f}, overrun_exit_rpm{3300.0f};
|
||||
|
||||
explicit Carburetor(float throat_diameter = 0.0381f);
|
||||
|
||||
// air_mass_flow is positive from atmosphere toward the engine.
|
||||
void step(float dt, float pedal, float slide, float rpm, float air_mass_flow,
|
||||
float air_density, float upstream_pressure, float downstream_pressure);
|
||||
|
||||
float indicated_afr() const { return indicated_afr_; }
|
||||
float fuel_flow() const { return delivered_fuel_flow_; }
|
||||
float film_mass() const { return film_mass_; }
|
||||
float bowl_level() const { return bowl_mass_ / bowl_capacity; }
|
||||
bool overrun_active() const { return overrun_; }
|
||||
bool fault() const { return fault_; }
|
||||
float venturi_depression() const { return venturi_depression_; }
|
||||
|
||||
private:
|
||||
float bowl_mass_{}, film_mass_{};
|
||||
float throat_area_{}, venturi_depression_{};
|
||||
float filtered_air_flow_{}, filtered_fuel_flow_{}, delivered_fuel_flow_{};
|
||||
float indicated_afr_{13.5f};
|
||||
float previous_pedal_{}, lift_enrichment_{};
|
||||
bool initialized_{}, overrun_{}, fault_{};
|
||||
};
|
||||
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user