Skip to content

Commit a12254e

Browse files
committed
Automatic merge of T1.6-108-g8fb3285d6 and 13 pull requests
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window - Pull request #1091 at 492795a: Automatic speed control - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1157 at 39cd994: Dynamic brake authorization by TCS - Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler - Pull request #1162 at 2516cce: specifies precedence of DDS over ACE - Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9. - Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci. - Pull request #1082 at d3722cd: Allow variable water level in glass gauge - Pull request #1128 at 086d502: Particle Emitter Overhaul - Pull request #1160 at 9dc6b3b: Route Based TTrack Sounds
15 parents 7b9f96a + 8fb3285 + f46d5f2 + 492795a + ba3c47f + 91d2d26 + e241a0d + 39cd994 + 48c9a63 + 2516cce + 2f9e292 + 1ad9889 + d3722cd + 086d502 + 9dc6b3b commit a12254e

File tree

1 file changed

+77
-77
lines changed

1 file changed

+77
-77
lines changed

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

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,34 @@ public override void Initialize()
14681468

14691469
CylinderSteamUsageLBpS = 1.0f; // Set to 1 to ensure that there are no divide by zero errors
14701470

1471+
if (BoilerEvapRateLbspFt2 == 0) // If boiler evaporation rate is not in ENG file then set a default value
1472+
{
1473+
if (SteamLocomotiveFuelType == SteamLocomotiveFuelTypes.Wood)
1474+
{
1475+
BoilerEvapRateLbspFt2 = 11.5f; // Default rate for evaporation rate. Assume a default rate of 12 lbs/sqft of evaporation area
1476+
}
1477+
else if (SteamLocomotiveFuelType == SteamLocomotiveFuelTypes.Oil)
1478+
{
1479+
BoilerEvapRateLbspFt2 = 18.0f; // Default rate for evaporation rate. Assume a default rate of 18 lbs/sqft of evaporation area
1480+
}
1481+
else
1482+
{
1483+
BoilerEvapRateLbspFt2 = 15.0f; // Default rate for evaporation rate. Assume a default rate of 15 lbs/sqft of evaporation area
1484+
}
1485+
}
1486+
BoilerEvapRateLbspFt2 = MathHelper.Clamp(BoilerEvapRateLbspFt2, 7.5f, 30.0f); // Clamp BoilerEvap Rate to between 7.5 & 30 - some modern locomotives can go as high as 30, but majority are around 15.
1487+
TheoreticalMaxSteamOutputLBpS = pS.FrompH(Me2.ToFt2(EvaporationAreaM2) * BoilerEvapRateLbspFt2); // set max boiler theoretical steam output
1488+
1489+
float BoilerVolumeCheck = Me2.ToFt2(EvaporationAreaM2) / BoilerVolumeFT3; //Calculate the Boiler Volume Check value.
1490+
if (BoilerVolumeCheck > 15) // If boiler volume is not in ENG file or less then a viable figure (ie high ratio figure), then set to a default value
1491+
{
1492+
BoilerVolumeFT3 = Me2.ToFt2(EvaporationAreaM2) / 8.3f; // Default rate for evaporation rate. Assume a default ratio of evaporation area * 1/8.3
1493+
// Advise player that Boiler Volume is missing from or incorrect in ENG file
1494+
if (Simulator.Settings.VerboseConfigurationMessages)
1495+
Trace.TraceWarning("Boiler Volume not found in ENG file, or doesn't appear to be a valid figure, and has been set to {0} Ft^3", BoilerVolumeFT3);
1496+
}
1497+
1498+
14711499
// Set up boiler water defaults
14721500

14731501
// Water Gauge Length - always use OR entered value as first preference
@@ -1476,11 +1504,46 @@ public override void Initialize()
14761504
// Boiler Length - always use OR entered value as first preference
14771505
BoilerLengthM = ORBoilerLengthM;
14781506

1507+
// If OR value hasn't been set, then use MSTS value if present
1508+
if (BoilerLengthM == 0 && MSTSBoilerLengthM > 0)
1509+
{
1510+
if (MSTSBoilerLengthM > 0.4f * CarLengthM && MSTSBoilerLengthM < CarLengthM) // Check validity of MSTS value
1511+
{
1512+
BoilerLengthM = MSTSBoilerLengthM;
1513+
}
1514+
else
1515+
{
1516+
BoilerLengthM = Me.FromFt(20.0f); // limit default boiler length to 20 ft
1517+
}
1518+
1519+
if (Simulator.Settings.VerboseConfigurationMessages)
1520+
{
1521+
Trace.TraceInformation("Boiler Length set as per MSTS default = {0}", FormatStrings.FormatDistance(BoilerLengthM, IsMetric));
1522+
}
1523+
}
1524+
else if (BoilerLengthM == 0 && MSTSBoilerLengthM == 0)
1525+
{
1526+
if (HasTenderCoupled)
1527+
{
1528+
BoilerLengthM = 0.48f * CarLengthM; // Set default boiler length for tank locomotives
1529+
}
1530+
else
1531+
{
1532+
BoilerLengthM = 0.6f * CarLengthM; // Set default boiler length for tender locomotives
1533+
}
1534+
1535+
if (Simulator.Settings.VerboseConfigurationMessages)
1536+
{
1537+
Trace.TraceInformation("Boiler Length set to default = {0}", FormatStrings.FormatDistance(BoilerLengthM, IsMetric));
1538+
}
1539+
}
1540+
14791541
if (BoilerDiameterM == 0)
14801542
{
1481-
BoilerDiameterM = Me.FromFt(6.0f); // Set default boiler diameter to 6 ft
1543+
BoilerDiameterM = 3.3f * (float)Math.Sqrt(Me3.FromFt3(BoilerVolumeFT3) / (float)(Math.PI * BoilerLengthM)); // Set default boiler diameter based upon boiler volume and length
1544+
14821545
if (Simulator.Settings.VerboseConfigurationMessages)
1483-
Trace.TraceWarning("Boiler Diameter not found in ENG file and has been set to {0}", FormatStrings.FormatDistance(BoilerDiameterM, IsMetric)); // Advise player that Boiler Diameter is missing from ENG file
1546+
Trace.TraceWarning("Boiler Diameter not found in ENG file and has been set to {0}", FormatStrings.FormatDistance(BoilerDiameterM, IsMetric));
14841547
}
14851548

14861549
// Water model - locomotive boilers require water level to be maintained above the firebox crown sheet
@@ -1499,37 +1562,10 @@ public override void Initialize()
14991562
{
15001563
BoilerCrownCoverageHeightM = Me.FromIn(3.0f); // Set default crown coverage height to 3"
15011564
if (Simulator.Settings.VerboseConfigurationMessages)
1502-
Trace.TraceWarning("Boiler Crown Coverage Height not found in ENG file and has been set to {0}", FormatStrings.FormatVeryShortDistanceDisplay(BoilerCrownCoverageHeightM, IsMetric)); // Advise player that Boiler Crown Coverage Height is missing from ENG file
1565+
Trace.TraceWarning("Boiler Crown Coverage Height not found in ENG file and has been set to {0}", FormatStrings.FormatVeryShortDistanceDisplay(BoilerCrownCoverageHeightM, IsMetric));
15031566
}
15041567

1505-
// Initialise Boiler parameters
1506-
1507-
// If OR value hasn't been set, then use MSTS value if present
1508-
if (BoilerLengthM == 0 && MSTSBoilerLengthM > 0)
1509-
{
1510-
if (MSTSBoilerLengthM > 0.4f * CarLengthM && MSTSBoilerLengthM < CarLengthM)
1511-
{
1512-
BoilerLengthM = MSTSBoilerLengthM;
1513-
}
1514-
else
1515-
{
1516-
BoilerLengthM = Me.FromFt(20.0f); // Set default boiler length to 20 ft
1517-
}
1518-
1519-
if (Simulator.Settings.VerboseConfigurationMessages)
1520-
{
1521-
Trace.TraceInformation("Boiler Length set as per MSTS default = {0}", FormatStrings.FormatDistance(BoilerLengthM, IsMetric));
1522-
}
1523-
}
1524-
else if (BoilerLengthM == 0 && MSTSBoilerLengthM == 0)
1525-
{
1526-
BoilerLengthM = Me.FromFt(20.0f); // Set default boiler length to 20 ft
1527-
1528-
if (Simulator.Settings.VerboseConfigurationMessages)
1529-
{
1530-
Trace.TraceInformation("Boiler Length set to default = {0}", FormatStrings.FormatDistance(BoilerLengthM, IsMetric));
1531-
}
1532-
}
1568+
// Initialise Boiler parameters, if not found in Eng file
15331569

15341570
// If OR value hasn't been set, then use MSTS value if present
15351571
if (WaterGlassLengthM == 0 && MSTSSteamGaugeGlassHeightM > 0 && MSTSSteamGaugeGlassHeightM < Me.FromIn(12))
@@ -1576,34 +1612,6 @@ public override void Initialize()
15761612

15771613
float MaxWaterFraction = BoilerWaterFractionAbs; // Initialise the max water fraction when the boiler starts
15781614

1579-
if (BoilerEvapRateLbspFt2 == 0) // If boiler evaporation rate is not in ENG file then set a default value
1580-
{
1581-
if (SteamLocomotiveFuelType == SteamLocomotiveFuelTypes.Wood)
1582-
{
1583-
BoilerEvapRateLbspFt2 = 11.5f; // Default rate for evaporation rate. Assume a default rate of 12 lbs/sqft of evaporation area
1584-
}
1585-
else if (SteamLocomotiveFuelType == SteamLocomotiveFuelTypes.Oil)
1586-
{
1587-
BoilerEvapRateLbspFt2 = 18.0f; // Default rate for evaporation rate. Assume a default rate of 18 lbs/sqft of evaporation area
1588-
}
1589-
else
1590-
{
1591-
BoilerEvapRateLbspFt2 = 15.0f; // Default rate for evaporation rate. Assume a default rate of 15 lbs/sqft of evaporation area
1592-
}
1593-
}
1594-
BoilerEvapRateLbspFt2 = MathHelper.Clamp(BoilerEvapRateLbspFt2, 7.5f, 30.0f); // Clamp BoilerEvap Rate to between 7.5 & 30 - some modern locomotives can go as high as 30, but majority are around 15.
1595-
TheoreticalMaxSteamOutputLBpS = pS.FrompH(Me2.ToFt2(EvaporationAreaM2) * BoilerEvapRateLbspFt2); // set max boiler theoretical steam output
1596-
1597-
float BoilerVolumeCheck = Me2.ToFt2(EvaporationAreaM2) / BoilerVolumeFT3; //Calculate the Boiler Volume Check value.
1598-
if (BoilerVolumeCheck > 15) // If boiler volume is not in ENG file or less then a viable figure (ie high ratio figure), then set to a default value
1599-
{
1600-
BoilerVolumeFT3 = Me2.ToFt2(EvaporationAreaM2) / 8.3f; // Default rate for evaporation rate. Assume a default ratio of evaporation area * 1/8.3
1601-
// Advise player that Boiler Volume is missing from or incorrect in ENG file
1602-
if (Simulator.Settings.VerboseConfigurationMessages)
1603-
Trace.TraceWarning("Boiler Volume not found in ENG file, or doesn't appear to be a valid figure, and has been set to {0} Ft^3", BoilerVolumeFT3);
1604-
}
1605-
1606-
16071615
// Assign default steam table values if table not in ENG file
16081616
if (BoilerEfficiencyGrateAreaLBpFT2toX == null)
16091617
{
@@ -7163,7 +7171,7 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
71637171
BoilerHeatOutBTUpS += WaterMotionPumpHeatLossBTU; // Total loss of boiler heat due to water injection - inject steam and water Heat
71647172

71657173
// Update pump lockout timer
7166-
if (WaterMotionPump1IsOn || WaterMotionPump2IsOn)
7174+
if (WaterMotionPump1IsOn || WaterMotionPump2IsOn || WaterMotionPumpLockedOut)
71677175
{
71687176
if (WaterMotionPumpLockedOut)
71697177
{
@@ -7305,12 +7313,13 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
73057313
}
73067314

73077315
// Update injector lockout timer
7308-
if (Injector1IsOn || Injector2IsOn)
7316+
if (Injector1IsOn || Injector2IsOn || InjectorLockedOut)
73097317
{
73107318
if (InjectorLockedOut)
73117319
{
73127320
InjectorLockOutTimeS += elapsedClockSeconds;
73137321
}
7322+
73147323
if (InjectorLockOutTimeS > InjectorLockOutResetTimeS)
73157324
{
73167325
InjectorLockedOut = false;
@@ -7414,7 +7423,7 @@ private void UpdateFiring(float absSpeedMpS)
74147423
StopInjector1Sound();
74157424
StopInjector2Sound();
74167425
}
7417-
else if (CurrentWaterGaugeFraction <= 0.55 && CurrentWaterGaugeFraction > 0.50 && !InjectorLockedOut) // turn injector 1 on 25% if water level in boiler drops between 0.5 and 0.55 water gauge
7426+
else if (CurrentWaterGaugeFraction <= 0.55 && CurrentWaterGaugeFraction > 0.525 && !InjectorLockedOut)
74187427
{
74197428
Injector1IsOn = true;
74207429
Injector1Fraction = 0.25f;
@@ -7423,7 +7432,7 @@ private void UpdateFiring(float absSpeedMpS)
74237432
InjectorLockedOut = true;
74247433
PlayInjector1SoundIfStarting();
74257434
}
7426-
else if (CurrentWaterGaugeFraction <= 0.50 && CurrentWaterGaugeFraction > 0.45 && !InjectorLockedOut) // turn injector 1 on 50% if water level in boiler drops between 0.5 and 0.45
7435+
else if (CurrentWaterGaugeFraction <= 0.525 && CurrentWaterGaugeFraction > 0.5 && !InjectorLockedOut)
74277436
{
74287437
Injector1IsOn = true;
74297438
Injector1Fraction = 0.5f;
@@ -7432,7 +7441,7 @@ private void UpdateFiring(float absSpeedMpS)
74327441
InjectorLockedOut = true;
74337442
PlayInjector1SoundIfStarting();
74347443
}
7435-
else if (CurrentWaterGaugeFraction <= 0.45 && CurrentWaterGaugeFraction > 0.40 && !InjectorLockedOut) // turn injector 1 on 100% if water level in boiler drops between 0.4 and 0.45
7444+
else if (CurrentWaterGaugeFraction <= 0.5 && CurrentWaterGaugeFraction > 0.475 && !InjectorLockedOut)
74367445
{
74377446
Injector1IsOn = true;
74387447
Injector1Fraction = 1.0f;
@@ -7443,7 +7452,7 @@ private void UpdateFiring(float absSpeedMpS)
74437452
}
74447453
else if (BoilerPressurePSI > (MaxBoilerPressurePSI - 100.0)) // If boiler pressure is not too low then turn on injector 2 as well
74457454
{
7446-
if (CurrentWaterGaugeFraction <= 0.40 && CurrentWaterGaugeFraction > 0.35 && !InjectorLockedOut)
7455+
if (CurrentWaterGaugeFraction <= 0.475 && CurrentWaterGaugeFraction > 0.45 && !InjectorLockedOut)
74477456
{
74487457

74497458
Injector1IsOn = true;
@@ -7453,7 +7462,7 @@ private void UpdateFiring(float absSpeedMpS)
74537462
InjectorLockedOut = true;
74547463
PlayInjector2SoundIfStarting();
74557464
}
7456-
else if (CurrentWaterGaugeFraction <= 0.35 && CurrentWaterGaugeFraction > 0.30 && !InjectorLockedOut)
7465+
else if (CurrentWaterGaugeFraction <= 0.45 && CurrentWaterGaugeFraction > 0.425 && !InjectorLockedOut)
74577466
{
74587467
Injector1IsOn = true;
74597468
Injector1Fraction = 1.0f;
@@ -7462,21 +7471,12 @@ private void UpdateFiring(float absSpeedMpS)
74627471
InjectorLockedOut = true;
74637472
PlayInjector2SoundIfStarting();
74647473
}
7465-
else if (CurrentWaterGaugeFraction <= 0.55 && CurrentWaterGaugeFraction > 0.5325 && !InjectorLockedOut)
7466-
{
7467-
Injector1IsOn = true;
7468-
Injector1Fraction = 1.0f;
7469-
Injector2IsOn = true;
7470-
Injector2Fraction = 0.3f;
7471-
InjectorLockedOut = true;
7472-
PlayInjector2SoundIfStarting();
7473-
}
7474-
else if (CurrentWaterGaugeFraction <= 0.5325 && CurrentWaterGaugeFraction > 0.525 && !InjectorLockedOut)
7474+
else if (CurrentWaterGaugeFraction <= 0.425 && !InjectorLockedOut)
74757475
{
74767476
Injector1IsOn = true;
74777477
Injector1Fraction = 1.0f;
74787478
Injector2IsOn = true;
7479-
Injector2Fraction = 0.4f;
7479+
Injector2Fraction = 1.0f;
74807480
InjectorLockedOut = true;
74817481
PlayInjector2SoundIfStarting();
74827482
}

0 commit comments

Comments
 (0)