Skip to content

Commit 72674c9

Browse files
authored
Merge pull request #1015 from cesarBLG/electrical-braking-enhancement
Enhancements for EP brakes
2 parents 0cd8cb8 + 1ade99e commit 72674c9

18 files changed

+345
-196
lines changed

Source/Documentation/Manual/physics.rst

+33-17
Original file line numberDiff line numberDiff line change
@@ -2590,6 +2590,10 @@ behave exactly the same way as player controlled ones.
25902590

25912591
.. _physics-braking:
25922592

2593+
.. index::
2594+
single: BrakeSystemType
2595+
single: BrakeEquipmentType
2596+
25932597
Open Rails Braking
25942598
==================
25952599

@@ -2627,13 +2631,15 @@ graduated release. It will also force graduated release of brakes in triple
26272631
valves. This option should be unchecked, except for compatibility problems
26282632
with old MSTS stock.
26292633

2630-
The following brake types are implemented in OR:
2634+
The following brake types are implemented in OR. They can be selected using
2635+
the ``Wagon(BrakeSystemType`` parameter:
26312636

2632-
- Vacuum single
2633-
- Air single-pipe
2634-
- Air twin-pipe
2635-
- EP (Electro-pneumatic)
2636-
- Single-transfer-pipe (air and vacuum)
2637+
- Vacuum single pipe: ``BrakeSystemType ("Vacuum_single_pipe")``
2638+
- Air single-pipe: ``BrakeSystemType ("Air_single_pipe")``
2639+
- Air twin-pipe: ``BrakeSystemType ("Air_twin_pipe")``
2640+
- EP (Electro-pneumatic, twin-pipe): ``BrakeSystemType ("EP")``
2641+
- EP single-pipe: ``BrakeSystemType ("EP_single_pipe")``
2642+
- Single-transfer-pipe (air and vacuum): ``BrakeSystemType ("Air_piped")`` or ``BrakeSystemType ("Vacuum_piped")``
26372643

26382644
The operation of air single-pipe brakes is described in general below.
26392645

@@ -2658,17 +2664,19 @@ brake features.
26582664
For EP brakes, two variants are available:
26592665

26602666
- If ``Wagon(ORTSEPBrakeControlsBrakePipe`` is set to 0 (default situation),
2661-
an electrical wire (application wire) provides simultaneous fast brake application
2662-
along the train. Release time will be fast if standard air brake haven't been applied,
2663-
otherwise air brakes will determine release time. Typically this system is present
2664-
with Train Brake Controllers having an EP-only application section, followed by an
2665-
air application portion which serves as a fallback system.
2667+
an electrical wire (application wire) provides simultaneous fast brake application
2668+
along the train. Release time will be fast if standard air brake haven't been applied,
2669+
otherwise air brakes will determine release time. Typically this system is present
2670+
with Train Brake Controllers having an EP-only application section, followed by an
2671+
air application portion which serves as a fallback system, or in combination with a
2672+
solenoid valve that isolates the triple valve when EP brakes are operational.
2673+
26662674
- If ``Wagon(ORTSEPBrakeControlsBrakePipe`` is set to 1, brake pipe is charged and discharged
2667-
simultaneously at each car in the train, providing fast and uniform brake application and release.
2668-
The locomotive instructs the cars to "charge" or "discharge" the brake pipe to reach
2669-
a reference pressure. Standard triple valves or distributors will follow brake pipe variations
2670-
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
2671-
used in high speed trains.
2675+
simultaneously at each car in the train, providing fast and uniform brake application and release.
2676+
The locomotive instructs the cars to "charge" or "discharge" the brake pipe to reach
2677+
a reference pressure. Standard triple valves or distributors will follow brake pipe variations
2678+
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
2679+
used in high speed trains.
26722680

26732681
.. _physics-brake-controller:
26742682

@@ -3380,10 +3388,12 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
33803388
single: ORTSBrakeEmergencyTimeFactor
33813389
single: ORTSBrakePipeTimeFactor
33823390
single: ORTSEPBrakeControlsBrakePipe
3391+
single: ORTSEPBrakeInhibitsTripleValve
33833392
single: ORTSCompressorIsMuControlled
33843393
single: Supply_Reservoir
33853394
single: ORTSSupplyResCapacity
33863395
single: ORTSSupplyResChargingRate
3396+
single: Emergency_Solenoid_Valve
33873397

33883398
- ``Wagon(BrakePipeVolume`` -- Volume of car's brake pipe in cubic feet
33893399
(default .5).
@@ -3456,6 +3466,8 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
34563466
by the brake system.
34573467
- ``Wagon(ORTSEPBrakeControlsBrakePipe`` -- Set to 1 for UIC EP brake: brake pipe
34583468
pressure is electrically controlled at every fitted car.
3469+
- ``Wagon(ORTSEPBrakeInhibitsTripleValve`` -- Set to 1 if the car is fitted with a
3470+
selector valve that ignores brake pipe pressure when EP brakes are operational.
34593471
- ``Wagon(ORTSBrakeRelayValveRatio`` -- Determines the proportionality constant
34603472
between pressure as demanded by the triple valve and brake cylinder pressure.
34613473
This is achieved via a relay valve which sets BC pressure proportionally.
@@ -3534,7 +3546,7 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
35343546
- ``Wagon(ORTSInitialApplicationThreshold`` -- The pressure difference between
35353547
the brake pipe and auxiliary reservoir at which the triple valve will
35363548
change from release to apply (default 1 psi).
3537-
- ``BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
3549+
- ``Wagon(BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
35383550
loco or wagon, which will constantly charge to the brake pipe pressure
35393551
or MR pipe (if equipped) pressure. If a supply reservoir is equipped,
35403552
supply res air will be used to pressurize the brake cylinders thru the relay
@@ -3571,6 +3583,10 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
35713583
Pipe for twin pipe braking systems (default = Main Reservoir Pressure).
35723584
- ``Engine(ORTSCompressorIsMuControlled`` -- Set to 1 if compressors from
35733585
all locomotives are synchronized.
3586+
- ``Wagon(BrakeEquipmentType(Emergency_Solenoid_Valve`` -- Adds an
3587+
electrically controlled valve that quickly applies maximum
3588+
brake cylinder pressure during an emergency braking. Only available if the
3589+
brake cylinder pressure is controlled using a relay valve.
35743590

35753591
.. _physics-retainers:
35763592

Source/Orts.Simulation/Simulation/Physics/Train.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4040,7 +4040,7 @@ public virtual void InitializeBrakes()
40404040
if (Simulator.Settings.VerboseConfigurationMessages && LeadLocomotiveIndex >= 0) // Check incompatibilities between brake control valves
40414041
{
40424042
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
4043-
if (Cars.Any(x => (x as MSTSWagon).BrakeValve != lead.BrakeValve))
4043+
if (lead.BrakeSystem is AirSinglePipe leadBrakes && Cars.Any(x => x.BrakeSystem is AirSinglePipe carBrakes && leadBrakes.BrakeValve != carBrakes.BrakeValve))
40444044
{
40454045
Trace.TraceInformation("Cars along the train have incompatible brake control valves");
40464046
}
@@ -4069,17 +4069,17 @@ public void UnconditionalInitializeBrakes()
40694069
car.MSTSBrakeSystem = new VacuumSinglePipe(car);
40704070
else if (lead.BrakeSystem is AirTwinPipe)
40714071
car.MSTSBrakeSystem = new AirTwinPipe(car);
4072-
else if (lead.BrakeSystem is AirSinglePipe)
4072+
else if (lead.BrakeSystem is AirSinglePipe leadAir)
40734073
{
40744074
car.MSTSBrakeSystem = new AirSinglePipe(car);
40754075
// if emergency reservoir has been set on lead locomotive then also set on trailing cars
4076-
if (lead.EmergencyReservoirPresent)
4076+
if (leadAir.EmergencyReservoirPresent)
40774077
{
4078-
car.EmergencyReservoirPresent = lead.EmergencyReservoirPresent;
4078+
(car.BrakeSystem as AirSinglePipe).EmergencyReservoirPresent = leadAir.EmergencyReservoirPresent;
40794079
}
40804080
}
4081-
else if (lead.BrakeSystem is EPBrakeSystem)
4082-
car.MSTSBrakeSystem = new EPBrakeSystem(car);
4081+
else if (lead.BrakeSystem is EPBrakeSystem ep)
4082+
car.MSTSBrakeSystem = new EPBrakeSystem(car, ep.TwoPipes);
40834083
else if (lead.BrakeSystem is SingleTransferPipe)
40844084
car.MSTSBrakeSystem = new SingleTransferPipe(car);
40854085
else

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ public override void Initialize()
17381738
}
17391739

17401740
// MaximumMainReservoirPipePressurePSI is only used in twin pipe system, and should have a value
1741-
if ((BrakeSystem is AirTwinPipe))
1741+
if (BrakeSystem is AirSinglePipe air && air.TwoPipes)
17421742
{
17431743

17441744
// for airtwinpipe system, make sure that a value is set for it

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

+5-69
Original file line numberDiff line numberDiff line change
@@ -236,51 +236,13 @@ public enum WindowState
236236
public float BearingHotBoxSmokeDurationS;
237237
public float BearingHotBoxSmokeVelocityMpS = 15.0f;
238238
public Color BearingHotBoxSmokeSteadyColor = Color.Gray;
239-
240-
/// <summary>
241-
/// True if vehicle is equipped with an additional emergency brake reservoir
242-
/// </summary>
243-
public bool EmergencyReservoirPresent;
244-
public enum BrakeValveType
245-
{
246-
None,
247-
TripleValve, // Plain triple valve
248-
Distributor, // Triple valve with graduated release
249-
DistributingValve, // Triple valve + driver brake valve control. Only for locomotives
250-
}
251-
/// <summary>
252-
/// Type of brake valve in the car
253-
/// </summary>
254-
public BrakeValveType BrakeValve;
255-
/// <summary>
256-
/// True if equipped with handbrake. (Not common for older steam locomotives.)
257-
/// </summary>
258-
public bool HandBrakePresent;
259-
/// <summary>
260-
/// Number of available retainer positions. (Used on freight cars, mostly.) Might be 0, 3 or 4.
261-
/// </summary>
262-
public int RetainerPositions;
263-
264-
/// <summary>
265-
/// Indicates whether a brake is present or not when Manual Braking is selected.
266-
/// </summary>
267-
public bool ManualBrakePresent;
239+
List<string> BrakeEquipment = new List<string>();
268240

269241
/// <summary>
270242
/// Indicates whether a non auto (straight) brake is present or not when braking is selected.
271243
/// </summary>
272244
public bool NonAutoBrakePresent;
273245

274-
/// <summary>
275-
/// Indicates whether an auxiliary reservoir is present on the wagon or not.
276-
/// </summary>
277-
public bool AuxiliaryReservoirPresent;
278-
279-
/// <summary>
280-
/// Indicates whether an additional supply reservoir is present on the wagon or not.
281-
/// </summary>
282-
public bool SupplyReservoirPresent;
283-
284246
/// <summary>
285247
/// Active locomotive for a control trailer
286248
/// </summary>
@@ -1372,30 +1334,11 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
13721334
case "wagon(brakesystemtype":
13731335
CarBrakeSystemType = stf.ReadStringBlock(null).ToLower();
13741336
BrakeSystem = MSTSBrakeSystem.Create(CarBrakeSystemType, this);
1337+
MSTSBrakeSystem?.SetBrakeEquipment(BrakeEquipment);
13751338
break;
13761339
case "wagon(brakeequipmenttype":
1377-
foreach (var equipment in stf.ReadStringBlock("").ToLower().Replace(" ", "").Split(','))
1378-
{
1379-
switch (equipment)
1380-
{
1381-
case "triple_valve": BrakeValve = BrakeValveType.TripleValve; break;
1382-
case "distributor":
1383-
case "graduated_release_triple_valve": BrakeValve = BrakeValveType.Distributor; break;
1384-
case "distributing_valve": BrakeValve = BrakeValveType.DistributingValve; break;
1385-
case "emergency_brake_reservoir": EmergencyReservoirPresent = true; break;
1386-
case "handbrake": HandBrakePresent = true; break;
1387-
case "auxilary_reservoir": // MSTS legacy parameter - use is discouraged
1388-
case "auxiliary_reservoir":
1389-
AuxiliaryReservoirPresent = true;
1390-
break;
1391-
case "manual_brake": ManualBrakePresent = true; break;
1392-
case "retainer_3_position": RetainerPositions = 3; break;
1393-
case "retainer_4_position": RetainerPositions = 4; break;
1394-
case "supply_reservoir":
1395-
SupplyReservoirPresent = true;
1396-
break;
1397-
}
1398-
}
1340+
BrakeEquipment = stf.ReadStringBlock("").ToLower().Replace(" ", "").Split(',').ToList();
1341+
MSTSBrakeSystem?.SetBrakeEquipment(BrakeEquipment);
13991342
break;
14001343
case "wagon(coupling":
14011344
Couplers.Add(new MSTSCoupling()); // Adds a new coupler every time "Coupler" parameters found in WAG and INC file
@@ -1739,13 +1682,6 @@ public virtual void Copy(MSTSWagon copy)
17391682
IsGreaseFrictionBearing = copy.IsGreaseFrictionBearing;
17401683
CarBrakeSystemType = copy.CarBrakeSystemType;
17411684
BrakeSystem = MSTSBrakeSystem.Create(CarBrakeSystemType, this);
1742-
EmergencyReservoirPresent = copy.EmergencyReservoirPresent;
1743-
BrakeValve = copy.BrakeValve;
1744-
HandBrakePresent = copy.HandBrakePresent;
1745-
ManualBrakePresent = copy.ManualBrakePresent;
1746-
AuxiliaryReservoirPresent = copy.AuxiliaryReservoirPresent;
1747-
SupplyReservoirPresent = copy.SupplyReservoirPresent;
1748-
RetainerPositions = copy.RetainerPositions;
17491685
InteriorShapeFileName = copy.InteriorShapeFileName;
17501686
InteriorSoundFileName = copy.InteriorSoundFileName;
17511687
Cab3DShapeFileName = copy.Cab3DShapeFileName;
@@ -1817,7 +1753,7 @@ public virtual void Copy(MSTSWagon copy)
18171753
IntakePointList.Add(new IntakePoint(copyIntakePoint));
18181754
}
18191755
}
1820-
1756+
BrakeEquipment = new List<string>(BrakeEquipment);
18211757
MSTSBrakeSystem.InitializeFromCopy(copy.BrakeSystem);
18221758
if (copy.WeightLoadController != null) WeightLoadController = new MSTSNotchController(copy.WeightLoadController);
18231759

0 commit comments

Comments
 (0)