Skip to content

Commit 7dde3e9

Browse files
committed
Automatic merge of T1.5.1-797-gabb8eb9a4 and 13 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at a055bca: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #899 at b5bd060: Duplex steam engines - Booster Engine addition - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #908 at 4b4afe3: feat: supports switching adhesion precisions - Pull request #909 at c3a572a: Correct Control Car crash bug
15 parents fa9fd10 + abb8eb9 + 3539862 + d00beb9 + f92de76 + a055bca + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 0a9d939 + b5bd060 + 9b0b04f + 4b4afe3 + c3a572a commit 7dde3e9

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

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

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)