Skip to content

Commit

Permalink
Automatic merge of T1.5.1-567-gefb91a402 and 13 pull requests
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
openrails-bot committed Sep 6, 2023
15 parents cb43104 + efb91a4 + 98dd1a7 + 61bbf43 + d00beb9 + 410a585 + d05f581 + b39e5d8 + 9afc8c3 + 489f261 + a34b857 + e71bc5a + 776d6df + c15333e + 5cb32fa commit 7124409
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -54,6 +54,7 @@ public class AirSinglePipe : MSTSBrakeSystem
protected float MaxAuxilaryChargingRatePSIpS = 1.684f;
protected float BrakeInsensitivityPSIpS = 0.07f;
protected float EmergencyValveActuationRatePSIpS = 0;
protected bool LegacyEmergencyValve = false;
protected float EmergencyDumpValveRatePSIpS = 0;
protected float EmergencyDumpValveTimerS = 120;
protected float? EmergencyDumpStartTime;
Expand Down Expand Up @@ -174,6 +175,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
TripleValveSensitivityPSI = thiscopy.TripleValveSensitivityPSI;
BrakeCylinderSpringPressurePSI = thiscopy.BrakeCylinderSpringPressurePSI;
ServiceMaxCylPressurePSI = thiscopy.ServiceMaxCylPressurePSI;
LegacyEmergencyValve = thiscopy.LegacyEmergencyValve;
}

// Get the brake BC & BP for EOT conditions
Expand Down Expand Up @@ -345,6 +347,7 @@ public override void Save(BinaryWriter outf)
outf.Write((int)HoldingValve);
outf.Write(UniformChargingActive);
outf.Write(QuickServiceActive);
outf.Write(LegacyEmergencyValve);
}

public override void Restore(BinaryReader inf)
Expand All @@ -371,6 +374,7 @@ public override void Restore(BinaryReader inf)
HoldingValve = (ValveState)inf.ReadInt32();
UniformChargingActive = inf.ReadBoolean();
QuickServiceActive = inf.ReadBoolean();
LegacyEmergencyValve = inf.ReadBoolean();
}

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

if ((Car as MSTSWagon).EmergencyReservoirPresent && EmergencyValveActuationRatePSIpS == 0)
{
EmergencyValveActuationRatePSIpS = 15;
LegacyEmergencyValve = true;
}

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

if (valveType == MSTSWagon.BrakeValveType.Distributor)
Expand Down

0 comments on commit 7124409

Please sign in to comment.