Factorio

Factorio

View Stats:
pat Oct 5, 2023 @ 3:54am
Is there a smarter "inactivity" condition?
Once the game starts really getting busy and I need optimum train throughput, I often run into the same problem. A station that was once extremely busy (and may be again) is getting bogged down with lines of trains waiting to get through, because the need for a product has temporarily died down to a trickle.

I have the schedule at that station set to:
Empty cargo
OR
15 seconds passed
OR
2 seconds inactivity

But one of the chests that the train is emptying into is very slowly being emptied. This means that the "inactivity" condition is never met and the train is going to sit there for the entire 15 seconds while one item per second is offloaded.

I'd love to have some sort of condition where if activity falls below a certain threshold, the train moves on. Or possibly if the item count in my bank of chests reaches a certain level. Is there anything vaguely like this, or some other method that would work?

With all due respect, if your advice is simply "design your train network better", please assume that you've already offered that. I'm just looking for an answer to that specific question. Thanks.
< >
Showing 16-30 of 45 comments
knighttemplar1960 Oct 5, 2023 @ 10:40am 
I'm going a bit different direction with this one. If train traffic is a problem why set to anything other than empty cargo? With inactivity and time passed conditions set a full train pulls in unloads what it can and sits there unloading 1 item per second until the time passed clock is met.

That means you have a full train coming in and a partially empty train leaving which just increases train traffic. Obviously not using a full train's worth of material between deliveries. You could just use the cargo empty condition and let the train sit in the station until its empty. At a rate of 1 item per second being used your train station buffer should hold more than enough to let production continue without interruption until the next full train arrives. This makes the train itself an extra buffer at the station and keeping it off the main rails until its empty will help reduce train traffic.
knighttemplar1960 Oct 5, 2023 @ 11:03am 
This post is about how to balance robot requests better.

Logistic robots use a weighted round robin delivery system. If you have different levels of material requests in one network the weighting system messes up the robots assignments and ends up with wildly different balance levels in the chests until it gets to the point that all chests but a couple are empty and the one or 2 that still have material are half or more full.

In this smelter system that I set up when I first started playing Factorio I had plate requests set to 4,800 at the loading stations, and ore requests at the smelters set to 2,400 (full chests for each material) and nuclear fuel requests to keep the trains fueled set to 3. After a few deliveries the ore unloading area looked like this (and stayed this way):
https://steamcommunity.com/sharedfiles/filedetails/?id=2385270665
and the plate loading area looked like this:
https://steamcommunity.com/sharedfiles/filedetails/?id=2385271093
Someone told me that uneven requests caused this (I think it was Nailfoot) so I set plate and ore requests both to 2,400 so the ore chests would be full and all the plate chests would be half full.

After a few more rounds of deliveries the unloading stations looked like this:
https://steamcommunity.com/sharedfiles/filedetails/?id=2386206436
and the plate loading stations looked like this:
https://steamcommunity.com/sharedfiles/filedetails/?id=2386205694
It still wasn't perfectly balanced but it was MUCH smoother. The robots spent less time delivering and more time idling so I was able to reduce the number of robots in that network by about 20% and use them elsewhere.
pat Oct 5, 2023 @ 2:12pm 
Originally posted by knighttemplar1960:
I'm going a bit different direction with this one. If train traffic is a problem why set to anything other than empty cargo?

The problem is that demand fluctuates. I'll have a green circuit factory that wants copper wire. It can't get copper wire fast enough, so I have to build a copper wire factory WAY over there where there's a decent copper ore outcropping. It takes a while for the trains to bring the wire all that distance, so I assign a lot of trains. At some point, for whatever reason, the need for green circuits evaporates, and if the only condition is "empty cargo", all those trains are going to start backing up.

And I'm sure there are those that will have other solutions, but sometimes it's good to get a specific question answered.

I could ask for a really good enchilada sauce and someone replies that I should make nachos instead because they're better. Well that may very well be true, and I'll definitely make nachos at some point, but I still feel my life would be more complete if I knew how to make enchilada sauce.
brian_va Oct 5, 2023 @ 2:32pm 
Originally posted by pat:
so I assign a lot of trains. At some point, for whatever reason, the need for green circuits evaporates, and if the only condition is "empty cargo", all those trains are going to start backing up.

train limits might be something to look into as well as the other solutions.
malogoss Oct 5, 2023 @ 3:24pm 
I read the OP many times and there has to be something I'm missing. I'm sure there's a very simple solution, but no screenshot, no video, it's tough to guess.

Usually, unless you unload directly into assemblers or something similar, unloading is done like this:
wagon --> inserter --> chest
And then the chest is emptied directly by robots, or the items in the chest are moved by another inserter.

Say the chest can hold a maximum of 4800 items.

What if the inserter only started working when there are less than 4000 items in the chest, and then worked non-stop until there are at least 4500 items in the chest. At 4500 it stops, waits until the items in the chest drop under 4000 again, etc...

That would solve your problem. The inserter would be active for short bursts and inactive for periods of time long enough that the station's "inactivity" condition would be met.

And that is what an SR Latch is for. I won't go into details. If you need a tutorial, here's one.

https://youtu.be/Wm4jiFDo0Lk?si=nQps0H-NoZoSWe9S
Last edited by malogoss; Oct 5, 2023 @ 10:38pm
pat Oct 5, 2023 @ 3:56pm 
Originally posted by malogoss:
And that is what an SR Latch is for. I won't go into details. If you need a tutorial, here's one.

https://youtu.be/Wm4jiFDo0Lk?si=nQps0H-NoZoSWe9S

Thanks. This is something I'm totally unfamiliar with.
kremlin Oct 5, 2023 @ 4:29pm 
It's just plain bad practice to set the trains to have a constant idle loop, you're a lot better off setting your trains up so they idle at the loading stops when the unloading stops can't take a trainload. Then you don't have traffic problems. There is simply no traffic when the resources aren't being used.
PunCrathod Oct 5, 2023 @ 4:36pm 
I had a thought. I am assuming you are carrying multiple different items on the same train. Instead of doing complicated circuitry just set the exit condition to be item a=0 or item b=0 or item c=0... item x=0. This way the train leaves when one of the item types it carries is empty from the train.
Last edited by PunCrathod; Oct 5, 2023 @ 4:36pm
Originally posted by pat:
Originally posted by knighttemplar1960:
I'm going a bit different direction with this one. If train traffic is a problem why set to anything other than empty cargo?

The problem is that demand fluctuates. I'll have a green circuit factory that wants copper wire. It can't get copper wire fast enough, so I have to build a copper wire factory WAY over there where there's a decent copper ore outcropping. It takes a while for the trains to bring the wire all that distance, so I assign a lot of trains. At some point, for whatever reason, the need for green circuits evaporates, and if the only condition is "empty cargo", all those trains are going to start backing up.

And I'm sure there are those that will have other solutions, but sometimes it's good to get a specific question answered.

I could ask for a really good enchilada sauce and someone replies that I should make nachos instead because they're better. Well that may very well be true, and I'll definitely make nachos at some point, but I still feel my life would be more complete if I knew how to make enchilada sauce.
In that case build more storage for your trains (a larger stacker). Each ore patch starts out with a maximum amount of ore. Once you have the maximum number of miners on the patch you can calculate the maximum ore output per unit time and from there arrive at the maximum number of trains required to move the ore to your smelters. Build one step in your stacker for each train required for the maximum and the trains stack up when demand backs up but they don't get in each others way and they are ready to take up the demand when it spikes because you are building something large again.

This also applies to any subfactories that you build. There is a maximum possible throughput for that subfactory. Once you have calculated it you know the maximum number of trains needed to move all its possible product and can build one step in its stacker for each train it can supply.

At this point if your ore supply is insufficient to your needs, you have to mine a new ore patch. If your smelting capacity is reached you have to build a new smelter array, if your subfactory can't keep up with demand you have to build an additional subfactory for that product.

You can tell at glance what solution is required by looking at the number of trains that are waiting in the stacker of each train station. If its empty (or low) on waiting trains its time to expand again.

This advice isn't a nachos recipe when you are wanting enchilada sauce. Its a how to have enough chili peppers on hand to make either one (or both at the same time).
astrosha Oct 5, 2023 @ 9:02pm 
Originally posted by pat:
Once the game starts really getting busy and I need optimum train throughput, I often run into the same problem. A station that was once extremely busy (and may be again) is getting bogged down with lines of trains waiting to get through, because the need for a product has temporarily died down to a trickle.

I have the schedule at that station set to:
Empty cargo
OR
15 seconds passed
OR
2 seconds inactivity

But one of the chests that the train is emptying into is very slowly being emptied. This means that the "inactivity" condition is never met and the train is going to sit there for the entire 15 seconds while one item per second is offloaded.

I'd love to have some sort of condition where if activity falls below a certain threshold, the train moves on. Or possibly if the item count in my bank of chests reaches a certain level. Is there anything vaguely like this, or some other method that would work?

With all due respect, if your advice is simply "design your train network better", please assume that you've already offered that. I'm just looking for an answer to that specific question. Thanks.

Circuit Network!

Either set a Dynamic Train Stop Limit (so the trains don't even bother going to that train stop unless there is room for at least one full load to be dropped off),
OR use the circuit network to tell the train to leave.

Whatever chest (sounds like you are using mixed loads and filter inserters to remove items to specific chests) has the item in question you want to monitor, wire it (or them) up (red or green wire) to a Constant Combinator. How much are you looking to keep on hand of that item? 47 Walls? 386 Copper Wire? Set the CC to that item and number, but make the number NEGATIVE. -47 Walls. -42 Laser turrets. whatever the item and desired amount is, set that CC.

Now using that same colored wire, send that to the Train Stop. Send signals to the train, and tell the train to leave when whatever item it is >= 0.

For example, lets say you want to keep 600 Copper Wire on hand for GC. The chests that carry the Copper Wire are sitting at 48 between them, so the signal going to the train stop will be -552. Since that is not >= 0, the train will continue to offload. Now when the chests reach 605 the train will see there are 5 (605 + -600 = 5) and since that IS >= 0, it will stop and move along.

You will need that circuit condition to be among your OR conditions for the train leaving the stop.

That said, it sounded as though your train stop is either on the main track and not on a side track somewhere, making trains that stop there, or stop waiting to go there, block traffic. Or that you have too many trains trying to go there for your stacker to handle, and that results in trains sitting in the main track blocking traffic.

If its the former, that is not a good practice to have. You've seen why. If its the latter, then might I suggest, either in addition to or instead of the above, using dynamic Train Stop Limits so that trains don't even try to go to the stop unless there is room for their full load anyway?
I don't exactly remember if you can do it without mods, but you should change train limit via circuit. The formula is total capacity of your buffer chests minus their combined contents, then divide that value by train capacity (factorio always round integers down) and set it as train limit. That would solve it.
Vyndicu Oct 6, 2023 @ 1:16am 
Originally posted by Нагризолич:
I don't exactly remember if you can do it without mods, but you should change train limit via circuit. The formula is total capacity of your buffer chests minus their combined contents, then divide that value by train capacity (factorio always round integers down) and set it as train limit. That would solve it.

Train Limit is a Vanilla Feature.

Originally posted by 1.1.0 Patch Note for Factorio:
Major Features

Train stop allows to set limit of incoming trains.

Source: https://wiki.factorio.com/Version_history/1.1.0#1.1.0
Originally posted by Vyndicu:
Train Limit is a Vanilla Feature.
I know, I'm not sure you can change train limit via circuits. I definitely did that in a mod pack when playing city blocks, but that should be vanilla feature as well, I don't have factorio insalled to check.
オルゴール Oct 6, 2023 @ 1:39am 
Originally posted by pat:
Originally posted by オルゴール:
You could use belt balancers to evenly balance the belts before putting it into the train

I can't imagine how that would make a difference.
Oh excuse me I misread your post as bots being an obvious solution insteadof you using bots, my bad.
Chindraba Oct 6, 2023 @ 2:34am 
There is a possibly smarter wait condition but it still requires circuity at the station. In short it is to use the wait condition of "Circuit condition" with some setting and the train stop having the "Send to train" mode turned on. The Mode of operations settings for the train stop won't show until the stop is connected to something with a circuit wire.

One way to use presumes you are using chests at the station, some people don't, but most do. Connect a wire from the train stop to all the chests. In the Circuit condition of the schedule set the condition to Circuit Copper wire = 57600. Of course, the copper wire would need to be changed to what ever the product is, and the count to what makes a "full" station. Copper wire is stack size 200 and steel chest is 48 stacks and many use 6 steel chests at station so it is 200 * 48 * 6 = 57600 for one wagon. If it is copper plates (stack size 100), only 2 wooden chests and 4 wagons it would be 100 * 16 * 2 * 4 = 12800. Of not is that when setting the number you see the whole think, 57,600 or 12800, but when looking at the schedule it will only show 57k or 12k. It remembers the real number and only shows the short version.

What happens is that for one brief pulse of time all the chests will be full and the total on the wire will show that and the train will start to leave. As soon as the train decides to leave the inserters set to unload it are automatically turned off. The inserter unloading the chest into the machine or belt will take out the next item and the chest won't be full again. This would, normally, trigger the inserter on the train to get a replacement, but it can't because the train has already switched into travel mode.

There are, of course, other refinements you can make to this, and to other parts of the station's mode and train's schedule. This is Factorio and there's always "another way," and we, as the engineers, have to decide which way to use this time.

Even for this system, it don't have to use the full chest count. If your base can deliver a train to the station every 3 minutes, and that factory uses 60/sec of the product, you could set the wait condition to enough to run for a little over 3 min, say 3 min. 10 sec. 3 * 60 + 10 = 190 sec, 190sec * 60 items/sec = 11,400 items, wait condition is Circuit Copper cable ≥ (=>) 11400. Here you have to use greater than or equal, because the chest will hold more and several inserters working at the same time could make the count go over the "magic" number since it is not a full chest count.
This should give you a solution for right now, and give you ideas for even more solutions, now and in other places.
Last edited by Chindraba; Oct 6, 2023 @ 2:35am
< >
Showing 16-30 of 45 comments
Per page: 1530 50

Date Posted: Oct 5, 2023 @ 3:54am
Posts: 45