Skip to content

Commit 97a00b7

Browse files
committed
Automatic merge of T1.5.1-870-ge0bf062eb and 17 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 9c456aa: 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 42f1dd9: feat: Improved system information collection - Pull request #903 at 0d6d045: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #912 at 659396e: New Triple Valve Features Vol. 2 - Pull request #914 at 29245e1: Adjustments to Duplex steam - Pull request #915 at 6d911d7: Correct calculation error with curve friction - Pull request #916 at 11ac52c: Distributed Power Air Brake Synchronization - Pull request #917 at fde18cf: Lighting Configuration Enhancements
19 parents 8463bee + e0bf062 + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 42f1dd9 + 0d6d045 + 9b0b04f + 6834af0 + 659396e + 29245e1 + 6d911d7 + 11ac52c + fde18cf commit 97a00b7

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public enum SlipControlType
268268
public float TrackSanderSandConsumptionReverseM3pS = 0;
269269
public float SandWeightKgpM3 = 1600; // One cubic metre of sand weighs about 1.54-1.78 tonnes.
270270
public float TrackSanderSteamConsumptionForwardLbpS;
271-
public float TrackSanderSteamConsumptionReverseLbpS;
271+
public float TrackSanderSteamConsumptionReverseLbpS = 0;
272272

273273

274274
// Vacuum Braking parameters
@@ -1814,15 +1814,9 @@ public override void Initialize()
18141814

18151815
if (TrackSanderSteamConsumptionForwardLbpS == 0 && SandingSystemType == SandingSystemTypes.Steam)
18161816
{
1817-
TrackSanderSteamConsumptionForwardLbpS = 300f / 3600f; // Default value - 300lbs/hr
1817+
TrackSanderSteamConsumptionForwardLbpS = 300f / 3600f; // Default value - 300lbs/hr - this value is un confirmed at this stage.
18181818
}
18191819

1820-
if (TrackSanderSteamConsumptionReverseLbpS == 0 && SandingSystemType == SandingSystemTypes.Steam)
1821-
{
1822-
TrackSanderSteamConsumptionReverseLbpS = 300f / 3600f; // Default value - 300lbs/hr
1823-
}
1824-
1825-
18261820
base.Initialize();
18271821
if (DynamicBrakeBlendingEnabled) airPipeSystem = BrakeSystem as AirSinglePipe;
18281822

@@ -3326,15 +3320,35 @@ public void UpdateTrackSander(float elapsedClockSeconds)
33263320
// Calculate steam, air or gravity consumption for different sander modes
33273321
if (SandingSystemType == SandingSystemTypes.Steam)
33283322
{
3323+
float sandingSteamConsumptionLbpS = 0.0f;
3324+
float sandingSandConsumptionM3pS = 0.0f;
3325+
33293326
if (Direction == Direction.Reverse)
33303327
{
3331-
SandingSteamUsageLBpS = TrackSanderSteamConsumptionReverseLbpS;
3328+
sandingSteamConsumptionLbpS = TrackSanderSteamConsumptionReverseLbpS;
3329+
sandingSandConsumptionM3pS = TrackSanderSandConsumptionReverseM3pS;
33323330
}
33333331
else
33343332
{
3335-
SandingSteamUsageLBpS = TrackSanderSteamConsumptionForwardLbpS;
3333+
sandingSteamConsumptionLbpS = TrackSanderSteamConsumptionForwardLbpS;
3334+
sandingSandConsumptionM3pS = TrackSanderSandConsumptionForwardM3pS;
33363335
}
33373336

3337+
// Calculate steam consumption
3338+
SandingSteamUsageLBpS = (BoilerPressurePSI / MaxBoilerPressurePSI) * sandingSteamConsumptionLbpS * elapsedClockSeconds;
3339+
3340+
// Calculate sand consumption for sander
3341+
if (CurrentTrackSandBoxCapacityM3 > 0.0) // if sand still in sandbox then sanding is available
3342+
{
3343+
// Calculate consumption of sand, and drop in sand box level
3344+
CurrentTrackSanderSandConsumptionM3pS = (BoilerPressurePSI / MaxBoilerPressurePSI) * sandingSandConsumptionM3pS * elapsedClockSeconds;
3345+
CurrentTrackSandBoxCapacityM3 -= CurrentTrackSanderSandConsumptionM3pS;
3346+
CurrentTrackSandBoxCapacityM3 = MathHelper.Clamp(CurrentTrackSandBoxCapacityM3, 0.0f, MaxTrackSandBoxCapacityM3);
3347+
if (CurrentTrackSandBoxCapacityM3 <= 0.0)
3348+
{
3349+
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Sand supply has been exhausted"));
3350+
}
3351+
}
33383352
}
33393353
else // air consumption
33403354
{
@@ -3352,25 +3366,25 @@ public void UpdateTrackSander(float elapsedClockSeconds)
33523366
sandingSandConsumptionM3pS = TrackSanderSandConsumptionForwardM3pS;
33533367
}
33543368

3355-
// Calculate air consumption and change in main air reservoir pressure
3356-
CurrentTrackSanderAirConsumptionM3pS = (MainResPressurePSI * MaxMainResPressurePSI) * pS.FrompM(sandingAirConsumptionM3pS) * elapsedClockSeconds;
3369+
// Calculate air consumption and change in main air reservoir pressure
3370+
CurrentTrackSanderAirConsumptionM3pS = (MainResPressurePSI / MaxMainResPressurePSI) * sandingAirConsumptionM3pS * elapsedClockSeconds;
33573371
float SanderPressureDiffPSI = CurrentTrackSanderAirConsumptionM3pS / Me3.ToFt3(MainResVolumeM3);
3358-
MainResPressurePSI -= SanderPressureDiffPSI;
3359-
MainResPressurePSI = MathHelper.Clamp(MainResPressurePSI, 0.001f, MaxMainResPressurePSI);
3372+
MainResPressurePSI -= SanderPressureDiffPSI;
3373+
MainResPressurePSI = MathHelper.Clamp(MainResPressurePSI, 0.001f, MaxMainResPressurePSI);
33603374

33613375
// Calculate sand consumption for sander
3362-
if (CurrentTrackSandBoxCapacityM3 > 0.0) // if sand still in sandbox then sanding is available
3363-
{
3364-
// Calculate consumption of sand, and drop in sand box level
3365-
CurrentTrackSanderSandConsumptionM3pS = (MainResPressurePSI * MaxMainResPressurePSI) * pS.FrompH(sandingSandConsumptionM3pS) * elapsedClockSeconds;
3376+
if (CurrentTrackSandBoxCapacityM3 > 0.0) // if sand still in sandbox then sanding is available
3377+
{
3378+
// Calculate consumption of sand, and drop in sand box level
3379+
CurrentTrackSanderSandConsumptionM3pS = (MainResPressurePSI / MaxMainResPressurePSI) * sandingSandConsumptionM3pS * elapsedClockSeconds;
33663380
CurrentTrackSandBoxCapacityM3 -= CurrentTrackSanderSandConsumptionM3pS;
3367-
CurrentTrackSandBoxCapacityM3 = MathHelper.Clamp(CurrentTrackSandBoxCapacityM3, 0.0f, MaxTrackSandBoxCapacityM3);
3381+
CurrentTrackSandBoxCapacityM3 = MathHelper.Clamp(CurrentTrackSandBoxCapacityM3, 0.0f, MaxTrackSandBoxCapacityM3);
33683382
if (CurrentTrackSandBoxCapacityM3 <= 0.0)
3369-
{
3370-
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Sand supply has been exhausted"));
3383+
{
3384+
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Sand supply has been exhausted"));
3385+
}
33713386
}
33723387
}
3373-
}
33743388
}
33753389

33763390
}

0 commit comments

Comments
 (0)