@@ -1841,6 +1841,9 @@ Scripts will run if referenced by OR-specific fields in the .eng file.
18411841 single: ORTSEngineBrakeController
18421842 single: ORTSCircuitBreaker
18431843 single: ORTSTractionCutOffRelay
1844+ single: ORTSPantographSelector
1845+ single: ORTSVoltageSelector
1846+ single: ORTSPowerLimitationSelector
18441847 single: ORTSPowerSupply
18451848 single: ORTSTrainControlSystem
18461849
@@ -1872,6 +1875,15 @@ Scripts will run if referenced by OR-specific fields in the .eng file.
18721875 * - Passenger car power supply
18731876 - ``ORTS.Scripting.Api.PassengerCarPowerSupply ``
18741877 - ``Wagon ( ORTSPowerSupply ( "DemoPower.cs" ) ) ``
1878+ * - Pantograph selector
1879+ - ``ORTS.Scripting.Api.PantographSelector ``
1880+ - ``Engine ( ORTSPantographSelector ( Script ( "DemoPantographSelector.cs" ) ) ) ``
1881+ * - Voltage selector
1882+ - ``ORTS.Scripting.Api.VoltageSelector ``
1883+ - ``Engine ( ORTSVoltageSelector ( Script ( "DemoVoltageSelector.cs" ) ) ) ``
1884+ * - Power limitation selector
1885+ - ``ORTS.Scripting.Api.PowerLimitationSelector ``
1886+ - ``Engine ( ORTSPantographSelector ( Script ( "DemoPowerLimitator.cs" ) ) ) ``
18751887 * - Train Control System
18761888 - ``ORTS.Scripting.Api.TrainControlSystem ``
18771889 - ``Engine ( ORTSTrainControlSystem ( "DemoTCS.cs" ) ) ``
@@ -2054,14 +2066,66 @@ Use the following .eng parameter to load a traction cut-off relay script::
20542066 )
20552067
20562068``ORTSTractionCutOffRelay `` refers to the traction cut-off relay script in the engine's ``Script ``
2057- subfolder. For this field, the .cs extension is optional. "Automatic" and "Manual" load the generic OR
2058- traction cut-off relay implementation, so do `not ` use these names for your own script.
2069+ subfolder. For this field, the .cs extension is optional. Alternatively, there are several
2070+ built-in OR traction cut-off relay implementations:
2071+
2072+ - "Automatic": no driver intervention required, circuit breaker is closed when conditions are met.
2073+ - "Manual": a traction cut-off switch with open and closed positions.
2074+ - "PushButtons": a traction cut-off relay with dedicated open and close buttons.
2075+
2076+ Please do `not ` use these names for your own script, since the generic implementation will
2077+ be loaded instead.
20592078
20602079``ORTSTractionCutOffRelayClosingDelay `` refers to the delay between the closing command of the traction cut-off relay
20612080and the effective closing of the relay.
20622081
2082+ .. _features-scripting-powerselectors
2083+
2084+ Pantograph, voltage and power limitation selectors
2085+ --------------------------------------------------
2086+
2087+ Available for electric locomotives only. The scripts control
2088+ the behavior of the locomotive's
2089+ :ref: `pantograph selector <physics-pantograph-selector >`,
2090+ :ref: `voltage selector <physics-voltage-selector >` and
2091+ :ref: `power limitation selector <physics-power-limitation-selector >` respectively.
2092+
2093+ .. index ::
2094+ single: ORTSPantographSelector
2095+ single: ORTSVoltageSelector
2096+ single: ORTSPowerLimitationSelector
2097+
2098+ Use the following .eng parameters to load power selector scripts::
2099+
2100+ Engine (
2101+ ORTSPantographSelector (
2102+ Script ( "YourPSScript.cs" )
2103+ SelectorPositions ( ... )
2104+ )
2105+ ORTSVoltageSelector (
2106+ Script ( "YourVSScript.cs" )
2107+ SelectorPositions ( ... )
2108+ )
2109+ ORTSPowerLimitationSelector (
2110+ Script ( "YourPLSScript.cs" )
2111+ SelectorPositions ( ... )
2112+ )
2113+ )
2114+
2115+ ``Script `` refers to the circuit breaker script in the engine's ``Script ``
2116+ subfolder. For this field, the .cs extension is optional. Alternatively, there are several
2117+ built-in OR selector implementations which can be used if custom features such as interlocking
2118+ with other devices are not required:
2119+
2120+ - "Default": a selector with sequential positions.
2121+ - "Circular": same as above, but the first position follows again after the last one.
2122+
2123+ Please do `not ` use these names for your own script, since the generic implementation will
2124+ be loaded instead.
2125+
20632126.. _features-scripting-powersupply :
20642127
2128+
20652129Diesel and electric power supply
20662130--------------------------------
20672131
@@ -2081,6 +2145,7 @@ Use the following .eng parameter to load a power supply script::
20812145
20822146 Engine (
20832147 ORTSPowerSupply ( "YourEPS.cs" )
2148+ ORTSPowerSupplyParameters ( "YourEPS.ini" )
20842149 ORTSPowerOnDelay ( 5s )
20852150 ORTSAuxPowerOnDelay ( 10s )
20862151 )
@@ -2089,6 +2154,12 @@ Use the following .eng parameter to load a power supply script::
20892154subfolder. For this field, the .cs extension is optional. "Default" will load the generic OR power supply
20902155implementation, so do `not ` use this name for your own script.
20912156
2157+ ``ORTSPowerSupplyParameters ``, an optional field, refers to an .ini file,
2158+ also in the ``Script `` subfolder, whose parameters will be made available to the
2159+ power supply script through the ``GetBoolParameter() ``, ``GetIntParameter() ``,
2160+ ``GetFloatParameter() ``, and ``GetStringParameter() `` methods. This .ini file provides for easy customization of
2161+ the behavior of the power supply script by end users.
2162+
20922163``ORTSPowerOnDelay `` refers to the delay between the closing of the circuit breaker or the traction cut-off relay
20932164and the availability of the power for traction.
20942165
@@ -2470,6 +2541,23 @@ which may be used this way within the script:
24702541
24712542 so that, instead of ORTS_TCSnn the related mnemonic string is displayed.
24722543
2544+ Generic cabview controls are also available for the Power Supply subsystem. They are named ORTS_POWER_SUPPLY1, ORTS_POWER_SUPPLY2
2545+ and so on in the cabview file. Their usage is the same as for the TCS controls.
2546+
2547+ Events related to power supply controls are made available to power supply scripts via ``TCSEvent.GenericTCSButtonPressed ``,
2548+ ``TCSEvent.GenericTCSButtonReleased ``, ``TCSEvent.GenericTCSSwitchOff `` and ``TCSEvent.GenericTCSSwitchOn `` events,
2549+ received asynchronously by script through the method:
2550+
2551+ .. code-block :: csharp
2552+
2553+ public override void HandleEvent (PowerSupplyEvent evt , string message )
2554+
2555+ As for the TCS buttons, message is a string representing the control number with zero-base indexing
2556+ (e.g. "5" corresponds to ORTS_POWER_SUPPLY6).
2557+
2558+ SetCabDisplayControl and SetCustomizedCabviewControlName methods, which work in the same
2559+ way as their TCS counterparts, are accessible from all power supply scripts.
2560+
24732561Helper classes
24742562--------------
247525633 helper classes are available in the ``Orts.Scripting.Api `` namespace:
0 commit comments