[0.17.50] Gate Read Sensor reacts multiple times to slow train
Posted: Wed Jun 19, 2019 1:35 pm
I have this train-counting configuration:
The gate is set to Read Sensor. The bottom arithmetic combinator receives this input and adds 0, producing a different output. The decider combinator checks whether the undelayed (gate) input is greater than the delayed (0-added) input and emits 1. The top arithmetic combinator adds the decider's output to a signal.
This all works beautifully if the train goes quickly through the gate. In some places, I have some routing logic just before the gate. Sometimes, trains stop at the routing signal. In these cases, when the train starts again and passes through the counter, multiple "open" events of the gate will occur.
I can reproduce this manually by putting a train some 20ish blocks away and driving through the gate, accelerating all the time. If I do that, the count is correct. If I instead start ~5 rail blocks away, where the gate has not been triggered to open yet, then multiple trains will be counted.
The effect is more pronounced if I drive backwards through the gate.
Note: this is not the "nothing happened for 5s, so the gate closed" effect. Visually, the gate remains completely open at all times. To trigger the bug, the train doesn't need to stop or decelerate. Continuous acceleration toward the gate will also trigger it, as long as the speed at which the train passes the gate is sufficiently slow.
The gate is set to Read Sensor. The bottom arithmetic combinator receives this input and adds 0, producing a different output. The decider combinator checks whether the undelayed (gate) input is greater than the delayed (0-added) input and emits 1. The top arithmetic combinator adds the decider's output to a signal.
This all works beautifully if the train goes quickly through the gate. In some places, I have some routing logic just before the gate. Sometimes, trains stop at the routing signal. In these cases, when the train starts again and passes through the counter, multiple "open" events of the gate will occur.
I can reproduce this manually by putting a train some 20ish blocks away and driving through the gate, accelerating all the time. If I do that, the count is correct. If I instead start ~5 rail blocks away, where the gate has not been triggered to open yet, then multiple trains will be counted.
The effect is more pronounced if I drive backwards through the gate.
Note: this is not the "nothing happened for 5s, so the gate closed" effect. Visually, the gate remains completely open at all times. To trigger the bug, the train doesn't need to stop or decelerate. Continuous acceleration toward the gate will also trigger it, as long as the speed at which the train passes the gate is sufficiently slow.