The Two photocell method:

The two photocell design works because it ensures that there is always at least one section of track (the area between two photocells) between the trains. During this design a train owns both the photocell that it already passed (photocellhas) and the photocell that it will cover next given that it continues in the same direction around the track (photocellnext). In this way a train are stopped when it arrive at a photocell and it cannot be allocated the next photocell that it will need to continue travel. In this case the train would not be able to be allocated this resource because some other train needs this resource as its next photocell. This is what creates the space between trains on the track given the two photocell method.