Skip to content

Commit 0d270d7

Browse files
committed
Automatic merge of T1.5.1-1088-g264349b1ce and 20 pull requests
- Pull request #891 at 9a1d6b2: Auto save - Pull request #959 at 2452cb0: Fix TrackViewer crash on big zoom value - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #976 at 877cc94: Increased center of gravity range - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #882 at 8f695a4: Blueprint/train car operations UI window - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #922 at a3bc9e7: Autopilot for timetable mode - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at 7e0cbd5: Multiple Track Profiles & Superelevation Improvements - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #970 at 6fa5eed: feat: Remove unnecessary Windows.Forms usage - Pull request #973 at c35be87: fix: Using singular target framework to allow for different platforms across different projects - Pull request #974 at 5faea6f: Bug fix for https://bugs.launchpad.net/or/+bug/2076034 Doors remain open in AI trains - Pull request #975 at b2dd5c0: Bug fix for https://bugs.launchpad.net/or/+bug/2076133 Crash when AI train dissolves near camera - Pull request #900 at c27f32d: DMI updates - Pull request #903 at 9dabe97: Downloading route content (Github, zip) - Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #952 at 8347095: Investigation - Pulsing graphics
22 parents 6fe110b + 264349b + 9a1d6b2 + 2452cb0 + e90a2aa + 877cc94 + d00beb9 + 8f695a4 + 1f5ba4c + a3bc9e7 + a519452 + 7e0cbd5 + 46d0472 + 6fa5eed + c35be87 + 5faea6f + b2dd5c0 + c27f32d + 9dabe97 + dfc715e + f92de76 + 8347095 commit 0d270d7

File tree

29 files changed

+1280
-1057
lines changed

29 files changed

+1280
-1057
lines changed
Binary file not shown.

Source/Documentation/Manual/appendices.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,16 @@ Volumetric Flow m^3/s air flow m^3/s
6464
\ L/min
6565
\ L/s
6666
Speed m/s other m/s m/s meter per second
67+
\ cm/s centimeters per second
68+
\ mm/s millimeters per second
6769
\ km/h
6870
\ kph kph kilometer per hour
69-
\ kmh kmh misspelling accepted by MSTS
70-
\ kmph
71-
\ mph dynamic mph mph miles per hour
72-
brake
71+
\ kmh kmh, misspelling accepted by MSTS
72+
kmph
73+
\ mph dynamic mph mph miles per hour,
74+
brake legacy dynamic brake parameters use mph default
75+
\ ft/s feet per second
76+
\ in/s inches per second
7377
Frequency Hz Hz Hertz
7478
\ rps revolutions per second
7579
\ rpm

Source/Documentation/Manual/features-route.rst

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,15 +858,72 @@ Defining Curve Superelevation
858858

859859
.. index::
860860
single: ORTSTrackSuperElevation
861+
single: ORTSSuperElevation
862+
single: MaxFreightUnderbalance
863+
single: MaxPassengerUnderbalance
864+
single: MinimumCant
865+
single: MaximumCant
866+
single: Precision
867+
single: MaxRunOffSlope
868+
single: MaxRunOffSpeed
869+
single: MinimumSpeed
861870

862871
This feature allows curves within the route to be assigned a value for superelevation. It
863872
is inserted either in the route's root .trk file or in the "Include" .trk file.
864873

865-
It should be noted that currently this information only applies to physics calculations
866-
for superelevation. The visual movement of the train due to superelevation is set within
867-
the option menu.
874+
The superelevation standard defined here will control the simulated level of superelevation on
875+
each track section on the entire route and, if enabled in the options, the amount of visual
876+
superelevation generated by the dynamic track system.
877+
878+
To define a superelevation standard, add a ``ORTSSuperElevation`` block to the route's .trk
879+
file and add some (or all) of the following parameters inside the ``ORTSSuperElevation`` block:
880+
881+
- ``MaxFreightUnderbalance`` -- The maximum amount (using units of length) of cant deficiency/underbalance
882+
that should be allowed for trains travelling at the freight speed limit. (Default 5 cm ~ 2 inches.)
883+
- ``MaxPassengerUnderbalance`` -- The maximum amount (using units of length) of cant deficiency/underbalance
884+
that should be allowed for trains travelling at the passenger speed limit. (Default 7.5 cm ~ 3 inches.)
885+
For comfort reasons, the underbalance values should be equal to or less than the
886+
``ORTSUnbalancedSuperElevation`` value used by the rolling stock on the route. If the superelevation
887+
required to achieve the max passenger underbalance is different from that required for freight, the
888+
curve will use whichever superelevation is larger (the actual amount of underbalance may be lower).
889+
- ``MinimumCant`` -- If a curve needs superelevation, the amount of superelevation will be no lower than
890+
this value (given in units of length). (Default 1.25 cm ~ 0.5 inches.)
891+
- ``MaximumCant`` -- Sets the maximum amount of superelevation (units of length) that any curve is allowed
892+
to have, regardless of other factors. Usually curves should be designed to avoid reaching this limit.
893+
(Default is determined by the superelevation setting in the options menu. Level 0 = 7 cm, level 10 = 17 cm.)
894+
- ``Precision`` -- Determines the accuracy (in length) to which the superelevation is maintained. If
895+
the superelevation required by a curve is not a nice number, it will be rounded up to the nearest
896+
multiple of ``Precision``. (Default 0.5 cm ~ 0.2 inches.)
897+
- ``MaxRunOffSlope`` -- Sets a limit on the amount of change in superelevation per unit length along a curve
898+
(quantity is unitless). This allows for smooth transition between flat and superelevated track at low speeds.
899+
(Default 0.003.)
900+
- ``MaxRunOffSpeed`` -- Sets a limit on the amount of change in superelevation per second (units of speed) when
901+
travelling at the max speed for the curve. This allows for smooth transition between flat and superelevated
902+
track at high speeds. (Default 4 cm/sec ~ 1.5 inches/sec.)
903+
- ``MinimumSpeed`` -- The minimum speed limit required for superelevation to be added to a curve. Useful for
904+
preventing superelevation from being generated in yards. (Default 25 kmh ~ 15 mph.)
905+
906+
Any parameters not specified will use the default values, which are suitable for most medium-speed routes.
907+
Upon route loading, the given parameters will be used to calculate the appropriate amount of superelevation
908+
for each curve based on the curve radius and speed limits. An example ``ORTSSuperElevation`` block which
909+
defines the superelevation standard used by Union Pacific is given below::
910+
911+
ORTSSuperElevation(
912+
MaxFreightUnderbalance ( 1in )
913+
MaxPassengerUnderbalance ( 3in )
914+
MinimumCant ( 0.25in )
915+
MaximumCant ( 5in )
916+
Precision ( 0.25in )
917+
MaxRunOffSlope ( 0.0019 )
918+
MaxRunOffSpeed ( 1.25in/s )
919+
MinimumSpeed ( 15mph )
920+
)
868921

869-
The values are assigned by inserting the following parameter::
922+
Open Rails also supports a simpler but less accurate way to define superelevation. It is
923+
recommended to not use this system as it does not follow the principles of real superelevation
924+
design, producing less accurate results. However, it has been retained to support prior routes.
925+
The parameter ``ORTSTrackSuperElevation`` can be added to the .trk file to define a table
926+
of superelevation values::
870927

871928
ORTSTrackSuperElevation ( x y .......... )
872929

Source/Orts.Formats.Msts/RouteFile.cs

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717

18-
using System;
1918
using System.Collections.Generic;
2019
using System.Diagnostics;
21-
using System.Linq;
22-
using System.Text;
2320
using Orts.Parsers.Msts;
2421
using System.IO;
22+
using ORTS.Common;
2523

2624
namespace Orts.Formats.Msts
2725
{
@@ -107,6 +105,7 @@ public Tr_RouteFile(STFReader stf)
107105
new STFReader.TokenProcessor("ortsuserpreferenceremoveforesttreesfromroads", ()=>{ RemoveForestTreesFromRoads = stf.ReadBoolBlock(false); }),
108106
// values for superelevation
109107
new STFReader.TokenProcessor("ortstracksuperelevation", ()=>{ SuperElevationHgtpRadiusM = new Interpolator(stf); }),
108+
new STFReader.TokenProcessor("ortssuperelevation", ()=>{ SuperElevationHgtpRadiusM = null; SuperElevation = new SuperElevationStandard(stf); }),
110109
// images
111110
new STFReader.TokenProcessor("graphic", ()=>{ Thumbnail = stf.ReadStringBlock(null); }),
112111
new STFReader.TokenProcessor("loadingscreen", ()=>{ LoadingScreen = stf.ReadStringBlock(null); }),
@@ -123,8 +122,6 @@ public Tr_RouteFile(STFReader stf)
123122
new STFReader.TokenProcessor("ortscurvesmsnumber", ()=>{ CurveSMSNumber = stf.ReadIntBlock(null); }),
124123
new STFReader.TokenProcessor("ortscurveswitchsmsnumber", ()=>{ CurveSwitchSMSNumber = stf.ReadIntBlock(null); }),
125124
new STFReader.TokenProcessor("ortsopendoorsinaitrains", ()=>{ OpenDoorsInAITrains = stf.ReadBoolBlock(false); }),
126-
new STFReader.TokenProcessor("ortsplaytracksoundsbasecontinuous", ()=>{ TrackSoundDefaultContinuousPlay = stf.ReadBoolBlock(false); }),
127-
new STFReader.TokenProcessor("ortsdistancebetweentrackjoints", ()=>{ DistanceBetweenTrackJointsM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
128125

129126
});
130127
//TODO This should be changed to STFException.TraceError() with defaults values created
@@ -133,6 +130,7 @@ public Tr_RouteFile(STFReader stf)
133130
if (Description == null) throw new STFException(stf, "Missing Description");
134131
if (RouteStart == null) throw new STFException(stf, "Missing RouteStart");
135132
if (ForestClearDistance == 0 && RemoveForestTreesFromRoads) Trace.TraceWarning("You must define also ORTSUserPreferenceForestClearDistance to avoid trees on roads");
133+
if (SuperElevation == null) SuperElevation = new SuperElevationStandard();
136134
}
137135

138136
public string RouteID; // ie JAPAN1 - used for TRK file and route folder name
@@ -152,9 +150,8 @@ public Tr_RouteFile(STFReader stf)
152150
public string DefaultWaterTowerSMS;
153151
public string DefaultSignalSMS;
154152
public float TempRestrictedSpeed = -1f;
155-
public Interpolator SuperElevationHgtpRadiusM; // Superelevation of tracks
156-
public bool TrackSoundDefaultContinuousPlay = false;
157-
public float DistanceBetweenTrackJointsM;
153+
public Interpolator SuperElevationHgtpRadiusM; // Superelevation of tracks as a function of radius, deprecated
154+
public SuperElevationStandard SuperElevation;
158155

159156
// Values for calculating Tunnel Resistance - will override default values.
160157
public float SingleTunnelAreaM2;
@@ -207,12 +204,12 @@ public class TRKEnvironment
207204
public TRKEnvironment(STFReader stf)
208205
{
209206
stf.MustMatch("(");
210-
for( int i = 0; i < 12; ++i )
207+
for (int i = 0; i < 12; ++i)
211208
{
212209
var envfilekey = stf.ReadString();
213210
var envfile = stf.ReadStringBlock(null);
214211
ENVFileNames.Add(envfilekey, envfile);
215-
// Trace.TraceInformation("Environments array key {0} equals file name {1}", envfilekey, envfile);
212+
// Trace.TraceInformation("Environments array key {0} equals file name {1}", envfilekey, envfile);
216213
}
217214
stf.SkipRestOfBlock();
218215
}
@@ -223,9 +220,41 @@ public string ENVFileName(SeasonType seasonType, WeatherType weatherType)
223220
//return ENVFileNames[index];
224221
var envfilekey = seasonType.ToString() + weatherType.ToString();
225222
var envfile = ENVFileNames[envfilekey];
226-
// Trace.TraceInformation("Selected Environment file is {1}", envfilekey, envfile);
223+
// Trace.TraceInformation("Selected Environment file is {1}", envfilekey, envfile);
227224
return envfile;
228225
}
229226
}
230227

228+
public class SuperElevationStandard
229+
{
230+
public float SuperElevationMaxFreightUnderbalanceM = 0.05f; // Default 5 cm ~ 2 inches
231+
public float SuperElevationMaxPaxUnderbalanceM = 0.075f; // Default 7.5 cm ~ 3 inches
232+
public float SuperElevationMinCantM = 0.0125f; // Default 1.25 cm ~ 0.5 inches
233+
public float SuperElevationMaxCantM; // Specified by user settings by default
234+
public float SuperElevationMinSpeedMpS = MpS.FromKpH(25.0f); // Default 25 kmh ~ 15 mph
235+
public float SuperElevationPrecisionM = 0.005f; // Default 5 mm ~ 0.2 inches
236+
public float SuperElevationRunoffSlope = 0.003f; // Maximum rate of change of superelevation per track length, default 0.3%
237+
public float SuperElevationRunoffSpeedMpS = 0.04f; // Maximum rate of change of superelevation per second, default 4 cm / sec ~ 1.5 inches / sec
238+
239+
public SuperElevationStandard()
240+
{
241+
// Initialize new instance with default values
242+
}
243+
public SuperElevationStandard(STFReader stf)
244+
{
245+
stf.MustMatch("(");
246+
stf.ParseBlock(new STFReader.TokenProcessor[] {
247+
new STFReader.TokenProcessor("maxfreightunderbalance", () => { SuperElevationMaxFreightUnderbalanceM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
248+
new STFReader.TokenProcessor("maxpassengerunderbalance", () => { SuperElevationMaxPaxUnderbalanceM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
249+
new STFReader.TokenProcessor("minimumcant", () => { SuperElevationMinCantM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
250+
new STFReader.TokenProcessor("maximumcant", () => { SuperElevationMaxCantM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
251+
new STFReader.TokenProcessor("minimumspeed", () => { SuperElevationMinSpeedMpS = stf.ReadFloatBlock(STFReader.UNITS.Speed, null); }),
252+
new STFReader.TokenProcessor("precision", () => { SuperElevationPrecisionM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); }),
253+
new STFReader.TokenProcessor("maxrunoffslope", () => { SuperElevationRunoffSlope = stf.ReadFloatBlock(STFReader.UNITS.None, null); }),
254+
new STFReader.TokenProcessor("maxrunoffspeed", () => { SuperElevationRunoffSpeedMpS = stf.ReadFloatBlock(STFReader.UNITS.Speed, null); }),
255+
});
256+
stf.SkipRestOfBlock();
257+
}
258+
}
259+
231260
}

Source/Orts.Formats.Msts/SoundManagmentFile.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ public class SharedSMSFileManager
3737
public static int CurveSMSNumber;
3838
public static int CurveSwitchSMSNumber;
3939
public static bool AutoTrackSound = false;
40-
public static bool PlayDefaultTrackSoundsContinuous = false;
41-
public static float DistanceBetweenTrackJointsM;
42-
public static bool CarOnSwitch = false;
4340

4441
public static SoundManagmentFile Get(string path)
4542
{
@@ -201,7 +198,7 @@ public struct CurvePoint
201198

202199
public class VolumeCurve
203200
{
204-
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled, AngleofAttackControlled, CarFrictionControlled, WheelRpMControlled, TrackJointControlled, SwitchControlled, TunnelControlled };
201+
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
205202

206203
public Controls Control = Controls.None;
207204
public float Granularity = 1.0f;
@@ -225,12 +222,6 @@ public VolumeCurve(STFReader stf)
225222
case "variable3controlled": Control = Controls.Variable3Controlled; break;
226223
case "brakecylcontrolled": Control = Controls.BrakeCylControlled; break;
227224
case "curveforcecontrolled": Control = Controls.CurveForceControlled; break;
228-
case "angleofattackcontrolled": Control = Controls.AngleofAttackControlled; break;
229-
case "carfrictioncontrolled": Control = Controls.CarFrictionControlled; break;
230-
case "wheelrpmcontrolled": Control = Controls.WheelRpMControlled; break;
231-
case "trackjointcontrolled": Control = Controls.TrackJointControlled; break;
232-
case "switchcontrolled": Control = Controls.SwitchControlled; break;
233-
case "tunnelcontrolled": Control = Controls.TunnelControlled; break;
234225
default: STFException.TraceWarning(stf, "Crash expected: Skipped unknown VolumeCurve/Frequencycurve type " + type); stf.SkipRestOfBlock(); return;
235226
}
236227
stf.ParseBlock(new STFReader.TokenProcessor[] {
@@ -352,7 +343,7 @@ public Discrete_Trigger(STFReader f)
352343
public class Variable_Trigger : Trigger
353344
{
354345
public enum Events { Speed_Inc_Past, Speed_Dec_Past, Distance_Inc_Past, Distance_Dec_Past,
355-
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, CarInTunnel_Inc_Past, CarInTunnel_Dec_Past,
346+
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
356347
};
357348

358349
public Events Event;
@@ -398,16 +389,6 @@ public Variable_Trigger(STFReader f)
398389
case "brakecyl_dec_past": Event = Events.BrakeCyl_Dec_Past; break;
399390
case "curveforce_inc_past": Event = Events.CurveForce_Inc_Past; break;
400391
case "curveforce_dec_past": Event = Events.CurveForce_Dec_Past; break;
401-
case "angleofattack_inc_past": Event = Events.AngleofAttack_Inc_Past; break;
402-
case "angleofattack_dec_past": Event = Events.AngleofAttack_Dec_Past; break;
403-
case "wheelrpm_inc_past": Event = Events.WheelRPM_Inc_Past; break;
404-
case "wheelrpm_dec_past": Event = Events.WheelRpM_Dec_Past; break;
405-
case "trackjoints_inc_past": Event = Events.TrackJoints_Inc_Past; break;
406-
case "trackjoints_dec_past": Event = Events.TrackJoints_Dec_Past; break;
407-
case "caronswitch_inc_past": Event = Events.CarOnSwitch_Inc_Past; break;
408-
case "caronswitch_dec_past": Event = Events.CarOnSwitch_Dec_Past; break;
409-
case "carintunnel_inc_past": Event = Events.CarInTunnel_Inc_Past; break;
410-
case "carintunnel_dec_past": Event = Events.CarInTunnel_Dec_Past; break;
411392
}
412393

413394

0 commit comments

Comments
 (0)