Ignore delivery timeout when train is at station

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Ignore delivery timeout when train is at station

Post by wvlad »

Sometimes unloading to unequally filled chests may cause waiting. Sending another train with the same delivery will only make it worse. I suggest to add a check for train state and ignore delivery timeout when it is one of these:
defines.train_state.on_the_path
defines.train_state.arrive_signal
defines.train_state.wait_signal
defines.train_state.arrive_station
defines.train_state.wait_station

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Ignore delivery timeout when train is at station

Post by Optera »

Stuck trains unable to un-load will be forced out of the station after stop timeout.
Delivery timeout should be set to longest round trip time + stop timeout.

Generally it's up to the player to come up with builds that ensure equal loading and unloading. You can find some ideas on how to solve this in the design thread.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Ignore delivery timeout when train is at station

Post by wvlad »

Stations are already over-complicated and take too much place for such common entity (if you use belts). I forgot to say that I disabled stop-timeout for unloading because I would never want a loaded train to go into depot since there is no way to get rid of unwanted fluids automatically. And of course I would not even want to get rid of it, instead I would prefer to see a warning signal so I have to come and fix the thing.

What's the point at all in this timeout? I think the only one - when a train get destroyed by enemies. Only in this single case you would want its delivery to be simply discarded. In all other cases there is an issue which should be fixed in-game manually and sending more trains would only make things worse.

btw If it wasn't lua I would quickly make my own mod where you just place a station entity and specify requested items in its settings instead of all this inserters-wires-belts-splitters mess for just common single train station. Unfortunately it takes too much time in language like lua.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Ignore delivery timeout when train is at station

Post by Optera »

Timeouts are fail safes and should never trigger when LTN is used as intended.

Stop timeout prevents delivery timeout to kick in when trains can't finish loading/unloading by forcing trains out of the blocked station.
As your intitial post implies your stations block trains due to imbalanced unloading either due to requesting more than your stations buffers can hold or loading itself being imbalanced.

Delivery timeout serves as indicator that player intervention is required e.g. trains running out of fuel, deadlocks. There may be other mods out there displaying that info directly. They should work perfectly fine alongside LTN as long as they don't start editing train schedules e.g. Smarter Trains.
Invalidating deliveries when trains are changed or destroyed is handled in events and therefore fires immidiatly.


Even without mods like wide chest balanced loading/unloading hardly takes more space than imbalanced.
With builds like zuris load balancer it actually takes less space and processing time than the belt balancers often thoughtlessly slapped around stations.
Image

Since you claim to be a developer yourself a bit of binary and arithmic logic shouldn't feel overly complicated to you.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Ignore delivery timeout when train is at station

Post by wvlad »

Yeah, this would help to balance chests for single wagon. But this is not what I mean by unbalanced stations.

1. Unbalanced usage of incoming items in 3-wagon* requester stations. There is no 100% throughput 3-1..3 belt balancers with balanced input.
2. Unbalanced loading:
I have a 4-wagons loader station that accepts 2..4 wagon trains.
I have multiple requesters with 2..4 wagons that use it. And most of them use 3 wagons.
It leads to a situation where first 3 wagons chests are more "popular". E.g. I have 1-3 wagon chests empty but 4th wagon chest is full. Then another 3-wagon requester sees like there are enough items and sends a train. That train will stop there and wait while enough items are produced for first 3-wagon chests. In this case it would be a really bad idea to trigger timeout causing another train to be sent and another... You got the idea, right?

*Wagon = cargo wagon.

Also as I already said if train was not destroyed and there is some cargo/fluid inside it shouldn't continue to depot. So with discarding its delivery I would toggle it to manual mode and show some warning for player.
Though I'm agree that trains shouldn't wait it's still better for them to wait than loosing items and dealing with their cargo in depot (and multiple deliveries can be discarded this way).
Last edited by wvlad on Fri Jan 19, 2018 12:23 am, edited 2 times in total.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Ignore delivery timeout when train is at station

Post by wvlad »

3. Unbalanced unloading. Personally I use min=max train length for unloaders to avoid waiting but there is still another issue when requested amount is less than train capactiy:
Loader station after previous loading have some wagon chests full and some empty which causes next train wagons to be filled not equally. Then when such train comes to a requester station its chests will be filled not equally too. This will make station to look like it has enough items but they are in a one wagon chests which limits output. It can be partially solved by calculating things and matching chest locked slots with requested amount but why do I have to calculate this each time I change requested amount in a station?

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Ignore delivery timeout when train is at station

Post by Optera »

wvlad wrote:Yeah, this would help to balance chests for single wagon. But this is not what I mean by unbalanced stations.
wvlad wrote:2. Unbalanced loading:
I have a 4-wagons loader station that accepts 2..4 wagon trains.
I have multiple requesters with 2..4 wagons that use it. And most of them use 3 wagons.
It leads to a situation where first 3 wagons chests are more "popular". E.g. I have 1-3 wagon chests empty but 4th wagon chest is full. Then another 3-wagon requester sees like there are enough items and sends a train. That train will stop there and wait while enough items are produced for first 3-wagon chests. In this case it would be a really bad idea to trigger timeout causing another train to be sent and another... You got the idea, right?
Zuris design works on whole trains. I used it to blanace 2-8 trains myself before I had to switch to merging chests + loader designs to tickle out a bit more ups for my megabase.
Before you misunderstand, I use "wagon > stack filter inserter > merging chest > loader" to get most out of each entity.
wvlad wrote:1. Unbalanced usage of incoming items in 3-wagon* requester stations. There is no 100% throughput 3-1..3 belt balancers with balanced input.
Loaders connected to a warehouse or wide chest are highly effective balancers for any n-m split.
wvlad wrote:Also as I already said if train was not destroyed and there is some cargo/fluid inside it shouldn't continue to depot. So with discarding its delivery I would toggle it to manual mode and show some warning for player.
Though I'm agree that trains shouldn't wait it's still better for them to wait than loosing items and dealing with their cargo in depot (and multiple deliveries can be discarded this way).
Depots should be treated as train service areas. Remove fluid/item residues and refill locomotives with fuel.
A logistic requester & provider not only requests fuel but also allows for easy recirculation of cleaned out items when set to high provide priority and low provide threshold.
wvlad wrote:3. Unbalanced unloading. Personally I use min=max train length for unloaders to avoid waiting but there is still another issue when requested amount is less than train capactiy:
Loader station after previous loading have some wagon chests full and some empty which causes next train wagons to be filled not equally. Then when such train comes to a requester station its chests will be filled not equally too. This will make station to look like it has enough items but they are in a one wagon chests which limits output. It can be partially solved by calculating things and matching chest locked slots with requested amount but why do I have to calculate this each time I change requested amount in a station?
To me it seems harder to engineer a station loading trains wagon by wagon than one loading each wagon simultanously.
Once again use zuri loader or chest mods and wire the buffer to ltn not what's before the buffer.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Ignore delivery timeout when train is at station

Post by wvlad »

Depots should be treated as train service areas. Remove fluid/item residues and refill locomotives with fuel.
Without special mods you can't unload fluids without filtering them and you know you can't filter them currently.
Once again use zuri loader or chest mods and wire the buffer to ltn not what's before the buffer.
I use chest mods but only for 1 wagon length, not for whole station - because longer chest can be misused as a super fast belt and having that in game would ruin it for me. And I still don't use loaders because they seem cheaty to me. This is why I would prefer to have a single "station" entity incorporating all those cheaty things so I can't use them individually.

Thanks for pointing me to using wide chests for balancing belts, that's a good idea! I just realized that I can use a normal chest to balance 1>3.
Zuris design works on whole trains.
I don't see how it solves my case. Initially chests are filled equally but shorter trains consume only from first chests. Then the numbers are still > threshold because the last chest is full. But the next short train can't get items from it and waits for first chests to fill. The only way to solve this is either using merged chests like you said (which is a cheat for me if I can use them outside of station) or some complicated stuff to rearrange buffered items between chests.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Ignore delivery timeout when train is at station

Post by Optera »

wvlad wrote:
Depots should be treated as train service areas. Remove fluid/item residues and refill locomotives with fuel.
Without special mods you can't unload fluids without filtering them and you know you can't filter them currently.
I'm using Inventory Sensor to get fluid/wagon and fix the rounding "error" so controlling one pump/fluid type becomes possible.
If you go all out with such a setup you can clean 11 different fluids from a wagon.
wvlad wrote:
Zuris design works on whole trains.
I don't see how it solves my case. Initially chests are filled equally but shorter trains consume only from first chests. Then the numbers are still > threshold because the last chest is full. But the next short train can't get items from it and waits for first chests to fill. The only way to solve this is either using merged chests like you said (which is a cheat for me if I can use them outside of station) or some complicated stuff to rearrange buffered items between chests.
If threshold = all chests fully loaded it would work, but addmitadly that's a huge amount of items just sitting around.

I don't get the "is too op for me since i can use it for other stuff" argument. It's your game and you decide what you use and how.
Many games have cheesy exploits, if you feel you have to use them just because they exist factorio is the wrong game for you to begin with. See bot vs belt debate.

Post Reply

Return to “Logistic Train Network”