Script SC01 Priority train signals (by adlet)

If you liked this item, please rate it up on Steam Workshop page.

Author: adlet

Last revision: 28 Apr at 20:46 UTC (1)

File size: 2.69 MB

On Steam Workshop

Description:

Script 01: Priority train signals
This script allows to hold trains at signals when priority trains are detected.

• Key features:

° Allow priority trains first through junction/intersection
° Multi-block priority train detection (from any distance)
° Multiple controllers can work together to solve complex tasks
° Many different scenarios/use cases
° Flexible definition of priority trains (by tag/stop/track)
° Prevent deadlocks between priority and ordinary trains
° Pre-departure lock: applies close to priority train departure
° Script can be started by signal pass-by or line stop arrival

• Use cases:

° Non-stop trains can hold stopping trains in stop from long distance.
° Trains on main line can hold trains on crossing secondary line.
° Priority train can get green light at junction ahead of ordinary train
° Hold train if there is no available platform at destination.
° Train using a crossover can yield to straight direction trains
° Lock only one or some tracks after switch, not entire signal
° Lock junction ahead of priority train departure from platform
° Single track line with multiple blocks (with some limitations)
° Passing buses/cars can hold stopping buses in stop
° Priority in merging city road lanes or tram tracks
° Grade crossing (rail/road)
° Emulate road yield sign
° Supplement script 60 to enable yielding left and right turns

• Working layout: see layout with multiple examples in the mod folder, with comments

• How it works

° Signal(s) lock if:

(a) linked controller has been activated, and
(b) defined conditions are met

° Controller activates in one of three ways:

(a) a train passes signal 011 Activate controller by signal pass-by
(b) at time to departure if train passed 012 Activate controlller by time to departure
(c) at time to departure if train arrived at line stop with 013 Activate controller by line stop

° When controller activates it locks if and for as long as any lock conditions (a)-(e) below are met:

(a) a priority train (by tag) reserves or occupies general train sensor
(b) any train reserves or occupies a priority train sensor
(c) any train reserves or occupies a passing station sensor but will not stop there
(d) if activated via elements 012 or 013, that train reserves a platform stop sensor
(e) maximum trains allowed reserve or occupy capacity check sensors

° If lock conditions are met but controller was not activated, it does not lock. Similarly, if controller is activated but at least one of the conditions above is not met, it does not lock.

° The controller unlocks and is deactivated if lock conditions are no longer met. Additional activation is required to re-lock.

° Exception: If a train is stopped on overflow marker, lock is lifted temporarily, until that train has moved.

° When controller is locked, the following happens:

(a) any linked signal (014 Lockable path signal) is set to Stop for ordinary trains. Priority and unclassified trains can still pass.
(b) any linked marker (015 Lockable marker) is set to be used by a specific priority train. No other train can pass if there is a signal in front of the marker.

° Locked signals retain normal aspects (e.g. yellow for standard NIMBY path signal). To display different aspects, attach struct 016 Forced red signal to the signal. (This can be path signal, balise, marker). This signal will display any desired textures set in the signal, e.g. red, yellow, flashing, etc. This signal must also be listed in the controller as 016 Forced red signals.

• Deployment notes:

° Controller can be located anywhere, including off-track. A controller can have multiple linked elements 011-016.

° The lock state is updated every 6 seconds. If lock conditions disappear, the lock is released within 6s.

° Lockable markers (015) allow to lock specific directions after signal. Place on desired branch track after the switch, instead of locking the signal.

° Elements 011 and 012 can activate controller either by any train passing or only by priority (by tag) train. Can be marker, balise or path signal.

° Element 012 must be placed on platform so trains stop directly above it. Also include the departure signal into controller platform stop sensors. The lock will stay as long as the train is still on the marker and the departure signal has its reservation. To keep the lock after passing the departure signal, make next signal(s) a general or priority sensor. If train is past or close to scheduled departure, the lock will engage within 6s of arrival.

° Tags are optional in various use cases.

If priority line tag is set, trains without it are ordinary.
If ordinary line tag is set, trains without it are priority
If no tags are set, all trains are ordinary
If both priority and ordinary line tags are set, trains without either tags are unclassified
Unclassified trains generally ignore the script (do not lock/are not locked), except they cannot pass signals leading to reserved markers (element 015).

° How to use overflow sensors:

A priority train can both lock and be locked by ordinary or unclassified trains ahead.
Place overflow markers where a train (priority, ordinary, etc.) will be stopped in a deadlock. For example, just before entrance signal if station has one, or on siding in overlap zone if no entrance signal. If a train is stopped there, the lock will temporarily release.

• Use with script 60 Timed intersections

° Permits right turn on red or left turn with yield to straight traffic
° Set lockable path signal on the turn before the junction with straight track.
° Entry signal should be path signal on straight direction.
° Train sensors should be balise next to the path signal and next balise/path signal
° No overflow sensor usually necessary.

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.