System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at R3DWeb.sParseContent(String sPageID, String sText)
at cms.Page_Load(Object sender, EventArgs e)
Controls And Gauges
« [[wiki/Tutorials/SteamLocomotiveValveGear]] | [[wiki/Main/Tutorials]] | [[wiki/Tutorials/IncludeWithRotate]] »
From build 102.3.1
Control desk of class 303 emu showing
- Controls (Brake control, aws acknowledge button and power control)
- Gauges (aws indicator, train and main brake gauges and speed)
- Indicator (slip indicator)
Controls
The Control keyword allows you to specify an animated control in the cab.
Syntax
ControlX Component_Name
ControlY Component_Name
ControlZ Component_Name
ControlB Component_Name
where
ControlX
is used for a control rotating about the x(w) axis
ControlY
is used for a control rotating about the y(l) axis. A steam loco regulator is typically ControlY
ControlZ
is used for a control rotating about the z(h) axis. The controls in the screenshot above are ControlZ
ControlB
is used for a button type control (eg the aws button above), note the different movement parameters
- is the control parameter to be linked to the control, see [[wiki/Scripting/VehicleDynamics]]
- is the inclusion point - the origin of the component.
- specify the rotation of the control, in degrees, with r0 being the angle for the control’s minimum position and r1 the angle for the maximum position
- are used for button controls and specify the movement of the button component when operated.
examples:
ControlZ 40/0/5 POWER 45,-80 303PowerControl
ControlB -25/15/-5 AWS 0,0,-2 303_AWSPlunger
Hotspots
In order for the user to operate the control, you need to specify the active point on the control (the hotspot) and the direction of movement.
This is done by placing a hotspot term in the control component.
Syntax
HOTSPOT
where
- is the parameter this modifies (this must be the same as the control itself)
- is the position on the control of the hotspot. Ie this is where the user will click to operate the control
- is the endpoint of the movement arrow (see above) for negative movement of the control
- is the endpoint of the movement arrow (see above) for positive movement of the control
- is the amount the control moves when the mouse moves on the screen. (may not be used anymore, suggest set to 10)
example:
HOTSPOT Power -140/0/85 -140/-50/85 -140/50/85 10
Defines the hotspot on the power control at position −140/0/85 on the control component. The movement arrows are from −140/0/85 to −140/−50/85 and −140/0/85 to −140/50/85. When in driving mode, the simulation draws the movement arrows (red and green, see screenshot above) (provided the user has not turned off the display of arrows)
Gauges
The new igauge keyword allows you to include operating gauges in a locomotive cab. The gauge can be driven by loco dynamic parameters and also script functions (see [[wiki/Scripting/RegenerativeElectric]])
I would have liked to use just “Gauge” but that is already in use, hence “igauge”
Note that the iGauge keyword is used for the moving part of the gauge - ie the needle, the fixed part - the outer casing - would be modelled as a separate component.
Syntax
IGauge Component_Name
where
- is the parameter to be used to drive the gauge, see [[wiki/Scripting/VehicleDynamics]]
- is the inclusion point - the origin of the component.
- is the rotation of the component about the x/y/z axes. Rotation is specified in degrees per unit of the parameter, thus (for example) the train speed (in m/s) ranges from (say) 0 to 50 m/s , if the rotation parameter is 4 the component will rotate 4 degree per m/s, so at 50 m/s it will be rotated 200 degrees.
- is the initial rotation in degrees (when the parameter is zero).
for example
IGauge 0 -11/-2/143 0/10/0 0/-160/0 ControlModule_Pointer
would produce a pointer linked to parameter 0 (speed) and starting at −160 degrees and then rotating 10 degrees per m/s
Indicator
An indicator is a lamp (etc) that lights up to indicator a condition (Eg a warning condition, such as the slip indicator above)
Syntax
INDICATOR
where
- is the parameter that drives the indicator. see [[wiki/Scripting/VehicleDynamics]] The component is rendered when the parameter is non-zero
- is the position of the component (as for an include component)
- is the sub-component
example:
# Slip indicator
INDICATOR 6 0/-2/2 303SlipIndicator
Example
The code below is a simple “vehicle” with a power control and speed gauge:
NAME ControlDemo
Metric
Length 1000
Power 100
Weight 100
Max 100
CAB 0/500/150
ControlZ 0/50/50 POWER 0,180 ControlDemo.Control
Fill -200/0/30 200/0/30 200/1000/30 -200/1000/30 0.0.0 =
# Speedometer
IGauge 0 70/50/50 0/0/10 0/0/0 ControlDemo.Pointer
# Slip indicator
INDICATOR 6 -70/50/50 ControlDemo.Indicator
[end]###########################################
NAME ControlDemo.Pointer
Metric
Component
FILL -5/0/0 5/0/0 5/50/0 -5/50/0 255.0.0 =
[end] ###########################################
Name ControlDemo.Control
Metric
Component
FILL -5/0/0 5/0/0 5/100/0 -5/100/0 255.255.255 =
HOTSPOT POWER 0/100/0 25/100/0 -25/100/0 10
[end] ###########################################
Name ControlDemo.Indicator
Metric
Component
FILL -10/-10/0 10/-10/0 10/10/0 -10/10/0 255.255.0 =
« [[wiki/Tutorials/SteamLocomotiveValveGear]] | [[wiki/Main/Tutorials]] | [[wiki/Tutorials/IncludeWithRotate]] »
import