[kovarex] [0.17.64] Train Signal Continues Sending Its Signals When "Closed" By Circuit Network Signal and is Present

Bugs that are actually features.
Post Reply
ATAD
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Aug 08, 2019 2:14 am
Contact:

[kovarex] [0.17.64] Train Signal Continues Sending Its Signals When "Closed" By Circuit Network Signal and is Present

Post by ATAD »

While attempting to create a safe train crossing gate system, I noticed the following bug in my train signal behavior:

Setup:

1. Regular train signals: "A" and "B", where signal "A" is before signal "B" in terms of handling approaching trains in that order
2. Signal "B" becomes "closed" by a circuit network signal
3. When an automatic train stops for signal B because it's "closed" (forced red) by a circuit network condition, signal "A" remains yellow (or sometimes red, depending on distance between signals) due to the presence of this train
4. (This bug, I think): If signal "A" subsequently receives a "close signal" from another circuit network condition becoming true while the train is occupying its block, signal "A" continues broadcasting its signals; and if it was yellow, it continues to appear yellow, which I think is incorrect.

Here are my screenshots showing the basic problem:

1. This selected signal is set to close when it receives a purple color signal; it's closed correctly now (attached light is correctly out) when a train is NOT present on its guarded block:
20190810151845_1.jpg
20190810151845_1.jpg (725.43 KiB) Viewed 3318 times

2. This same signal is now yellow and still broadcasting a yellow signal (attached light is yellow) when a train is present because the train was stopped by the red "closed" signal ahead of it. This signal should be closed and should cease broadcasting at this point:
20190810145538_1.jpg
20190810145538_1.jpg (631.22 KiB) Viewed 3318 times

Blueprint for my testcase and these screenshots:




Testcase:

1. Place the above blueprint and train; connect everything to a power source
2. Make sure the train is configured to go to both stops
3. Fuel the train and set it to "automatic"
4. Approach the horizontal gate from the right hand side and stay to the right to avoid setting activating the other vertical gate on the left (for now)
5. Wait for the train to approach and stop at the now-closed signal from the horizontal gate

* Observe that the closed signal correctly ceases broadcasting its color signals

6. Walk to the left to trigger the vertical gate so it broadcasts a purple color circuit network signal which should "close" the left-hand signal

* Observe that the left-hand signal is still broadcasting a "yellow" color signal to its attached light, and the left-hand signal appears yellow instead of red

Expected results:

This signal should change to red, and cease broadcasting any of its color signals under these conditions.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by quyxkh »

ATAD wrote:
Sat Aug 10, 2019 7:34 pm
2. This same signal is now yellow and still broadcasting a yellow signal (attached light is yellow) when a train is present because the train was stopped by the red "closed" signal ahead of it. This signal should be closed and should cease broadcasting
I have this as a downside (I'd probably go for "counterintuitive consequence" myself but "downside" seems okay enough) of behavior that's so valuable it makes it worth the pain here: a train doesn't count as having passed a signal until its lead car(maybe just locomotive? haven't tested)'s _center point_ has passed the signal, but the train will try to stop with its leading edge short of the signal -- so the train in your picture hasn't yet actually passed the yellow signal.

To see the value of this, put a signal immediately before and immediately after a train stop and watch the readouts. Even if you have the exit signal closed, a departing train will reserve the entry signal -- and that's how you wire circuits to react when trains want to leave stops but can't because you've closed the exit or there's another train in the exit block, it's how you wire circuits to react when a train actually does leave its stop rather than just wants to. There are lots of other behaviors you can get with this too. Perhaps simplest is that this means closing the entry signal stops an arrived train leaving, giving you control over what the train does without interfering with your readout of the exit block's condition. Hacky? Ohhhh, yeah. But that's the _fun_ of it.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2733
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by mmmPI »

I have tested the blueprint and came to the same conclusion.
If you space out your signal you don't get the yellow color held by first signal, it turns red.
From my testing, the spacing required is: place 3 signals as close as you can, get rid of the middle one.
If you try closer _center point_ has defined by quyxkh can't pass the signal.



I was inspired to make a thing where you can see it happening :
1.2MB gif
I dont know if it's a bug but i was really confused during the testings :), in your safe-crossing, this prevent the door from opening even if the train has stopped, because the signal is yellow, and not, red, which is weird because the open/close condition should tell him to go red. Yet it is stuck in yellow because it seems to be considering the train is still breaking.

ATAD
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Aug 08, 2019 2:14 am
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by ATAD »

I made an even more extreme example with more signals. Even if the signals are red from the presence of the train, they still don't "close" when they receive a "close" signal; they still broadcast their color signals.
20190810210037_1.jpg
20190810210037_1.jpg (742.5 KiB) Viewed 3251 times
Blueprint:



I don't mean any offense or anything like that, but I still think this is a bug due to this tooltip description:
20190810211002_1.jpg
20190810211002_1.jpg (725.4 KiB) Viewed 3251 times
(Although maybe this tooltip should change to note that this case is an exception to the rule; if this is spec behavior)

Also, if the "Signal B" in my first description was red due to the presence of another train in its guarded block, (instead of closed by a matching circuit network condition) this bug is still present; the other signals "closed" by the circuit network still broadcast their color signals when a train is present in their blocks.

Thanks for all the comments so far; good stuff! (I'm in Software QA BTW)

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by quyxkh »

Yup, that confused me for a bit, but think about it: there's some reason the signal's red, and there's a train in the block and the close condition's set. When there's multiple reasons to close a signal, a train in the block wins. It's closed because there's a train in the block. Circuit closure's lower priority than train-presence closure. I can make sense of this: it means the signal's red if there's a train in the block, full stop. If the signal's not broadcasting (and all the conditions broadcast) then the block's empty and the condition's met. There aren't any questions left to ask about what's going on. If circuit closure took priority you wouldn't be able to tell whether there was a train in the block. You can probably find downsides to any other choice of priorities too, but that just makes the current behavior a judgement call.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2733
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by mmmPI »

ATAD wrote:
Sun Aug 11, 2019 1:27 am
I made an even more extreme example with more signals. Even if the signals are red from the presence of the train, they still don't "close" when they receive a "close" signal; they still broadcast their color signals.
On this one i assume you mean, the pink lamp is "on", so the signal are closed by circuits, (and also because of the train) so they shouldn't make the lamps reds according to the tooltip.
quyxkh wrote:
Sun Aug 11, 2019 1:57 am
When there's multiple reasons to close a signal, a train in the block wins.
That's what i thought too

Maybe it is a edge case in which the tooltip appears misleading. Maybe it's more serious and the intended behavior is that the lamp should be turned off at this point. ( not picturing mentally the consequences of those yet despite the explanations)

I understand this is not only (or not at all) the closest signal. This is another thing than the yellow signal to my eyes. It was several weird things in one design :)

When experimenting for this one i found another behavior that i don't understand, which is contradicting the tooltip in a similar fashion viewtopic.php?f=&t=74399

The same settings as yours, except with "anything" instead of "pink". It seems that a rail signal closed by circuit is also outputing something. ( in second case without any train interaction). I am curious to see where this leads :)

Edit: I was wrong in my other case, the rail signal doesn't emit when it is closed, UNLESS A TRAIN IS PRESENT, ( which "could" be added in the tooltip to make it more exhaustive )

ATAD
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Aug 08, 2019 2:14 am
Contact:

Re: [0.17.64] Train Signal Continues Sending Its Own Signals When "Closed" By Circuit Network Signal and Train is Presen

Post by ATAD »

I finished my "safe crossing" gate system design, and now I worry that if this "bug" (if it is a bug) is fixed, it may cause my design to fail to work correctly.

So, I'd be perfectly happy or content if this wasn't fixed. (if it's even "broken", that is)

If it is "fixed", maybe there should be an option to force a train signal closed (red) using circuit conditions, but still have the signal send the signals designed for each color based on the color the signal is supposed to be (based on the presence or lack of a train.)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.64] Train Signal Continues Sending Its Signals When "Closed" By Circuit Network Signal and is Presen

Post by kovarex »

Yea, if the signal is red because train is in the block, it has priority, so not a bug.

Post Reply

Return to “Not a bug”