Wiki source code of Deadlock prevention
Last modified by stu114053 on 2025/01/30 12:17
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
6.1 | 1 | === Inputs: === |
![]() |
4.1 | 2 | |
![]() |
6.1 | 3 | * {{code language="none"}}position and train_on_track{{/code}} |
4 | * {{code language="none"}}pre_next_segment{{/code}} | ||
5 | * {{code language="none"}}moving{{/code}} | ||
6 | * {{code language="none"}}track_speeds{{/code}} | ||
7 | {{code language="none"}}{{/code}} | ||
![]() |
4.1 | 8 | |
![]() |
6.1 | 9 | === Features: === |
![]() |
3.1 | 10 | |
![]() |
7.1 | 11 | * **Take an alternative route (route == 1):** on full station (KH, KH_REV, IC, OC) or other special for deadlocks prevention\\ |
![]() |
6.1 | 12 | ** e.g. if KH_ST is full and the KIO_LN are occupied by incoming (into KH) trains a train leaving KH should always leave through KH |
![]() |
7.1 | 13 | * **Lock the entrance to KH_LN and KH_LN_REV and the corresponding exit of the turnout track:** more than two trains travel in the opposite direction of KH |
14 | * **Assign a random destination to trains:** that are in a station, have no destination and are blocking other trains | ||
![]() |
7.2 | 15 | ** {{code language="none"}}random_destination{{/code}} is calculated deterministically |
![]() |
7.1 | 16 | ** can be disabled for each train by settingĀ {{code language="none"}}no_forced_direction{{/code}} |
17 | * **KH_ST is full in one direction and the KIO_LN in the opposite direction/ exit of the turnout track are locked**: depends on how busy KH_LN is and if someone wants to enter from KH_LN (same for REV) | ||
18 | * **Lock opposite direction in KH**: a train in the KH pass may have to wait for a long time if trains are looping in the opposite direction, so wait for two trains ({{code language="none"}}waiting_bound_KH{{/code}} inĀ {{code language="none"}}KH_Deadlock_Prevention{{/code}}) and then enable its movement | ||
19 | * **Set a random destination for each train (random_mode == true):** sets destination if train doesn't have one |