refined
This commit is contained in:
@@ -38,7 +38,7 @@ namespace FluidSim.Tests
|
||||
|
||||
// ---------- Throttle control ----------
|
||||
public double Throttle { get; set; } = 0.0;
|
||||
public double MaxThrottleArea { get; set; } = 6 * Units.cm2; // 2 cm²
|
||||
public double MaxThrottleArea { get; set; } = 3 * Units.cm2; // 2 cm²
|
||||
|
||||
public override void Initialize(int sampleRate)
|
||||
{
|
||||
@@ -49,37 +49,38 @@ namespace FluidSim.Tests
|
||||
solver.CflTarget = 0.9;
|
||||
|
||||
// ---- Crankshaft (external, passed to cylinder) ----
|
||||
crankshaft = new Crankshaft(1000);
|
||||
crankshaft.Inertia = 0.05;
|
||||
crankshaft = new Crankshaft(600);
|
||||
crankshaft.Inertia = 0.1;
|
||||
crankshaft.FrictionConstant = 2;
|
||||
crankshaft.FrictionViscous = 0.05;
|
||||
crankshaft.FrictionViscous = 0.04;
|
||||
|
||||
// ---- Cylinder ----
|
||||
double bore = 0.056, stroke = 0.057, conRod = 0.110, compRatio = 9.2;
|
||||
double ivo = 370.0, ivc = 580.0, evo = 120.0, evc = 350.0;
|
||||
double ivo = 350.0, ivc = 580.0, evo = 120.0, evc = 370.0;
|
||||
cylinder = new Cylinder(bore, stroke, conRod, compRatio, ivo, ivc, evo, evc, crankshaft)
|
||||
{
|
||||
MaxIntakeArea = 3.7 * Units.cm2,
|
||||
MaxExhaustArea = 3.7 * Units.cm2,
|
||||
IntakeValveDiameter = 30 * Units.mm, // 30 mm
|
||||
IntakeValveLift = 5 * Units.mm, // 5 mm
|
||||
ExhaustValveDiameter = 28 * Units.mm, // 28 mm
|
||||
ExhaustValveLift = 5 * Units.mm // 5 mm
|
||||
};
|
||||
solver.AddComponent(cylinder);
|
||||
|
||||
double pipeDiameter = 2 * Units.cm;
|
||||
double pipeArea = Units.AreaFromDiameter(pipeDiameter);
|
||||
|
||||
exhaustSoundProcessor = new SoundProcessor(sampleRate, 1, pipeDiameter) { Gain = 0.05f };
|
||||
intakeSoundProcessor = new SoundProcessor(sampleRate, 1, pipeDiameter) { Gain = 0.05f };
|
||||
exhaustSoundProcessor = new SoundProcessor(sampleRate, 1, pipeDiameter) { Gain = 0.1f };
|
||||
intakeSoundProcessor = new SoundProcessor(sampleRate, 1, pipeDiameter) { Gain = 0.1f };
|
||||
reverb = new OutdoorExhaustReverb(sampleRate);
|
||||
|
||||
// ---- Pipes ----
|
||||
intakePipeBeforeThrottle = new Pipe1D(0.15, pipeArea, 5);
|
||||
intakeRunner = new Pipe1D(0.1, pipeArea, 5);
|
||||
exhaustPipe = new Pipe1D(1.00, pipeArea, 80);
|
||||
intakePipeBeforeThrottle = new Pipe1D(0.2, pipeArea, 10);
|
||||
intakeRunner = new Pipe1D(0.2, pipeArea, 10);
|
||||
exhaustPipe = new Pipe1D(0.5, pipeArea, 50);
|
||||
solver.AddComponent(intakePipeBeforeThrottle);
|
||||
solver.AddComponent(intakeRunner);
|
||||
solver.AddComponent(exhaustPipe);
|
||||
|
||||
// ---- Plenum (5 mL) ----
|
||||
intakePlenum = new Volume0D(5 * Units.mL, 101325.0, 300.0);
|
||||
var plenumInlet = intakePlenum.CreatePort();
|
||||
var plenumOutlet = intakePlenum.CreatePort();
|
||||
@@ -95,9 +96,9 @@ namespace FluidSim.Tests
|
||||
|
||||
// ---- Throttle orifice (variable area) ----
|
||||
throttleOrifice = new OrificeLink(plenumInlet, intakePipeBeforeThrottle, isPipeLeftEnd: false,
|
||||
areaProvider: () => MaxThrottleArea * Math.Clamp(Throttle, 0.001, 1))
|
||||
areaProvider: () => MaxThrottleArea * Math.Clamp(Throttle, 0.0001, 1))
|
||||
{
|
||||
DischargeCoefficient = 0.1,
|
||||
DischargeCoefficient = 0.2,
|
||||
UseInertance = false
|
||||
};
|
||||
solver.AddOrificeLink(throttleOrifice);
|
||||
@@ -170,7 +171,7 @@ namespace FluidSim.Tests
|
||||
|
||||
float exhaustDry = exhaustSoundProcessor.Process(exhaustOpenEnd);
|
||||
float intakeDry = intakeSoundProcessor.Process(intakeOpenEnd);
|
||||
return reverb.Process(intakeDry + exhaustDry);
|
||||
return reverb.Process(exhaustDry + intakeDry);
|
||||
}
|
||||
|
||||
public override void Draw(RenderWindow target)
|
||||
|
||||
Reference in New Issue
Block a user