Skip to content

Commit f40d537

Browse files
committed
Automatic merge of T1.6-rc8-48-ga5be12922 and 14 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2e06f85: Automatic speed control - Pull request #1104 at ccc5c4d: Handle simple adhesion within the axle module - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - 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 #1130 at 8ae6bb7: Fix F9 points to an incorrect car ID. - Pull request #1143 at ba9e40a: Status in Work Orders popup set too fast - Pull request #1152 at 66dfd09: fix: Clean up multiple issues with data logger - Pull request #1155 at 40f8c34: fix for illegal characters in refeerence to Shape file - Pull request #1157 at 39cd994: Dynamic brake authorization by TCS - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1128 at 1d7643d: Particle Emitter Overhaul
16 parents f5d196e + a5be129 + e10390b + 2e06f85 + ccc5c4d + 270f22f + ba3c47f + 91d2d26 + e241a0d + 8ae6bb7 + ba9e40a + 66dfd09 + 40f8c34 + 39cd994 + 5845a1a + 1d7643d commit f40d537

File tree

6 files changed

+31
-37
lines changed

6 files changed

+31
-37
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5537,16 +5537,14 @@ the tables below.
55375537
.. index::
55385538
single: DoesBrakeCutPower
55395539
single: BrakeCutsPowerAtBrakeCylinderPressure
5540-
single: ORTSBrakeCutsPowerAtBrakePipePressure
5541-
single: ORTSBrakeRestoresPowerAtBrakePipePressure
5540+
single: OrtsEmergencyBrakeCutsDynamicBrake
55425541

5543-
Other parameters in the Engine section of the ENG file are used by the braking system to request traction cut-off to the TCS:
5542+
Other parameters in the Engine section of the ENG file are used by the TCS:
55445543

5545-
- ``DoesBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction for air brake system (1 for enabled, 0 for disabled)
5546-
- ``ORTSDoesVacuumBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction for vacuum brake system (1 for enabled, 0 for disabled)
5544+
- ``DoesBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction (1 for enabled, 0 for disabled)
55475545
- ``BrakeCutsPowerAtBrakeCylinderPressure( x )`` sets the minimum pressure in the brake cylinder that cuts the traction (by default 4 PSI)
5548-
- ``ORTSBrakeCutsPowerAtBrakePipePressure( x )`` sets the maximum pressure in the brake pipe that cuts the traction
5549-
- ``ORTSBrakeRestoresPowerAtBrakePipePressure( x )`` sets the minimum pressure in the brake pipe that restores the traction
5546+
- ``OrtsEmergencyBrakeCutsDynamicBrake`` sets whether an emergency braking disables dynamic brakes
5547+
55505548

55515549
Train Derailment
55525550
----------------

Source/Orts.Simulation/Common/Scripting/TrainControlSystem.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,13 @@ internal void AttachToHost(ScriptedTrainControlSystem host)
265265
/// </summary>
266266
public Func<bool> DoesBrakeCutPower;
267267
/// <summary>
268-
/// Deprecated. Returns positive infinity if traction cutoff is requested by the brake system, and negative infinity if it is not requested
268+
/// Train brake pressure value which triggers the power cut-off.
269269
/// </summary>
270-
[Obsolete("BrakeCutsPowerAtBrakeCylinderPressureBar() is deprecated, use BrakeSystemTractionAuthorization instead")]
271-
public float BrakeCutsPowerAtBrakeCylinderPressureBar()
272-
{
273-
return BrakeSystemTractionAuthorization ? float.PositiveInfinity : float.NegativeInfinity;
274-
}
275-
public bool BrakeSystemTractionAuthorization => Host.BrakeSystemTractionAuthorization;
270+
public Func<float> BrakeCutsPowerAtBrakeCylinderPressureBar;
271+
/// <summary>
272+
/// True if dynamic brake must be cut if the emergency brake is applied.
273+
/// </summary>
274+
public bool EmergencyBrakeCutsDynamicBrake => Locomotive.EmergencyBrakeCutsDynamicBrake;
276275
/// <summary>
277276
/// State of the train brake controller.
278277
/// </summary>

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ public enum SlipControlType
298298
public float LargeEjectorBrakePipeChargingRatePSIorInHgpS;
299299
public float ExhausterHighSBPChargingRatePSIorInHgpS; // Rate for Exhauster in high speed mode
300300
public float ExhausterLowSBPChargingRatePSIorInHgpS; // Rate for Exhauster in high speed mode
301+
public bool VacuumBrakeCutoffActivated = false;
301302
public bool BrakeFlagDecrease = false;
302303
public bool BrakeFlagIncrease = false;
303304

@@ -463,6 +464,7 @@ public float OdometerM
463464
public float BrakeCutsPowerAtBrakePipePressurePSI;
464465
public bool DoesVacuumBrakeCutPower { get; private set; }
465466
public bool DoesBrakeCutPower { get; private set; }
467+
public bool EmergencyBrakeCutsDynamicBrake { get; private set; }
466468
public float BrakeCutsPowerAtBrakeCylinderPressurePSI { get; private set; }
467469
public bool DoesHornTriggerBell { get; private set; }
468470
public bool DPSyncTrainApplication { get; private set; }
@@ -1119,6 +1121,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
11191121
case "engine(brakecutspoweratbrakecylinderpressure": BrakeCutsPowerAtBrakeCylinderPressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
11201122
case "engine(ortsbrakecutspoweratbrakepipepressure": BrakeCutsPowerAtBrakePipePressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
11211123
case "engine(ortsbrakerestorespoweratbrakepipepressure": BrakeRestoresPowerAtBrakePipePressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
1124+
case "engine(ortsemergencybrakecutsdynamicbrake": EmergencyBrakeCutsDynamicBrake = stf.ReadBoolBlock(false); break;
11221125
case "engine(doeshorntriggerbell": DoesHornTriggerBell = stf.ReadBoolBlock(false); break;
11231126
case "engine(ortshornlightstimer": HornTimerS = stf.ReadFloatBlock(STFReader.UNITS.Time, null); break;
11241127
case "engine(ortsbelllightstimer": BellTimerS = stf.ReadFloatBlock(STFReader.UNITS.Time, null); break;
@@ -1338,6 +1341,7 @@ public override void Copy(MSTSWagon copy)
13381341
BrakeCutsPowerAtBrakeCylinderPressurePSI = locoCopy.BrakeCutsPowerAtBrakeCylinderPressurePSI;
13391342
BrakeCutsPowerAtBrakePipePressurePSI = locoCopy.BrakeCutsPowerAtBrakePipePressurePSI;
13401343
BrakeRestoresPowerAtBrakePipePressurePSI = locoCopy.BrakeRestoresPowerAtBrakePipePressurePSI;
1344+
EmergencyBrakeCutsDynamicBrake = locoCopy.EmergencyBrakeCutsDynamicBrake;
13411345
DynamicBrakeCommandStartTime = locoCopy.DynamicBrakeCommandStartTime;
13421346
DynamicBrakeBlendingOverride = locoCopy.DynamicBrakeBlendingOverride;
13431347
DynamicBrakeBlendingForceMatch = locoCopy.DynamicBrakeBlendingForceMatch;
@@ -1853,17 +1857,17 @@ public override void Initialize()
18531857

18541858
}
18551859

1856-
if ((DoesBrakeCutPower || DoesVacuumBrakeCutPower) && BrakeCutsPowerAtBrakePipePressurePSI > BrakeRestoresPowerAtBrakePipePressurePSI)
1860+
if (DoesBrakeCutPower && BrakeCutsPowerAtBrakePipePressurePSI > BrakeRestoresPowerAtBrakePipePressurePSI)
18571861
{
18581862
BrakeCutsPowerAtBrakePipePressurePSI = BrakeRestoresPowerAtBrakePipePressurePSI - 1.0f;
18591863

18601864
if (Simulator.Settings.VerboseConfigurationMessages)
18611865
{
1862-
Trace.TraceInformation("BrakeCutsPowerAtBrakePipePressure is greater then BrakeRestoresPowerAtBrakePipePressure, and has been set to value of {0}", FormatStrings.FormatPressure(BrakeCutsPowerAtBrakePipePressurePSI, PressureUnit.PSI, BrakeSystemPressureUnits[BrakeSystemComponent.BrakePipe], true));
1866+
Trace.TraceInformation("BrakeCutsPowerAtBrakePipePressure is greater then BrakeRestoresPowerAtBrakePipePressurePSI, and has been set to value of {0} InHg", Bar.ToInHg(Bar.FromPSI(BrakeCutsPowerAtBrakePipePressurePSI)));
18631867
}
18641868
}
18651869

1866-
if (DoesVacuumBrakeCutPower && BrakeSystem is VacuumSinglePipe && (BrakeRestoresPowerAtBrakePipePressurePSI == 0 || BrakeRestoresPowerAtBrakePipePressurePSI > OneAtmospherePSI))
1870+
if (DoesBrakeCutPower && (BrakeSystem is VacuumSinglePipe) && (BrakeRestoresPowerAtBrakePipePressurePSI == 0 || BrakeRestoresPowerAtBrakePipePressurePSI > OneAtmospherePSI))
18671871
{
18681872
BrakeRestoresPowerAtBrakePipePressurePSI = Bar.ToPSI(Bar.FromInHg(15.0f)); // Power can be restored once brake pipe rises above 15 InHg
18691873

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,18 +1188,6 @@ public void UpdateAngleCockState(bool AngleCockOpen, ref float AngleCockOpenAmou
11881188
}
11891189
}
11901190

1191-
public virtual void UpdateTractionCutoff()
1192-
{
1193-
var locomotive = Car as MSTSLocomotive;
1194-
if (!locomotive.DoesBrakeCutPower) return;
1195-
if (locomotive.BrakeCutsPowerAtBrakePipePressurePSI > 0)
1196-
{
1197-
if (BrakeLine1PressurePSI < locomotive.BrakeCutsPowerAtBrakePipePressurePSI) locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = false;
1198-
else if (BrakeLine1PressurePSI >= locomotive.BrakeRestoresPowerAtBrakePipePressurePSI) locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = true;
1199-
}
1200-
else locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = CylPressurePSI <= locomotive.BrakeCutsPowerAtBrakeCylinderPressurePSI;
1201-
}
1202-
12031191
public override void Update(float elapsedClockSeconds)
12041192
{
12051193
var valveType = BrakeValve;
@@ -1966,8 +1954,6 @@ public override void Update(float elapsedClockSeconds)
19661954

19671955
}
19681956

1969-
if (Car is MSTSLocomotive) UpdateTractionCutoff();
1970-
19711957
// Record HUD display values for brake cylinders depending upon whether they are wagons or locomotives/tenders (which are subject to their own engine brakes)
19721958
if (Car.WagonType == MSTSWagon.WagonTypes.Engine || Car.WagonType == MSTSWagon.WagonTypes.Tender)
19731959
{

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,19 +453,25 @@ public override void Update(float elapsedClockSeconds)
453453
float BrakeCutoffPressurePSI = OneAtmospherePSI - lead.BrakeCutsPowerAtBrakePipePressurePSI;
454454
float BrakeRestorePressurePSI = OneAtmospherePSI - lead.BrakeRestoresPowerAtBrakePipePressurePSI;
455455

456-
if (Car is MSTSLocomotive locomotive && locomotive.DoesVacuumBrakeCutPower)
456+
if (lead.DoesVacuumBrakeCutPower)
457457
{
458+
458459
// There are three zones of operation - (note logic reversed - O InHg = 14.73psi, and eg 21 InHg = 4.189psi)
459460
// Cutoff - exceeds set value, eg 12.5InHg (= 8.5psi)
460461
// Between cutoff and restore levels - only if cutoff has triggerd
461462
// Restore - when value exceeds set value, eg 17InHg (= 6.36 psi) - resets throttle
462463
if (BrakeLine1PressurePSI < BrakeRestorePressurePSI)
463464
{
464-
locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = true;
465+
lead.VacuumBrakeCutoffActivated = false;
465466
}
466467
else if (BrakeLine1PressurePSI > BrakeCutoffPressurePSI)
467468
{
468-
locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = false;
469+
lead.MotiveForceN = 0.0f; // ToDO - This is not a good way to do it, better to be added to MotiveForce Update in MSTSLocomotive(s) when PRs Added
470+
lead.VacuumBrakeCutoffActivated = true;
471+
}
472+
else if (lead.VacuumBrakeCutoffActivated)
473+
{
474+
lead.MotiveForceN = 0.0f; // ToDO - This is not a good way to do it, better to be added to MotiveForce Update in MSTSLocomotive(s) when PRs Added
469475
}
470476
}
471477
}

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/TrainControlSystem.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ protected set
153153
public bool DynamicBrakingAuthorization { get; private set; }
154154
public float MaxThrottlePercent { get; private set; } = 100f;
155155
public bool FullDynamicBrakingOrder { get; private set; }
156-
public bool BrakeSystemTractionAuthorization = true;
157156

158157
public Dictionary<int, float> CabDisplayControls = new Dictionary<int, float>();
159158

@@ -369,7 +368,8 @@ public void Initialize()
369368
Script.DynamicBrakingAuthorization = () => DynamicBrakingAuthorization;
370369
Script.BrakePipePressureBar = () => Locomotive.BrakeSystem != null ? Bar.FromPSI(Locomotive.BrakeSystem.BrakeLine1PressurePSI) : float.MaxValue;
371370
Script.LocomotiveBrakeCylinderPressureBar = () => Locomotive.BrakeSystem != null ? Bar.FromPSI(Locomotive.BrakeSystem.GetCylPressurePSI()) : float.MaxValue;
372-
Script.DoesBrakeCutPower = () => Locomotive.DoesBrakeCutPower || Locomotive.DoesVacuumBrakeCutPower;
371+
Script.DoesBrakeCutPower = () => Locomotive.DoesBrakeCutPower;
372+
Script.BrakeCutsPowerAtBrakeCylinderPressureBar = () => Bar.FromPSI(Locomotive.BrakeCutsPowerAtBrakeCylinderPressurePSI);
373373
Script.TrainBrakeControllerState = () => Locomotive.TrainBrakeController.TrainBrakeControllerState;
374374
Script.AccelerationMpSS = () => Locomotive.AccelerationMpSS;
375375
Script.AltitudeM = () => Locomotive.WorldPosition.Location.Y;
@@ -1198,7 +1198,8 @@ public override void Update()
11981198
PowerCut |= ExternalEmergency;
11991199
}
12001200

1201-
SetTractionAuthorization(BrakeSystemTractionAuthorization);
1201+
SetTractionAuthorization(!DoesBrakeCutPower() || LocomotiveBrakeCylinderPressureBar() < BrakeCutsPowerAtBrakeCylinderPressureBar());
1202+
SetDynamicBrakingAuthorization(!EmergencyBrakeCutsDynamicBrake || !IsBrakeEmergency());
12021203

12031204
SetEmergencyBrake(EmergencyBrake);
12041205
SetFullBrake(FullBrake);

0 commit comments

Comments
 (0)