Skip to content

Commit 6fcbe31

Browse files
committed
Add volume controlled curve for back pressure
1 parent af5bc46 commit 6fcbe31

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Source/Orts.Formats.Msts/SoundManagmentFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public struct CurvePoint
240240

241241
public class VolumeCurve
242242
{
243-
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
243+
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled, BackPressureControlled };
244244

245245
public Controls Control = Controls.None;
246246
public float Granularity = 1.0f;
@@ -264,6 +264,7 @@ public VolumeCurve(STFReader stf)
264264
case "variable3controlled": Control = Controls.Variable3Controlled; break;
265265
case "brakecylcontrolled": Control = Controls.BrakeCylControlled; break;
266266
case "curveforcecontrolled": Control = Controls.CurveForceControlled; break;
267+
case "backpressurecontrolled": Control = Controls.BackPressureControlled; break;
267268
default: STFException.TraceWarning(stf, "Crash expected: Skipped unknown VolumeCurve/Frequencycurve type " + type); stf.SkipRestOfBlock(); return;
268269
}
269270
stf.ParseBlock(new STFReader.TokenProcessor[] {

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,6 +3192,9 @@ public override void Update(float elapsedClockSeconds)
31923192

31933193
}
31943194

3195+
// calculate total back pressure from all exhausts
3196+
BackPressurePSIG = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpH)];
3197+
31953198
UpdateTractiveForce(elapsedClockSeconds, ThrottlePercent / 100f, AbsSpeedMpS, AbsWheelSpeedMpS);
31963199

31973200
#endregion

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2009 - 2022 by the Open Rails project.
1+
// COPYRIGHT 2009 - 2022 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -183,6 +183,8 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
183183
public float CarHeatCurrentCompartmentHeatJ;
184184
public float CarInsideTempC;
185185

186+
public float BackPressurePSIG; // Back pressure in steam cylinder for sound system
187+
186188
// some properties of this car
187189
public float CarWidthM = 2.5f;
188190
public float CarLengthM = 40; // derived classes must overwrite these defaults

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,7 @@ private float ReadValue(Orts.Formats.Msts.VolumeCurve.Controls control, MSTSWago
15041504
case Orts.Formats.Msts.VolumeCurve.Controls.Variable3Controlled: return car.Variable3;
15051505
case Orts.Formats.Msts.VolumeCurve.Controls.BrakeCylControlled: return car.BrakeSystem.GetCylPressurePSI();
15061506
case Orts.Formats.Msts.VolumeCurve.Controls.CurveForceControlled: return car.CurveForceNFiltered;
1507+
case Orts.Formats.Msts.VolumeCurve.Controls.BackPressureControlled: return car.BackPressurePSIG;
15071508
default: return 0;
15081509
}
15091510
}

0 commit comments

Comments
 (0)