Skip to content

Commit 0c12e3a

Browse files
committed
Automatic merge of T1.6-186-g21d9ada29 and 10 pull requests
- Pull request #1082 at b191a54: Allow variable water level in glass gauge - Pull request #1057 at 85bde8e: Switchable brake system - Pull request #1081 at a8127a1: Brake cuts power unification - Pull request #1122 at 73c47b4: Wagon Size and Centering Controls - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1128 at b6c197f: Particle Emitter Overhaul - Pull request #1169 at 906f204: Revise TrainCar.SetUpWheels to Better Handle Unusual Rolling Stock - Pull request #1175 at d28315e: Make Data Logger interval configurable - Pull request #1176 at 4cd961b: Remove Implicit Requirement for Engine Name to Come After "Engine (" - Pull request #1178 at 015769e: Fix Diesel RPM Rate of Change
12 parents a14a010 + 21d9ada + b191a54 + 85bde8e + a8127a1 + 73c47b4 + e241a0d + b6c197f + 906f204 + d28315e + 4cd961b + 015769e commit 0c12e3a

File tree

6 files changed

+37
-20
lines changed

6 files changed

+37
-20
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5642,12 +5642,17 @@ the tables below.
56425642
.. index::
56435643
single: DoesBrakeCutPower
56445644
single: BrakeCutsPowerAtBrakeCylinderPressure
5645+
single: ORTSBrakeCutsPowerAtBrakePipePressure
5646+
single: ORTSBrakeRestoresPowerAtBrakePipePressure
56455647
single: OrtsEmergencyBrakeCutsDynamicBrake
56465648

5647-
Other parameters in the Engine section of the ENG file are used by the TCS:
5649+
Other parameters in the Engine section of the ENG file are used for traction-braking interlock:
56485650

5649-
- ``DoesBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction (1 for enabled, 0 for disabled)
5651+
- ``DoesBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction for air brake system (1 for enabled, 0 for disabled)
5652+
- ``ORTSDoesVacuumBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction for vacuum brake system (1 for enabled, 0 for disabled)
56505653
- ``BrakeCutsPowerAtBrakeCylinderPressure( x )`` sets the minimum pressure in the brake cylinder that cuts the traction (by default 4 PSI)
5654+
- ``ORTSBrakeCutsPowerAtBrakePipePressure( x )`` sets the maximum pressure in the brake pipe that cuts the traction
5655+
- ``ORTSBrakeRestoresPowerAtBrakePipePressure( x )`` sets the minimum pressure in the brake pipe that restores the traction
56515656
- ``OrtsEmergencyBrakeCutsDynamicBrake`` sets whether an emergency braking disables dynamic brakes
56525657

56535658

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,14 @@ internal void AttachToHost(ScriptedTrainControlSystem host)
265265
/// </summary>
266266
public Func<bool> DoesBrakeCutPower;
267267
/// <summary>
268-
/// Train brake pressure value which triggers the power cut-off.
268+
/// Deprecated. Returns positive infinity if traction cutoff is requested by the brake system, and negative infinity if it is not requested
269269
/// </summary>
270-
public Func<float> BrakeCutsPowerAtBrakeCylinderPressureBar;
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;
271276
/// <summary>
272277
/// True if dynamic brake must be cut if the emergency brake is applied.
273278
/// </summary>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ 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;
302301
public bool BrakeFlagDecrease = false;
303302
public bool BrakeFlagIncrease = false;
304303

@@ -1855,17 +1854,17 @@ public override void Initialize()
18551854

18561855
}
18571856

1858-
if (DoesBrakeCutPower && BrakeCutsPowerAtBrakePipePressurePSI > BrakeRestoresPowerAtBrakePipePressurePSI)
1857+
if ((DoesBrakeCutPower || DoesVacuumBrakeCutPower) && BrakeCutsPowerAtBrakePipePressurePSI > BrakeRestoresPowerAtBrakePipePressurePSI)
18591858
{
18601859
BrakeCutsPowerAtBrakePipePressurePSI = BrakeRestoresPowerAtBrakePipePressurePSI - 1.0f;
18611860

18621861
if (Simulator.Settings.VerboseConfigurationMessages)
18631862
{
1864-
Trace.TraceInformation("BrakeCutsPowerAtBrakePipePressure is greater then BrakeRestoresPowerAtBrakePipePressurePSI, and has been set to value of {0} InHg", Bar.ToInHg(Bar.FromPSI(BrakeCutsPowerAtBrakePipePressurePSI)));
1863+
Trace.TraceInformation("BrakeCutsPowerAtBrakePipePressure is greater then BrakeRestoresPowerAtBrakePipePressure, and has been set to value of {0}", FormatStrings.FormatPressure(BrakeCutsPowerAtBrakePipePressurePSI, PressureUnit.PSI, BrakeSystemPressureUnits[BrakeSystemComponent.BrakePipe], true));
18651864
}
18661865
}
18671866

1868-
if (DoesBrakeCutPower && (BrakeSystem is VacuumSinglePipe) && (BrakeRestoresPowerAtBrakePipePressurePSI == 0 || BrakeRestoresPowerAtBrakePipePressurePSI > OneAtmospherePSI))
1867+
if (DoesVacuumBrakeCutPower && BrakeSystem is VacuumSinglePipe && (BrakeRestoresPowerAtBrakePipePressurePSI == 0 || BrakeRestoresPowerAtBrakePipePressurePSI > OneAtmospherePSI))
18691868
{
18701869
BrakeRestoresPowerAtBrakePipePressurePSI = Bar.ToPSI(Bar.FromInHg(15.0f)); // Power can be restored once brake pipe rises above 15 InHg
18711870

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,18 @@ public void UpdateAngleCockState(bool AngleCockOpen, ref float AngleCockOpenAmou
12581258
}
12591259
}
12601260

1261+
public virtual void UpdateTractionCutoff()
1262+
{
1263+
var locomotive = Car as MSTSLocomotive;
1264+
if (!locomotive.DoesBrakeCutPower) return;
1265+
if (locomotive.BrakeCutsPowerAtBrakePipePressurePSI > 0)
1266+
{
1267+
if (BrakeLine1PressurePSI < locomotive.BrakeCutsPowerAtBrakePipePressurePSI) locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = false;
1268+
else if (BrakeLine1PressurePSI >= locomotive.BrakeRestoresPowerAtBrakePipePressurePSI) locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = true;
1269+
}
1270+
else locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = CylPressurePSI <= locomotive.BrakeCutsPowerAtBrakeCylinderPressurePSI;
1271+
}
1272+
12611273
public override void Update(float elapsedClockSeconds)
12621274
{
12631275
var valveType = BrakeValve;
@@ -2024,6 +2036,8 @@ public override void Update(float elapsedClockSeconds)
20242036

20252037
}
20262038

2039+
if (Car is MSTSLocomotive) UpdateTractionCutoff();
2040+
20272041
// Record HUD display values for brake cylinders depending upon whether they are wagons or locomotives/tenders (which are subject to their own engine brakes)
20282042
if (Car.WagonType == MSTSWagon.WagonTypes.Engine || Car.WagonType == MSTSWagon.WagonTypes.Tender)
20292043
{

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

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

513-
if (lead.DoesVacuumBrakeCutPower)
513+
if (Car is MSTSLocomotive locomotive && locomotive.DoesVacuumBrakeCutPower)
514514
{
515-
516515
// There are three zones of operation - (note logic reversed - O InHg = 14.73psi, and eg 21 InHg = 4.189psi)
517516
// Cutoff - exceeds set value, eg 12.5InHg (= 8.5psi)
518517
// Between cutoff and restore levels - only if cutoff has triggerd
519518
// Restore - when value exceeds set value, eg 17InHg (= 6.36 psi) - resets throttle
520519
if (BrakeLine1PressurePSI < BrakeRestorePressurePSI)
521520
{
522-
lead.VacuumBrakeCutoffActivated = false;
521+
locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = true;
523522
}
524523
else if (BrakeLine1PressurePSI > BrakeCutoffPressurePSI)
525524
{
526-
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
527-
lead.VacuumBrakeCutoffActivated = true;
528-
}
529-
else if (lead.VacuumBrakeCutoffActivated)
530-
{
531-
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
525+
locomotive.TrainControlSystem.BrakeSystemTractionAuthorization = false;
532526
}
533527
}
534528
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ 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;
156157

157158
public Dictionary<int, float> CabDisplayControls = new Dictionary<int, float>();
158159

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

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

12041204
SetEmergencyBrake(EmergencyBrake);

0 commit comments

Comments
 (0)