OpenTTD: Semaphores

Disclaimer: I usually use two-way semaphores. Never quite figured out one-way ones properly.

The absolute easiest thing to do would be to avoid semaphores and build two separate tracks, each leading to a separate slot in the double station.

However, if you want to overlap a part of the track, you pretty much have to set up semaphores at each intersection to make sure your trains don't crash into each other. The basic idea is that once a train passes through a semaphore, the semaphore turns red behind it until the train passes through another one further down the track.

You also have to make sure you set them in a way that doesn't result in a deadlock. For example, if you had three semaphores set up like this:

enter image description here

and a train passed through semaphore Y while your other train's heading back from the oil refinery station, you can end up in a situation where semaphor X will block both trains and they'll sit there forever (until you notice that your profits are dropping like crazy).

One way to mitigate deadlocks is to leave enough space between semaphores to fit the whole train and try to avoid chokepoints like the semaphore at X would be.

My advice for you is to start by simplifying your tracks. :) But if you'd rather not, I'd start with the following arrangement:

enter image description here

I think you might run into trouble at that "bottom" end of the station where you don't have a semaphore-able space to protect each station track, but it's been a while and I'm not sure if that's actually going to be a problem.