Page 1 of 1

[1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 4:09 am
by DaemosDaen
Setup:
A rail network split off with 2 stations that have 4 rail lanes associated with them. Each station allows access to it via a set of logi gates at the intersection that is closed unless there is a need for the material in at that build

Station 1 is for green chips and is only connected to lanes 1,2, and 4. Limit 1 train
Station 2 is for Red chips and connects too all 4 lanes, green chips are produced onsite. Limit 1 train

Rail Lane 1 allows Iron trains through, this is closed to either station unless the station requests it by sending an Iron signal on the red line coming from the station area. This happens if there is less then 5000 Iron in the logistics storage
Rail Lane 2 allows Copper Trains through, this is closed to either station unless the station requests it by sending an Copper signal on the red line coming from the station area. This happens if there is less then 5000 copper in the logistics storage
Rail Lane 3 allows Plastics trains through, this is closed to either station unless the station requests it by sending an Plastics signal on the red line coming from the station area. This happens if there is less then 5000 Plastics in the logistics storage. Please note that this station does not connect to station 1 at all.
Rail Lane 4, this lane does not close as this is for pick up trains and PAX trains.

I have encountered the following two scenarios;

1.) Station 1 has requested the Plastics train, there was no way for it to get to that station directly. The train was wanting to look through Station 2, but was not able to (fortunately) because Station 2 did not need any Plastics so the train could not loop through and use the 4th lane to contaminate my green chip area. Please note that the stations were not set up to disable themselves when they did not need anything. Both the Iron and Copper lanes were opened for the station, but the station was fixated with the Plastics train. As apart of the troubleshooting, I re-set up the deciders to enable/disable each station.

Both station are set to enable if 5000 of anything is needed AND there is no train in the station already.

2.) Current issue: Station 1 needs nothing so all lanes are closed for the moment. Station 2 needs both Iron and Copper, however the Station is calling for the Plastics train, even thought the signals for the plastics lane are closed. This can create a scenario where supplies get stuck along the tracks and copper/iron are wanting to go to station 1. I have saved the factory in this state and will be hosting it here: https://1drv.ms/u/s!AlpZQdyrEQxIiPAzYAz ... A?e=VUPIWA

Notes: The logic mess at each station turn off is an attempt to create the functionality of a chain signal that one can open/close. Each Lane has an open/close at the end of each yard that is opened when a station need a resource. The 'random' Cargo Wagons at the dead-ends of this area are there to make it easier to work with the logic mess, without it, they would never close. And yes I am transporting in water for my nuclear power plants by train.

As I was typing this, station 1 started to request iron, however the copper train keeps trying to go there because the yard is open for station 2, but station 2 keeps wanting plastics, which may never actually get there with the factory off. (no research)

Actual chain signals that I could open/close would be the easiest fix for my set up btw :p.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 4:15 am
by Loewchen
You describe a setup that does not work. What exactly is the bug?

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 12:23 pm
by Klonan
I can't see described anything actionable, I am moving this to gameplay help

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 6:58 pm
by Yoyobuae
Loewchen wrote:
Thu Nov 26, 2020 4:15 am
You describe a setup that does not work. What exactly is the bug?
I was thinking the same thing.

"My setup doesn't work therefore it's the game's fault" <<< seen posts like this far to many times.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 7:11 pm
by Zanthra
If you have different trains for different resources all scheduled to deliver at the same train station, and are using circuits to control signals to prevent the trains for unneeded resources from reaching the destination, then you probably wont be able to use the train limit effectively, since a train waiting at a rail signal closed by circuit condition will still take up the reservation for that station.

I would recommend putting waiting stations on Rail lines 1 2 and 3, and add them to the supply trains before the final destination, then set the trains to wait for a circuit condition to leave the lane for delivery. Instead of reserving the final destination, they will reserve the waiting stations until the final destination calls for them.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 7:24 pm
by DaemosDaen
Zanthra wrote:
Thu Nov 26, 2020 7:11 pm
If you have different trains for different resources all scheduled to deliver at the same train station, and are using circuits to control signals to prevent the trains for unneeded resources from reaching the destination, then you probably wont be able to use the train limit effectively, since a train waiting at a rail signal closed by circuit condition will still take up the reservation for that station.

I would recommend putting waiting stations on Rail lines 1 2 and 3, and add them to the supply trains before the final destination, then set the trains to wait for a circuit condition to leave the lane for delivery. Instead of reserving the final destination, they will reserve the waiting stations until the final destination calls for them.
Wait stations (via a FiFo yard for each) are already on the line, they get stuck after this stop as the drop-off station will only call one and will not call one that actually has an open signal. I have tried this without the limit, but the 'fake closeable chain signal' is not fast enough and trains get stuck in that block.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 7:31 pm
by Zanthra
DaemosDaen wrote:
Thu Nov 26, 2020 7:24 pm
Zanthra wrote:
Thu Nov 26, 2020 7:11 pm
If you have different trains for different resources all scheduled to deliver at the same train station, and are using circuits to control signals to prevent the trains for unneeded resources from reaching the destination, then you probably wont be able to use the train limit effectively, since a train waiting at a rail signal closed by circuit condition will still take up the reservation for that station.

I would recommend putting waiting stations on Rail lines 1 2 and 3, and add them to the supply trains before the final destination, then set the trains to wait for a circuit condition to leave the lane for delivery. Instead of reserving the final destination, they will reserve the waiting stations until the final destination calls for them.
Wait stations (via a FiFo yard for each) are already on the line, they get stuck after this stop as the drop-off station will only call one and will not call one that actually has an open signal. I have tried this without the limit, but the 'fake closeable chain signal' is not fast enough and trains get stuck in that block.
Wire the circuit network to the train station instead of the signal, and have the train departure condition based on that signal. They won't reserve the next station until the departure condition is met.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 8:08 pm
by DaemosDaen
Klonan wrote:
Thu Nov 26, 2020 12:23 pm
I can't see described anything actionable, I am moving this to gameplay help
The only way I know to explain this; All logic is perceived. White is currently Train logic, Green is the change added by setting a limit in the station. Red is the part I perceive to be a bug/missing.

1.) Train finds the nearest station on the network
2.) Train check to see if the station has a limit
3a.) If there is space on the reserve list the Train tells the station to add it to the list of trains heading for that station
3b.) If there is no space on the reserve list train removes it's self from that station's reserve list
looks for the next nearest station with the same name
goes back to step 2
4.) Train looks for an open path to the station.
5a.) on finding an open path, the train goes to station
5b.) on failure to find a path, train removes it's self from that station's reserve list
looks for the next nearest station with the same name
goes back to step 2

If everything. but the red part is not close to the intended logic of the station limit, then I apologize and am confused as to how this works.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 8:18 pm
by Zanthra
A train with no path will not reserve a station.

The trains pathfinder is how it finds the nearest station, so #4 is concurrent with #1 in my understanding.

Basically.

1) Pathfinder searches all routes ahead of the train.
2) If a path finds a destination station:
2a) If the station has free reservations, it takes a reservation and finishes pathfinding with that path.
2b) If the station does not have reservations, continue with 1.
3) If all routes are exhausted with no valid stations found, pathfinding fails with "No Path" message.

Note that closed rail signals don't stop a train from pathing through it:
When the rail block is guarded by a rail signal set to red by the circuit network -> Add a penalty of 1000.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Thu Nov 26, 2020 8:31 pm
by DaemosDaen
Zanthra wrote:
Thu Nov 26, 2020 7:31 pm
Wire the circuit network to the train station instead of the signal, and have the train departure condition based on that signal. They won't reserve the next station until the departure condition is met.
I have a signal just after the yard stations that serves the purpose before, I had the issue where the condition would be true for multiple trains I can see how this might clear up my specific issue. I will have to try wiring the stations and testing this out when I get home. Gonna feel stupid if it's this simple, heh.

Still I believe there is a bit of logic missing from the station limit as mentioned in my reply to Klonan's post.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Fri Nov 27, 2020 2:35 am
by DaemosDaen
Zanthra wrote:
Thu Nov 26, 2020 7:31 pm
Wire the circuit network to the train station instead of the signal, and have the train departure condition based on that signal. They won't reserve the next station until the departure condition is met.
I can confirm that this did not fix anything as the issue is that stuff is going to the wrong station taking up the station reservation. Example Station 1 is needing copper while the iron train is reserved to that station even thought it has an open road to station 2.

I don't even think the penalties for closed signals are working as intended here

What seems to have fixed it; setting the allowed trains to 3 seems to have smooth it all out I think. I guess it need 1 for each supply type maybe.

Still say the trans should be able to remove themselves from the station if they sit too long.

Edit: nope, it's back to requesting too many of the same type of material making it pointless again. I guess I gotta work on trying to get the fake closable chain signals working properly.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Fri Nov 27, 2020 4:32 am
by Zanthra
DaemosDaen wrote:
Fri Nov 27, 2020 2:35 am
Zanthra wrote:
Thu Nov 26, 2020 7:31 pm
Wire the circuit network to the train station instead of the signal, and have the train departure condition based on that signal. They won't reserve the next station until the departure condition is met.
I can confirm that this did not fix anything as the issue is that stuff is going to the wrong station taking up the station reservation. Example Station 1 is needing copper while the iron train is reserved to that station even thought it has an open road to station 2.

I don't even think the penalties for closed signals are working as intended here

What seems to have fixed it; setting the allowed trains to 3 seems to have smooth it all out I think. I guess it need 1 for each supply type maybe.

Still say the trans should be able to remove themselves from the station if they sit too long.

Edit: nope, it's back to requesting too many of the same type of material making it pointless again. I guess I gotta work on trying to get the fake closable chain signals working properly.
I think there is a race condition where if the iron lane is opened as long as the station need resources, then a second train could be signaled to supply the station if it reaches the station before the unloading can clear the resource request. It then will sit and wait on the chain signal to reach the destinatnion station, and potentially path to the wrong station if the other one opens.

There is a "Read Trains Count" that you could use. If the station needs a resource, and the trains count is 0, then send the circuit signal to allow the train to depart the previous station. As soon as a train is fulfilling the request, no further trains are signalled. Only after any called trains are done unloading will the trains count go back to 0, and another train can be called.

If you are concerned about a train going to the other station with the wrong resource if it opens, then you can call forward plastic only if it does not also need iron or copper, and call forward copper only if it does not also need iron. Then it prioritizes iron, then copper, then plastic, and only calls one resource forward at a time, and a train is never waiting at a signal.

Re: [1.1.1] Limited Stations cause Train pathing issues.

Posted: Fri Nov 27, 2020 6:41 am
by Zanthra
Here are the modifications I made:

Train Stop has "Read trains count" enabled, and the red circuit network is connected on the input of the two combinators near the stop. Trains limit should be set to 1 although it's not in the screenshot. I was thinking it would be irrelevant, and it should be as long as the manually controlled signals approaching the stop don't mess with the path cost too much.
Train Stop.jpg
Train Stop.jpg (703.78 KiB) Viewed 2994 times
An additional combinator is added to pass the Iron, Copper and Plastic request signals to the green network only if trains count, C = 0.
Additional Combinator.jpg
Additional Combinator.jpg (681.46 KiB) Viewed 2994 times
Trains depart only if they are requested, and the resources parked to the left are not requested.
Train Conditions.jpg
Train Conditions.jpg (590.33 KiB) Viewed 2994 times