Skip to content

Commit 5f5f1f5

Browse files
committed
Add load/empty tokens for relay valve and inshot
1 parent 56abfa2 commit 5f5f1f5

File tree

4 files changed

+213
-16
lines changed

4 files changed

+213
-16
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ and the state of these parameters when the wagon or locomotive is full.
663663
single: EmptyORTSWagonFrontalArea
664664
single: EmptyORTSDavisDragConstant
665665
single: EmptyCentreOfGravity_Y
666+
single: EmptyBrakeRelayValveRatio
667+
single: EmptyBrakeRelayValveInshot
666668
single: IsGondola
667669
single: UnloadingStartDelay
668670
single: FreightAnimContinuous
@@ -680,11 +682,13 @@ and the state of these parameters when the wagon or locomotive is full.
680682
single: FullORTSWagonFrontalArea
681683
single: FullORTSDavisDragConstant
682684
single: FullCentreOfGravity_Y
685+
single: FullBrakeRelayValveRatio
686+
single: FullBrakeRelayValveInshot
683687

684688
To configure the stock correctly the following empty and full parameters need to be
685689
included in the ORTSFreightAnims file. Empty values are included in the first block,
686690
and full values are included in the second code block. A sample code block is shown
687-
below.::
691+
below::
688692

689693
ORTSFreightAnims
690694
(
@@ -720,6 +724,58 @@ below.::
720724
)
721725
)
722726

727+
For some rolling stock, it may be more realistic to handle variations in load/empty
728+
brake force by changing the brake cylinder pressure developed, rather than changing
729+
the brake force directly. In such cases, the empty/load relay valve parameters work
730+
best. Unlike other freight physics parameters, the relay valve ratio will not change
731+
continuously as freight is loaded. Instead, when the freight load is above 25% capacity,
732+
the loaded relay valve ratio is used, otherwise the empty ratio (or the ratio defined
733+
in the main .wag file) is used. The level of brake cylinder in-shot can also be changed
734+
depending on the load level as is often the case on load proportioning equipment. The
735+
standard behavior of these parameters is defined in more detail in the
736+
:ref:`air brakes physics <physics-braking-parameters>` section.
737+
738+
Here is an example of a gondola with a 50% load/empty valve::
739+
740+
ORTSMaxBrakeShoeForce ( 31300lb )
741+
MaxHandbrakeForce ( 32000lb )
742+
743+
ORTSFreightAnims (
744+
MSTSFreightAnimEnabled ( 0 )
745+
WagonEmptyWeight( 28.9t-us )
746+
747+
EmptyBrakeRelayValveRatio ( 0.5 )
748+
EmptyBrakeRelayValveInshot ( -15psi )
749+
750+
ORTSDavis_A ( 87.35lbf )
751+
ORTSDavis_B ( 0.289lbf/mph )
752+
ORTSDavis_C ( 0.144lbf/mph^2 )
753+
ORTSWagonFrontalArea ( 120ft^2 )
754+
ORTSDavisDragConstant ( 0.0012 )
755+
EmptyCentreOfGravity_Y ( 1.377 )
756+
IsGondola( 1 )
757+
UnloadingStartDelay ( 5 )
758+
759+
FreightAnimContinuous (
760+
IntakePoint ( 0.0 6.0 FreightCoal )
761+
Shape ( COAL_LOAD.s )
762+
MaxHeight ( 0.0 )
763+
MinHeight ( -2.2 )
764+
FreightWeightWhenFull ( 114.1t-us )
765+
FullAtStart ( 0 )
766+
767+
FullBrakeRelayValveRatio ( 1.0 )
768+
FullBrakeRelayValveInshot ( 0psi )
769+
770+
FullORTSDavis_A ( 258.5lbf )
771+
FullORTSDavis_B ( 1.43lbf/mph )
772+
FullORTSDavis_C ( 0.0504lbf/mph^2 )
773+
ORTSWagonFrontalArea ( 120ft^2 )
774+
ORTSDavisDragConstant ( 0.00042 )
775+
FullCentreOfGravity_Y ( 2.251 )
776+
)
777+
)
778+
723779
.. index::
724780
single: Shape
725781
single: MaxHeight

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

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ public void Load()
411411
float LoadEmptyMaxBrakeForceN;
412412
float LoadEmptyMaxHandbrakeForceN;
413413
float LoadEmptyCentreOfGravityM_Y;
414+
float LoadEmptyRelayValveRatio;
415+
float LoadEmptyInshotPSI;
414416

415417
float LoadFullMassKg;
416418
float LoadFullORTSDavis_A;
@@ -421,6 +423,8 @@ public void Load()
421423
float LoadFullMaxBrakeForceN;
422424
float LoadFullMaxHandbrakeForceN;
423425
float LoadFullCentreOfGravityM_Y;
426+
float LoadFullRelayValveRatio;
427+
float LoadFullInshotPSI;
424428

425429

426430
/// <summary>
@@ -787,6 +791,24 @@ public virtual void LoadFromWagFile(string wagFilePath)
787791
LoadEmptyCentreOfGravityM_Y = CentreOfGravityM.Y;
788792
}
789793

794+
if (FreightAnimations.EmptyRelayValveRatio > 0)
795+
{
796+
LoadEmptyRelayValveRatio = FreightAnimations.EmptyRelayValveRatio;
797+
}
798+
else if (BrakeSystem is AirSinglePipe brakes)
799+
{
800+
LoadEmptyRelayValveRatio = brakes.RelayValveRatio;
801+
}
802+
803+
if (FreightAnimations.EmptyInshotPSI != 0)
804+
{
805+
LoadEmptyInshotPSI = FreightAnimations.EmptyInshotPSI;
806+
}
807+
else if (BrakeSystem is AirSinglePipe brakes)
808+
{
809+
LoadEmptyInshotPSI = brakes.RelayValveInshotPSI;
810+
}
811+
790812
// Read (initialise) Static load ones if a static load
791813
// Test each value to make sure that it has been defined in the WAG file, if not default to Root WAG file value
792814
if (FreightAnimations.FullPhysicsStaticOne != null)
@@ -866,6 +888,24 @@ public virtual void LoadFromWagFile(string wagFilePath)
866888
{
867889
LoadFullCentreOfGravityM_Y = CentreOfGravityM.Y;
868890
}
891+
892+
if (FreightAnimations.FullPhysicsStaticOne.FullStaticRelayValveRatio > 0)
893+
{
894+
LoadFullRelayValveRatio = FreightAnimations.FullPhysicsStaticOne.FullStaticRelayValveRatio;
895+
}
896+
else if (BrakeSystem is AirSinglePipe brakes)
897+
{
898+
LoadFullRelayValveRatio = brakes.RelayValveRatio;
899+
}
900+
901+
if (FreightAnimations.FullPhysicsStaticOne.FullStaticInshotPSI > 0)
902+
{
903+
LoadFullInshotPSI = FreightAnimations.FullPhysicsStaticOne.FullStaticInshotPSI;
904+
}
905+
else if (BrakeSystem is AirSinglePipe brakes)
906+
{
907+
LoadFullInshotPSI = brakes.RelayValveInshotPSI;
908+
}
869909
}
870910

871911
// Read (initialise) Continuous load ones if a continuous load
@@ -956,6 +996,24 @@ public virtual void LoadFromWagFile(string wagFilePath)
956996
{
957997
LoadFullCentreOfGravityM_Y = CentreOfGravityM.Y;
958998
}
999+
1000+
if (FreightAnimations.FullPhysicsContinuousOne.FullRelayValveRatio > 0)
1001+
{
1002+
LoadFullRelayValveRatio = FreightAnimations.FullPhysicsContinuousOne.FullRelayValveRatio;
1003+
}
1004+
else if (BrakeSystem is AirSinglePipe brakes)
1005+
{
1006+
LoadFullRelayValveRatio = brakes.RelayValveRatio;
1007+
}
1008+
1009+
if (FreightAnimations.FullPhysicsContinuousOne.FullInshotPSI != 0)
1010+
{
1011+
LoadFullInshotPSI = FreightAnimations.FullPhysicsContinuousOne.FullInshotPSI;
1012+
}
1013+
else if (BrakeSystem is AirSinglePipe brakes)
1014+
{
1015+
LoadFullInshotPSI = brakes.RelayValveInshotPSI;
1016+
}
9591017
}
9601018

9611019
if (!FreightAnimations.MSTSFreightAnimEnabled) FreightShapeFileName = null;
@@ -978,6 +1036,11 @@ public virtual void LoadFromWagFile(string wagFilePath)
9781036
// Update brake parameters
9791037
MaxBrakeForceN = LoadFullMaxBrakeForceN;
9801038
MaxHandbrakeForceN = LoadFullMaxHandbrakeForceN;
1039+
if (BrakeSystem is AirSinglePipe brakes)
1040+
{
1041+
brakes.RelayValveRatio = LoadFullRelayValveRatio;
1042+
brakes.RelayValveInshotPSI = LoadFullInshotPSI;
1043+
}
9811044

9821045
// Update friction related parameters
9831046
DavisAN = LoadFullORTSDavis_A;
@@ -1002,6 +1065,12 @@ public virtual void LoadFromWagFile(string wagFilePath)
10021065
// Update brake parameters
10031066
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxBrakeForceN;
10041067
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
1068+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
1069+
if (BrakeSystem is AirSinglePipe brakes)
1070+
{
1071+
brakes.RelayValveRatio = TempMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
1072+
brakes.RelayValveInshotPSI = TempMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
1073+
}
10051074

10061075
// Update friction related parameters
10071076
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempMassDiffRatio) + LoadEmptyORTSDavis_A;
@@ -1030,6 +1099,11 @@ public virtual void LoadFromWagFile(string wagFilePath)
10301099
// Update brake physics
10311100
MaxBrakeForceN = LoadEmptyMaxBrakeForceN;
10321101
MaxHandbrakeForceN = LoadEmptyMaxHandbrakeForceN;
1102+
if (BrakeSystem is AirSinglePipe brakes)
1103+
{
1104+
brakes.RelayValveRatio = LoadEmptyRelayValveRatio;
1105+
brakes.RelayValveInshotPSI = LoadEmptyInshotPSI;
1106+
}
10331107

10341108
// Update friction related parameters
10351109
DavisAN = LoadEmptyORTSDavis_A;
@@ -1713,6 +1787,8 @@ public virtual void Copy(MSTSWagon copy)
17131787
LoadEmptyORTSDavis_C = copy.LoadEmptyORTSDavis_C;
17141788
LoadEmptyDavisDragConstant = copy.LoadEmptyDavisDragConstant;
17151789
LoadEmptyWagonFrontalAreaM2 = copy.LoadEmptyWagonFrontalAreaM2;
1790+
LoadEmptyRelayValveRatio = copy.LoadEmptyRelayValveRatio;
1791+
LoadEmptyInshotPSI = copy.LoadEmptyInshotPSI;
17161792
LoadFullMassKg = copy.LoadFullMassKg;
17171793
LoadFullCentreOfGravityM_Y = copy.LoadFullCentreOfGravityM_Y;
17181794
LoadFullMaxBrakeForceN = copy.LoadFullMaxBrakeForceN;
@@ -1722,6 +1798,8 @@ public virtual void Copy(MSTSWagon copy)
17221798
LoadFullORTSDavis_C = copy.LoadFullORTSDavis_C;
17231799
LoadFullDavisDragConstant = copy.LoadFullDavisDragConstant;
17241800
LoadFullWagonFrontalAreaM2 = copy.LoadFullWagonFrontalAreaM2;
1801+
LoadFullRelayValveRatio = copy.LoadFullRelayValveRatio;
1802+
LoadFullInshotPSI = copy.LoadFullInshotPSI;
17251803

17261804
if (copy.IntakePointList != null)
17271805
{
@@ -2125,6 +2203,12 @@ public override void Update(float elapsedClockSeconds)
21252203
// Update brake parameters
21262204
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxBrakeForceN;
21272205
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
2206+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
2207+
if (BrakeSystem is AirSinglePipe brakes)
2208+
{
2209+
brakes.RelayValveRatio = TempMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
2210+
brakes.RelayValveInshotPSI = TempMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
2211+
}
21282212
// Update friction related parameters
21292213
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempMassDiffRatio) + LoadEmptyORTSDavis_A;
21302214
DavisBNSpM = ((LoadFullORTSDavis_B - LoadEmptyORTSDavis_B) * TempMassDiffRatio) + LoadEmptyORTSDavis_B;
@@ -2232,6 +2316,12 @@ private void UpdateLocomotiveLoadPhysics()
22322316
// Update brake parameters
22332317
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxBrakeForceN;
22342318
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
2319+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
2320+
if (BrakeSystem is AirSinglePipe brakes)
2321+
{
2322+
brakes.RelayValveRatio = TempMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
2323+
brakes.RelayValveInshotPSI = TempMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
2324+
}
22352325
// Update friction related parameters
22362326
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempMassDiffRatio) + LoadEmptyORTSDavis_A;
22372327
DavisBNSpM = ((LoadFullORTSDavis_B - LoadEmptyORTSDavis_B) * TempMassDiffRatio) + LoadEmptyORTSDavis_B;
@@ -2278,6 +2368,12 @@ private void UpdateLocomotiveLoadPhysics()
22782368
// Update brake parameters
22792369
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxBrakeForceN;
22802370
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
2371+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
2372+
if (BrakeSystem is AirSinglePipe brakes)
2373+
{
2374+
brakes.RelayValveRatio = TempMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
2375+
brakes.RelayValveInshotPSI = TempMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
2376+
}
22812377
// Update friction related parameters
22822378
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempMassDiffRatio) + LoadEmptyORTSDavis_A;
22832379
DavisBNSpM = ((LoadFullORTSDavis_B - LoadEmptyORTSDavis_B) * TempMassDiffRatio) + LoadEmptyORTSDavis_B;
@@ -3220,6 +3316,12 @@ private void UpdateTenderLoad()
32203316
// Update brake parameters
32213317
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempTenderMassDiffRatio) + LoadEmptyMaxBrakeForceN;
32223318
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempTenderMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
3319+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
3320+
if (BrakeSystem is AirSinglePipe brakes)
3321+
{
3322+
brakes.RelayValveRatio = TempTenderMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
3323+
brakes.RelayValveInshotPSI = TempTenderMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
3324+
}
32233325
// Update friction related parameters
32243326
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempTenderMassDiffRatio) + LoadEmptyORTSDavis_A;
32253327
DavisBNSpM = ((LoadFullORTSDavis_B - LoadEmptyORTSDavis_B) * TempTenderMassDiffRatio) + LoadEmptyORTSDavis_B;
@@ -3253,6 +3355,12 @@ private void UpdateTenderLoad()
32533355
// Update brake parameters
32543356
MaxBrakeForceN = ((LoadFullMaxBrakeForceN - LoadEmptyMaxBrakeForceN) * TempTenderMassDiffRatio) + LoadEmptyMaxBrakeForceN;
32553357
MaxHandbrakeForceN = ((LoadFullMaxHandbrakeForceN - LoadEmptyMaxHandbrakeForceN) * TempTenderMassDiffRatio) + LoadEmptyMaxHandbrakeForceN;
3358+
// Not sensible to vary the relay valve ratio continouously; instead, it changes to loaded if more than 25% cargo is present
3359+
if (BrakeSystem is AirSinglePipe brakes)
3360+
{
3361+
brakes.RelayValveRatio = TempTenderMassDiffRatio > 0.25f ? LoadFullRelayValveRatio : LoadEmptyRelayValveRatio;
3362+
brakes.RelayValveInshotPSI = TempTenderMassDiffRatio > 0.25f ? LoadFullInshotPSI : LoadEmptyInshotPSI;
3363+
}
32563364
// Update friction related parameters
32573365
DavisAN = ((LoadFullORTSDavis_A - LoadEmptyORTSDavis_A) * TempTenderMassDiffRatio) + LoadEmptyORTSDavis_A;
32583366
DavisBNSpM = ((LoadFullORTSDavis_B - LoadEmptyORTSDavis_B) * TempTenderMassDiffRatio) + LoadEmptyORTSDavis_B;

0 commit comments

Comments
 (0)