Skip to content

Commit 7817bb3

Browse files
committed
Rework options so superelevation is enabled by default in most cases, rather than always disabled by default
1 parent ca546dd commit 7817bb3

File tree

16 files changed

+176
-74
lines changed

16 files changed

+176
-74
lines changed
Binary file not shown.

Source/Documentation/Manual/features-route.rst

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,27 @@ Defining Curve Superelevation
868868
single: MaxRunOffSpeed
869869
single: MinimumSpeed
870870
single: MaximumSpeed
871+
single: ORTSForceSuperElevation
872+
single: TrackGauge
871873

872874
This feature allows curves within the route to be assigned a value for superelevation. It
873-
is inserted either in the route's root .trk file or in the "Include" .trk file.
874-
875-
The superelevation standard defined here will control the simulated level of superelevation on
876-
each track section on the entire route and, if enabled in the options, the amount of visual
877-
superelevation generated by the dynamic track system.
878-
879-
To define a superelevation standard, add a ``ORTSSuperElevation`` block to the route's .trk
875+
is inserted either in the route's root .trk file or in the "Include" .trk file. Before
876+
starting, the predominant gauge of track on the route should be given using the legacy
877+
``TrackGauge`` token. The default units used are meters, though other units are supported
878+
as in other parts of the program. If ``TrackGauge`` is set to 0 (like most MSTS routes)
879+
or not present in the .trk file, then the default gauge given in the
880+
:ref:`Superelevation Options <options-superelevation>` will be used for superelevation calculations.
881+
882+
Defining a superelevation standard in the .trk file will control both the simulated level of
883+
superelevation on each track section on the entire route and the amount of visual
884+
superelevation generated by the dynamic track system. However, in some cases it may be desired
885+
to manually influence the use of visual superelevation due to (un)desired graphical effects.
886+
The token ``ORTSForceSuperElevation`` can be given a true/false value to force enable/disable
887+
visual superelevation effects regardless of user settings and other ORTS behaviors. Adding
888+
this token will have no impact on the physical simulation of superelevation, this only forces
889+
the graphical elements to be enabled or disabled.
890+
891+
To define a superelevation standard, add an ``ORTSSuperElevation`` block to the route's .trk
880892
file and add some (or all) of the following parameters inside the ``ORTSSuperElevation`` block:
881893

882894
- ``MaxFreightUnderbalance`` -- The maximum amount (using units of length) of cant deficiency/underbalance
@@ -925,6 +937,15 @@ defines the superelevation standard used by Union Pacific is given below::
925937
MinimumSpeed ( 15mph )
926938
)
927939

940+
Note that it is also possible to create a superelevation standard which entirely disables superelevation
941+
on the route, should the real railroad not use superelevation. This can be achieved by setting
942+
``MaximumCant ( 0 )`` and leaving all other values default. Note that this disables both physics and visual
943+
superelevation::
944+
945+
ORTSSuperElevation(
946+
MaximumCant ( 0 )
947+
)
948+
928949
More than one ``ORTSSuperElevation`` block can be added to the .trk file to facilitate routes that require
929950
different superelevation standards for different track speeds (for example, a route with both standard speed
930951
160 kmh tracks and dedicated 300 kmh high speed tracks). If a track has a speed limit below ``MinimumSpeed``
3.47 KB
Loading

Source/Documentation/Manual/options.rst

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -766,16 +766,46 @@ Some experimental features being introduced in Open Rails may be turned on
766766
and off through the *Experimental* tab of the Options window, as
767767
described below.
768768

769+
.. _options-superelevation:
770+
769771
Superelevation
770772
---------------
771773

772-
If "Use Visual Superelevation" is enabled, ORTS applies superelevation graphics
773-
to curves on every route. For the best results, you need to enter
774-
the correct gauge for your route, otherwise the resulting superelevation
775-
may not be accurate. Note that the physics system will always consider the
776-
physical effects of superelevation regardless of this setting.
774+
ORTS implements graphical superelevation (tilting) of tracks using Dynamic Tracks.
775+
For superelevation to appear, the route must have one (or more) ``<route folder>/TrackProfiles/
776+
TrProfile.stf`` files. A document describing the creation of track profiles, ``How to
777+
Provide Track Profiles for Open Rails Dynamic Track.pdf``, can be found in the
778+
*Menu > Documents* drop-down or the Open Rails ``/Source/Documentation/`` folder. Forum
779+
discussions about track profiles can also be found on `Elvas Tower
780+
<http://www.elvastower.com/forums/index.php?/topic/21119-superelevation/
781+
page__view__findpost__p__115247>`_.
777782

778-
When visual superelevation is selected, two viewing effects occur at runtime:
783+
However, superelevation will also appear if the route has a superelevation standard
784+
``ORTSSuperElevation`` :ref:`defined within the route's .trk file <features-route-curve-superelevation>`
785+
regardless of the use of track profiles. *It is recommended to combine* **both** *track profiles
786+
and ``ORTSSuperElevation`` for best results*, as dynamic track (ie: superelevation) is rendered
787+
as Kuju track without any track profiles installed, which may not appear correct.
788+
789+
.. note::
790+
791+
This behavior can be overwritten if ``ORTSForceSuperElevation ( 0/1 )`` is present in the .trk file.
792+
A setting of 0 will always disable superelevation graphics, while 1 always enables it, regardless
793+
of the criteria described here.
794+
795+
To support routes without Track Profiles and without ``ORTSSuperElevation``, the
796+
"Legacy Superelevation" option can be enabled. This will activate superelevation visuals
797+
on routes regardless of missing data, which may be appropriate for original MSTS routes but
798+
will not be aesthetically pleasing for routes using more modern track shapes. Experimentation
799+
may be required to determine the correct setting, and *editing of routes* (to add data to the
800+
.trk file and/or to add track profiles) will be required for best results.
801+
802+
.. note::
803+
804+
The configuration described here only affects the visual depiction of superelevation.
805+
Superelevation is still considered by train physics regardless of the state of the visual system.
806+
807+
When visual superelevation is enabled (either through correct configuration of a route,
808+
or enabled with the "Legacy Superelevation" option), two viewing effects occur at runtime:
779809

780810
1. If an external camera view is selected, the tracks and the running
781811
train will be shown inclined towards the inside of the curve.
@@ -785,18 +815,16 @@ When visual superelevation is selected, two viewing effects occur at runtime:
785815
.. image:: images/options-superelevation_1.png
786816
.. image:: images/options-superelevation_2.png
787817

788-
The amount of superelevation applied can be customized
789-
:ref:`from within the route's .trk file <features-route-curve-superelevation>`.
818+
Note that superelevation usually won't be this distinct. The amount of superelevation
819+
depends on the track speed limit and curve radius, where higher speeds and tighter curves
820+
lead to more intense superelevation.
790821

791-
OR implements superelevated tracks using Dynamic Tracks. You can change
792-
the appearance of tracks by creating one (or more) ``<route folder>/TrackProfiles/
793-
TrProfile.stf`` files. The document ``How to Provide Track Profiles for
794-
Open Rails Dynamic Track.pdf`` describing the creation of track profiles
795-
can be found in the *Menu > Documents* drop-down or the
796-
Open Rails ``/Source/Documentation/`` folder. Forum
797-
discussions about track profiles can also be found on `Elvas Tower
798-
<http://www.elvastower.com/forums/index.php?/topic/21119-superelevation/
799-
page__view__findpost__p__115247>`_.
822+
Additionally, the superelevation physics system requires knoweldge of the gauge of track used on
823+
the route. Normally, this should be defined with ``TrackGauge``
824+
:ref:`in the .trk file <features-route-curve-superelevation>`, but many routes have the gauge value
825+
set to 0, which is not useful. In such a case, the program must use the gauge (in millimeters)
826+
specified by the "Default Gauge" option. Note this assumes the entire route has the same gauge of track.
827+
Multi-gauge routes are not fully supported at the moment.
800828

801829

802830
.. _options-shape-warnings:

Source/Documentation/Manual/physics.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ rigid wheel base, track gauge and super elevation. The curve resistance
9595
has its lowest value at the curve's optimal speed. Running at higher or
9696
lower speed causes higher curve resistance. The worst situation is
9797
starting a train from zero speed. The track gauge value can be set by
98-
``ORTSTrackGauge`` parameter, otherwise 1435 mm is used. The rigid wheel base
98+
``ORTSTrackGauge`` parameter, otherwise the gauge is assumed to be the
99+
gauge specified in the route's .trk file. The rigid wheel base
99100
can be also set by ``ORTSRigidWheelBase``, otherwise the value is estimated.
100101
Further details are discussed later.
101102

Source/Menu/Options.Designer.cs

Lines changed: 23 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/Options.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,9 @@ private void InitializeHelpIcons()
902902
(pbControlConfirmations, new Control[] { labelControlConfirmations, comboControlConfirmations }),
903903
(pbWebServerPort, new Control[] { labelWebServerPort }),
904904
(pbPerformanceTuner, new Control[] { checkPerformanceTuner, labelPerformanceTunerTarget }),
905+
906+
// Experimental tab
907+
(pbSuperElevation, new[] { ElevationText }),
905908
};
906909
foreach ((PictureBox pb, Control[] controls) in helpIconControls)
907910
{
@@ -1060,6 +1063,12 @@ private void HelpIcon_Click(object sender, EventArgs _)
10601063
pbPerformanceTuner,
10611064
baseUrl + "/options.html#performance-tuner"
10621065
},
1066+
1067+
// Experimental tab
1068+
{
1069+
pbSuperElevation,
1070+
baseUrl + "/options.html#super-elevation"
1071+
},
10631072
};
10641073
if (urls.TryGetValue(sender, out var url))
10651074
{

Source/Orts.Formats.Msts/RouteFile.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public Tr_RouteFile(STFReader stf)
108108
new STFReader.TokenProcessor("ortstracksuperelevation", ()=>{ SuperElevationHgtpRadiusM = new Interpolator(stf); }),
109109
// New superelevation standard, will overwrite ORTSTrackSuperElevation
110110
new STFReader.TokenProcessor("ortssuperelevation", ()=>{ SuperElevation.Add(new SuperElevationStandard(stf)); }),
111+
new STFReader.TokenProcessor("trackgauge", ()=>{ RouteGaugeM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
112+
new STFReader.TokenProcessor("ortsforcesuperelevation", ()=>{ SuperElevationMode = stf.ReadBoolBlock(false) ? 1 : 0; }),
111113
// images
112114
new STFReader.TokenProcessor("graphic", ()=>{ Thumbnail = stf.ReadStringBlock(null); }),
113115
new STFReader.TokenProcessor("loadingscreen", ()=>{ LoadingScreen = stf.ReadStringBlock(null); }),
@@ -159,6 +161,8 @@ public Tr_RouteFile(STFReader stf)
159161
public string DefaultWaterTowerSMS;
160162
public string DefaultSignalSMS;
161163
public float TempRestrictedSpeed = -1f;
164+
public float RouteGaugeM; // Track gauge used by this route in meters. FUTURE: Better handling of track gauge to support routes with mixed gauges
165+
public int SuperElevationMode = -1; // -1: use simulator setting, 0: force disable visual superelevation, 1: force enable visual superelevation
162166
public Interpolator SuperElevationHgtpRadiusM; // Superelevation of tracks as a function of radius, deprecated
163167
public List<SuperElevationStandard> SuperElevation = new List<SuperElevationStandard>();
164168

@@ -246,6 +250,7 @@ public class SuperElevationStandard
246250
public float RunoffSlope = 0.003f; // Maximum rate of change of superelevation per track length, default 0.3%
247251
public float RunoffSpeedMpS = 0.055f; // Maximum rate of change of superelevation per second, default 55 mm / sec (1.5 inches / sec on imperial routes)
248252
public bool UseLegacyCalculation = true; // Should ORTSTrackSuperElevation be used for superelevation calculations?
253+
public bool DefaultStandard = true; // Is this standard a default (auto-generated) one?
249254

250255
// Initialize new instance with default values (default metric values)
251256
public SuperElevationStandard(bool metric = true, bool highSpeed = false)
@@ -331,6 +336,8 @@ public SuperElevationStandard(STFReader stf)
331336
new STFReader.TokenProcessor("maxrunoffspeed", () => { RunoffSpeedMpS = stf.ReadFloatBlock(STFReader.UNITS.Speed, null); }),
332337
});
333338

339+
DefaultStandard = false;
340+
334341
// Disable legacy superelevation calculations if sufficient data is given
335342
if (MaxFreightUnderbalanceM <= 10.0f || MaxPaxUnderbalanceM <= 10.0f)
336343
UseLegacyCalculation = false;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,9 @@ public virtual void LoadFromWagFile(string wagFilePath)
11291129

11301130
if (BrakeSystem == null)
11311131
BrakeSystem = MSTSBrakeSystem.Create(CarBrakeSystemType, this);
1132+
1133+
if (TrackGaugeM <= 0) // Use gauge of route/sim settings if gauge wasn't defined
1134+
TrackGaugeM = Simulator.RouteTrackGaugeM;
11321135
}
11331136

11341137
// Compute total mass of wagon including freight animations and variable loads like containers

0 commit comments

Comments
 (0)