Skip to content

Commit 5489025

Browse files
committed
Add ramp up and down to curve squeal.
1 parent e0f3c55 commit 5489025

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ public Direction Direction
583583
protected SmoothedData CurveForceFilter = new SmoothedData(0.75f);
584584
public float CurveForceNFiltered;
585585

586+
protected SmoothedData CurveSquealAoAmRadFilter = new SmoothedData(0.75f);
587+
public float CurveSquealAoAmRadFiltered;
588+
586589
public float TunnelForceN; // Resistive force due to tunnel, in Newtons
587590
public float FrictionForceN; // in Newtons ( kg.m/s^2 ) unsigned, includes effects of curvature
588591
public float BrakeForceN; // current braking force applied to slow train (Newtons) - will be impacted by wheel/rail friction
@@ -970,6 +973,9 @@ public virtual void Update(float elapsedClockSeconds)
970973

971974
AngleOfAttackmRad = GetAngleofAttackmRad();
972975

976+
CurveSquealAoAmRadFilter.Update(elapsedClockSeconds, AngleOfAttackmRad);
977+
CurveSquealAoAmRadFiltered = CurveSquealAoAmRadFilter.SmoothedValue;
978+
973979
UpdateCurveSpeedLimit(); // call this first as it will provide inputs for the curve force.
974980
UpdateCurveForce(elapsedClockSeconds);
975981
UpdateTunnelForce();
@@ -2265,6 +2271,7 @@ public virtual void Save(BinaryWriter outf)
22652271
outf.Write(CarHeatCurrentCompartmentHeatJ);
22662272
outf.Write(CarSteamHeatMainPipeSteamPressurePSI);
22672273
outf.Write(CarHeatCompartmentHeaterOn);
2274+
outf.Write(CurveSquealAoAmRadFiltered);
22682275
}
22692276

22702277
// Game restore
@@ -2289,6 +2296,8 @@ public virtual void Restore(BinaryReader inf)
22892296
CarSteamHeatMainPipeSteamPressurePSI = inf.ReadSingle();
22902297
CarHeatCompartmentHeaterOn = inf.ReadBoolean();
22912298
FreightAnimations?.LoadDataList?.Clear();
2299+
CurveSquealAoAmRadFiltered = inf.ReadSingle();
2300+
CurveSquealAoAmRadFilter.ForceSmoothValue(CurveSquealAoAmRadFiltered);
22922301
}
22932302

22942303
//================================================================================================//

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ private float ReadValue(Orts.Formats.Msts.VolumeCurve.Controls control, MSTSWago
15151515
case Orts.Formats.Msts.VolumeCurve.Controls.Variable3Controlled: return car.Variable3;
15161516
case Orts.Formats.Msts.VolumeCurve.Controls.BrakeCylControlled: return car.BrakeSystem.GetCylPressurePSI();
15171517
case Orts.Formats.Msts.VolumeCurve.Controls.CurveForceControlled: return car.CurveForceNFiltered;
1518-
case Orts.Formats.Msts.VolumeCurve.Controls.AngleofAttackControlled: return car.AngleOfAttackmRad;
1518+
case Orts.Formats.Msts.VolumeCurve.Controls.AngleofAttackControlled: return car.CurveSquealAoAmRadFiltered;
15191519
case Orts.Formats.Msts.VolumeCurve.Controls.CarFrictionControlled: return car.Train.WagonCoefficientFriction;
15201520
default: return 0;
15211521
}

0 commit comments

Comments
 (0)