Skip to content

Commit 4e59b7b

Browse files
committed
Automatic merge of T1.5.1-1689-g72674c98d and 14 pull requests
- Pull request #900 at b54024b: DMI in 3D cab + two more dials - Pull request #1030 at d3ae4a2: Refactor settings, in prep for settings exporter - Pull request #1045 at cc4d53c: Bugfix: Empty Start Time for Explore, and other issues loading from Menu Selection and Content Routes - Pull request #1052 at 382ea6d: Content Manager: Add axle count, and lowest derail force - Pull request #1062 at 3b18c48: Train Forces popup Window. - Pull request #1064 at 53dd604: Add Train Info tab to Help window (F1) - Pull request #1066 at 62c89c1: Log derailment, using TraceInformation. - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #1000 at d8d9709: Locomotive operation from control car - Pull request #1029 at 92c74ef: Superelevation Follow Up Fixes - Pull request #1065 at 409064d: Fix for PantographToggle sound event - Pull request #1068 at d6e1f83: Build for online-only documentation files - Pull request #896 at f1681df: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #1067 at 777efaf: Traction and dynamic brake retardation
16 parents ee8cffc + 72674c9 + b54024b + d3ae4a2 + cc4d53c + 382ea6d + 3b18c48 + 53dd604 + 62c89c1 + 1f5ba4c + d8d9709 + 92c74ef + 409064d + d6e1f83 + f1681df + 777efaf commit 4e59b7b

32 files changed

+1349
-1290
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,58 @@ with the ``ORTSTractionMotorType ( AC ) `` parameter, to be inserted in the Engi
11411141
section of the ENG file. The use of this motor will have an impact on wheel slip,
11421142
because the wheel speed never exceeds the frequency of the rotating magnetic field.
11431143
1144+
Traction force retardation
1145+
''''''''''''''''''''''''''
1146+
1147+
.. index::
1148+
single: ORTSTractiveForceRampUpRate
1149+
single: ORTSTractiveForceRampDownRate
1150+
single: ORTSTractiveForceRampDownToZeroRate
1151+
single: ORTSDynamicBrakeForceRampUpRate
1152+
single: ORTSDynamicBrakeForceRampDownRate
1153+
single: ORTSDynamicBrakeForceRampDownToZeroRate
1154+
single: ORTSDelayTimeBeforeUpdating
1155+
1156+
When the driver sets full throttle, the control electronics may not apply the full
1157+
tractive force instantly, but it will instead linearly apply force until reaching
1158+
the target demand. This can be tuned both for traction and dynamic braking by inserting
1159+
``ORTSTractiveForceRampUpRate``, ``ORTSTractiveForceRampDownRate``,
1160+
``ORTSTractiveForceRampDownToZeroRate``, ``ORTSDynamicBrakeForceRampUpRate``,
1161+
``ORTSDynamicBrakeForceRampDownRate`` and ``ORTSDynamicBrakeForceRampDownToZeroRate``
1162+
in the .eng file. The value of each parameter determines the force increase/decrease
1163+
rate in one second.
1164+
1165+
Example::
1166+
1167+
Engine (
1168+
ORTSTractiveForceRampUpRate ( 50kN )
1169+
ORTSTractiveForceRampDownRate ( 50kN )
1170+
ORTSTractiveForceRampDownToZeroRate ( 100kN )
1171+
ORTSDynamicBrakeForceRampUpRate ( 70kN )
1172+
ORTSDynamicBrakeForceRampDownRate ( 50kN )
1173+
ORTSDynamicBrakeForceRampDownToZeroRate ( 50kN )
1174+
)
1175+
1176+
Another possibility to avoid sudden variations in tractive force while the driver
1177+
is moving the throttle, is to only update the throttle/brake demand when the lever
1178+
has not been moved for a defined amount of time. This can be implemented using the
1179+
``ORTSDelayTimeBeforeUpdating``, which has to be inserted for the desired
1180+
controller in the ``EngineControllers`` block.
1181+
1182+
Example::
1183+
1184+
Engine (
1185+
EngineControllers (
1186+
Throttle ( 0 1 0.1 0
1187+
NumNotches ( 0 )
1188+
ORTSDelayTimeBeforeUpdating ( 0.5s )
1189+
)
1190+
Brake_Dynamic ( 0 1 0.1 0
1191+
NumNotches ( 0 )
1192+
ORTSDelayTimeBeforeUpdating ( 1s )
1193+
)
1194+
)
1195+
)
11441196

11451197
Steam Locomotives
11461198
-----------------
@@ -2590,6 +2642,10 @@ behave exactly the same way as player controlled ones.
25902642

25912643
.. _physics-braking:
25922644

2645+
.. index::
2646+
single: BrakeSystemType
2647+
single: BrakeEquipmentType
2648+
25932649
Open Rails Braking
25942650
==================
25952651

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

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

2632-
- Vacuum single
2633-
- Air single-pipe
2634-
- Air twin-pipe
2635-
- EP (Electro-pneumatic)
2636-
- Single-transfer-pipe (air and vacuum)
2689+
- Vacuum single pipe: ``BrakeSystemType ("Vacuum_single_pipe")``
2690+
- Air single-pipe: ``BrakeSystemType ("Air_single_pipe")``
2691+
- Air twin-pipe: ``BrakeSystemType ("Air_twin_pipe")``
2692+
- EP (Electro-pneumatic, twin-pipe): ``BrakeSystemType ("EP")``
2693+
- EP single-pipe: ``BrakeSystemType ("EP_single_pipe")``
2694+
- Single-transfer-pipe (air and vacuum): ``BrakeSystemType ("Air_piped")`` or ``BrakeSystemType ("Vacuum_piped")``
26372695

26382696
The operation of air single-pipe brakes is described in general below.
26392697

@@ -2658,17 +2716,19 @@ brake features.
26582716
For EP brakes, two variants are available:
26592717

26602718
- 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.
2719+
an electrical wire (application wire) provides simultaneous fast brake application
2720+
along the train. Release time will be fast if standard air brake haven't been applied,
2721+
otherwise air brakes will determine release time. Typically this system is present
2722+
with Train Brake Controllers having an EP-only application section, followed by an
2723+
air application portion which serves as a fallback system, or in combination with a
2724+
solenoid valve that isolates the triple valve when EP brakes are operational.
2725+
26662726
- 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.
2727+
simultaneously at each car in the train, providing fast and uniform brake application and release.
2728+
The locomotive instructs the cars to "charge" or "discharge" the brake pipe to reach
2729+
a reference pressure. Standard triple valves or distributors will follow brake pipe variations
2730+
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
2731+
used in high speed trains.
26722732

26732733
.. _physics-brake-controller:
26742734

@@ -3380,10 +3440,12 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
33803440
single: ORTSBrakeEmergencyTimeFactor
33813441
single: ORTSBrakePipeTimeFactor
33823442
single: ORTSEPBrakeControlsBrakePipe
3443+
single: ORTSEPBrakeInhibitsTripleValve
33833444
single: ORTSCompressorIsMuControlled
33843445
single: Supply_Reservoir
33853446
single: ORTSSupplyResCapacity
33863447
single: ORTSSupplyResChargingRate
3448+
single: Emergency_Solenoid_Valve
33873449

33883450
- ``Wagon(BrakePipeVolume`` -- Volume of car's brake pipe in cubic feet
33893451
(default .5).
@@ -3456,6 +3518,8 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
34563518
by the brake system.
34573519
- ``Wagon(ORTSEPBrakeControlsBrakePipe`` -- Set to 1 for UIC EP brake: brake pipe
34583520
pressure is electrically controlled at every fitted car.
3521+
- ``Wagon(ORTSEPBrakeInhibitsTripleValve`` -- Set to 1 if the car is fitted with a
3522+
selector valve that ignores brake pipe pressure when EP brakes are operational.
34593523
- ``Wagon(ORTSBrakeRelayValveRatio`` -- Determines the proportionality constant
34603524
between pressure as demanded by the triple valve and brake cylinder pressure.
34613525
This is achieved via a relay valve which sets BC pressure proportionally.
@@ -3534,7 +3598,7 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
35343598
- ``Wagon(ORTSInitialApplicationThreshold`` -- The pressure difference between
35353599
the brake pipe and auxiliary reservoir at which the triple valve will
35363600
change from release to apply (default 1 psi).
3537-
- ``BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
3601+
- ``Wagon(BrakeEquipmentType(Supply_Reservoir`` -- Adds a supply reservoir to the
35383602
loco or wagon, which will constantly charge to the brake pipe pressure
35393603
or MR pipe (if equipped) pressure. If a supply reservoir is equipped,
35403604
supply res air will be used to pressurize the brake cylinders thru the relay
@@ -3571,6 +3635,10 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
35713635
Pipe for twin pipe braking systems (default = Main Reservoir Pressure).
35723636
- ``Engine(ORTSCompressorIsMuControlled`` -- Set to 1 if compressors from
35733637
all locomotives are synchronized.
3638+
- ``Wagon(BrakeEquipmentType(Emergency_Solenoid_Valve`` -- Adds an
3639+
electrically controlled valve that quickly applies maximum
3640+
brake cylinder pressure during an emergency braking. Only available if the
3641+
brake cylinder pressure is controlled using a relay valve.
35743642

35753643
.. _physics-retainers:
35763644

Source/Orts.Common/Conversions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static class Kg
189189
/// <summary>Convert from kilograms to UK Tons</summary>
190190
public static float ToTUK(float kg) { return kg * (1.0f / 1016.047f); }
191191
/// <summary>Convert from kilogram to metric tonnes</summary>
192-
public static float ToTonne(float kg) { return kg / 1000.0f; }
192+
public static float ToTonne(float kg) { return kg * (1.0f / 1000.0f); }
193193
/// <summary>Convert from metrix tonnes to kilogram</summary>
194194
public static float FromTonne(float tonne) { return tonne * 1000.0f; }
195195
}

Source/Orts.Parsers.Msts/STFReader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,11 @@ public float ReadFloat(UNITS validUnits, float? defaultValue)
609609
// However, some values (mostly "time" ones) may be followed by text. Therefore that approach cannot be used consistently
610610
// and has been abandoned. </CJComment>
611611

612+
float val;
613+
double scale = ParseUnitSuffix(ref item, validUnits);
612614
if (item.Length == 0) return 0.0f;
613615
if (item[item.Length - 1] == ',') item = item.TrimEnd(',');
614-
double scale = ParseUnitSuffix(ref item, validUnits); // must be after TrimEnd(','), otherwise the unit parsed becomes invalid
615-
if (float.TryParse(item, parseNum, parseNFI, out float val)) return (scale == 1) ? val : (float)(scale * val);
616+
if (float.TryParse(item, parseNum, parseNFI, out val)) return (scale == 1) ? val : (float)(scale * val);
616617
STFException.TraceWarning(this, "Cannot parse the constant number " + item);
617618
if (item == ")") StepBackOneItem();
618619
return defaultValue.GetValueOrDefault(0);

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4042,7 +4042,7 @@ public virtual void InitializeBrakes()
40424042
if (Simulator.Settings.VerboseConfigurationMessages && LeadLocomotiveIndex >= 0) // Check incompatibilities between brake control valves
40434043
{
40444044
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
4045-
if (Cars.Any(x => (x as MSTSWagon).BrakeValve != lead.BrakeValve))
4045+
if (lead.BrakeSystem is AirSinglePipe leadBrakes && Cars.Any(x => x.BrakeSystem is AirSinglePipe carBrakes && leadBrakes.BrakeValve != carBrakes.BrakeValve))
40464046
{
40474047
Trace.TraceInformation("Cars along the train have incompatible brake control valves");
40484048
}
@@ -4061,13 +4061,33 @@ public void UnconditionalInitializeBrakes()
40614061
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
40624062
if (lead.TrainBrakeController != null)
40634063
{
4064-
foreach (var car in Cars)
4064+
foreach (MSTSWagon car in Cars)
40654065
{
4066-
if (lead.BrakeSystem.GetType() != car.BrakeSystem.GetType())
4066+
if (lead.CarBrakeSystemType != car.CarBrakeSystemType) // Test to see if car brake system is the same as the locomotive
40674067
{
4068-
(car as MSTSWagon).EmergencyReservoirPresent = lead.EmergencyReservoirPresent;
4069-
car.BrakeSystem = BrakeSystem.CreateNewLike(lead.BrakeSystem, car);
4070-
car.BrakeSystem.InitializeFromCopy(lead.BrakeSystem, false);
4068+
// If not, change so that they are compatible
4069+
car.CarBrakeSystemType = lead.CarBrakeSystemType;
4070+
if (lead.BrakeSystem is VacuumSinglePipe)
4071+
car.MSTSBrakeSystem = new VacuumSinglePipe(car);
4072+
else if (lead.BrakeSystem is AirTwinPipe)
4073+
car.MSTSBrakeSystem = new AirTwinPipe(car);
4074+
else if (lead.BrakeSystem is AirSinglePipe leadAir)
4075+
{
4076+
car.MSTSBrakeSystem = new AirSinglePipe(car);
4077+
// if emergency reservoir has been set on lead locomotive then also set on trailing cars
4078+
if (leadAir.EmergencyReservoirPresent)
4079+
{
4080+
(car.BrakeSystem as AirSinglePipe).EmergencyReservoirPresent = leadAir.EmergencyReservoirPresent;
4081+
}
4082+
}
4083+
else if (lead.BrakeSystem is EPBrakeSystem ep)
4084+
car.MSTSBrakeSystem = new EPBrakeSystem(car, ep.TwoPipes);
4085+
else if (lead.BrakeSystem is SingleTransferPipe)
4086+
car.MSTSBrakeSystem = new SingleTransferPipe(car);
4087+
else
4088+
throw new Exception("Unknown brake type");
4089+
4090+
car.MSTSBrakeSystem.InitializeFromCopy(lead.BrakeSystem);
40714091
Trace.TraceInformation("Car and Locomotive Brake System Types Incompatible on Car {0} - Car brakesystem type changed to {1}", car.CarID, car.CarBrakeSystemType);
40724092
}
40734093
}

Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public override string GetStatus()
263263
/// <summary>
264264
/// This function updates periodically the locomotive's motive force.
265265
/// </summary>
266-
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
266+
protected override void UpdateTractiveForce(float elapsedClockSeconds)
267267
{
268268
}
269269

0 commit comments

Comments
 (0)