Unloading specific amount of items
Unloading specific amount of items
Hello all, I don't know if this is covered but I've made several oil outposts and the train stops at each outpost and gives out empty barrels in return for the full one. They thing is I want every oil outpost to give five empty barrels out because it doesn't need more than that.
My setup is like this: Train stops at a the outpost, the empty barrels gets put out in a chest then onto the belt which takes them to the empty crude barrel assembly machine.
My setup is like this: Train stops at a the outpost, the empty barrels gets put out in a chest then onto the belt which takes them to the empty crude barrel assembly machine.
- MalcolmCooks
- Filter Inserter

- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Unloading specific amount of items
Does the train wait while the barrels are being filled up and then put back on the train, or are they immediately replaced with full ones?
Re: Unloading specific amount of items
First I estimate the interval between trains. Then I calculate how much oil the outpost produces during that time and how many barrels it fills. I put enough tanks to keep that amount stored and use simple circuit conditions to unload correct amount of empty barrels into normal chests. All filled barrels are loaded into the train. I use normally 15 or 20 second stops. Train goes around loop with several outposts. I have enough wagons to keep all needed barrels.
This method is far from exact but it works well enough to be practical to all sized bases. First I use typically trains with 4 wagons (2 for empty and 2 for full) and later 8 wagons. I usually overestimate needed barrels clearly so that there is extra capacity if there is some small delay in train's schedule. I calculate numbers based on 0.1 oil/s (or 0.2 if I allow modules). Oil wells decay in any case so fast that I do not bother to take it into account at the late game.
I am not sure how well this fits to your need for 5 barrels. I leave usually 100-400 barrels at a time. For example there are 25 pumpjacks and I use modules. It gives 25*0.2 = 5 oils per second. Train interval is 15 minutes which means 4500 units of oil. I use 2 tanks (or 3) and leave 180 barrels. Inaccuracy of few dozens does no harm. Barrels are cheap and long trains look better.
This method is far from exact but it works well enough to be practical to all sized bases. First I use typically trains with 4 wagons (2 for empty and 2 for full) and later 8 wagons. I usually overestimate needed barrels clearly so that there is extra capacity if there is some small delay in train's schedule. I calculate numbers based on 0.1 oil/s (or 0.2 if I allow modules). Oil wells decay in any case so fast that I do not bother to take it into account at the late game.
I am not sure how well this fits to your need for 5 barrels. I leave usually 100-400 barrels at a time. For example there are 25 pumpjacks and I use modules. It gives 25*0.2 = 5 oils per second. Train interval is 15 minutes which means 4500 units of oil. I use 2 tanks (or 3) and leave 180 barrels. Inaccuracy of few dozens does no harm. Barrels are cheap and long trains look better.
Re: Unloading specific amount of items
I think I put my oil low at the beginning of the game
It is scarce. But I have one wagon with half dedicated to full barrels and half empty.
Station A is my main area where full barrels will be unloaded. Station B on the same line has a small production for plastic. It has its own pumpjacks but I want the train to deliver 5 barrels here then station C is purely for taking full barrels then station D is where the oil is. This station needs the most empty barrels.
So right now I have this loop setup. A-D-C-B-A.
Train leaves from A with empty barrels and goes to station D where it needs most of the barrels and it ends up taking the whole. No barrels are left for C and B. Then coming back at C, no barrels then at B, I want the train to give out five full barrels for the small production here. I hope you get what my problem is.
It is scarce. But I have one wagon with half dedicated to full barrels and half empty.
Station A is my main area where full barrels will be unloaded. Station B on the same line has a small production for plastic. It has its own pumpjacks but I want the train to deliver 5 barrels here then station C is purely for taking full barrels then station D is where the oil is. This station needs the most empty barrels.
So right now I have this loop setup. A-D-C-B-A.
Train leaves from A with empty barrels and goes to station D where it needs most of the barrels and it ends up taking the whole. No barrels are left for C and B. Then coming back at C, no barrels then at B, I want the train to give out five full barrels for the small production here. I hope you get what my problem is.
- MalcolmCooks
- Filter Inserter

- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Unloading specific amount of items
I would like to help, but I don't really understand what is going on
Can you explain again, but say exactly what is being loaded to and unloaded from the train at each station?
Can you explain again, but say exactly what is being loaded to and unloaded from the train at each station?
Re: Unloading specific amount of items
I'll just keep it simple. A train full of crude oil barrels stops at an outpost and starts unloading barrels. It unloads the whole lot. I want only 5 or ten (let's say 10 for convenience) barrels to be dropped off. How do I tell the inserter to take only ten out and not one hundred.
Re: Unloading specific amount of items
Connect the inserter to a chest with a red wire.
Set the circuit condition to oil barrel < 10.
Then you need to slow down the chest unloading to keep 10 barrels in the chest until the train leaves.
Set the circuit condition to oil barrel < 10.
Then you need to slow down the chest unloading to keep 10 barrels in the chest until the train leaves.
Re: Unloading specific amount of items
I didn't get the second part of your post. So that means the Inserter won't work after ten oil barrels are stored in the chest.DaveMcW wrote:Connect the inserter to a chest with a red wire.
Set the circuit condition to oil barrel < 10.
Then you need to slow down the chest unloading to keep 10 barrels in the chest until the train leaves.
Re: Unloading specific amount of items
i can see multiple solutions for your problem.
first that comes to my mind is, that you will have "empty barrel buffer", usually box. then train "unloading" inserter will have condition to unload, only if there is less than X (in your case 5) empty barrels in box.
next is inserter that takes barels from box (and stuff them to filling factory, or just onto belt), this one will need to be connected on belt, that is delivering full barrels to train, depending on how much buffer you plan for that, you will connect it to segment (one segment of belt can hold 6-8 items). so you can for example connect it to 2nd segment before train loading segment, then set condition, that inserter will be enabled only if segment is empty. you can also setup "loading" buffer box instead, and then set condition to amount of full barels inside that box less than X.
there are more complex solution involving combinators and counters, but i use similar solution to what i described above.
first that comes to my mind is, that you will have "empty barrel buffer", usually box. then train "unloading" inserter will have condition to unload, only if there is less than X (in your case 5) empty barrels in box.
next is inserter that takes barels from box (and stuff them to filling factory, or just onto belt), this one will need to be connected on belt, that is delivering full barrels to train, depending on how much buffer you plan for that, you will connect it to segment (one segment of belt can hold 6-8 items). so you can for example connect it to 2nd segment before train loading segment, then set condition, that inserter will be enabled only if segment is empty. you can also setup "loading" buffer box instead, and then set condition to amount of full barels inside that box less than X.
there are more complex solution involving combinators and counters, but i use similar solution to what i described above.
Re: Unloading specific amount of items
It is easiest to do by connecting the signal previous to train stop to output inserter of oil barrel chest. Set the signal to read state and inserter work if green signal > 0. If there is train on station, it does not unload oil barrels. There may be occasional short breaks if other trains occupy that block but probably they do not harm anything.DaveMcW wrote:Connect the inserter to a chest with a red wire.
Set the circuit condition to oil barrel < 10.
Then you need to slow down the chest unloading to keep 10 barrels in the chest until the train leaves.
Re: Unloading specific amount of items
i use buffers, but this idea has some merit. i will try it next timeHannu wrote:It is easiest to do by connecting the signal previous to train stop to output inserter of oil barrel chest. Set the signal to read state and inserter work if green signal > 0. If there is train on station, it does not unload oil barrels. There may be occasional short breaks if other trains occupy that block but probably they do not harm anything.DaveMcW wrote:Connect the inserter to a chest with a red wire.
Set the circuit condition to oil barrel < 10.
Then you need to slow down the chest unloading to keep 10 barrels in the chest until the train leaves.
Re: Unloading specific amount of items
I'm a couple of days late, but two options worth trying:
Option 1: Drop off 5 barrels, pick up all oil
* Create a reset signal on the train station. {If SIGNAL in (YELLOW, GREEN) then R = 1}
* Create a memory cell, and read inserters hand FROM train. {If Memory Cell > 4, then disable}
Option 2: Drop off 5 barrels, pick up 5 barrels
* Create a memory cell, and read inserters hand FROM train. {If Memory Cell > [second Memory Cell]+4, then disable}
* Create a second memory cell, and read inserters hand TO train. {If Memory Cell > 4, then send train}
Stack Inserter bonus may prevent 5 exactly, so you'll either want to disable this bonus or plan for multiples of your bonus.
Option 1: Drop off 5 barrels, pick up all oil
* Create a reset signal on the train station. {If SIGNAL in (YELLOW, GREEN) then R = 1}
* Create a memory cell, and read inserters hand FROM train. {If Memory Cell > 4, then disable}
Option 2: Drop off 5 barrels, pick up 5 barrels
* Create a memory cell, and read inserters hand FROM train. {If Memory Cell > [second Memory Cell]+4, then disable}
* Create a second memory cell, and read inserters hand TO train. {If Memory Cell > 4, then send train}
Stack Inserter bonus may prevent 5 exactly, so you'll either want to disable this bonus or plan for multiples of your bonus.


