How can i make my trains wait?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
DunDikke
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Feb 21, 2021 1:41 pm
Contact:

How can i make my trains wait?

Post by DunDikke »

Hello everyone!

I'm setting up a trainstation for smelting iron see my screenshot:
Image

As you can see i've got 4 unloading stations. They are all named the same
I also have 13 waiting stations, all named the same.
There are 6 trains that load at 2 mining sites (there will be more in the future)

The unloading stations Switch off when there is enough iron ore in the chests.
(switch on when iron is less then 45100)

At every unloading station there is an combinator that sends signal "A" iff there is less then 45000 iron ore in the chest
Signal "A" gets send to all the waiting stations. (Signal "A" gets send a little later then the activation of the unloading stations)

I have a waiting condition in all the trains that says: Drive when signal "A" is more then 0

So here is the problem:
iff a unloading station becomes active and signal "A" is send all trains will try to start driving to that station. 1 train wil go to the station and unload, all the other trains skip the unloading station and drive the rest off there shedule and eventually they come back to the waitingstations.

How can i make my trains wait and not drive a useless lap?

I did read a lot on the internet but did not find a good and simple solution.

thx in advance!!

SoShootMe
Filter Inserter
Filter Inserter
Posts: 319
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: How can i make my trains wait?

Post by SoShootMe »

DunDikke wrote:
Sun Feb 21, 2021 2:19 pm
As you can see i've got 4 unloading stations. They are all named the same
I also have 13 waiting stations, all named the same.
...
How can i make my trains wait and not drive a useless lap?
Trains skip stops in their schedule if all stops of that name are (or become) disabled. A simple solution is to control each stop's train limit by the circuit network instead of disabling the stop. To do this you can use a decider combinator, with input connected to the buffer chests and output connected to the stop, to set a train limit of 1 if there is space in the buffer chests for a train to unload, or a limit of 0 otherwise.

This no longer requires the circuit network connection between the unload and waiting stops, and the train schedules don't need a condition on the entry for the waiting stops: they'll wait there (if necessary) until they can reserve one of the unload stops.

DunDikke
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Feb 21, 2021 1:41 pm
Contact:

Re: How can i make my trains wait?

Post by DunDikke »

thx, i'm gonna try

DunDikke
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Feb 21, 2021 1:41 pm
Contact:

Re: How can i make my trains wait?

Post by DunDikke »

works like a charm, thx!!

astroshak
Filter Inserter
Filter Inserter
Posts: 527
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: How can i make my trains wait?

Post by astroshak »

To control the Train Limit, when I want to do so, I compare the current total material at the stop with the maximum amount that the stop can hold. Divide the difference by the capacity of a single train, and that reveals how many train loads are there for pickup, or how many train loads it would take to fill it up.

Wire all of the chests together. For a Loading Station, connect them to the Input side of an Arithmetic Combinator. Each / (whatever your train capacity is), output T. For an 8 cargo wagon train that is sent for Iron Ore, that would be Each / 16000, output T. Wire the output to the train stop, set the limit to T.

For an unloading station, make two changes. First, connect a Constant Combinator to the chests, with the negative of the maximum capacity of the chests. For a 4 cargo wagon train carrying Green Circuits, the CC would be set to (24*48*200=) -230400 on the Green Circuit signal. Second, change the divisor on the Arithmetic Combinator to a negative number (-32000 for this train).

This allows multiple trains to head to a station that can service them, but no more than the station is able to service at any one time.

chrismeka
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Sep 20, 2021 2:11 pm
Contact:

Re: How can i make my trains wait?

Post by chrismeka »

SoShootMe wrote:
Sun Feb 21, 2021 5:10 pm
DunDikke wrote:
Sun Feb 21, 2021 2:19 pm
As you can see i've got 4 unloading stations. They are all named the same
I also have 13 waiting stations, all named the same.
...
How can i make my trains wait and not drive a useless lap?
Trains skip stops in their schedule if all stops of that name are (or become) disabled. A simple solution is to control each stop's train limit by the circuit network instead of disabling the stop. To do this you can use a decider combinator, with input connected to the buffer chests and output connected to the stop, to set a train limit of 1 if there is space in the buffer chests for a train to unload, or a limit of 0 otherwise.

This no longer requires the circuit network connection between the unload and waiting stops, and the train schedules don't need a condition on the entry for the waiting stops: they'll wait there (if necessary) until they can reserve one of the unload stops.
Thank you so much for this SoShootMe as DunDikke said this worked a treat. I didn't know if I was going to be able to achieve this without installing a MOD. :D

Much appreciated.

Astroshak - I'm sure your solution is good too but its a bit beyond me at this stage :P

Post Reply

Return to “Gameplay Help”