Skip to content

Commit 277dacd

Browse files
committed
Merge branch 'master' into controller-delays
2 parents b7b097b + ade0195 commit 277dacd

23 files changed

+368
-212
lines changed

Build.cmd

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ FOR /F "usebackq tokens=1* delims==" %%A IN (`CALL GetVersion.cmd %Mode%`) DO SE
8383
REM Restore NuGet packages.
8484
nuget restore Source\ORTS.sln || GOTO :error
8585

86-
REM Recreate Program directory for output.
86+
REM Recreate Program directory for output and delete previous build files.
8787
CALL :recreate "Program" || GOTO :error
88+
CALL :delete "OpenRails-%Mode%*" || GOTO :error
8889

8990
REM Build main program.
9091
REM Disable warning CS1591 "Missing XML comment for publicly visible type or member".
@@ -126,11 +127,14 @@ IF NOT "%Mode%" == "Unstable" (
126127
NET stop ClickToRunSvc
127128
NET start ClickToRunSvc
128129

129-
REM Recreate Documentation folder for output.
130-
CALL :recreate "Program\Documentation" || GOTO :error
130+
REM Create the documentation folders for output.
131+
CALL :create "Program\Documentation" || GOTO :error
132+
CALL :create "Program\Documentation\Online" || GOTO :error
133+
CALL :create "Program\Documentation\es" || GOTO :error
131134

132135
REM Compile the documentation.
133136
FOR %%E IN (doc docx docm xls xlsx xlsm odt) DO FOR %%F IN ("Source\Documentation\*.%%E") DO ECHO %%~F && OfficeToPDF.exe /bookmarks /print "%%~F" "Program\Documentation\%%~nF.pdf" || GOTO :error
137+
FOR %%E IN (doc docx docm xls xlsx xlsm odt) DO FOR %%F IN ("Source\Documentation\Online\*.%%E") DO ECHO %%~F && OfficeToPDF.exe /bookmarks /print "%%~F" "Program\Documentation\Online\%%~nF.pdf" || GOTO :error
134138
>"Source\Documentation\Manual\version.py" ECHO version = '%OpenRails_Version%' || GOTO :error
135139
>>"Source\Documentation\Manual\version.py" ECHO release = '%OpenRails_Revision%' || GOTO :error
136140
PUSHD "Source\Documentation\Manual" && CALL make.bat clean & POPD || GOTO :error
@@ -139,13 +143,13 @@ IF NOT "%Mode%" == "Unstable" (
139143
REM Copy the documentation.
140144
FOR %%F IN ("Source\Documentation\*.pdf") DO CALL :copy "%%~F" "Program\Documentation\%%~nF.pdf" || GOTO :error
141145
CALL :copy "Source\Documentation\Manual\_build\latex\Manual.pdf" "Program\Documentation\Manual.pdf" || GOTO :error
142-
CALL :create "Program\Documentation\es"
143146
CALL :copy "Source\Documentation\Manual\es\Manual.pdf" "Program\Documentation\es\Manual.pdf" || GOTO :error
144147
ROBOCOPY /MIR /NJH /NJS "Source\Documentation\SampleFiles" "Program\Documentation\SampleFiles"
145148
IF %ERRORLEVEL% GEQ 8 GOTO :error
146149

147150
REM Copy the documentation separately.
148151
FOR %%F IN ("Program\Documentation\*.pdf") DO CALL :copy "%%~F" "OpenRails-%Mode%-%%~nxF" || GOTO :error
152+
FOR %%F IN ("Program\Documentation\Online\*.pdf") DO CALL :copy "%%~F" "OpenRails-%Mode%-%%~nxF" || GOTO :error
149153
)
150154

151155
IF "%Mode%" == "Stable" (
@@ -161,8 +165,7 @@ IF "%Mode%" == "Stable" (
161165
)
162166

163167
REM Create binary and source zips.
164-
CALL :delete "OpenRails-%Mode%*.zip" || GOTO :error
165-
PUSHD "Program" && 7za.exe a -r -tzip -x^^!*.xml "..\OpenRails-%Mode%.zip" . && POPD || GOTO :error
168+
PUSHD "Program" && 7za.exe a -r -tzip -x^^!*.xml -x^^!Online "..\OpenRails-%Mode%.zip" . && POPD || GOTO :error
166169
7za.exe a -r -tzip -x^^!.* -x^^!obj -x^^!lib -x^^!_build -x^^!*.bak "OpenRails-%Mode%-Source.zip" "Source" || GOTO :error
167170

168171
ENDLOCAL

Source/Documentation/Manual/physics.rst

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,10 @@ behave exactly the same way as player controlled ones.
26562656

26572657
.. _physics-braking:
26582658

2659+
.. index::
2660+
single: BrakeSystemType
2661+
single: BrakeEquipmentType
2662+
26592663
Open Rails Braking
26602664
==================
26612665

@@ -2693,13 +2697,15 @@ graduated release. It will also force graduated release of brakes in triple
26932697
valves. This option should be unchecked, except for compatibility problems
26942698
with old MSTS stock.
26952699

2696-
The following brake types are implemented in OR:
2700+
The following brake types are implemented in OR. They can be selected using
2701+
the ``Wagon(BrakeSystemType`` parameter:
26972702

2698-
- Vacuum single
2699-
- Air single-pipe
2700-
- Air twin-pipe
2701-
- EP (Electro-pneumatic)
2702-
- Single-transfer-pipe (air and vacuum)
2703+
- Vacuum single pipe: ``BrakeSystemType ("Vacuum_single_pipe")``
2704+
- Air single-pipe: ``BrakeSystemType ("Air_single_pipe")``
2705+
- Air twin-pipe: ``BrakeSystemType ("Air_twin_pipe")``
2706+
- EP (Electro-pneumatic, twin-pipe): ``BrakeSystemType ("EP")``
2707+
- EP single-pipe: ``BrakeSystemType ("EP_single_pipe")``
2708+
- Single-transfer-pipe (air and vacuum): ``BrakeSystemType ("Air_piped")`` or ``BrakeSystemType ("Vacuum_piped")``
27032709

27042710
The operation of air single-pipe brakes is described in general below.
27052711

@@ -2724,17 +2730,19 @@ brake features.
27242730
For EP brakes, two variants are available:
27252731

27262732
- If ``Wagon(ORTSEPBrakeControlsBrakePipe`` is set to 0 (default situation),
2727-
an electrical wire (application wire) provides simultaneous fast brake application
2728-
along the train. Release time will be fast if standard air brake haven't been applied,
2729-
otherwise air brakes will determine release time. Typically this system is present
2730-
with Train Brake Controllers having an EP-only application section, followed by an
2731-
air application portion which serves as a fallback system.
2733+
an electrical wire (application wire) provides simultaneous fast brake application
2734+
along the train. Release time will be fast if standard air brake haven't been applied,
2735+
otherwise air brakes will determine release time. Typically this system is present
2736+
with Train Brake Controllers having an EP-only application section, followed by an
2737+
air application portion which serves as a fallback system, or in combination with a
2738+
solenoid valve that isolates the triple valve when EP brakes are operational.
2739+
27322740
- If ``Wagon(ORTSEPBrakeControlsBrakePipe`` is set to 1, brake pipe is charged and discharged
2733-
simultaneously at each car in the train, providing fast and uniform brake application and release.
2734-
The locomotive instructs the cars to "charge" or "discharge" the brake pipe to reach
2735-
a reference pressure. Standard triple valves or distributors will follow brake pipe variations
2736-
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
2737-
used in high speed trains.
2741+
simultaneously at each car in the train, providing fast and uniform brake application and release.
2742+
The locomotive instructs the cars to "charge" or "discharge" the brake pipe to reach
2743+
a reference pressure. Standard triple valves or distributors will follow brake pipe variations
2744+
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
2745+
used in high speed trains.
27382746

27392747
.. _physics-brake-controller:
27402748

@@ -3446,10 +3454,12 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
34463454
single: ORTSBrakeEmergencyTimeFactor
34473455
single: ORTSBrakePipeTimeFactor
34483456
single: ORTSEPBrakeControlsBrakePipe
3457+
single: ORTSEPBrakeInhibitsTripleValve
34493458
single: ORTSCompressorIsMuControlled
34503459
single: Supply_Reservoir
34513460
single: ORTSSupplyResCapacity
34523461
single: ORTSSupplyResChargingRate
3462+
single: Emergency_Solenoid_Valve
34533463

34543464
- ``Wagon(BrakePipeVolume`` -- Volume of car's brake pipe in cubic feet
34553465
(default .5).
@@ -3522,6 +3532,8 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
35223532
by the brake system.
35233533
- ``Wagon(ORTSEPBrakeControlsBrakePipe`` -- Set to 1 for UIC EP brake: brake pipe
35243534
pressure is electrically controlled at every fitted car.
3535+
- ``Wagon(ORTSEPBrakeInhibitsTripleValve`` -- Set to 1 if the car is fitted with a
3536+
selector valve that ignores brake pipe pressure when EP brakes are operational.
35253537
- ``Wagon(ORTSBrakeRelayValveRatio`` -- Determines the proportionality constant
35263538
between pressure as demanded by the triple valve and brake cylinder pressure.
35273539
This is achieved via a relay valve which sets BC pressure proportionally.
@@ -3600,7 +3612,7 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
36003612
- ``Wagon(ORTSInitialApplicationThreshold`` -- The pressure difference between
36013613
the brake pipe and auxiliary reservoir at which the triple valve will
36023614
change from release to apply (default 1 psi).
3603-
- ``BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
3615+
- ``Wagon(BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
36043616
loco or wagon, which will constantly charge to the brake pipe pressure
36053617
or MR pipe (if equipped) pressure. If a supply reservoir is equipped,
36063618
supply res air will be used to pressurize the brake cylinders thru the relay
@@ -3637,6 +3649,10 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
36373649
Pipe for twin pipe braking systems (default = Main Reservoir Pressure).
36383650
- ``Engine(ORTSCompressorIsMuControlled`` -- Set to 1 if compressors from
36393651
all locomotives are synchronized.
3652+
- ``Wagon(BrakeEquipmentType(Emergency_Solenoid_Valve`` -- Adds an
3653+
electrically controlled valve that quickly applies maximum
3654+
brake cylinder pressure during an emergency braking. Only available if the
3655+
brake cylinder pressure is controlled using a relay valve.
36403656

36413657
.. _physics-retainers:
36423658

Source/Documentation/Manual/sound.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Trigger Function
101101
44 SteamHeatChange
102102
45 Pantograph1Up
103103
46 Pantograph1Down
104-
47 Pantograph1Toggle
104+
47 PantographToggle
105105
48 VigilanceAlarmReset
106106
54 TrainBrakePressureDecrease
107107
56 VigilanceAlarmOn
@@ -698,4 +698,4 @@ the sound does not depend from that keyword.
698698
In the example shown, the sound is played if all conditions are met, that is season
699699
is spring or winter and weather is rain and time of day is within one of the two
700700
intervals 7-12 or 13-20. There may be as many TimeOfDay lines as wanted,
701-
but the granularity is one hour.
701+
but the granularity is one hour.

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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ public override void Initialize()
17741774
}
17751775

17761776
// MaximumMainReservoirPipePressurePSI is only used in twin pipe system, and should have a value
1777-
if ((BrakeSystem is AirTwinPipe))
1777+
if (BrakeSystem is AirSinglePipe air && air.TwoPipes)
17781778
{
17791779

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

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

Lines changed: 5 additions & 71 deletions
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

@@ -3672,7 +3608,6 @@ public override void SignalEvent(PowerSupplyEvent evt)
36723608
if (Pantographs != null)
36733609
{
36743610
Pantographs.HandleEvent(evt);
3675-
SignalEvent(Event.PantographToggle);
36763611
}
36773612
break;
36783613
}
@@ -3692,7 +3627,6 @@ public override void SignalEvent(PowerSupplyEvent evt, int id)
36923627
if (Pantographs != null)
36933628
{
36943629
Pantographs.HandleEvent(evt, id);
3695-
SignalEvent(Event.PantographToggle);
36963630
}
36973631
break;
36983632
}

0 commit comments

Comments
 (0)