Skip to content

Commit 4df3be7

Browse files
authored
Merge pull request #384 from cesarBLG/etcs-dmi-display
ETCS Driver Machine Interface Discussion: http://www.elvastower.com/forums/index.php?/topic/34577-planning-area-of-the-etcs-dmi/ Blueprint: https://blueprints.launchpad.net/or/+spec/etcs-dmi
2 parents f497b6b + a90119a commit 4df3be7

File tree

155 files changed

+3740
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+3740
-249
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,9 @@ Use the following .eng paramater to load an electric power supply script::
806806
The .cs extension is optional. "Default" will load the generic OR power supply
807807
implementation, so do `not` use this name for your own script.
808808

809+
810+
.. _features-scripting-tcs:
811+
809812
Train Control System
810813
--------------------
811814

@@ -919,6 +922,17 @@ which returns a handle for the player locomotive instance of the MSTSLocomotive
919922
class. Through such handle all public classes, methods and variables of
920923
the OR Simulation environment can be accessed within the script.
921924

925+
The Train Control System class provides the ETCSStatus field, which controls the information
926+
to be displayed in the ETCS DMI. For example, the following block orders the DMI to show the circular speed gauge in yellow colour as the train approaches a speed restriction:
927+
928+
.. code-block:: csharp
929+
930+
ETCSStatus.CurrentMonitor = Monitor.TargetSpeed;
931+
ETCSStatus.CurrentSupervisionStatus = SupervisionStatus.Indication;
932+
ETCSStatus.TargetDistanceM = 1234.5f;
933+
ETCSStatus.AllowedSpeedMpS = 50;
934+
ETCSStatus.InterventionSpeedMpS = 52.5f;
935+
ETCSStatus.TargetSpeedMpS = 25;
922936
923937
.. index::
924938
single: MultiStateDisplay

Source/Documentation/Manual/options.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,18 @@ system ETCS.
695695
Units ( KM_PER_HOUR )
696696
)
697697

698+
It is also possible to display the full ETCS display using the following block
699+
instead::
700+
701+
ScreenDisplay (
702+
Type ( ORTS_ETCS SCREEN_DISPLAY )
703+
Position ( 280 272 320 240 )
704+
Units ( KM_PER_HOUR )
705+
)
706+
707+
The information displayed in the DMI is controlled via the TCS script. For more details,
708+
see :ref:`C# engine scripting - Train Control System <features-scripting-tcs>`.
709+
698710
Load day/night textures only when needed
699711
----------------------------------------
700712

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public enum CABViewControlTypes
233233
ORTS_TCS46,
234234
ORTS_TCS47,
235235
ORTS_TCS48,
236+
ORTS_ETCS,
236237

237238
// Further CabViewControlTypes must be added above this line, to avoid their malfunction in 3DCabs
238239
EXTERNALWIPERS,
@@ -313,7 +314,8 @@ public CabViewControls(STFReader stf, string basepath)
313314
new STFReader.TokenProcessor("combinedcontrol", ()=>{ Add(new CVCDiscrete(stf, basepath)); }),
314315
new STFReader.TokenProcessor("firebox", ()=>{ Add(new CVCFirebox(stf, basepath)); }),
315316
new STFReader.TokenProcessor("dialclock", ()=>{ ProcessDialClock(stf, basepath); }),
316-
new STFReader.TokenProcessor("digitalclock", ()=>{ Add(new CVCDigitalClock(stf, basepath)); })
317+
new STFReader.TokenProcessor("digitalclock", ()=>{ Add(new CVCDigitalClock(stf, basepath)); }),
318+
new STFReader.TokenProcessor("screendisplay", ()=>{ Add(new CVCScreen(stf, basepath)); })
317319
});
318320

319321
//TODO Uncomment when parsed all type
@@ -1165,6 +1167,36 @@ protected int ParseNumStyle(STFReader stf)
11651167
}
11661168
#endregion
11671169

1170+
#region Screen based controls
1171+
public class CVCScreen : CabViewControl
1172+
{
1173+
public readonly Dictionary<string, string> CustomParameters = new Dictionary<string, string>();
1174+
public CVCScreen()
1175+
{
1176+
}
1177+
1178+
public CVCScreen(STFReader stf, string basepath)
1179+
{
1180+
stf.MustMatch("(");
1181+
stf.ParseBlock(new STFReader.TokenProcessor[] {
1182+
new STFReader.TokenProcessor("type", ()=>{ ParseType(stf); }),
1183+
new STFReader.TokenProcessor("position", ()=>{ ParsePosition(stf); }),
1184+
new STFReader.TokenProcessor("graphic", ()=>{ ParseGraphic(stf, basepath); }),
1185+
new STFReader.TokenProcessor("units", ()=>{ ParseUnits(stf); }),
1186+
new STFReader.TokenProcessor("parameters", ()=>{ ParseCustomParameters(stf); }),
1187+
});
1188+
}
1189+
protected void ParseCustomParameters(STFReader stf)
1190+
{
1191+
stf.MustMatch("(");
1192+
while (!stf.EndOfBlock())
1193+
{
1194+
CustomParameters[stf.ReadString().ToLower()] = stf.ReadString().ToLower();
1195+
}
1196+
}
1197+
}
1198+
#endregion
1199+
11681200
#region other controls
11691201
public class CVCSignal : CVCDiscrete
11701202
{

0 commit comments

Comments
 (0)