[Hanziq] [0.15] Trains with no enabled train station stutter

This subforum contains all the issues which we already resolved.
mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

[Hanziq] [0.15] Trains with no enabled train station stutter

Post by mrvn »

I have a train with 2 stops, both of which are disabled. This causes the train to start moving to the next stop and then stop the next tick because the stop is disabled. Repeat at infinitum. The train stutters and moves very slowly along the track.

Note: One train stop is disabled when a train is present using the new T <id> signal (enable if T = 0).

Loewchen
Global Moderator
Global Moderator
Posts: 8308
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Trains with no enabled train station stutter

Post by Loewchen »

What version is that?

IV 
Inserter
Inserter
Posts: 46
Joined: Thu Oct 27, 2016 2:16 pm
Contact:

Re: Trains with no enabled train station stutter

Post by IV  »

This has to be 15.11, nothing else supports the 'T' signal.

This is what I think is of the situation, although I'm might be wrong because I have incomplete information.
1. Your train decides to leave.
2. The T signal goes to 0.
3. The Station is enabled.
4. The train moved a tiny bit forward, yet so little that it still considers itself to be at the station. Thus it arrives at its destination.
1. (Again) The train decides to leave, again.
...
Since the train moves a tiny bit each time, at some point it will no longer consider itself to be at the station and it will either go to this station 'the long way' (or it will go to another station, depending on you setup).

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by Twinsen »

it's what IV said.
While it looks silly I believe it's working as intended(it's what you are telling the train to do after all).

Your described situation seems to have no gameplay value. I tested different similar use cases and they seem to work correctly, so I don't see a bug here unless you can give me more use cases.

Case
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Jun 28, 2016 9:25 am
Contact:

Re: Trains with no enabled train station stutter

Post by Case »

Hey mates.

I would like to have this declared as bug as well .. there is a bug report about this issue in the 'solved bugs section'. I disagree that this is caused by a glitchy network or has no application at all. Lemme give you an example and you can see the application in the attached save. My train world is completely driven by disabled stations. Also each station is controlled by demand. This means if I have delivered a certain amount the station only opens again when this demand falls under a certain level again (this gives room for the trains to handle multiple stations with one simple schedule (A->B))
Application:
- station names are the same for both load (A) and both unload (B) stations
- lets say you have 2 Iron Loads -> 2 trains and -> 2 Iron unloads
- both trains start at the load position (load stations are disabled because the trains are in it - unload stations are enabled because they need iron)
- both trains go to the unload stations - problem here is both trains try to go to the same station! - no problem if you disable the unload station the moment the first train arrives. So one of the A is disabled and the second train goes to the next A. So far so good
- both unload stations are enabled because there is no train
- first train goes to first B - the stations are in this state A=1 (demand is full-filled) A=1 - B=0 B=1
- second train finishes it delivery and goes back to B
- now the 'bug part start'
- both trains are in B and the stations are disabled -> both A have no demand so they are also disabled (both trains in B are going 'nuts' with the stutter bug)

Maybe it is a bit hart to read lemme try a table maybe it helps:
A A B B
0 0 1 1 (both trains at B)
1 0 0 0 (both trains on its way to A - first train arrives)
1 1 0 0 (second train reroutes to second A because the first one is closed)
1 1 1 0 (first train goes back to first B and disables the station so the second train can go to the second B - also first A does not switch on because the demand is still full-filled)
1 1 1 1 (both train are at B and disable the station - both A are disabled because there is no demand. - stutter 'bug')

Also while my save contains some 'silly' combinator stuff it is not necessary for the described use case its just set T=0 -> 1 and a second condition for the A stations.


I hope this helps a bit .. or maybe you can say why the given example is not valid. The given example is just the smallest use case - consider adding more trains and more 'silly' (sorry :) I found this comment a bit to much so I have to ride on it) combinator stuff and you have a lot of applications where the disabling of all stations in a train schedule makes perfect sense (at least to me).


The trains in this save work mostly like the above described example - Copper Cable Load LCC / Iron Plate Load LCC / Copper Plate Load LCC are the stations that are afflicted by the bug .. just watch it for one or two rounds and you will see how the bug works. The logic at the unload stations is just a hysteresis - bring X amount and come again when X less than Y.
RailWorld disabled bug 0.15.12.zip
(33.82 MiB) Downloaded 231 times

If you still consider this not as a bug I would appreciate a short description how you guys thought the disable feature should be used and maybe we can discuss about it a bit - maybe in the suggestion or general section ofc

anyway take care and have fun
Case

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by Twinsen »

Case wrote:- both trains go to the unload stations - problem here is both trains try to go to the same station! - no problem if you disable the unload station the moment the first train arrives. So one of the A is disabled and the second train goes to the next A. So far so good
This is not necessary. A properly signaled station with multiple stops will work without the circuit logic. Trains automatically go to an empty station with the same name if one is occupied. Take this bit out and I think your setup will work as intended.

But to avoid confusion I might make it so trains will never leave the station if there are no enabled stations in it's schedule, thus not creating this loop.

Your demand based trains is a good example for what I expect station disabling to be used for. You have an always enabled supply station and then the demand stations are enabled when needed. Or fully automated single train control by having only 1 station in a train's schedule on at the same time. My opinion in that there should not be systems where all the stations in a schedule are disabled, since a train with only disabled stations will stop in the middle of it's current route, but feel free to give me more examples, maybe something that won't be fixed with the change mentioned above.

Case
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Jun 28, 2016 9:25 am
Contact:

Re: Trains with no enabled train station stutter

Post by Case »

Hey mate..
Twinsen wrote: This is not necessary. A properly signaled station with multiple stops will work without the circuit logic. Trains automatically go to an empty station with the same name if one is occupied. Take this bit out and I think your setup will work as intended.
hmm I did not know this .. I tested it a couple of times but it did not work .. might be a wrong signal setting .. I will test this again

Anyway the example was just a simple use case. Let me give you an example where I think a schedule with all disabled stations is valid (at least how I see it).

Train a1: A -> B works like the above example (A is the supply station in this case)
Train b1: C -> D -> "A" -> E
As you can see in this case train b1 would try to go to A when it is not disabled and would be stuck because train a1 is still blocking it. But if you disable A the train would follow its normal route and if A is open the train will go to A. This is something I tried for low demand supplies where it is not important that b1 reaches A (worst case A is never open when the schedule from b1 is at D) in most cases b1 will reach A eventually and can grab supplies (you can also force it with some logic so that a1 will stop for a while) Like I said these are all very basic examples and it gets more and more complex the more trains you add to the network.
Also the first example has no state where the train is on track (aka there is always a station to go for) so it will not stuck at the track because both stations are dissabled. It can only happen if both trains are at station B. My save file has 3 Iron trains because I wanted to test how they behave - its not something I would use.

thanks for reopen this as bug .. I still think at least the fuel drain is a bug and should be somehow fixed .. I'm fine with a train not moving at all when no station is enabled (if he is on track and just stops - fine by me then you have something to puzzle and work around it.)

have fun
Case

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by mrvn »

Case wrote:Hey mate..
Twinsen wrote: This is not necessary. A properly signaled station with multiple stops will work without the circuit logic. Trains automatically go to an empty station with the same name if one is occupied. Take this bit out and I think your setup will work as intended.
hmm I did not know this .. I tested it a couple of times but it did not work .. might be a wrong signal setting .. I will test this again
When a train is blocked for some indetermined time it will repath. If you have stations by the same name and one is busy that can lead to the blocked train choosing the other station. This seems to work reasonably for a multi train stop terminal with all the stops in a row close together.

But that doesn't happen instantly nor over a distance. If you have stations with the same name at different places, like iron mines, then often trains will go to the same station and halfway there the station becomes busy. The trains in transit should repath right then. Disabling the station causes that regardless of wether the train is at a red signal. Also even with a blocked train the repath might (and often seems to do for mines) just choose the blocked station because it is so much nearer or because some signal to any other station is red too or something. From my experience deactivating a station is the only sure way to make trains not go there.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by mrvn »

Twinsen wrote: But to avoid confusion I might make it so trains will never leave the station if there are no enabled stations in it's schedule, thus not creating this loop.
Please do. Prior to 0.15.11 a train with no active train stops would just sit at its station waiting iirc.

And if you don't then at least make it stop repathing every tick, at least that's what I think is hapening. The train decides to go, it starts driving, it sees the station it is driving to is disabled, it stops, it tries to pick a new station but all are disabled so it picks a disabled station, it start driving again. But I realy hope you make trains not leave a station if they have no destination. It's just a waste of fuel and goes against the concept of disabling stations.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by mrvn »

stutterbug-single.zip
Single train stuttering
(3.41 MiB) Downloaded 161 times
This is a simple example with two unloading station and one loading station. All stations are disabled when busy. The loading station is also disabled if it can't fill a wagon and the unloading stations are disabled when they don't need supplies. Notice how the empty train leaves a disabled unloading station for an enabled unloading station when the loading station is disabled and then stutters there until the loading stations becomes enabled. The green lights show if a station is enabled and you see them stutter when the train stutters because the stop emits the T signal every time.

EDIT: Version was 0.15.12

Xgkkp
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Jul 27, 2016 12:58 am
Contact:

Re: Trains with no enabled train station stutter

Post by Xgkkp »

So, a couple of things to add to this (I posted a duplicate of this bug at viewtopic.php?f=7&t=48400)
  • When doing this, the Stuttering will happily move the train forward into a dead end, presumably via momentum (https://youtu.be/krZ2HghhYWg?t=1m27s)
  • It's not as simple as "happens when all stations are disabled" - I set up an SR latch (below) so that the station disables when the T signal is set but doesn't re-enable until the train has actually left. The train doesn't even try to start moving once, which seems to conflict with it's behaviour with pulsed disabling signals - I'd naively expect the behaviour to be the same (This circuit works around the problem)
fact_train.jpg
fact_train.jpg (105.89 KiB) Viewed 10146 times
(note, forgot to say that I changed the traffic light to Green=T just to be compact here)

IV 
Inserter
Inserter
Posts: 46
Joined: Thu Oct 27, 2016 2:16 pm
Contact:

Re: Trains with no enabled train station stutter

Post by IV  »

Hi Xgkkp,
Xgkkp wrote:
  • It's not as simple as "happens when all stations are disabled" - I set up an SR latch (below) so that the station disables when the T signal is set but doesn't re-enable until the train has actually left. The train doesn't even try to start moving once, which seems to conflict with it's behaviour with pulsed disabling signals - I'd naively expect the behaviour to be the same (This circuit works around the problem)
Yes, this makes sense in view of my first post in this topic. Stage 2. never happends, so the train never leaves.

Here is what I thing about the momentum issue. This is, technically, also not really a bug. It is a corner case of the following scenario:
You have a moving train with stops A and B. B is disabled. Now you disable A. The train is now in a 'no path' condition and breaks, without taking any turns. Even if this leads the train in to a dead end.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trains with no enabled train station stutter

Post by mrvn »

IV  wrote:Hi Xgkkp,
Here is what I thing about the momentum issue. This is, technically, also not really a bug. It is a corner case of the following scenario:
You have a moving train with stops A and B. B is disabled. Now you disable A. The train is now in a 'no path' condition and breaks, without taking any turns. Even if this leads the train in to a dead end.
I think that would be a bug, a dangerous one, if it happens like that. I'm talking about the without taking any turns part.

Say you have a fork in the track. The straight path is blocked by another train and the train decides to take a turn to get past it. Now a station is disabled, the train enters a "no path" and breaks , without taking any turns. And it barrels straight into the other train.

I sure do hope trains on emergency break still follow the path the had before and honor the signals they have reserved.

IV 
Inserter
Inserter
Posts: 46
Joined: Thu Oct 27, 2016 2:16 pm
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by IV  »

Hi mrvn,
I find the behaviour you expect from the train very reasonable, but I doubt that this is the designed behaviour.
I do think the following is true: if you disable the station a train is headed to, it will (almost?) immediately recompute its path. Thus it will no longer (necessarily) honour any path reservation. This is not really a problem in terms of collisions, as it now honours a new path. I'm not quite sure whether 'no path' trains on automatic reserve a path to break on (I think not).

I may be wrong, but I think nearly no rules apply to trains with no path, as this is a condition that is not supposed to happend within the current setting.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by mrvn »

I've been using station disabling quite a bit and haven't seen damaged trains yet. So there is hope the behaviour is sane.

If they recompute the path and take a different path that is fine, as long as it is a planed path and not blinding barreling straight into whatever. Using the old path already reserved just sounds like a good and trivial fallback.

One thing though. If a train is mid way and has all its stations disabled I would hope it still goes to some station, even a disabled one. I would expect it to go to the station it was already headed if no alternative is viable. Stopping in the middle of the track would be horrible. Well, if they do that then I guess you have to make sure to never disable all stations, I guess.


On that note: I would like to drive a train to a disabled station by force. Like when I open the train menu, select the dead station and click at "go to" then it should go there. If I want it to go to the next active station I would click there or just turn the train on automatic. Without this feature it is hard to reach a disabled station to check out why it is disabled.

Xgkkp
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Jul 27, 2016 12:58 am
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by Xgkkp »

RE: Train momentum into dead ends, this either might be a separate bug or "works as intended". It is annoying.

I've noticed that if I select a train at full speed and tell it to go to a new station it'll stop and then compute the path to the new station. However, during this stop it follows momentum rules e.g. if it was heading towards a dead end with a turning (that it'd always take when pathing) when you issue the command, it'll happily run into the dead end, requiring a run across the map to fix the train. Example: https://youtu.be/fc8cmyM54nI

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by mrvn »

Yes, this is anoying. Well, don't do that. You have a choice when to click.

But things to test:

1) what happens when the dead end has a red signal?
2) what happens when a train in on the dead end directly after the signal?
3) what happens when you disable the station through a signal without signals or trains (use a constant combinator and turn it on/off)
4) 3+1
5) 3+2

Xgkkp
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Jul 27, 2016 12:58 am
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by Xgkkp »

mrvn wrote:Yes, this is anoying. Well, don't do that. You have a choice when to click.
I haven't tested the other conditions yet, but "not clicking" isn't always so obvious because a high speed train with low breaking could very well go into a dead-end off screen.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [0.15] Trains with no enabled train station stutter

Post by mrvn »

Xgkkp wrote:
mrvn wrote:Yes, this is anoying. Well, don't do that. You have a choice when to click.
I haven't tested the other conditions yet, but "not clicking" isn't always so obvious because a high speed train with low breaking could very well go into a dead-end off screen.
Maybe that came out badly. What I mean is that you do have a choice there, you are watching the train, you notice when it gets stuck. You will have to walk across half your base to fix it but you can.

On the other hand, if it happens with disabled stations, it would be a silent problem. Trains would randomly get stuck with nobody paying attention. And stations get disabled magnitudes more often than manually clicking. A single productive mine will disable the station every 10 seconds and such a setup only makes sense with multiple mines.

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: [Hanziq] [0.15] Trains with no enabled train station stutter

Post by HanziQ »

Should be fixed in the next version, I'm hoping the fix doesn't break anything else.

Post Reply

Return to “Resolved Problems and Bugs”