Trains: how to avoid unloading just loaded items?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
bodom
Inserter
Inserter
Posts: 23
Joined: Thu May 05, 2016 8:16 am
Contact:

Trains: how to avoid unloading just loaded items?

Post by bodom »

Hi there,

I am trying to build a bit more complex train setup... and failing :D

I have a remote base (R), connected by railway to main base (M). I have to ship material to R, it will produce goods, and ship them back to M.
Because of space constraints, I have to do this by using only two stations: one per base. I also would like to use only one train, to avoid unnecessary congestion on the railway.

The problem is: if I use inserters on a side of the train to load items, and then I put a second row of inserters on the other side to unload them, the inserters will unload items as soon as they get loaded. I cannot use smart inserters to filter what gets unloaded, because I am mixing a wide variety of items into the same wagon.

In short, what I would like to do is to avoid the items that have just been inserted in a wagon to be unloaded until the train stops to next station.

Any ideas on how to handle this?

aka13
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by aka13 »

You could use a timer, which disables the combinators, after the items get loaded for the time the train stays on the station. Propably have a detector chest, which detects that the loading has started, and a timer, which stops the unloaders for a set amount of time.
Pony/Furfag avatar? Opinion discarded.

bodom
Inserter
Inserter
Posts: 23
Joined: Thu May 05, 2016 8:16 am
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by bodom »

That's a nice idea, but when the train arrives it needs to unload the materials shipped from the main base to make space for the produced goods

aka13
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by aka13 »

Well, I dont think you have more options, but to use multiple stations or whitelists...
Pony/Furfag avatar? Opinion discarded.

BlakeMW
Filter Inserter
Filter Inserter
Posts: 950
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by BlakeMW »

What you basically need is a combintator contraption which functions as a timer.

Say the train should stop for 20s, so the timer should run 1-1200 ticks (0 to 20s), it should only start running when a train has arrived. A train can be detected by unloading fuel from the locomotive into a smart chest, the presence of fuel in the smart chest can be used to start (reset) the timer. Once the timer is started, the fuel-taker-outer smart inserter should be disabled. The fuel should be removed at some point later (you could even use the presence of fuel in the chest as the condition for running the timer - once the timer hits 1200 you could take the fuel out)

When the timer is < 601, the unloading smart inserters should run.
When the timer is > 600, the loading smart inserters should run.
The timer can keep counting up after that, as long as it resets to 1 when a train arrives.

This is a fairly simple task with combinators, I expect it could be done with 3 or 4 combinators if you know the right patterns to use. It might be doable with 1 combinator with clever use of the fuel in the smart chest, this is because the basic timer involves a constant combinator outputing a signal of 1 into a decider combinator, but you could use the smart chest to output a "coal" signal of 1, taking the role of the constant combinator.

Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by Neotix »

Instead of timer, you can build Delta detector.
When train arrive, inserters will start unload and delta > 0. When all items will be unloaded, delta become = 0 again. The same with Loading. When inserters are putting items into wagon, delta < 0, when wagon is full delta = 0 or > 0 (if new items are putting into station buffer).
Delta detector can control RS latches that will order to load or unload items.

LazyLoneLion
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Mar 20, 2016 11:49 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by LazyLoneLion »

It's easy enough to use different carriages for different resources. Let's say car #1 for delivery from M to R, and car #2 for delivery from R to M.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2635
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by steinio »

Smart inserters with filter can also take items out of something.
Image

Transport Belt Repair Man

View unread Posts

Frightning
Filter Inserter
Filter Inserter
Posts: 807
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by Frightning »

steinio wrote:Smart inserters with filter can also take items out of something.
This

I had to do this for my Oil train so that my Empty Barrel unloading at the pumpjacks, and my Crude Barrel unloading at my base wouldn't take the freshly loaded/unloaded barrels that were being put back into the wagon back out and into the wrong part of my barrelling/unbarrelling setups. Real easy, just replace the Fast Inserters that would unload at each location with Smart Inserters and set their item filters appropriately.

bodom
Inserter
Inserter
Posts: 23
Joined: Thu May 05, 2016 8:16 am
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by bodom »

Thank you for the combinator advice: I am experimenting with it and it seems to work!

Unloading coal to detect when a train stops is genial :D
bodom wrote:I cannot use smart inserters to filter what gets unloaded, because I am mixing a wide variety of items into the same wagon.

Shokubai
Filter Inserter
Filter Inserter
Posts: 470
Joined: Mon May 02, 2016 3:17 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by Shokubai »

I'm curious why smart inserters won't work. How many different items are you unloading?

bodom
Inserter
Inserter
Posts: 23
Joined: Thu May 05, 2016 8:16 am
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by bodom »

A wide variety.

By example, I am sending iron plates, copper plates, coal, electric circuits, advanced circuits, blue circuits, etc... and receiving magazines, combat drones, assembly machines, rocket parts, armor parts, etc...

Frightning
Filter Inserter
Filter Inserter
Posts: 807
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by Frightning »

bodom wrote:Thank you for the combinator advice: I am experimenting with it and it seems to work!

Unloading coal to detect when a train stops is genial :D
bodom wrote:I cannot use smart inserters to filter what gets unloaded, because I am mixing a wide variety of items into the same wagon.
I find it hard to believe that you are using more than 30 different item types (or large quantities of more than 5). You can set different unloading inserters to unload different items and even wire them to the unloading chest/circuit network and give conditions for it unload the given items.

Shokubai
Filter Inserter
Filter Inserter
Posts: 470
Joined: Mon May 02, 2016 3:17 pm
Contact:

Re: Trains: how to avoid unloading just loaded items?

Post by Shokubai »

bodom wrote:A wide variety.

By example, I am sending iron plates, copper plates, coal, electric circuits, advanced circuits, blue circuits, etc... and receiving magazines, combat drones, assembly machines, rocket parts, armor parts, etc...
Perhaps the answer is diversification.

Either Add more cars or add more trains so all your eggs aren't in one basket. Then unloaded gets very simple as you have specific trains stop at specific stations for loading and unloading.

Post Reply

Return to “Gameplay Help”