Wiki source code of Deadlock prevention
Last modified by stu114053 on 2025/01/30 12:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | === Inputs: === | ||
| 2 | |||
| 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}} | ||
| 8 | |||
| 9 | === Features: === | ||
| 10 | |||
| 11 | * **Take an alternative route (route == 1):** on full station (KH, KH_REV, IC, OC) or other special for deadlocks prevention\\ | ||
| 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 | ||
| 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 | ||
| 15 | ** {{code language="none"}}random_destination{{/code}} is calculated deterministically | ||
| 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 |