Can you synchronize & time signals over long distance?

I'm working on a (over-engineered) project which involves having a storage depot before a station in which trains wait until a space is free at the station. I've done all the infrastructure and I need a solution with the signaling & logic behind the system. Here is the infrastructure:

Part of the depot & part of the station

On the top left you can see the depot which consists of 9 holding cells (A1, A2, A3, B1, B2, B3, C1, C2 & C3). Each cell stores trains for a particular platform of the station, of which there are also 9 (P1 to P9). So for P1 the trains wait at depot cell A1, for P2 the trains wait at cell P2 and so on... Each station platfor is designed to hold 2 trains loading + 1 train waiting:

The station

Whenever there are 2 trains loading and another waiting behind the station sign S1 turns red and won't allow another train in. Now let's look at the depot:

Depot cell A1, A2 & B1 (As well as parts of other cells).

What I want is to synchronize the signs depot A1 with sign S1 from the station platform P1 (Once I figure out one I'll do the rest myself). This would mean that only 3 trains will be able to go to the station immediately and then they will stop at the depot, but there is a problem: If the train leaves the depot to fill up the space, there is not enough time for it to turn the signal S1 red and more trains will leave, coughing up the system. There would be a few ways to solve it here:

  1. Have the signals A1 on a timer (Once they've turned red, they have to stay red for a certain amount of time): This allows 1 train to leave, which then turns all signals red due to the fact that only 1 path is available, which is taken by the leaving train. Then after a while the signals A1 can turn green again but at that point, hopefully, the train is already at the station and turning signal S1 red. this should mean A1 also stays red!
  2. Using an edge detector somehow: We can use an edge detector (a device that will turn the A1 signals green briefly everytime signal S1 turns red). this way only a single train is dispatched at the time again due to the fact that 1 train reserves the path and blocks all other trains from going. Both of these methods only work if there is at all times just a single path for trains to take therefor each holding cell has a bypass which allows previous holding cells to pass them while'st limiting the amount of possible paths for those cells to 1.

I've looked at using programmable signs which looks promising as well as "routefinding restrictions" (Both in the JGR Patch Pack v0.32.3). Preferably I'd like to not use extra tracks (I know there is a way to combine the block behind sign S1 and after the signs A1 and turn them in a single block, obviously you would need to replace the path based signals). Therefor I'm looking for maybe a signal based solution or for a timetable solution? Either that or a timetable solution (IDK just throwing the idea there if anyone knows).

Is there a clean way to do this without changing the rail layout too much? Here is a zoomed in screenshot of the setup: https://imgur.com/a/vINnp6B

In it's current form the holding cells A3, B3 & C3 don't work as there are multiple paths for trains to take and therefor multiple trains will depart at the same time, I'll be able to fix this though! Also there are also other systems included in the screenshot, including a very elaborate waypoint system which I hope doesn't confuse people. In essence, there are priority tracks where higher priorities have lower chances of being stopped by train merging, at some points these higher priorities are in the most inner track while at other points they are highest at the most outer track. I'm sorry if this is confusing but it works for me! Also I'm sorry for those who like right hand driving for trains...

Thanks in advance for the help! I'd love to keep people updated on how this project turns out!


Using solution #2

An edge detector in OpenTTD can be constructed via a NOT-gate and inverted detector. Take a look over at the Logic page of openttdCoop. This details various ways you can construct gates. AND and OR gates can be constructed using only signals; but NOT gates and such require 2 trains per gate; so this construction with 3 depots would require 12 trains and 6 gates. Each gate takes up about 3x3 tiles so you're looking at a footprint of about 12x7 tiles with added input/output lines.

Note that you need to disable 90 degree turns for trains for these constructions to function.

Note that these gates do not allow signals to create dangerous situations; such a gate would only serve to 'buffer' a train in your holding pen, not to limit traffic; it will not flash green if the block behind it is unsafe.

In addition, if there is no train at the station platform or buffer at all, then your edge detector will stay red and never turn green (as it sits in front of the station platform). Thus there must always be some trains buffered or the station will deadlock and thus stop working.

I have a simpler suggestion though:

Simply chain combo signals. If there is a row of combo signals from the platform to the holding pen (it is all effectively one signal block) then only one train can be in that whole section of track. Put 7 entry signals near the end of the last buffer; then chain combo signals until you reach the platform. The pathfinder will distribute the trains automatically due to the penalty associated with taking the same route as a previous train.

This means getting rid of the merge and split between the buffer and platforms: give each platform its own buffer. Instead, when wanting to distribute lots of trains between a number of platform groups, use a proper splitter before the buffer instead; not after. There's various types. Probability splitters will get you a roughly even distribution, while a simple gap splitter will fill each line from shortest- to longest-distance (Pathfinder-preferred order) to capacity. Gap splitters are best used for stations as they require no moving parts, and you don't care which platform is used as long as no platform is overwhelmed.