Skip to content

Commit 809a4d4

Browse files
committed
Automatic merge of T1.5.1-1689-g72674c98d and 14 pull requests
- Pull request #900 at 4629736: 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 17c8d18: 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 #1057 at d6bd4e3: Switchable brake system - 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
16 parents fa57fcb + 72674c9 + 4629736 + d3ae4a2 + cc4d53c + 17c8d18 + 3b18c48 + 53dd604 + 62c89c1 + 1f5ba4c + d8d9709 + 92c74ef + d6bd4e3 + 409064d + d6e1f83 + f1681df commit 809a4d4

32 files changed

+1239
-1046
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,58 +1141,6 @@ 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-
)
11961144
11971145
Steam Locomotives
11981146
-----------------

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 * (1.0f / 1000.0f); }
192+
public static float ToTonne(float kg) { return kg / 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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,10 @@ 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);
614612
if (item.Length == 0) return 0.0f;
615613
if (item[item.Length - 1] == ',') item = item.TrimEnd(',');
616-
if (float.TryParse(item, parseNum, parseNFI, out val)) return (scale == 1) ? val : (float)(scale * val);
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);
617616
STFException.TraceWarning(this, "Cannot parse the constant number " + item);
618617
if (item == ")") StepBackOneItem();
619618
return defaultValue.GetValueOrDefault(0);

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

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,33 +4061,14 @@ public void UnconditionalInitializeBrakes()
40614061
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
40624062
if (lead.TrainBrakeController != null)
40634063
{
4064-
foreach (MSTSWagon car in Cars)
4064+
foreach (var car in Cars)
40654065
{
4066-
if (lead.CarBrakeSystemType != car.CarBrakeSystemType) // Test to see if car brake system is the same as the locomotive
4066+
if (lead.BrakeSystem.GetType() != car.BrakeSystem.GetType())
40674067
{
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);
4068+
car.BrakeSystem = BrakeSystem.CreateNewLike(lead.BrakeSystem, car);
4069+
car.BrakeSystem.InitializeFromCopy(lead.BrakeSystem, false);
4070+
if (car.BrakeSystem is AirSinglePipe carAir && lead.BrakeSystem is AirSinglePipe leadAir)
4071+
carAir.EmergencyReservoirPresent = leadAir.EmergencyReservoirPresent;
40914072
Trace.TraceInformation("Car and Locomotive Brake System Types Incompatible on Car {0} - Car brakesystem type changed to {1}", car.CarID, car.CarBrakeSystemType);
40924073
}
40934074
}

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)
266+
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
267267
{
268268
}
269269

0 commit comments

Comments
 (0)