Skip to content

Commit 6c5b11f

Browse files
committed
Automatic merge of T1.5.1-1004-g6fd841761e and 19 pull requests
- Pull request #799 at dfc715e: Consolidated wind simulation - 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 8f695a4: Blueprint/train car operations UI window - Pull request #885 at 2728d6d: feat: Add notifications to Menu - Pull request #891 at 9a1d6b2: Auto save - 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 #900 at c27f32d: DMI updates - Pull request #903 at 3e390b8: Downloading route content (Github, zip) - Pull request #912 at 359cfee: New Triple Valve Features Vol. 2 - Pull request #922 at 0d3e70b: Autopilot for timetable mode - Pull request #946 at 66f836c: Advanced track sounds - Pull request #949 at 0306d75: Oil Burning Locomotive - Pull request #952 at b2af1f5: Investigation - Pulsing graphics part 1 - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at 84c2f4b: Add Support for Multiple Track Profiles - Pull request #956 at 6adc5a3: Map settings saved - Pull request #960 at c8e2a28: Fix draw state name in scripts
21 parents 14b2047 + 6fd8417 + dfc715e + d00beb9 + f92de76 + 8f695a4 + 2728d6d + 9a1d6b2 + 1f5ba4c + 5866028 + c27f32d + 3e390b8 + 359cfee + 0d3e70b + 66f836c + 0306d75 + b2af1f5 + a519452 + 84c2f4b + 6adc5a3 + c8e2a28 commit 6c5b11f

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

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

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ public class MSTSSteamLocomotive : MSTSLocomotive
122122
bool WaterMotionPump1IsOn = false;
123123
bool WaterMotionPump2IsOn = false;
124124
float WaterMotionPumpHeatLossBTU;
125+
bool WaterMotionPumpLockedOut = false;
126+
float WaterMotionPumpLockOutResetTimeS = 15.0f; // Time to reset the pump lock out time - time to prevent change of pumps
127+
float WaterMotionPumpLockOutTimeS; // Current lock out time - reset after Reset Time exceeded
125128
public bool CylinderCocksAreOpen;
126129
public bool BlowdownValveOpen;
127130
public bool CylinderCompoundOn; // Flag to indicate whether compound locomotive is in compound or simple mode of operation - simple = true (ie bypass valve is open)
@@ -1155,8 +1158,9 @@ public override void Save(BinaryWriter outf)
11551158
outf.Write(Injector2IsOn);
11561159
outf.Write(Injector2Fraction);
11571160
outf.Write(InjectorLockedOut);
1161+
outf.Write(WaterMotionPumpLockedOut);
11581162
outf.Write(InjectorLockOutTimeS);
1159-
outf.Write(InjectorLockOutResetTimeS);
1163+
outf.Write(WaterMotionPumpLockOutTimeS);
11601164
outf.Write(WaterTempNewK);
11611165
outf.Write(BkW_Diff);
11621166
outf.Write(WaterFraction);
@@ -1219,8 +1223,9 @@ public override void Restore(BinaryReader inf)
12191223
Injector2IsOn = inf.ReadBoolean();
12201224
Injector2Fraction = inf.ReadSingle();
12211225
InjectorLockedOut = inf.ReadBoolean();
1226+
WaterMotionPumpLockedOut = inf.ReadBoolean();
12221227
InjectorLockOutTimeS = inf.ReadSingle();
1223-
InjectorLockOutResetTimeS = inf.ReadSingle();
1228+
WaterMotionPumpLockOutTimeS = inf.ReadSingle();
12241229
WaterTempNewK = inf.ReadSingle();
12251230
BkW_Diff = inf.ReadSingle();
12261231
WaterFraction = inf.ReadSingle();
@@ -7021,11 +7026,19 @@ private void UpdateInjectors(float elapsedClockSeconds)
70217026
{
70227027
WaterMotionPump1FlowRateLBpS = MaximumWaterMotionPumpFlowRateLBpS * absSpeedMpS / MpS.FromMpH(MaxLocoSpeedMpH);
70237028
}
7029+
else
7030+
{
7031+
WaterMotionPump1FlowRateLBpS = 0;
7032+
}
70247033

70257034
if (WaterMotionPump2IsOn && absSpeedMpS > 0)
70267035
{
70277036
WaterMotionPump2FlowRateLBpS = MaximumWaterMotionPumpFlowRateLBpS * absSpeedMpS / MpS.FromMpH(MaxLocoSpeedMpH);
70287037
}
7038+
else
7039+
{
7040+
WaterMotionPump2FlowRateLBpS = 0;
7041+
}
70297042

70307043
if (WaterIsExhausted)
70317044
{
@@ -7036,14 +7049,29 @@ private void UpdateInjectors(float elapsedClockSeconds)
70367049
float TotalPumpFlowRateLbpS = WaterMotionPump1FlowRateLBpS + WaterMotionPump2FlowRateLBpS;
70377050

70387051
// Calculate heat loss for water injected
7039-
// Loss of boiler heat due to water injection - loss is the diff between steam and water Heat
7052+
// Loss of boiler heat due to water injection - loss is the diff between steam and ambient temperature (or pressure)
70407053
WaterMotionPumpHeatLossBTU = TotalPumpFlowRateLbpS * (WaterHeatPSItoBTUpLB[BoilerPressurePSI] - WaterHeatPSItoBTUpLB[0]);
70417054

70427055
// calculate Water steam heat based on injector water delivery temp
7043-
BoilerMassLB += elapsedClockSeconds * TotalPumpFlowRateLbpS; // Boiler Mass increase by Injector both pumps
7044-
BoilerHeatBTU -= elapsedClockSeconds * WaterMotionPumpHeatLossBTU; // Total loss of boiler heat due to water injection - inject steam and water Heat
7056+
BoilerMassLB += elapsedClockSeconds * TotalPumpFlowRateLbpS; // Boiler Mass increase by both pumps
7057+
BoilerHeatBTU -= elapsedClockSeconds * WaterMotionPumpHeatLossBTU; // Total loss of boiler heat due to water pump - inject cold water straight from tender
70457058
// InjectorBoilerInputLB += (elapsedClockSeconds * Injector1Fraction * InjectorFlowRateLBpS); // Keep track of water flow into boilers from Injector 1
70467059
BoilerHeatOutBTUpS += WaterMotionPumpHeatLossBTU; // Total loss of boiler heat due to water injection - inject steam and water Heat
7060+
7061+
// Update pump lockout timer
7062+
if (WaterMotionPump1IsOn || WaterMotionPump2IsOn)
7063+
{
7064+
if (WaterMotionPumpLockedOut)
7065+
{
7066+
WaterMotionPumpLockOutTimeS += elapsedClockSeconds;
7067+
}
7068+
if (WaterMotionPumpLockOutTimeS > WaterMotionPumpLockOutResetTimeS)
7069+
{
7070+
WaterMotionPumpLockedOut = false;
7071+
WaterMotionPumpLockOutTimeS = 0.0f;
7072+
7073+
}
7074+
}
70477075
}
70487076
else
70497077
{
@@ -7242,20 +7270,23 @@ private void UpdateFiring(float absSpeedMpS)
72427270

72437271
if (WaterMotionPumpFitted && !WaterIsExhausted)
72447272
{
7273+
72457274
if (WaterGlassLevelIN > 7.99) // turn pumps off if water level in boiler greater then 8.0, to stop cycling
72467275
{
72477276
WaterMotionPump1IsOn = false;
72487277
WaterMotionPump2IsOn = false;
72497278
}
7250-
else if (WaterGlassLevelIN <= 7.0 && WaterGlassLevelIN > 5.75) // turn water pump #1 on if water level in boiler drops below 7.0 and is above
7279+
else if (WaterGlassLevelIN <= 7.0 && WaterGlassLevelIN > 5.75 && !WaterMotionPumpLockedOut) // turn water pump #1 on if water level in boiler drops below 7.0 and is above
72517280
{
72527281
WaterMotionPump1IsOn = true;
72537282
WaterMotionPump2IsOn = false;
7283+
WaterMotionPumpLockedOut = true;
72547284
}
7255-
else if (WaterGlassLevelIN <= 5.75 && WaterGlassLevelIN > 4.5) // turn water pump #1 on if water level in boiler drops below 7.0 and is above
7285+
else if (WaterGlassLevelIN <= 5.75 && WaterGlassLevelIN > 4.5 && !WaterMotionPumpLockedOut) // turn water pump #2 on as well if water level in boiler drops below 5.75 and is above
72567286
{
72577287
WaterMotionPump1IsOn = true;
72587288
WaterMotionPump2IsOn = true;
7289+
WaterMotionPumpLockedOut = true;
72597290
}
72607291
}
72617292
else

0 commit comments

Comments
 (0)