@@ -291,6 +291,10 @@ public class MSTSSteamLocomotive : MSTSLocomotive
291291 SmoothedData BurnRateSmoothKGpS = new SmoothedData(150); // Changes in BurnRate take x seconds to fully react to changing needs - models increase and decrease in heat.
292292 float FuelRateSmoothed = 0.0f; // Smoothed Fuel Rate
293293
294+ int NumberofMotiveForceValues = 36;
295+ float[] MotiveForceAverageN = new float[36];
296+ float DisplayAverageMotiveForceN;
297+
294298 public Orts.Simulation.Simulation.RollingStocks.SubSystems.PowerSupplies.SteamEngines SteamEngines;
295299
296300 // steam performance reporting
@@ -2548,6 +2552,11 @@ public override void Update(float elapsedClockSeconds)
25482552
25492553 }
25502554
2555+
2556+
2557+
2558+
2559+
25512560 /// <summary>
25522561 /// Update variables related to audiovisual effects (sound, steam)
25532562 /// </summary>
@@ -3060,6 +3069,8 @@ private void UpdateFX(float elapsedClockSeconds)
30603069 BoosterCylinderSteamExhaust02SteamVolumeM3pS = BoosterCylinderSteamExhaustOn && BoosterCylinderSteamExhaust02On ? (10.0f * BoosterSteamFraction) : 0.0f;
30613070 BoosterCylinderSteamExhaust02SteamVelocityMpS = 100.0f;
30623071
3072+ Trace.TraceInformation("Booster Exhaust - ExhaustOn {0} Exhaust01On {1} Exhaust02On {2} ExhaustVolume01 {3} ExhaustVolume02 {4} SteamFraction {5} Speed {6}", BoosterCylinderSteamExhaustOn, BoosterCylinderSteamExhaust01On, BoosterCylinderSteamExhaust02On, BoosterCylinderSteamExhaust01SteamVolumeM3pS, BoosterCylinderSteamExhaust02SteamVolumeM3pS, BoosterSteamFraction, BoosterEngineSpeedRpM);
3073+
30633074 // Booster Cylinder Steam Cylinder Cocks (automatic)
30643075 BoosterCylinderCockSteam11VolumeMpS = BoosterCylinderCocksOn && BoosterCylinderCock11On ? (10.0f * BoosterSteamFraction) : 0.0f;
30653076 BoosterCylinderCock11SteamVelocityMpS = 100.0f;
@@ -3219,13 +3230,14 @@ private void UpdateFX(float elapsedClockSeconds)
32193230 variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
32203231 }
32213232
3233+ variable[i] = ThrottlePercent == 0 ? 0 : variable[i];
3234+
32223235 // overwrite Booster variable if in Idle or Run mode - gears not engaged
32233236 if (SteamEngines[i].AuxiliarySteamEngineType != SteamEngine.AuxiliarySteamEngineTypes.Booster && (SteamBoosterRunMode && !BoosterGearsEngaged) || SteamBoosterIdleMode)
32243237 {
32253238 variable[i] = BoosterEngineSpeedRpM;
32263239 }
32273240
3228- variable[i] = ThrottlePercent == 0 ? 0 : variable[i];
32293241 }
32303242
32313243 // Set variables for each engine
@@ -6111,6 +6123,9 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float loc
61116123
61126124 DisplayTractiveForceN = TractiveForceN;
61136125
6126+ DisplayAverageMotiveForceN = AverageMotiveForce(elapsedClockSeconds);
6127+
6128+
61146129 MotiveForceSmoothN.Update(elapsedClockSeconds, MotiveForceN);
61156130 MotiveForceSmoothedN = MotiveForceSmoothN.SmoothedValue;
61166131 if (float.IsNaN(MotiveForceN))
@@ -6173,6 +6188,29 @@ protected override void ApplyDirectionToTractiveForce(ref float tractiveForceN,
61736188 }
61746189
61756190
6191+ /// <summary>
6192+ /// Normalise booster engine crank angle so that it is a value between 0 and 360 starting at the real crank angle difference
6193+ /// </summary>
6194+ private float AverageMotiveForce(float elapsedClockSeconds)
6195+ {
6196+ float AverageTotal = 0;
6197+ float AverageForceN = 0;
6198+
6199+ for (int i = 0; i < NumberofMotiveForceValues - 2; i++)
6200+ {
6201+
6202+ MotiveForceAverageN[i] = MotiveForceAverageN[i + 1];
6203+ AverageTotal += MotiveForceAverageN[i+1];
6204+
6205+ }
6206+ MotiveForceAverageN[NumberofMotiveForceValues-1] = TractiveForceN;
6207+ AverageTotal += MotiveForceAverageN[NumberofMotiveForceValues-1];
6208+
6209+ AverageForceN = AverageTotal / NumberofMotiveForceValues;
6210+
6211+ return AverageForceN;
6212+ }
6213+
61766214 /// <summary>
61776215 /// Normalise booster engine crank angle so that it is a value between 0 and 360 starting at the real crank angle difference
61786216 /// </summary>
@@ -7829,7 +7867,7 @@ public override string GetDebugStatus()
78297867 Simulator.Catalog.GetString("M/Press"),
78307868 MainResPressurePSI);
78317869
7832- status.AppendFormat("\n{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\n",
7870+ status.AppendFormat("\n{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\ n",
78337871 Simulator.Catalog.GetString("CylE:"),
78347872 Simulator.Catalog.GetString("#1"),
78357873 CylinderSteamExhaust1On ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"),
@@ -7838,7 +7876,12 @@ public override string GetDebugStatus()
78387876 Simulator.Catalog.GetString("#3"),
78397877 CylinderSteamExhaust3On ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"),
78407878 Simulator.Catalog.GetString("#4"),
7841- CylinderSteamExhaust4On ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"));
7879+ CylinderSteamExhaust4On ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"),
7880+ Simulator.Catalog.GetString("AvMF"),
7881+ FormatStrings.FormatForce(MotiveForceN, IsMetric)
7882+
7883+
7884+ );
78427885
78437886 }
78447887
0 commit comments