Script Hitch At Stop
This script allows the hitching (coupling) and unhitching of trains, triggered by trains arriving at stops on a line. The overall flow of the script is:
- Line A last stop -> Wait to hitch to another line, select line B
- Line B at that same station -> Hitch at a stop
- Line B where you want to unhitch again (or even another line that the train from Line B eventually goes to) -> Unhitch at a stop
- And then define some other schedule that will pick up the train left in the platform from there
The unhitched trains are placed in the platform with no shift assignment, ready for a new shift to pick them up.
Multiple trains can be hitched to the same driver, either at the same stop, or at separate stops. The "Hitch group" parameters can be used to control which trains to unhitch at a given stop.
Wait to hitch to another line has these parameters:
- The line to wait for a train to hitch to
- The maximum waiting time; if this timeout is reached, the waiting train is intervened.
- The hitch group number to assign, if necessary to distinguish between different trains when unhitching. Leave set to 1 if not needed.
Hitch at a stop has these parameters:
- The position to hitch the new train at, where 1 is closest to the train being hitched to
- Whether to attach the hitcher in front or behind the train being hitched to
- Whether to reverse the driver train before hitching. Use this option if coupling a loco to rolling stock, use this option to ‘change cabs’ after coupling
Unhitch at a stop has these parameter:
- Whether to place the unhitched train(s) in front of the train that is hitched to, or behind it
- The hitch group number to unhitch; all trains that were assigned this hitch group will be unhitched. Leave set to 1 if not needed.
NIMBY’s hitching functionality requires separate trains for each part. For example, if the combined train is a 3-car + 3-car EMU, the trains must be purchased two separate 3-car EMUs. A single train purchased as 6 cars cannot be split into 3+3.
Troubleshooting hints:
- Make sure that there is both one line with Wait to hitch to another line with a line selected (remember to hit Apply!), and one with Hitch at a stop, which have those at the same station.
- Ensure that the timeout on Wait to hitch is less than the time the train has to wait
- The script is only triggered when a train arrives at a stop. If you apply it to a line where a train is already waiting at the hitching station, it will not detect that train.
- Enable logging under Control -> Script Hitch At Stop -> Develop -> Enable Logging. A train in Wait to hitch should be polling every few seconds, and a train arriving for Hitch At Stop will report it is ready to be hitched to. A "WaitForHitchTask failure" message indicates the waiting train encountered a problem which will have been logged.
Items to be aware of:
- The driver train cannot become unassigned or move to a different line before the hitcher arrives, because those activities will count as the driver having "departed". Either swap the order of driver and hitcher, assign the driver using the departure line, or ensure the driver will not complete its inbound stop before the hitcher arrives.
- If multiple trains are unhitched at once, the order they are placed in is not deterministic
- If multiple trains are on the same line at the same station in the "Hitch at a stop" state, the train that a hitcher will attach to is not deterministic