Skip to content

Commit 0f402c4

Browse files
committed
Automatic merge of T1.5.1-1204-g8bc1d82939 and 17 pull requests
- Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #885 at 8f473ce: feat: Add notifications to Menu - Pull request #891 at 9a1d6b2: Auto save - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #952 at 8347095: Investigation - Pulsing graphics - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at c8a37a7: Multiple Track Profiles & Superelevation Improvements - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #980 at a7406de: Downloading route content (Github, zip) second part - Pull request #981 at 10d297f: Multiple type trainset lightglows - Pull request #982 at efcf19c: WEB based Switch Panel enhancement: Alerter - Pull request #983 at 202316e: WEB based Switch Panel bug: DPU window - Pull request #984 at 0f8122e: Player train switching for timetable mode - Pull request #900 at c27f32d: DMI updates - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder
19 parents dc65d0c + 8bc1d82 + dfc715e + d00beb9 + 8f473ce + 9a1d6b2 + 1f5ba4c + 8347095 + a519452 + c8a37a7 + 46d0472 + e90a2aa + a7406de + 10d297f + efcf19c + 202316e + 0f8122e + c27f32d + f92de76 commit 0f402c4

File tree

2 files changed

+62
-20
lines changed

2 files changed

+62
-20
lines changed

Source/Documentation/Manual/features-route.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -881,30 +881,30 @@ file and add some (or all) of the following parameters inside the ``ORTSSuperEle
881881

882882
- ``MaxFreightUnderbalance`` -- The maximum amount (using units of length) of cant deficiency/underbalance
883883
that should be allowed for trains travelling at the freight speed limit. Larger allowed underbalance
884-
results in less extreme superelevation. (Default 5 cm ~ 2 inches.)
884+
results in less extreme superelevation. (Default 100 mm for metric routes, 2 in for imperial routes.)
885885
- ``MaxPassengerUnderbalance`` -- The maximum amount (using units of length) of cant deficiency/underbalance
886-
that should be allowed for trains travelling at the passenger speed limit. (Default 7.5 cm ~ 3 inches.)
886+
that should be allowed for trains travelling at the passenger speed limit. (Default 150 mm / 3 in.)
887887
For comfort reasons, the underbalance values should be equal to or less than the
888888
``ORTSUnbalancedSuperElevation`` value used by the rolling stock on the route. If the superelevation
889889
required to achieve the max passenger underbalance is different from that required for freight, the
890890
curve will use whichever superelevation is larger (the actual amount of underbalance may be lower).
891891
- ``MinimumCant`` -- If a curve needs superelevation, the amount of superelevation will be no lower than
892-
this value (given in units of length). (Default 1.25 cm ~ 0.5 inches.)
892+
this value (given in units of length). (Default 10 mm / 0.5 in.)
893893
- ``MaximumCant`` -- Sets the maximum amount of superelevation (units of length) that any curve is allowed
894894
to have, regardless of other factors. Usually curves should be designed to avoid reaching this limit, as
895895
exceeding the limit could result in excessive curve force or even trains toppling over at low speeds.
896-
(Default is determined by the superelevation setting in the options menu. Level 0 = 7 cm, level 10 = 17 cm.)
896+
(Default 180 mm / 6 in.)
897897
- ``Precision`` -- Determines the accuracy (in length) to which the superelevation is maintained. If
898898
the superelevation required by a curve is not a nice number, it will be rounded up to the nearest
899-
multiple of ``Precision``. (Default 0.5 cm ~ 0.2 inches.)
899+
multiple of ``Precision``. (Default 5 mm / 0.25 in.)
900900
- ``MaxRunOffSlope`` -- Sets a limit on the amount of change in superelevation per unit length along a curve
901901
(quantity is unitless). This allows for smooth transition between flat and superelevated track at low speeds.
902902
(Default 0.003.)
903903
- ``MaxRunOffSpeed`` -- Sets a limit on the amount of change in superelevation per second (units of speed) when
904904
travelling at the max speed for the curve. This allows for smooth transition between flat and superelevated
905-
track at high speeds. (Default 4 cm/sec ~ 1.5 inches/sec.)
905+
track at high speeds. (Default 55 mm/sec / 1.5 in/sec.)
906906
- ``MinimumSpeed`` -- The minimum speed limit required for superelevation to be added to a curve. Useful for
907-
preventing superelevation from being generated in yards. (Default 25 kmh ~ 15 mph.)
907+
preventing superelevation from being generated in yards. (Default 25 kmh / 15 mph.)
908908
- ``MaximumSpeed`` -- The maximum speed limit allowed for superelevation to be added to a curve. This
909909
is only useful if a route needs multiple sets of superelevation settings. See section below for a
910910
description on use of multiple superelevation standards. (Default unlimited.)

Source/Orts.Formats.Msts/RouteFile.cs

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Orts.Parsers.Msts;
2121
using System.IO;
2222
using ORTS.Common;
23+
using System.Linq;
2324

2425
namespace Orts.Formats.Msts
2526
{
@@ -131,7 +132,14 @@ public Tr_RouteFile(STFReader stf)
131132
if (Description == null) throw new STFException(stf, "Missing Description");
132133
if (RouteStart == null) throw new STFException(stf, "Missing RouteStart");
133134
if (ForestClearDistance == 0 && RemoveForestTreesFromRoads) Trace.TraceWarning("You must define also ORTSUserPreferenceForestClearDistance to avoid trees on roads");
134-
if (SuperElevation.Count <= 0) SuperElevation.Add(new SuperElevationStandard());
135+
if (SuperElevation.Count <= 0)
136+
{
137+
// No superelevation standard defined, create the default one
138+
if (SuperElevationHgtpRadiusM != null)
139+
SuperElevation.Add(new SuperElevationStandard(SuperElevationHgtpRadiusM, MilepostUnitsMetric));
140+
else
141+
SuperElevation.Add(new SuperElevationStandard(MilepostUnitsMetric));
142+
}
135143
}
136144

137145
public string RouteID; // ie JAPAN1 - used for TRK file and route folder name
@@ -228,23 +236,57 @@ public string ENVFileName(SeasonType seasonType, WeatherType weatherType)
228236

229237
public class SuperElevationStandard
230238
{
231-
public float MaxFreightUnderbalanceM = float.PositiveInfinity;
232-
public float MaxPaxUnderbalanceM = float.PositiveInfinity;
233-
public float MinCantM = 0.0125f; // Default 1.25 cm ~ 0.5 inches
234-
public float MaxCantM = 0.15f; // Default limit on superelevation is 15 cm ~ 6 inches
235-
public float MinSpeedMpS = MpS.FromKpH(25.0f); // Default 25 kmh ~ 15 mph
239+
public float MaxFreightUnderbalanceM = float.PositiveInfinity; // Limit to be set elsewhere
240+
public float MaxPaxUnderbalanceM = float.PositiveInfinity; // Limit to be set elsewhere
241+
public float MinCantM = 0.010f; // Default 10 mm (0.5 inches on imperial routes)
242+
public float MaxCantM = 0.180f; // Default limit on superelevation is 180 mm (5 inches on imperial routes)
243+
public float MinSpeedMpS = MpS.FromKpH(25.0f); // Default 25 kmh (15 mph on imperial routes)
236244
public float MaxSpeedMpS = float.PositiveInfinity; // Default unlimited
237-
public float PrecisionM = 0.005f; // Default 5 mm ~ 0.2 inches
245+
public float PrecisionM = 0.005f; // Default 5 mm (0.25 inches on imperial routes)
238246
public float RunoffSlope = 0.003f; // Maximum rate of change of superelevation per track length, default 0.3%
239-
public float RunoffSpeedMpS = 0.04f; // Maximum rate of change of superelevation per second, default 4 cm / sec ~ 1.5 inches / sec
247+
public float RunoffSpeedMpS = 0.055f; // Maximum rate of change of superelevation per second, default 55 mm / sec (1.5 inches / sec on imperial routes)
240248
public bool UseLegacyCalculation = true; // Should ORTSTrackSuperElevation be used for superelevation calculations?
241249

242-
public SuperElevationStandard()
250+
// Initialize new instance with default values (default metric values)
251+
public SuperElevationStandard(bool metric = true)
243252
{
244-
// Initialize new instance with default values
245-
MaxFreightUnderbalanceM = 0.05f; // Default 5 cm ~ 2 inches
246-
MaxPaxUnderbalanceM = 0.075f; // Default 7.5 cm ~ 3 inches
253+
if (metric)
254+
{
255+
// Set underbalance to millimeter values for metric routes
256+
MaxFreightUnderbalanceM = 0.100f; // Default 100 mm
257+
MaxPaxUnderbalanceM = 0.150f; // Default 150 mm
258+
// Other parameters are already metric by default
259+
}
260+
else
261+
{
262+
// Set values in imperial units
263+
MaxFreightUnderbalanceM = Me.FromIn(2.0f); // Default 2 inches
264+
MaxPaxUnderbalanceM = Me.FromIn(3.0f); // Default 3 inches
265+
MinCantM = Me.FromIn(0.5f);
266+
MaxCantM = Me.FromIn(6.0f);
267+
MinSpeedMpS = MpS.FromMpH(15.0f);
268+
PrecisionM = Me.FromIn(0.25f);
269+
RunoffSpeedMpS = MpS.FromMpH(0.0852f); // 1.5 inches per second
270+
}
247271
}
272+
273+
// Initialize new instance from superelevation interpolator
274+
// Interpolator X values should be curve radius, Y values amount of superelevation in meters
275+
public SuperElevationStandard(Interpolator elevTable, bool metric = true)
276+
{
277+
MinCantM = elevTable.Y.Min();
278+
MaxCantM = elevTable.Y.Max();
279+
280+
if (!metric)
281+
{
282+
// Some extra data still required, use imperial units if the route uses it
283+
MinSpeedMpS = MpS.FromMpH(15.0f);
284+
PrecisionM = Me.FromIn(0.25f);
285+
RunoffSpeedMpS = MpS.FromMpH(0.0852f); // 1.5 inches per second
286+
}
287+
}
288+
289+
// Read data for new instance using STF format
248290
public SuperElevationStandard(STFReader stf)
249291
{
250292
stf.MustMatch("(");
@@ -268,7 +310,7 @@ public SuperElevationStandard(STFReader stf)
268310
{
269311
if (MaxPaxUnderbalanceM > 10.0f)
270312
{
271-
// Neither underbalance has been defined
313+
// Neither underbalance has been defined, assume some defaults
272314
MaxFreightUnderbalanceM = 0.05f; // Default 5 cm ~ 2 inches
273315
MaxPaxUnderbalanceM = 0.075f; // Default 7.5 cm ~ 3 inches
274316
}

0 commit comments

Comments
 (0)