Skip to content

Commit a66fbd0

Browse files
committed
Automatic merge of T1.6-rc4-32-g196d83e86 and 13 pull requests
- Pull request #1104 at 6ef735b: Handle simple adhesion within the axle module - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 7fc8de1: Automatic speed control - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1130 at 251a677: Fix F9 points to an incorrect car ID. - Pull request #1132 at 934d29e: Fixes For Correct Questionable Braking Parameters - Pull request #1133 at 8dc00d5: Minor Fix for Brake Pipe Charging - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification - Pull request #1124 at fab5457: Built-in PBL2 brake controller
15 parents d9e494a + 196d83e + 6ef735b + e10390b + 7fc8de1 + 387388e + 270f22f + ba3c47f + 91d2d26 + 251a677 + 934d29e + 8dc00d5 + 5845a1a + 689494b + fab5457 commit a66fbd0

25 files changed

+1189
-1228
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ and the state of these parameters when the wagon or locomotive is full.
799799
single: FullBrakeRelayValveInshot
800800

801801
To configure the stock correctly the following empty and full parameters need to be
802-
included in the ORTSFreightAnims file. Empty values are included in the first block,
803-
and full values are included in the second code block. A sample code block is shown
804-
below::
802+
included in the ``ORTSFreightAnims`` block. Empty values are included in the first block,
803+
and full values are included in the ``FreightAnimContinuous`` or ``FreightAnimStatic``
804+
sub-block. A sample code block is shown below::
805805

806806
ORTSFreightAnims
807807
(
@@ -837,6 +837,12 @@ below::
837837
)
838838
)
839839

840+
Any parameters not included will use the equivalent value specified outside
841+
the ORTSFreightAnims block. If the Davis A, B, and C values are not given
842+
they will be determined automatically using other properties of the rolling
843+
stock and either the 1926 Davis formula or 1992 CN formula, depending on the
844+
ORTSBearingType specified in the Wagon section.
845+
840846
For some rolling stock, it may be more realistic to handle variations in load/empty
841847
brake force by changing the brake cylinder pressure developed, rather than changing
842848
the brake force directly. In such cases, the empty/load relay valve parameters work

Source/Documentation/Manual/physics.rst

Lines changed: 68 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,75 @@ the WAG / ENG file is discussed.
3939
Resistive Forces
4040
----------------
4141

42-
Open Rails physics calculates resistance based on real world physics:
43-
gravity, mass, rolling resistance and optionally curve resistance. This is
44-
calculated individually for each car in the train. The program calculates
45-
rolling resistance, or friction, based on the Friction parameters in the
46-
Wagon section of .wag/.eng file. Open Rails identifies whether the .wag
47-
file uses the *FCalc* utility or other friction data. If *FCalc* was used to
48-
determine the Friction variables within the .wag file, Open Rails compares
49-
that data to the Open Rails Davis equations to identify the closest match
50-
with the Open Rails Davis equation. If no-FCalc Friction parameters are
51-
used in the .wag file, Open Rails ignores those values, substituting its
52-
actual Davis equation values for the train car.
42+
Open Rails physics calculates resistance based on real world principles:
43+
gravity, mass, rolling resistance, and curve resistance. This is calculated
44+
individually for each car in the train.
45+
46+
The program supports a few methods for determining rolling resistance.
47+
The oldest method, intended only to support legacy content, uses the
48+
``Friction`` parameters in the Wagon section of .wag/.eng file.
49+
Open Rails identifies whether the .wag file used the *FCalc* utility or
50+
other friction data. If *FCalc* was used to determine the Friction variables
51+
within the .wag file, Open Rails attempts to determine the Davis coefficients
52+
originally used to derive the Friction parameters. If no FCalc Friction
53+
parameters are used in the .wag file, Open Rails ignores those values,
54+
substituting resistance calculated by the original 1923 Davis equation.
5355

5456
.. index::
5557
single: ORTSDavis_A
5658
single: ORTSDavis_B
5759
single: ORTSDavis_C
60+
single: ORTSBearingType
5861

59-
A basic (simplified) Davis formula is used in the following form:
62+
For new content, it is preferred to not use the ``Friction`` parameters,
63+
and instead enter the Davis coefficients directly as this is more
64+
prototypical. In the Wagon section, the parameters ``ORTSDavis_A``,
65+
``ORTSDavis_B``, and ``ORTSDavis_C`` can be used to provide these values.
66+
When using this method, the wagon section should also specify the type of
67+
wheel bearings used with the ``ORTSBearingType`` parameter.
68+
These values are then used in a generic form of the Davis formula:
6069

6170
F\ :sub:`res` = ORTSDavis_A + speedMpS * (ORTSDavis_B + ORTSDavis_C * speedMpS\ :sup:`2`\ )
6271

63-
Where F\ :sub:`res` is the friction force of the car. The rolling resistance
64-
can be defined either by *FCalc* or ORTSDavis_A, _B and _C components. If
65-
one of the *ORTSDavis* components is zero, *FCalc* is used. Therefore, e.g.
66-
if the data doesn't contain the B part of the Davis formula, a very small
67-
number should be used instead of zero.
72+
Where F\ :sub:`res` is the friction force of the car when travelling at a
73+
speed of *speedMpS*. Note that in this formula, unlike the empirical Davis
74+
formula, the weight of the rolling stock and the number of axles are not
75+
considered by this equation; the ORTSDavis values must be set already
76+
accounting for the weight and number of axles. Accepted units of measure
77+
for ORTSDavis parameters and the list of bearing types can be found in the
78+
:ref:`required parameters table <required-params>`.
79+
80+
In the case that ORTSDavis coefficients are not known or prove awkward to calculate,
81+
Open Rails can automatically calculate rolling resistance using other data
82+
in combination with the 1926 Davis equation (for grease and friction bearings)
83+
or the 1992 CN equation (for roller and low bearings). If given a supported
84+
``ORTSBearingType``, missing A and B coefficients will be found from the rail
85+
vehicle weight and number of axles. Likewise, if the C coefficient is missing it
86+
is automatically calculated from the ``ORTSWagonFrontalArea`` and
87+
``ORTSDavisDragConstant`` values (or defaults, if those are missing).
88+
While the auto-calculated results will be reasonable for standard rolling stock,
89+
manual entry of ORTSDavis coefficients is still preferred for more complicated
90+
rolling stock such as steam locomotives, multiple units, high speed trains,
91+
articulated units, and anything studied in experiments other than Davis.
6892

6993
.. index::
7094
single: ORTSMergeSpeed
7195
single: ORTSStandstillFriction
7296

73-
When a train is initially started, additional force is needed to overcome
74-
the initial higher bearing torque (forces) and track resistance. Starting resistance is calculated
75-
automatically by Open Rails based upon empirical prototypical data at low speeds.
76-
By selecting different values for ``ORTSBearingType`` different values of starting
77-
resistance will be applied. The Open Rails calculation for starting resistance takes
78-
into account different conditions, such as weather (for example, snowing or clear),
79-
wagon (axle) load, wheel bearing temperature and wheel diameter. Hence when using the OR calculation
80-
the correct values should be inserted in ``ORTSNumberAxles`` parameter in the wagon section, and
81-
``ORTSNumberDriveAxles`` in the engine section. The ``WheelRadius`` value should also be
82-
inserted in both sections as appropriate.
83-
84-
Alternatively the low-speed friction force can be manually specified by the user by setting
85-
``ORTSStandstillFriction`` and ``ORTSMergeSpeed``.
97+
The various forms of Davis equation are only accurate above 5 mph or so. They
98+
prove inaccurate at low speeds as additional force is needed to overcome
99+
the initial higher bearing torque (forces) and track resistance. Starting resistance
100+
is calculated automatically by Open Rails based upon environmental conditions
101+
and the setting of ``ORTSBearingType``. Each bearing type has a different starting
102+
resistance profile based on empirical prototypical data, including consideration
103+
for the temperature of the bearing, wagon (axle) load, and wheel diameter. Hence
104+
when using the OR calculation the correct values should be inserted in ``ORTSNumberAxles``
105+
parameter in the wagon section, and ``ORTSNumberDriveAxles`` in the engine section. The
106+
``WheelRadius`` value should also be inserted in both sections as appropriate.
107+
108+
Alternatively the low-speed friction force can be manually specified by the user by
109+
setting the zero-speed force in ``ORTSStandstillFriction`` and the speed at which the
110+
regular Davis equation takes over with ``ORTSMergeSpeed``.
86111

87112
.. index::
88113
single: ORTSTrackGauge
@@ -2161,6 +2186,8 @@ iii. `Testing Resources for Open Rails Steam Locomotives
21612186
.. |-| unicode:: U+00AD .. soft hyphen
21622187
:trim:
21632188

2189+
.. _required-params:
2190+
21642191
+-----------------------------------------------------------+-------------------+-------------------+-------------------+
21652192
|Parameter |Description |Recommended Units |Typical Examples |
21662193
+===========================================================+===================+===================+===================+
@@ -2273,9 +2300,10 @@ iii. `Testing Resources for Open Rails Steam Locomotives
22732300
| |friction |lbf/mph^2 |(1.43lbf/mph^2) |
22742301
| | |Use FCalc | |
22752302
+-----------------------------------------------------------+-------------------+-------------------+-------------------+
2276-
|ORTS |-| Bearing |-| Type ( x ) |Bearing type, || Roller, |( Roller ) |
2277-
| |defaults to || Friction, | |
2278-
| |Friction || Low | |
2303+
|ORTS |-| Bearing |-| Type ( x ) |Bearing type used || Grease, |( Roller ) |
2304+
| |to determine || Friction, | |
2305+
| |rolling resistance || Roller | |
2306+
| | || Low | |
22792307
| | | | |
22802308
+-----------------------------------------------------------+-------------------+-------------------+-------------------+
22812309
|**Friction (Engine section)** |
@@ -2743,46 +2771,6 @@ For EP brakes, two variants are available:
27432771
actuating the cylinders. This system is sometimes called "UIC EP brake". It is typically the system
27442772
used in high speed trains.
27452773

2746-
Defining Multiple Brake Systems
2747-
-------------------------------
2748-
2749-
It is possible to define multiple systems within ``OrtsBrakeMode`` sections::
2750-
2751-
ORTSBrakeMode (
2752-
ORTSBrakeModeName ( AG )
2753-
BrakeSystemType( Air_single_pipe )
2754-
Comment ( All brake parameters are available in such a section )
2755-
)
2756-
ORTSBrakeMode (
2757-
ORTSBrakeModeName ( VB )
2758-
BrakeSystemType( Vacuum_single_pipe )
2759-
Comment ( All brake parameters are available in such a section )
2760-
)
2761-
2762-
These sections can be used to either define dual vacuum/air rolling stock, or
2763-
can be used to define the brake modes of the UIC stock in the following form::
2764-
2765-
BrakeSystemType( Air_twin_pipe )
2766-
ORTSBrakeMode (
2767-
ORTSBrakeModeName ( G )
2768-
ORTSBrakeMass ( 67t )
2769-
Comment ( All brake parameters are available in such a section )
2770-
)
2771-
ORTSBrakeMode (
2772-
ORTSBrakeModeName ( P )
2773-
ORTSBrakeMass ( 83t )
2774-
BrakeSystemType( Vacuum_single_pipe )
2775-
Comment ( All brake parameters are available in such a section )
2776-
)
2777-
2778-
Available brake mode names to be used are: GG, G, PP, P, RR, R, R_MG, AG, AP, AU, VB, VP, VU.
2779-
With the ``ORTSBrakeModeNames`` keyword the used brake modes can be filtered,
2780-
for being able to define them in an include file, and using only the needed
2781-
ones. It can be used e.g. in the following form::
2782-
2783-
ORTSBrakeModeNames ( "P, R" )
2784-
2785-
27862774
.. _physics-brake-controller:
27872775

27882776
Train Brake Controller Positions
@@ -3192,13 +3180,6 @@ using the ORTSBrakeShoeFriction parameter, 1D (ie, speed only, see above section
31923180

31933181
``ORTSNumberCarBrakeShoes`` - to facilitate the operation of the default 2D curves above it is necessary to configure the number of brake shoes for each car.
31943182

3195-
``ORTSBrakeMass`` - Railways part of the UIC organisation instead of NBR
3196-
provide brake masses, measured in tonnes, which is a virtual value to define
3197-
the brake efficiency. Openrails uses this value as an alternative to setting
3198-
the max brake shoe force directly, and recalculates this to that force using
3199-
approximating formulas to the published UIC brake curves. This parameter is
3200-
ignored if the ``ORTSMaxBrakeShoeForce`` also set.
3201-
32023183
Whilst OR will attempt to set some defaults if parameters are left out, the most realistic operation will be achieved by using all the relevant parameters.
32033184

32043185
The following two legacy arrangements can be used as an alternative to the above method,
@@ -3207,26 +3188,6 @@ The following two legacy arrangements can be used as an alternative to the above
32073188

32083189
- Legacy #2 - where MaxBrakeForce and ORTSBrakeShoeFriction have been set, legacy operation will remain unchanged.
32093190

3210-
Load Compensation
3211-
-----------------
3212-
3213-
Load compensation stages can be defined in the following way::
3214-
3215-
OrtsLoadStage (
3216-
OrtsBrakeMass ( 28t )
3217-
Comment ( All brake parameters are available in such a section )
3218-
)
3219-
OrtsLoadStage (
3220-
OrtsBrakeMass ( 37t )
3221-
OrtsLoadStageMinMass ( 34t )
3222-
Comment ( All brake parameters are available in such a section )
3223-
)
3224-
3225-
The ``OrtsLoadStageMinMass`` parameter defines the minimum car mass (together
3226-
with the load) where the stage can be activated without risking the brake lock.
3227-
For the lowest stage this keyword should be omitted. In OpenRails the switching
3228-
between stages is automatic.
3229-
32303191

32313192
Train Brake Pipe Losses
32323193
-----------------------
@@ -3738,11 +3699,10 @@ The retainers of a car will only be available if either the General Option
37383699
:ref:`Retainer valve on all cars <options-retainers>` is checked, or the car's
37393700
.wag file contains a retainer valve declaration. To declare a retainer the line
37403701
``BrakeEquipmentType ( )`` in the .wag file must include either the item
3741-
``Retainer_4_Position``, ``Retainer_3_Position`` or ``UIC_mountain``. A 4 position
3702+
``Retainer_4_Position`` or the item ``Retainer_3_Position``. A 4 position
37423703
retainer includes four states: exhaust, low pressure (10 psi), high pressure
37433704
(20 psi), and slow direct (gradual drop to zero). A 3 position retainer does
3744-
not include the low pressure position. The UIC plain-mountain switch has only
3745-
2 positions. The use and display of the retainers is
3705+
not include the low pressure position. The use and display of the retainers is
37463706
described in :ref:`Extended HUD for Brake Information <physics-hud-brake>`.
37473707

37483708
The setting of the retained pressure and the number of retainers is
@@ -4837,10 +4797,7 @@ impact due to the wind will be zero.
48374797

48384798
**Wind Lateral Force Resistance** - When the wind blows from the side of the
48394799
train, the train will be pushed against the outside track rail, thus increasing
4840-
the amount of resistance experienced by the train.
4841-
4842-
To activate calculation of wind resistance, select the tickbox for "Wind dependent
4843-
resistance" in the Simulation TAB of the options menu. As wind only becomes
4800+
the amount of resistance experienced by the train. As wind only becomes
48444801
significant at higher train speeds, the wind resistance calculation only commences
48454802
once the train speed exceeds 5 mph.
48464803

@@ -4876,9 +4833,9 @@ parameters can be inputted via the WAG file or section.
48764833
``ORTSWagonFrontalArea`` -- The frontal cross sectional area of the wagon. The default units
48774834
are in ft^2, so if entering metres, include the Units of Measure.
48784835

4879-
``ORTSDavisDragConstant`` -- OR by default uses the standard Davis Drag constants. If alternate
4880-
drag constants are used in calculating the still air resistance, then it might be worthwhile
4881-
inputting these values.
4836+
``ORTSDavisDragConstant`` -- OR assigns a default drag constant based on the type of
4837+
rolling stock. For more specifity or for less typical types of rolling stock, the drag
4838+
coefficient can be entered manually. Typical values are unitless in the range of 0.0002 - 0.0024.
48824839

48834840

48844841
.. _physics-track-sanding:
@@ -4973,7 +4930,7 @@ However for those who like to customise, the following parameter can be inputted
49734930
single: ORTSTrailLocomotiveResistanceFactor
49744931

49754932
``ORTSTrailLocomotiveResistanceFactor`` -- The constant value by which the leading locomotive resistance
4976-
needs to be decreased for trailing operation.
4933+
needs to be multiplied for trailing operation (eg: 0.5 halves resistance, default 0.2083).
49774934

49784935
For steam locomotive tenders it may be necessary to enter this value depending upon the Drag constant used
49794936
to calculate the tender resistance.

Source/Orts.Common/Conversions.cs

Lines changed: 33 additions & 2 deletions
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
}
@@ -260,8 +260,23 @@ public static class NpM
260260
/// <summary>
261261
/// Resistance conversions from and to Newtons/metre/sec
262262
/// </summary>
263-
public static class NpMpS
263+
public static class NSpM
264264
{
265+
/// <summary>Convert from pounds per mph to newtons per meter per second</summary>
266+
public static float FromLbfpMpH(float lbfPerMpH) { return lbfPerMpH * 9.9503884f; }
267+
/// <summary>Convert from newtons per meter per second to pounds per mph</summary>
268+
public static float ToLbfpMpH(float nPerMpS) { return nPerMpS / 9.9503884f; }
269+
}
270+
271+
/// <summary>
272+
/// Resistance conversions from and to Newtons/metre^2/sec^2
273+
/// </summary>
274+
public static class NSSpMM
275+
{
276+
/// <summary>Convert from pounds per mph^2 to newtons per mps^2</summary>
277+
public static float FromLbfpMpH2(float lbfPerMpH2) { return lbfPerMpH2 * 22.2583849f; }
278+
/// <summary>Convert from newtons per mps^2 to pounds per mph^2</summary>
279+
public static float ToLbfpMpH2(float nPerMpS2) { return nPerMpS2 / 22.2583849f; }
265280
}
266281

267282
/// <summary>
@@ -576,8 +591,12 @@ public static class FormatStrings
576591
public static string f = Catalog.GetString("°F");
577592
public static string n = Catalog.GetString("N");
578593
public static string kN = Catalog.GetString("kN");
594+
public static string nspm = Catalog.GetString("N/m/s");
595+
public static string nsspmm = Catalog.GetString("N/(m/s)²");
579596
public static string lbf = Catalog.GetString("lbf");
580597
public static string klbf = Catalog.GetString("klbf");
598+
public static string lbfpmph = Catalog.GetString("lbf/mph");
599+
public static string lbfpmph2 = Catalog.GetString("lbf/mph²");
581600
public static string deg = Catalog.GetString("°");
582601

583602
/// <summary>
@@ -789,6 +808,18 @@ public static string FormatLargeForce(float forceN, bool isMetric)
789808
return String.Format(CultureInfo.CurrentCulture, "{0:F1} {1}", force * 1e-3f, unit);
790809
}
791810

811+
public static string FormatLinearResistance(float resistanceNSpM, bool isMetric)
812+
{
813+
var resistance = isMetric ? resistanceNSpM : NSpM.ToLbfpMpH(resistanceNSpM);
814+
return String.Format(CultureInfo.CurrentCulture, isMetric ? "{0:F1} {1}" : "{0:F2} {2}", resistance, nspm, lbfpmph);
815+
}
816+
817+
public static string FormatQuadraticResistance(float resistanceNSSpMM, bool isMetric)
818+
{
819+
var resistance = isMetric ? resistanceNSSpMM : NSSpMM.ToLbfpMpH2(resistanceNSSpMM);
820+
return String.Format(CultureInfo.CurrentCulture, isMetric ? "{0:F3} {1}" : "{0:F4} {2}", resistance, nsspmm, lbfpmph2);
821+
}
822+
792823
public static string FormatTemperature(float temperatureC, bool isMetric, bool isDelta)
793824
{
794825
var temperature = isMetric ? temperatureC : isDelta ? C.ToDeltaF(temperatureC) : C.ToF(temperatureC);

0 commit comments

Comments
 (0)