Skip to content

Commit aef9b46

Browse files
committed
Automatic merge of T1.5.1-1600-gee9c56d91 and 12 pull requests
- Pull request #900 at b54024b: DMI in 3D cab + two more dials - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #961 at 4148bea: Improvements for Power Supplies - Pull request #1015 at 14c132b: Enhancements for EP brakes - Pull request #1026 at 6a89a97: Fix for Multiplayer: remote trains chuff can't be heard https://bugs.launchpad.net/or/+bug/2092771 - Pull request #1029 at 31fd7d2: Superelevation Follow Up Fixes - Pull request #1031 at 34aa23a: Multiplayer Server, forked from Open Rails Ultimate; blueprint https://blueprints.launchpad.net/or/+spec/multiplayer-server - Pull request #1033 at 7efd355: Multiple signal light textures per signal - Pull request #1047 at b7152dc: Docs: adds translation docs - Pull request #1051 at 0ac5d30: Mouse wheel support for cabview controls + refactor - Pull request #1055 at d1a56b3: Route Based TTrack Sounds - Pull request #896 at f1681df: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
14 parents c8f7863 + ee9c56d + b54024b + 1f5ba4c + 4148bea + 14c132b + 6a89a97 + 31fd7d2 + 34aa23a + 7efd355 + b7152dc + 0ac5d30 + d1a56b3 + f1681df commit aef9b46

26 files changed

+838
-1020
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 33 additions & 17 deletions
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.Formats.Msts/RouteFile.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ public Tr_RouteFile(STFReader stf)
126126
new STFReader.TokenProcessor("ortscurvesmsnumber", ()=>{ CurveSMSNumber = stf.ReadIntBlock(null); }),
127127
new STFReader.TokenProcessor("ortscurveswitchsmsnumber", ()=>{ CurveSwitchSMSNumber = stf.ReadIntBlock(null); }),
128128
new STFReader.TokenProcessor("ortsopendoorsinaitrains", ()=>{ OpenDoorsInAITrains = stf.ReadBoolBlock(false); }),
129-
129+
new STFReader.TokenProcessor("ortsplaytracksoundsbasecontinuous", ()=>{ TrackSoundDefaultContinuousPlay = stf.ReadBoolBlock(false); }),
130+
new STFReader.TokenProcessor("ortsdistancebetweentrackjoints", ()=>{ DistanceBetweenTrackJointsM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
131+
new STFReader.TokenProcessor("ortsconcretesleepers", ()=>{ ConcreteSleepers = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
130132
});
131133
//TODO This should be changed to STFException.TraceError() with defaults values created
132134
if (RouteID == null) throw new STFException(stf, "Missing RouteID");
@@ -175,6 +177,11 @@ public Tr_RouteFile(STFReader stf)
175177
public float ForestClearDistance = 0;
176178
public bool RemoveForestTreesFromRoads = false;
177179

180+
// Track based sounds
181+
public bool TrackSoundDefaultContinuousPlay = false;
182+
public float DistanceBetweenTrackJointsM;
183+
public float ConcreteSleepers;
184+
178185
// images
179186
public string Thumbnail;
180187
public string LoadingScreen;

Source/Orts.Formats.Msts/SoundManagmentFile.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public class SharedSMSFileManager
3838
public static int CurveSwitchSMSNumber;
3939
public static bool AutoTrackSound = false;
4040

41+
public static bool PlayDefaultTrackSoundsContinuous = false;
42+
public static float ConcreteSleepers;
43+
4144
public static SoundManagmentFile Get(string path)
4245
{
4346
if (!SharedSMSFiles.ContainsKey(path))
@@ -240,7 +243,7 @@ public struct CurvePoint
240243

241244
public class VolumeCurve
242245
{
243-
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
246+
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled, AngleofAttackControlled, CarFrictionControlled, WheelRpMControlled };
244247

245248
public Controls Control = Controls.None;
246249
public float Granularity = 1.0f;
@@ -264,6 +267,9 @@ public VolumeCurve(STFReader stf)
264267
case "variable3controlled": Control = Controls.Variable3Controlled; break;
265268
case "brakecylcontrolled": Control = Controls.BrakeCylControlled; break;
266269
case "curveforcecontrolled": Control = Controls.CurveForceControlled; break;
270+
case "angleofattackcontrolled": Control = Controls.AngleofAttackControlled; break;
271+
case "carfrictioncontrolled": Control = Controls.CarFrictionControlled; break;
272+
case "wheelrpmcontrolled": Control = Controls.WheelRpMControlled; break;
267273
default: STFException.TraceWarning(stf, "Crash expected: Skipped unknown VolumeCurve/Frequencycurve type " + type); stf.SkipRestOfBlock(); return;
268274
}
269275
stf.ParseBlock(new STFReader.TokenProcessor[] {
@@ -385,7 +391,8 @@ public Discrete_Trigger(STFReader f)
385391
public class Variable_Trigger : Trigger
386392
{
387393
public enum Events { Speed_Inc_Past, Speed_Dec_Past, Distance_Inc_Past, Distance_Dec_Past,
388-
Variable1_Inc_Past, Variable1_2_Inc_Past, Variable1_3_Inc_Past, Variable1_4_Inc_Past, Variable1_Dec_Past, Variable1_2_Dec_Past, Variable1_3_Dec_Past, Variable1_4_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past
394+
Variable1_Inc_Past, Variable1_2_Inc_Past, Variable1_3_Inc_Past, Variable1_4_Inc_Past, Variable1_Dec_Past, Variable1_2_Dec_Past, Variable1_3_Dec_Past, Variable1_4_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past, AngleofAttack_Inc_Past, AngleofAttack_Dec_Past, WheelRpM_Dec_Past, WheelRPM_Inc_Past, TrackJoints_Inc_Past, TrackJoints_Dec_Past, CarOnSwitch_Inc_Past, CarOnSwitch_Dec_Past, CarOnXover_Inc_Past, CarOnXover_Dec_Past, WagonAxles_Inc_Past, WagonAxles_Dec_Past,
395+
ConcreteSleepers_Inc_Past, ConcreteSleepers_Dec_Past, CarInTunnel_Inc_Past, CarInTunnel_Dec_Past
389396
};
390397

391398
public Events Event;
@@ -431,6 +438,23 @@ public Variable_Trigger(STFReader f)
431438
case "brakecyl_dec_past": Event = Events.BrakeCyl_Dec_Past; break;
432439
case "curveforce_inc_past": Event = Events.CurveForce_Inc_Past; break;
433440
case "curveforce_dec_past": Event = Events.CurveForce_Dec_Past; break;
441+
442+
case "angleofattack_inc_past": Event = Events.AngleofAttack_Inc_Past; break;
443+
case "angleofattack_dec_past": Event = Events.AngleofAttack_Dec_Past; break;
444+
case "wheelrpm_inc_past": Event = Events.WheelRPM_Inc_Past; break;
445+
case "wheelrpm_dec_past": Event = Events.WheelRpM_Dec_Past; break;
446+
case "trackjoints_inc_past": Event = Events.TrackJoints_Inc_Past; break;
447+
case "trackjoints_dec_past": Event = Events.TrackJoints_Dec_Past; break;
448+
case "wagonaxles_inc_past": Event = Events.WagonAxles_Inc_Past; break;
449+
case "wagonaxles_dec_past": Event = Events.WagonAxles_Dec_Past; break;
450+
case "caronswitch_inc_past": Event = Events.CarOnSwitch_Inc_Past; break;
451+
case "caronswitch_dec_past": Event = Events.CarOnSwitch_Dec_Past; break;
452+
case "caronxover_inc_past": Event = Events.CarOnXover_Inc_Past; break;
453+
case "caronxover_dec_past": Event = Events.CarOnXover_Dec_Past; break;
454+
case "concretesleepers_inc_past": Event = Events.ConcreteSleepers_Inc_Past; break;
455+
case "concretesleepers_dec_past": Event = Events.ConcreteSleepers_Dec_Past; break;
456+
case "carintunnel_inc_past": Event = Events.CarInTunnel_Inc_Past; break;
457+
case "carintunnel_dec_past": Event = Events.CarInTunnel_Dec_Past; break;
434458
}
435459

436460

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

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ public TrainCar LastCar
163163
public bool HuDIsWheelSlip;
164164
public bool IsBrakeSkid;
165165

166+
public bool SoundSetupInitialise = true;
167+
166168
public bool HotBoxSetOnTrain = false;
167169
public int ActivityDurationS
168170
{
@@ -2004,6 +2006,27 @@ public virtual void Update(float elapsedClockSeconds, bool auxiliaryUpdate = tru
20042006
LogTrainSpeed(Simulator.ClockTime);
20052007
}
20062008

2009+
// Initialise track joint trigger points. Only runs once at start up.
2010+
if (SoundSetupInitialise)
2011+
{
2012+
var trackjointdistanceM = (float)Simulator.TRK.Tr_RouteFile.DistanceBetweenTrackJointsM;
2013+
float trainLengthM = 0;
2014+
2015+
foreach (var car in Cars)
2016+
{
2017+
car.realTimeTrackJointDistanceM = trackjointdistanceM + trainLengthM;
2018+
trainLengthM += car.CarLengthM;
2019+
2020+
if (trainLengthM > (float)Simulator.TRK.Tr_RouteFile.DistanceBetweenTrackJointsM)
2021+
{
2022+
trainLengthM = 0;
2023+
}
2024+
2025+
}
2026+
2027+
SoundSetupInitialise = false;
2028+
}
2029+
20072030
} // end Update
20082031

20092032
//================================================================================================//
@@ -4042,7 +4065,7 @@ public virtual void InitializeBrakes()
40424065
if (Simulator.Settings.VerboseConfigurationMessages && LeadLocomotiveIndex >= 0) // Check incompatibilities between brake control valves
40434066
{
40444067
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
4045-
if (Cars.Any(x => (x as MSTSWagon).BrakeValve != lead.BrakeValve))
4068+
if (lead.BrakeSystem is AirSinglePipe leadBrakes && Cars.Any(x => x.BrakeSystem is AirSinglePipe carBrakes && leadBrakes.BrakeValve != carBrakes.BrakeValve))
40464069
{
40474070
Trace.TraceInformation("Cars along the train have incompatible brake control valves");
40484071
}
@@ -4061,13 +4084,33 @@ public void UnconditionalInitializeBrakes()
40614084
MSTSLocomotive lead = (MSTSLocomotive)Cars[LeadLocomotiveIndex];
40624085
if (lead.TrainBrakeController != null)
40634086
{
4064-
foreach (var car in Cars)
4087+
foreach (MSTSWagon car in Cars)
40654088
{
4066-
if (lead.BrakeSystem.GetType() != car.BrakeSystem.GetType())
4089+
if (lead.CarBrakeSystemType != car.CarBrakeSystemType) // Test to see if car brake system is the same as the locomotive
40674090
{
4068-
(car as MSTSWagon).EmergencyReservoirPresent = lead.EmergencyReservoirPresent;
4069-
car.BrakeSystem = BrakeSystem.CreateNewLike(lead.BrakeSystem, car);
4070-
car.BrakeSystem.InitializeFromCopy(lead.BrakeSystem, false);
4091+
// If not, change so that they are compatible
4092+
car.CarBrakeSystemType = lead.CarBrakeSystemType;
4093+
if (lead.BrakeSystem is VacuumSinglePipe)
4094+
car.MSTSBrakeSystem = new VacuumSinglePipe(car);
4095+
else if (lead.BrakeSystem is AirTwinPipe)
4096+
car.MSTSBrakeSystem = new AirTwinPipe(car);
4097+
else if (lead.BrakeSystem is AirSinglePipe leadAir)
4098+
{
4099+
car.MSTSBrakeSystem = new AirSinglePipe(car);
4100+
// if emergency reservoir has been set on lead locomotive then also set on trailing cars
4101+
if (leadAir.EmergencyReservoirPresent)
4102+
{
4103+
(car.BrakeSystem as AirSinglePipe).EmergencyReservoirPresent = leadAir.EmergencyReservoirPresent;
4104+
}
4105+
}
4106+
else if (lead.BrakeSystem is EPBrakeSystem ep)
4107+
car.MSTSBrakeSystem = new EPBrakeSystem(car, ep.TwoPipes);
4108+
else if (lead.BrakeSystem is SingleTransferPipe)
4109+
car.MSTSBrakeSystem = new SingleTransferPipe(car);
4110+
else
4111+
throw new Exception("Unknown brake type");
4112+
4113+
car.MSTSBrakeSystem.InitializeFromCopy(lead.BrakeSystem);
40714114
Trace.TraceInformation("Car and Locomotive Brake System Types Incompatible on Car {0} - Car brakesystem type changed to {1}", car.CarID, car.CarBrakeSystemType);
40724115
}
40734116
}

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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)