250cc mx engine, and dyno
This commit is contained in:
@@ -107,13 +107,11 @@ namespace FluidSim.Components
|
||||
|
||||
if (closes < opens)
|
||||
{
|
||||
// Wrap‑around case (e.g., exhaust: opens near 480°, closes near 30°)
|
||||
effectiveClose += 720f;
|
||||
}
|
||||
duration = effectiveClose - effectiveOpen;
|
||||
if (duration <= 0f) return 0f;
|
||||
|
||||
// Map the angle into the [opens, opens+duration] window
|
||||
float mapped = deg;
|
||||
if (mapped < opens) mapped += 720f;
|
||||
if (mapped < opens || mapped > effectiveClose) return 0f;
|
||||
@@ -153,6 +151,10 @@ namespace FluidSim.Components
|
||||
|
||||
public void PreStep(float dt)
|
||||
{
|
||||
// Speed‑dependent spark advance (simple linear)
|
||||
float rpm = Crankshaft.AngularVelocity * 60f / (2f * MathF.PI);
|
||||
SparkAdvance = Math.Clamp(10f + rpm * 0.002f, 5f, 40f); // 10° at idle, ~30° at 10k rpm
|
||||
|
||||
float prevVolume = cylinderVolume;
|
||||
float crankAngleRad = Crankshaft.CrankAngle + PhaseOffset;
|
||||
cylinderVolume = ComputeVolume(crankAngleRad);
|
||||
@@ -170,7 +172,7 @@ namespace FluidSim.Components
|
||||
float prevDeg = (Crankshaft.PreviousAngle + PhaseOffset) * 180f / MathF.PI % 720f;
|
||||
float currDeg = crankAngleRad * 180f / MathF.PI % 720f;
|
||||
|
||||
// Intake closing
|
||||
// Intake closing – triggers fuel injection
|
||||
if (prevDeg >= IVO && prevDeg < IVC && currDeg >= IVC)
|
||||
{
|
||||
trappedAirMass = _airMass;
|
||||
|
||||
Reference in New Issue
Block a user