Add American V8 preset, carb fuel transport, and adaptive desktop audio

This commit is contained in:
2026-10-23 12:43:57 +02:00
parent 7a5c77c1c8
commit 85d4fb828a
36 changed files with 805 additions and 144 deletions

View File

@@ -1,3 +1,4 @@
#include "FluidSim/Carburetor.hpp"
#include "FluidSim/TwoStrokeScenario.hpp"
#include <iostream>
#include <stdexcept>
@@ -37,6 +38,17 @@ float reflected_pulse(bool expanding) {
}
}
int main() {
Carburetor carburetor;
for (int i = 0; i < 1000; ++i)
carburetor.step(.001f, .55f, .55f, 8000.0f, .012f, 1.15f, 101325.0f, 90000.0f);
const float cruise_afr = carburetor.indicated_afr();
carburetor.step(.001f, 0.0f, .05f, 8000.0f, .004f, 1.15f, 101325.0f, 86000.0f);
check(carburetor.overrun_active() && carburetor.fuel_flow() > 0.0f,
"carburetor cut fuel when the throttle closed");
check(std::isfinite(cruise_afr) && cruise_afr >= 4.0f && cruise_afr <= 40.0f &&
carburetor.bowl_level() > 0.0f && carburetor.bowl_level() <= 1.0f,
"carburetor mixture or float bowl left its physical bounds");
const std::array<PipeSection, 1> cone{{{.4f, .03f, .10f}}};
const float expected = pi/12 * .4f * (.03f*.03f + .03f*.10f + .10f*.10f);
for (float mesh : {.03f, .01f, .004f}) {
@@ -84,6 +96,16 @@ int main() {
check(std::abs(first-30.27f)<.03f && std::abs(s.vehicle.total_gear_ratio()-13.4f)<.03f,
"YZ125 primary/final/gear reduction incorrect");
s.set_throttle(.5f);
for (int sample = 0; sample < 22050; ++sample)
s.process();
bool transported_fuel = false;
for (int pipe_index : {1, 2})
for (const auto& cell : s.pipes[pipe_index].cells)
transported_fuel |= cell.fuel > 0.0f;
check(s.intake_plenum.fuel_mass() > 0.0f && s.crankcase.fuel_mass() > 0.0f && transported_fuel,
"carburetor fuel was not transported through intake, reed and crankcase");
Crankshaft crank;
crank.omega = 100;
crank.load_torque = 10;