Been trying to get passing loops to work for a couple of days now. I made a 5km single track and added 5 passing loops as shown in the image.

Trackmarks before each signal and buffer. I set all points so the mainline track was clear from one end to the other. Set up a train each end.
To start with, the mainline train had instructions to autodrive through each mainline track mark and into the yard at the far end. The other train had instructions to flip the two points in front of it and autodrive through the next trackmark on the passing loop side. Rinse and repeat till it got to the other end. Made sense to me. Move to the end of the next block and see what happens! What happened is the passing train (down train) flipped the first two points and waited. The mainline train proceeded merrily on its way until it reached the signal before the two switches the down train had flipped. Deadlock. Each set of instructions worked fine if they were the only train on the route. It also worked if the down train had no instructions.
I did notice that the down train would proceed if I flipped the points just after the signal it was supposed to pass through. Which made me think that maybe the AI needs control over the block after the block it wants to enter. So I changed instructions for the down train so that it had control of both the entry and exit switch of the next passing loop as it passed the signal of the current one. Both trains then made it to their destination! Smells like Victory!
There's still a few things I don't understand though...
A buffer shows a red signal. On my layout the signal before was red the buffer was always red and so the trains couldn't reach their destination. I put an invisible signal just before the buffer and that made it work but I don't understand the logic. My understanding is that the signal before a red must show yellow.

Trackmarks before each signal and buffer. I set all points so the mainline track was clear from one end to the other. Set up a train each end.
To start with, the mainline train had instructions to autodrive through each mainline track mark and into the yard at the far end. The other train had instructions to flip the two points in front of it and autodrive through the next trackmark on the passing loop side. Rinse and repeat till it got to the other end. Made sense to me. Move to the end of the next block and see what happens! What happened is the passing train (down train) flipped the first two points and waited. The mainline train proceeded merrily on its way until it reached the signal before the two switches the down train had flipped. Deadlock. Each set of instructions worked fine if they were the only train on the route. It also worked if the down train had no instructions.
I did notice that the down train would proceed if I flipped the points just after the signal it was supposed to pass through. Which made me think that maybe the AI needs control over the block after the block it wants to enter. So I changed instructions for the down train so that it had control of both the entry and exit switch of the next passing loop as it passed the signal of the current one. Both trains then made it to their destination! Smells like Victory!
There's still a few things I don't understand though...
- Why does a train need control over a point after the signal it is heading for?
- Is there some number of blocks that are required to be controlled by it?
- If so is this configurable?
- Why did I need to put an invisible signal between each buffer and the yard entry signal in order for the train to access the yard?
- If the buffer is a halt signal shouldn't that make the yard entry a caution, not a halt?
- Why are some signals not changing to proceed until after the train is well into the preceeding block?
- Points were set right, switching distance config was way down the line (3km). Sometimes signals would be set to proceed two or even three ahead. At other times the train would be in the block preceeding and travelling at half speed. Couldn't work out why.
A buffer shows a red signal. On my layout the signal before was red the buffer was always red and so the trains couldn't reach their destination. I put an invisible signal just before the buffer and that made it work but I don't understand the logic. My understanding is that the signal before a red must show yellow.