Additional signal script functions
This blueprint proposes to introduce a series of additional signal script functions.
This also includes the functions linked to the proposed introduction of signal variables as well as the proposed introduction of subtypes for NORMAL signals, see the relevant blueprints on these proposals for details.
Functions using signalid as identification for the signal from which information is required.
As detailed in the blueprint on the introduction on signal variables, it may be necessary to gather multiple items on information from another signal. To avoid unnecessary repetitive search actions to identify the required signal, functions have been made available which can retreive the required information through use of the signal ident.
Functions to obtain the signal ident :
* sigid = next_sig_
* sigid = next_nsig_
* sigid = opp_sig_
Functions using signal ident equivalent to existing functions :
* state = id_sig_
value = 1 if signal is enabled, otherwise 0
* sigasp = ID_SIG_LR(sigid) : returns the least restrictive aspect as set by the signal identified by sigid
Functions related to signal variables :
* store_lvar(key, value) : store a value in variable identified by key
* value = this_sig_lvar(key) : retrieve value linked to this signal identified by key
* value = next_sig_
* value = id_sig_lvar(sigid, key) : retrieve value of signal identified by sigid, value is identified by key.
Functions to adjust the SignalNumClearAhead values:
* increase_
* decrease_
* set_signalnumcl
* reset_signalnum
Note that the functions which increase or decrease the value of SignalNumClearAhead use the default value as specified in the signal type definition as the actual value, so, for instance, repetitive calls to increase_
Functions to query the subtype of a NORMAL signal :
* state = this_sig_
state = 1 if the signal has this subtype, otherwise state = 0
* state = next_sig_
state = 1 if the signal has this subtype, otherwise state = 0
* state = id_sig_
state = 1 if the signal has this subtype, otherwise state = 0
Additional Approach Control functions :
* approach_
regardless of any signals inbetween train and this signal
(normal approach control will only clear if signal is first signal ahead of train)
* approach_
(normally if a train approach a signal at danger it will try to claim the track sections beyond the signal)
Other functions :
* allow_clear_
(i.e. not reaching end of track or next signal) if signal is propagated
(normally a signal will only clear to a partial route if it is the first signal ahead of the train)
* state = train_requires_
checks if the route of the train approaching this signal runs as for as the signal identified by sigid.
If position = 0, it is checked if the route reaches the required signal;
if position = 1; it is checked if the route extends beyond the required signal.
The returned state = 1 if the route does extend as indicated, otherwise state = 0;
* sigid = find_req_
searches along the train’s route to locate the next normal signal with subtype ORSUBTYPE_type,
if found, the return value is the ident of that signal, otherwise sigid = -1.
Note that this function uses the train’s route to locate the signal, and not the route as may presently be set beyond the signal.
* state = route_cleared_
checks if the full route upto signal identified by sigid, has been cleared for the train which is approaching the signal
(i.e. for which the signal is enabled).
Function returns BLOCK_CLEAR if route is fully available, otherwise the value BLOCK_JN_OBSTRUCTED is returned.
* state = route_clear_
as above, but also checks if callon is allowed if the route is occupied.
Function returns BLOCK_CLEAR if route is fully available, BLOCK_JN_OBSTRUCTED if route is not available at all,
and returns BLOCK_OCCUPIED if part of the route is occupied by call-on is allowed.
* this_sig_noupdate() : calling this function will exclude this signal for the normal update sequence.
This can be used for signals which have a fixed setting, e.g. speed signals or signals at end of track.
Note that the script for such signals is always executed once so the required state will always be set.
Setting the option not to update the signal reduces the overall program load.
Discussion: http://
Roadmap: https:/
Blueprint information
- Status:
- Complete
- Approver:
- James Ross
- Priority:
- Low
- Drafter:
- r.roeterdink
- Direction:
- Approved
- Assignee:
- r.roeterdink
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Implemented
- Milestone target:
- 1.3
- Started by
- r.roeterdink
- Completed by
- James Ross
Related branches
Related bugs
Sprints
Whiteboard
Implemented in X3863.