How can I use Interrupts to go to Parametrized Pickup Stations?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
RMDragon
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Oct 23, 2024 10:28 pm
Contact:

How can I use Interrupts to go to Parametrized Pickup Stations?

Post by RMDragon »

I am trying to use the new interrupt system to build a rail network where any train can pick up and drop off any type of item. I have set up each station with names of "[Item icon] Pickup" or "[Item icon] Dropoff", where [Item icon] is what is being loaded/unloaded there.

I have managed to set up the interrupt for the generic drop-off stations without issue, but I'm having some problems setting up the one for the pick-up ones.

Originally, I tried using the "Item count" condition setting the [Item Parameter] equal to 0. I was hoping this would match any item that is not in the train cargo, and go to the corresponding station. However, as far as I can tell, this doesn't work because only items that are already in the cargo are being considered.

These are some solutions I found, but all of them have some disadvantages that I would like to avoid:
  1. Re-naming all pickup stations to "Pickup", regardless of what they load. That is, removing [Item icon] from all the pickup station names. Then, having an interrupt condition where if the train is empty it goes to a "Pickup" station. This does work, but it means I can't tell what the station is loading from the name, which I don't like.
  2. Another approach that does seem to work is setting an interrupt condition checking for a circuit [Signal Parameter], and setting the target station to "[Signal Parameter] Pickup". If I then connect a constant combinator to all stations and set the signals to all the possible [Item icon] values, the trains are able to find the corresponding stations. However, this means I would need to change the signals each time I added a new pickup station type. This is easy enough to do with logistic groups, but I am sure I would eventually forget to do it when adding a new type of station.
  3. So far, my preferred solution is doing option 2, but adding signals for all items I may ever want to load into a train. Then, I set the interrupt conditions to [Signal Parameter] > 0 AND "[Signal Parameter] Pickup" is not full. The second condition is important, as otherwise the train can pick any signal it receives, even if no station with that name exists, which breaks the system. Other than the almost negligible cost of one constant combinator for every new station I create, the main downside of this approach is the amount of time it will take me to add all the potentially relevant signals to the constant combinator. Also, if I ever want to use this system with items added by mods, I would have to remember to add those to the blueprint.
Is there any way to achieve this without having to add the constant combinator with all the signals? Am I missing something in how I can use the interrupts?
Kalanndok
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Sat Dec 12, 2015 9:07 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Kalanndok »

Have three types of stations.

Pickup, [item] dropoff and depot.

Schedule the train to always go to pickup and wait until full.
Interrupt it if [ItemWildcard] > 0 to go to [ItemWildcard] dropoff and wait until empty.
Interrupt it if "[no Destination] and not at depot and not at pickup" to go to depot without wait condition.
(and of course: Interrupt it if low fuel and set it to go to refuel :) )

What this does:
It clears the dropoff incase no pickup is accepting trains.
It makes the train go directly to a pickup if finished unloading.
It has a full train blocking the pickup station where the produced item has no demand anyways so no other trains come in to pickup stuff that's not needed.

What you need to make sure though:
Always have pickup stations request at least one train (if it's waiting at the depot it can also wait at the pickup stations...it's out of the way and even gets loaded slowly).
Always have at least as many trains as you have pickup stations.
Never have more trains than you have pickupstations plus depot plus pickup-station-waiting-space.
Tertius
Filter Inserter
Filter Inserter
Posts: 969
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

The crucial thing is to name all pickup stations the same, no matter the item. Once loaded with something, the interrupts decide where this will be delivered.
The only fixed station in the schedule is the pickup station. Everything else works through interrups. The delivery stations have all different, item specific names.

To get a picture in your mind, imagine you're a train.
  • You're currently empty and looking for work.
  • In your schedule, you're ordered to go to a station called "pickup".
  • Since there are many stations called "pickup", you're driving to the next one with a free slot.
  • You arrive at the station, and something is loaded into you.
  • The waiting condition becomes true, and you're about to leave the station. But where?
  • You have a book called "interrupts" that tells you where to drive, dependent on what you're carrying, so...
  • you look into what was loaded into your cargo wagons.
  • You try to match the cargo you detected with the entries in the interrupt list by checking the interrupt conditions.
  • You select the first matching interrupt and copy its schedule into your regular schedule as temporary entry.
  • You drive to the next schedule entry.
Keep in mind the interrupt list is checked just when the train is about to leave a station and trying to find a destination. It's not checked if the train is en route or waiting at a red signal.

You can enter one interrupt for every different cargo, or you can use the new green wildcard/substitution parameters for the interrupt condition and schedule.
The green wildcard works on the loaded cargo. It doesn't look at stations, it looks and matches the cargo currently loaded in the train. Once matched, the wildcard in destination station names is replaced with the matched item, constructing a real station name, and the train will have this station as destination.

Example for one interrupt per cargo can be seen in https://factorio.com/blog/post/fff-395 (first image) and an example for the wildcard can be seen in the second image. Generic description for interrupts in https://factorio.com/blog/post/fff-389
User avatar
AileTheAlien
Filter Inserter
Filter Inserter
Posts: 392
Joined: Sat Mar 11, 2017 4:30 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by AileTheAlien »

Tertius wrote: Thu Oct 24, 2024 12:01 pmThe only fixed station in the schedule is the pickup station.
Actually, I don't think it's necessary to have generic 'pickup' stations in your schedule, and you can keep the icons in your pickups. (Or "load", whatever you call them.)
RMDragon wrote: Wed Oct 23, 2024 11:34 pmRe-naming all pickup stations to "Pickup", regardless of what they load. That is, removing [Item icon] from all the pickup station names. Then, having an interrupt condition where if the train is empty it goes to a "Pickup" station. This does work, but it means I can't tell what the station is loading from the name, which I don't like.
I also wanted to keep my pickup stations named with icons, and I think the included proof-of-concept blueprint should fill your needs. (It has five stations, and is a very small loop of track. The arrows point to the wagon if it's loading, and to the resource if it's unloading.) At a "wait for orders" station (or "depot", whatever), the train waits until it receives the circle-i ("info"?) icon signal, before it tries to leave. The item-wildcard interrupt is then immediately fulfilled, because it checks for a generic item signal, which is then filled in by the combinator hooked up to the leftmost chest, and your "load (item)" destination is set. These two screenshots should also help, in case I phrased this poorly. (I'm actually surprised that nobody figured this out, or didn't share it. I guess I had to share it. :P ) Please note, the chests and decider combinators are just stand-ins for real signals shared across your train network by radars. 8-)
map
annotated blueprint
blueprint string
Last edited by AileTheAlien on Tue Nov 12, 2024 12:51 am, edited 1 time in total.
Afroman
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri Jan 06, 2017 3:28 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Afroman »

Sorry, I think I'm going to need more instructions here:

I'ver played around with the blueprint but can't figure it out.
The topmost combinator is waiuting for <train stop> signal to be >0. How does it get that signal?

I tried changing the signal to iron plates, then adding som iron plates in the corresponding chest, but then.... wait..... Imaybe I got it..... I'll get back to you....
Serenity
Smart Inserter
Smart Inserter
Posts: 1017
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Serenity »

Wube teased completely generic trains in the FFF, but those don't seem to work so well. I tried completely generic loading stations and what happened is that I had multiple trains going to stone and coal mines when I really needed only one. And I needed those other empty trains to get iron and copper. So I now have fixed loading stations, with interrupts for unloading, refueling and depots.

This gives me control over the amount of trains running for each resource. The depot stations could probably be eliminated as long as there are enough stacker spaces at the loading and unloading stations.
Tertius
Filter Inserter
Filter Inserter
Posts: 969
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Serenity wrote: Mon Nov 11, 2024 8:33 pm I had multiple trains going to stone and coal mines when I really needed only one.
In this case, it seems you set the train limit of these stations higher than 1, so multiple trains are sent there. If these loading stations are the nearest ones, trains are going there first, before they go to stations more far away. You could employ more trains, so if the nearer stations are all full, the more far away stations are visited.

I have a static limit of 2 in all my loading stations, and I did another thing to avoid first filling all slots of the nearest stations before trains go to the others: I have a circuit that raises station priority to 51 if there are 0 train slots reserved on a station and keep it at 50 if more than 1 slots are reserved. This way all stations regardless the distance are filled with 1 train first before the station gets a second train.
Serenity
Smart Inserter
Smart Inserter
Posts: 1017
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Serenity »

Tertius wrote: Mon Nov 11, 2024 10:37 pm In this case, it seems you set the train limit of these stations higher than 1, so multiple trains are sent there.
It wasn't trains going there at the same time, but another train pathing to the mine after the first one left. Train limits don't help with that.

Maybe one could set the priority of stations depending on the importance of the resources. But while that seems easy enough with stone vs iron/copper ore, this would break down with more complex networks transporting different kinds of intermediate products.
Tertius
Filter Inserter
Filter Inserter
Posts: 969
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Serenity wrote: Tue Nov 12, 2024 12:13 am It wasn't trains going there at the same time, but another train pathing to the mine after the first one left. Train limits don't help with that.
Probably you need more trains. Sum up the train limit of all stations, employ as many trains. Additionally, add a depot as buffer for empty trains, so empty trains can leave the unloading station.

If you have dynamic limits, add the maximum limit. The depot need to be big enough to store the additional trains that cannot go anywhere, if the limit is lower than the maximum. For example, if you have 10 stations with a dynamic limit of 0..2, your depot should have (2-0) * 10 = 20 lanes.
I used to build stations with dynamic limits for ore, but I realized static limits and enough trains are better. Loading stations don't even need buffer chests, because there is always a train waiting at the station, if you have enough trains.
jirkov
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Nov 07, 2024 4:07 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by jirkov »

Serenity wrote: Mon Nov 11, 2024 8:33 pm Wube teased completely generic trains in the FFF, but those don't seem to work so well.
Upgrading trains to groups and their shared work is an absolutely amazing improvement. I have almost 60 trains handling about 20 different types of materials. So one train can easily have a route that goes for uranium ore, plastics, red circuits, copper ore, copper wires and other various types that are needed at the time. Of course, it will take a bit of work to create the basic logic of train movement, but in the end it looks beautiful when the trains are not standing still, but running efficiently. It helps a lot in the case of an increased need for one material, when the normal static number would not be able to keep up, but the trains are automatically reordered and the given transport is strengthened. Adding new material consists of setting up a unified loading plan, where I specify the material in one comparator, by setting up a unified unloading plan, where again I specify the material in only one comparator and adding a simple condition to the group for interruption. And now the trains can handle new material for transportation.
User avatar
AileTheAlien
Filter Inserter
Filter Inserter
Posts: 392
Joined: Sat Mar 11, 2017 4:30 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by AileTheAlien »

jirkov wrote: Tue Nov 12, 2024 12:58 am Adding new material consists of setting up a unified loading plan, where I specify the material in one comparator, by setting up a unified unloading plan, where again I specify the material in only one comparator and adding a simple condition to the group for interruption. And now the trains can handle new material for transportation.
Can you share a blueprint for one of your trains that's in this group? I'd like to see how their schedule and interrupts are set up. Blueprints for your stations would probably also help. Right now, I've got trains with a generic signal interrupt, but because they can't reserve a drop-off station until they start pathing there, I've got more trains getting scheduled than requester stations can support. (So trains back up, filled with resources they can't unload.)
Post Reply

Return to “Gameplay Help”