Describe the bug
Segment tracks start to count from 0 to n for both sides but in opposite order.
Counting starts from left to right watching the other side of the segment.
Example 1: A railway line with 2 tracks
Side | 0 ------ 1 | Side
A | 1 ------ 0 | B
Position yourself on side A
and look toward side B
:
Left track (which is the top one in the schema) gets number 0 and the right track gets 1.
Now go to B
and look towards A
:
Left track is now the bottom one and gets number 0, the right track (top one) gets 1.
They should in theory match station gate out track.
These are the tracks going out from the station and into the railway line.
Station | Segment
-------------|--------------
Gate ---> 0 | 0 >--- Side
A ---< 1 | 1 <--- A
Example 2: What if station gate has 2 tracks while segment has only 1 track?
Station | Segment
-------------|--------------
Gate ---- 0 | Side
A ---> 1 | 0 >--- A
In this example gate track 0 is not connected and gate track 1 is connected to segment track 0 (which is the only one).
They don't match so it's hard to check if job stops use correct tracks.
If they where the same number the check would be trivial:
if(gate_track != segment_track)
{
//Error: Prompt user to change track and fix inconsistency
}
Example 3: A railway line with 3 tracks
Station | Segment
----------------|--------------
Gate ------> 0 | 0 >--- Side
A --. | 1 <--- A
^---< 1 | 2 <---
In this example track 1 of railway line is not connected to the station.
So gate track 1 is connected to segment track 2.
Possible Solution
In table railway_connections
:
add a column gate_track_num
along track_num
(which should be renamed segment_track_num
)
gate_track_num
: must match a gate track (from 0 to gate track count)
segment_track_num
: is the real number (from 0 to segment track count)