Page 1 of 1
Wagon inventory filters allowing two options?
Posted: Fri Jan 24, 2020 10:30 am
by vorner
Hello
Is it possible to set up a slot in a wagon to be filtered in a way that it allows holding two different (alternative; not at the same time of course) types of items?
I'm contemplating setting up a train-based base/factory, with belts only locally for production. Furthermore, I'd like to do it with a kind of a central storage where intermediate products are exchanged ‒ so, if I build a module that produces electric engines, I'd ship maybe iron plates, steel, circuits and barrelled lubricant there and then send the engines back into the storage for other modules to be able to pick up (I know this might turn out to be a bad idea, but exploring bad ideas and trying to make them work is part of the fun).
So I envision it would go like this. I calculate the ratios of input stuff, set up a train with filters and let it go through all the pickup stops ‒ so it fills all the iron slots with iron, then all the steel slots, … and delivers to the factory. Now, it gets empty or at least some of the types of inputs get empty (there might be some leftovers of some types depending on rounding errors to full stacks). I'd like the same train to take the empty barrels and the produced engines back, offload them into the storage and do another round. But I can't do that, because the slots are set for the input items. So what I'd really need is some way to say „this slots is allowed to hold either iron plates or engines“.
I think circuits won't do it ‒ the pick-up stations should be able to handle any kind of request (for different manufacturing modules) and fill them with how many items the train wants.
One think that I've come up so far is having the item that needs the most wagon space unfiltered and picked up last, so it fills the rest of the wagon, then use this space for the products. But that one feels less elegant and more fragile and I keep thinking there must be something better.
Or do people usually have separate input and output trains?
Re: Wagon inventory filters allowing two options?
Posted: Fri Jan 24, 2020 11:30 am
by astroshak
I may be wrong, but if you are trying to avoid that second train, I think your only option is adding another cargo wagon to your existing train, to carry the product and waste product back.
I don’t believe it possible to set a cargo wagon’s filters by circuit condition. Maybe a mod would let you do it? Dunno, but its not possible vanilla.
Re: Wagon inventory filters allowing two options?
Posted: Fri Jan 24, 2020 12:28 pm
by vorner
Well, my goal here is some feeling of utilization. It seems wasteful to have one train to carry stuff in one direction and let it be empty on the way back and another train being empty in the reverse direction. Adding another wagon that's empty in one direction is kind of the same situation O:-).
I mean, it's not really an issue, but some people aim at having huge number of launches of a rocket, some people aim at solutions that seem elegant or somehow interesting. A train that has a long but meaningful timetable and is utilized the whole way is something like that, especially if it can be done without excessive circuit conditions (having a wire from chests to the train to recognize everything is loaded and it makes no sense to continue waiting is fine, I'd like to avoid having to send requests over the wire between stations).
I guess I'll have to rely on the „Iron plates go in first so they don't need to have a filter“ and be careful to consume them all before letting the train on to reuse the space.
Re: Wagon inventory filters allowing two options?
Posted: Fri Jan 24, 2020 6:51 pm
by Ranger_Aurelien
vorner wrote: ↑Fri Jan 24, 2020 12:28 pm
I guess I'll have to rely on the „Iron plates go in first so they don't need to have a filter“ and be careful to consume them all before letting the train on to reuse the space.
You could try circuit conditions that count the contents and if too many persist don't enable the inserters for the other good (or something like that).
For example if you want the train to hold 4k iron , 5k steel, 2k lubricant on the way out, then have the station check the train's cargo total and load each specific as long as below those thresholds, then unload ALL at the other end. Conversely, you could do similar things at the outpost if you want to limit returns, then at the first station UnloadALL. For unloading use filter inserters to only pull the items to unload.
Another option is to segregate materials by car and on the way back put only engines in one car, and as many barrels as possible in the others...
Btw, to simplify a little consider BarrelRecycling particularly when a recipe at the outpost consumes steel:
https://mods.factorio.com/mod/BarrelRecycling
Re: Wagon inventory filters allowing two options?
Posted: Wed Jan 29, 2020 12:14 pm
by vorner
Thanks for the suggestion. Unfortunately, circuit conditions that count stuff solve my problem. Maybe I didn't explain it well enough.
So, I have a central storage/exchange area. It has many stops, each one either accepting item X or providing item X.
Then I have bunch of places that produce certain thing. A train serves one production place. It first visits several stops in the storage ‒ eg. first picking iron plates, then picking steel at another stop. Once everything is satisfied, it goes to the production place, unloads and loads the products, taking them back to the storage.
I can't set a circuit condition in the storage place, because single iron plates provider gives them to many different kinds of producers. Therefore it needs to be the train that „knows“ how many iron plates to take and how much space to leave for something else. Filters + item count conditions in the timetable menu work great for this. There's no need for circuits in the producer area, because it usually creates just one thing, possibly two.
Fortunately, when building this, I've discovered that most products „compress“ their inputs. If I pick up the most space demanding input and consume that, the product will take only as much or smaller number of slots in the train. Therefore, I can leave this one input without a filter, pick it up first ‒ it'll still leave space for the other inputs as these have filters. And the output will fit into this place. I could wish for something more elegant (if there is the product + some empty barrels to take back, it becomes a bit challenging to handle, but then when the ratios are computed for whole stacks, few more slots are usually left unused anyway, so these can be used for the barrels).
Re: Wagon inventory filters allowing two options?
Posted: Wed Jan 29, 2020 2:27 pm
by Olacken
You could set different output at the storage location using the read stopped train at the train stop (it give the train id) and some combinator to change how much it load depending on the train it would be a little bit of work but not much more than setting filters
Re: Wagon inventory filters allowing two options?
Posted: Wed Jan 29, 2020 10:15 pm
by netmand
On the surface this sounds like a interesting request, however, if you think this through; you'll never need this functionality. I understand your interest in shipping ingredients from supply depots to a production area then using the same train to transport the finished product.
If your train only moves all of the ingredients to make Chemical Science Packs, you'll never fill the wagon (with finished product) for its return trip. Its just easier to include the finished product in the wagon filtering and your system will work just fine.
I worked it out for Chemical science pack: filter your wagon slots: 6 Advanced circuit, 17 Engine unit, 11 Sulfur, 6 Chemical science pack. Each wagon ships ingredients and product for 840 Chemical science pack.
Re: Wagon inventory filters allowing two options?
Posted: Thu Jan 30, 2020 9:32 am
by vorner
You could set different output at the storage location using the read stopped train at the train stop (it give the train id) and some combinator to change how much it load depending on the train it would be a little bit of work but not much more than setting filters
That would be annoying and it wouldn't really scale. Currently, I have a blueprint for each of the manufacturing station. If I find out I'm short on eg. blue circuits, I just pick a place near railway, place it and it gets built, including fully configured train I can just set to automatic and it works. Now I'd have to add probably another combinator to handle that specific train ID to the central storage, which is annoying and will fill up space quite fast.
If your train only moves all of the ingredients to make Chemical Science Packs, you'll never fill the wagon (with finished product) for its return trip. Its just easier to include the finished product in the wagon filtering and your system will work just fine.
I don't need to completely fill it. But some products mostly work 1:1 to some of the ingredients. Take for example the electric motors. Each consumes one ordinary motor and they form stacks of the same size. If I have filters for ordinary motors and filters for electric motors, which are exclusive (I never need to carry both at the same time), I can take fewer of them on each trip, underutilizing the train.
But as I said, I think we can call this topic mostly solved by not filtering the most space-hungry ingredient.