Page 1 of 1

[0.18.9] Green train signal with train on both sides

Posted: Sat Feb 29, 2020 1:44 pm
by planetmaker
Consider the setup as in the screenshot and savegame.

There is a station which is occupied by a train with a signal immediately in front of the station and one immediately after the station.

Why is the signal in front of the station (thus where the train is standing on, gps -96,-48) also green while the train is waiting on the station beyond it?

Re: [0.18.9] Green train signal with train on both sides

Posted: Sat Feb 29, 2020 8:25 pm
by disentius
Interesting.
Tried to trace what happens, came up with this.

On a normal railsegment, the train default stop point is here.(small red circle)
Train stop point - railsegment.png
Train stop point - railsegment.png (872.94 KiB) Viewed 1256 times
If you put a station next to a signal the behaviour changes.
1. if the signal next to the station is not reserved(yellow) the train stop point changes to here, after the signal:
train stop point - signal not reserved yet.png
train stop point - signal not reserved yet.png (120.9 KiB) Viewed 1256 times
2. two ticks after the signal is reserved the train stop point is moved to here make sure the train aligns with the station:
train stop point - two ticks after signal reserved.png
train stop point - two ticks after signal reserved.png (211.18 KiB) Viewed 1256 times
This point is exactly on the boundary between the station segment(?) and the segment guarded by the rail signal. The rail signal changes from reserved to green when train speed reaches 0 (parked at the station)

3. one tick after the train is starting to leave it reserves the signal (yellow) and a tick later it crosses the segment line and the signal becomes red.

Test setup:

Re: [0.18.9] Green train signal with train on both sides

Posted: Tue Jun 09, 2020 12:28 pm
by boskid
To get train properly aligned with pumps there is part of a train movement logic that makes sure train is not closer than 2 (arriving distance) from train stop because it would not be possible to align to a given train stop by only moving forward. Since train moves up to a point where it will have distance of 2 from train stop, there is exactly 1 straigh rail that is not going to have train on it when train stops. Signal was first reserved because train path was going through it but when train stopped, signal turned green because of no train on a rail. There is not much value added for fixing this, i do not want to make train move forward a little to start occupying next block since it could cause alignment issues and i do not want to provide extra condition for a signal to turn red when there is no train in next block when there is immediately a train stop that has train stopped.

Moving this to not a bug. In the end, train (head joint of head rolling stock) did not pass a signal so when train is stopped, block ahead is not occupied and so green signal is a correct value.