While in conveyor and road the important thing was the state of each element that defines its vector and the control of that vector, in train the main element is the state of the blocks. Whether they are free or reserved by a particular train.
The three types of Block in the Database (JSON):
For simplicity, within that same block state, we also introduce which other blocks must be reserved at the same time as that block, and whether it has the characteristic of containing a switch, so that it has 3 coordinates with an origin, a destination, and an alternative destination:
; normal block:
"37": { "data": { "x1": 617, "y1": 59,
"x2": 573, "y2": 100,
"next": 38,
"prev": 36 } },
; block which, when reserved, also requires two other blocks to be reserved to protect the flanks:
"38": { "data": { "x1": 573, "y1": 100,
"x2": 532, "y2": 149,
"next": 39,
"prev": 37 ,
"bloq": [17, 16]} },
; block with a branch:
"40": { "data": { "x1": 468, "y1": 251,
"x2": 427, "y2": 300,
"next": 41,
"prev": 39 ,
"alt":300,
"x3": 468, "y3": 251,
"position":0} },
to which the CTC adds one more attribute: "occupiedBy", to indicate whether it is free (0) or which train occupies or has reserved it.