Skip to content

Commit 7124409

Browse files
committed
Automatic merge of T1.5.1-567-gefb91a402 and 13 pull requests
- Pull request #757 at 98dd1a7: Unify RailDriver code implementations - Pull request #831 at 61bbf43: poor mans switch panel on tablet - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #841 at 410a585: https://blueprints.launchpad.net/or/+spec/animating-trainset-windows - Pull request #853 at d05f581: Notify out of focus - Pull request #855 at b39e5d8: Adds new route from TrainSimulations - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #862 at 489f261: Fix engine leak problem - Pull request #863 at a34b857: Alternate preset 3D cabviewpoints - Pull request #864 at e71bc5a: Fixes for Undesired Emergency Applications - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #866 at c15333e: Fix Articulation For 0-Axle Train Cars - Pull request #870 at 5cb32fa: Fix water restore
15 parents cb43104 + efb91a4 + 98dd1a7 + 61bbf43 + d00beb9 + 410a585 + d05f581 + b39e5d8 + 9afc8c3 + 489f261 + a34b857 + e71bc5a + 776d6df + c15333e + 5cb32fa commit 7124409

File tree

1 file changed

+9
-2
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS

1 file changed

+9
-2
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/AirSinglePipe.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class AirSinglePipe : MSTSBrakeSystem
5454
protected float MaxAuxilaryChargingRatePSIpS = 1.684f;
5555
protected float BrakeInsensitivityPSIpS = 0.07f;
5656
protected float EmergencyValveActuationRatePSIpS = 0;
57+
protected bool LegacyEmergencyValve = false;
5758
protected float EmergencyDumpValveRatePSIpS = 0;
5859
protected float EmergencyDumpValveTimerS = 120;
5960
protected float? EmergencyDumpStartTime;
@@ -174,6 +175,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
174175
TripleValveSensitivityPSI = thiscopy.TripleValveSensitivityPSI;
175176
BrakeCylinderSpringPressurePSI = thiscopy.BrakeCylinderSpringPressurePSI;
176177
ServiceMaxCylPressurePSI = thiscopy.ServiceMaxCylPressurePSI;
178+
LegacyEmergencyValve = thiscopy.LegacyEmergencyValve;
177179
}
178180

179181
// Get the brake BC & BP for EOT conditions
@@ -345,6 +347,7 @@ public override void Save(BinaryWriter outf)
345347
outf.Write((int)HoldingValve);
346348
outf.Write(UniformChargingActive);
347349
outf.Write(QuickServiceActive);
350+
outf.Write(LegacyEmergencyValve);
348351
}
349352

350353
public override void Restore(BinaryReader inf)
@@ -371,6 +374,7 @@ public override void Restore(BinaryReader inf)
371374
HoldingValve = (ValveState)inf.ReadInt32();
372375
UniformChargingActive = inf.ReadBoolean();
373376
QuickServiceActive = inf.ReadBoolean();
377+
LegacyEmergencyValve = inf.ReadBoolean();
374378
}
375379

376380
public override void Initialize(bool handbrakeOn, float maxPressurePSI, float fullServPressurePSI, bool immediateRelease)
@@ -427,7 +431,10 @@ public override void Initialize()
427431
if (EngineRelayValveRatio == 0) EngineRelayValveRatio = RelayValveRatio;
428432

429433
if ((Car as MSTSWagon).EmergencyReservoirPresent && EmergencyValveActuationRatePSIpS == 0)
434+
{
430435
EmergencyValveActuationRatePSIpS = 15;
436+
LegacyEmergencyValve = true;
437+
}
431438

432439
if (InitialApplicationThresholdPSI == 0)
433440
{
@@ -478,8 +485,8 @@ public void UpdateTripleValveState(float elapsedClockSeconds)
478485
var prevState = TripleValveState;
479486
var valveType = (Car as MSTSWagon).BrakeValve;
480487
bool disableGradient = !(Car.Train.LeadLocomotive is MSTSLocomotive) && Car.Train.TrainType != Orts.Simulation.Physics.Train.TRAINTYPE.STATIC;
481-
// Small workaround to allow trains to more reliably go into emergency after uncoupling
482-
bool emergencyTripped = (Car.Train.TrainType == Orts.Simulation.Physics.Train.TRAINTYPE.STATIC) ?
488+
// Legacy cars and static cars use a simpler check for emergency applications to ensure emergency applications occur despite simplified physics
489+
bool emergencyTripped = (Car.Train.TrainType == Orts.Simulation.Physics.Train.TRAINTYPE.STATIC || LegacyEmergencyValve) ?
483490
BrakeLine1PressurePSI <= 0.75f * EmergResPressurePSI * AuxCylVolumeRatio / (AuxCylVolumeRatio + 1) : Math.Max(-SmoothedBrakePipeChangePSIpS.SmoothedValue, 0) > EmergencyValveActuationRatePSIpS;
484491

485492
if (valveType == MSTSWagon.BrakeValveType.Distributor)

0 commit comments

Comments
 (0)