Train station priority

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
krzysiek050
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jan 26, 2017 6:26 am
Contact:

Train station priority

Post by krzysiek050 »

Hi,

I have for example few output station witch produce cooper ore (mines) and few input station which consumes copper ore. I use signals to disable/enable stations. Output station is enabled when has enough products for whole train, and input station is enabled when ingredients number in chests falls below some level. All output stations for some product has same name, and all input stations has same name for same consumed product.

This work fine, when i output stations produce more than input stations can consume. But otherwise, there is situation when copper ore is delivered only for the closest station.

So, the question is. Can i use signal or something else to set train station priority? If i calculate station fill percentage and make it a signal, for example P [0-100], can use it to override train station priority?

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Train station priority

Post by mrvn »

You can't in vanilla. You can with Logistic Train Network mod.

What you can do in vanilla is to enable only those stations with highest priority. And for equal priority stations you can make a round-robin system so each time a train arrives at a station the next one activates.

Terukio
Long Handed Inserter
Long Handed Inserter
Posts: 67
Joined: Mon Mar 21, 2016 11:30 pm
Contact:

Re: Train station priority

Post by Terukio »

You could also disable the station you're unloading at by reading a red train signal behind the train that is unloading and send that signal to the station to close it.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Train station priority

Post by mrvn »

Terukio wrote:You could also disable the station you're unloading at by reading a red train signal behind the train that is unloading and send that signal to the station to close it.
That only helps if there is a second train waiting to unload. The case in question is when deliveries are low.

You also don't want to disable the station if a train drives through or is simply just arriving. Instead of the signal I use the trains ID. Each station has 2 decider combinators: "T = 0 ==> green 1" and "X > capacity ==> green 1" and the station is set to read train ID + enable "green > 1".

You can also search the forum for my post on how to make an enable/disable station with waiting bay so 2 trains can be at every station.

gsezz
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Thu Jan 04, 2018 8:23 pm
Contact:

Re: Train station priority

Post by gsezz »

Basically your problem is: when you consume more than you can deliver, only the first station gets something. - There is only one way to really fix this: mine more ore! Or deliver more.
Or if this happens in short spikes, buffer more ore in trains in a stacker in front of the smelting stations.

You could check the contents of your stations against each other, and open a station only when it has less ore than any other station. -> trains should circle through all station. This stops working when more than one station reaches zero, but at this point you should really stop messing with these stations and build new outposts. ;)
You could expand this into a real priority system by limiting the stations output. For example, one station could stop its inserters when the its under 100 ore, another station should stop when under 200 ore. -> if both are "empty" the one with 100 ore has priority.
This bottlenecks your stations a bit, because a second station will not immediately open while a train is being unloaded in the first station. You can minimize this by reading and adding the content of the train to the station.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Train station priority

Post by zOldBulldog »

Summarizing what I think is being said here:

1) Each mine / ore deposit has a loading station.

2) All of the loading stations for the same ore (i.e: copper) have the same name.

3) Read the chests to determine if they are full or at least have more than "x" items.

4) Read the signal immediately behind the train stopped at the station to determine if the station is occupied.

5) If (3) is true and (4) is green, enable the station. Otherwise disable it.

6) Presumably, if the station is disabled, the pathfinding should not send the train to the branch where the station is (I am assuming the station has a dedicated branch) and thus go to another mine. If a second train got into the branch before the first train got into the station, then it would wait for the first one to load and go, but with stack inserters it should be very fast. This can be completely prevented by making the whole branch one segment (segment =distance between signal lights) but my instincts tell me it is probably better to make extra trains and have up to one idle train per loading station than have a station be idle waiting for a train. Max throughout ought to happen if both loading and unloading stations have trains on them all the time even with the stack inserters running at max speed.

7) So, if each station has space for one train plus one waiting immediately behind, without clogging the lanes, the ideal number of trains is : 2 per unload station, 2 per mine, and 1 more in transit for each unload station. This should work well until the distances get long, then it may be necessary to add a stacker and extra trains to support more than one train in transit for each unload station. I partially implemented this and so far it works well. My only worry is to avoid getting run over crossing the main spur that goes to the unload station... so many trains :)

8) Unloading stations that are part of a set can probably follow similar logic, all with the same name. But unloading stations for different sets (each set being stations far apart or for different purposes and that you don't want to run dry) most likely need separate station names.

QUESTION:

Since I have 6 chests per wagon, is there an elegant/simple way to measure if every single waiting chest is full?

Man, I am so looking forward to having time to finish building this.

Mr. Tact
Filter Inserter
Filter Inserter
Posts: 460
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Re: Train station priority

Post by Mr. Tact »

zOldBulldog wrote: Since I have 6 chests per wagon, is there an elegant/simple way to measure if every single waiting chest is full?
Run a wire on all the chests, it will provide the sum. 50 ore per stack, 48 slot chests, should be a total of 14,400
Professional Curmudgeon since 1988.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Train station priority

Post by zOldBulldog »

The solutions posted above are definitely better as they also check that the stop has enough cargo ready to fill the train, but I just stumbled into a trivial approach to close a station when a train is at it.

Probably very obvious to the experts, but not so obvious to us beginners, so I thought I'd share it.

- Run a wire to a do-nothing pole nearby, to create a circuit.
- The circuit connection panel shows on the Train stop.
- Check Enable/disable and Read stopped train.
- If the Output signal is at its default value of T, set the Enabled condition to T <= 0.

And bingo! If there is a train at the stop, T has a value > 0 and thus the stop gets disabled.

That should work for a lot of people.

---

In my case I'm going to have to learn a bit more about combinators before I can do the solution I want. I only want to disable a station when:

1) The chests (or Storage Tanks) are not full (meaning that a full load is guaranteed, at max load speed).
OR
(
2A) T > 0 (a train is present at the Stop).
AND
2B) 2nd train signal back from the Stop is Red (meaning I have a train at the stop AND I have a train waiting right behind it).
)

Mr. Tact
Filter Inserter
Filter Inserter
Posts: 460
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Re: Train station priority

Post by Mr. Tact »

zOldBulldog wrote: In my case I'm going to have to learn a bit more about combinators before I can do the solution I want. I only want to disable a station when:

1) The chests (or Storage Tanks) are not full (meaning that a full load is guaranteed, at max load speed).
OR
(
2A) T > 0 (a train is present at the Stop).
AND
2B) 2nd train signal back from the Stop is Red (meaning I have a train at the stop AND I have a train waiting right behind it).
)
You could do this with 5 decision combinators. One for each decision, the fourth to get the "and", the fifth being the "or" between the first and the fourth.
Professional Curmudgeon since 1988.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Train station priority

Post by zOldBulldog »

Mr. Tact wrote:
zOldBulldog wrote: In my case I'm going to have to learn a bit more about combinators before I can do the solution I want. I only want to disable a station when:

1) The chests (or Storage Tanks) are not full (meaning that a full load is guaranteed, at max load speed).
OR
(
2A) T > 0 (a train is present at the Stop).
AND
2B) 2nd train signal back from the Stop is Red (meaning I have a train at the stop AND I have a train waiting right behind it).
)
You could do this with 5 decision combinators. One for each decision, the fourth to get the "and", the fifth being the "or" between the first and the fourth.
Thanks for the details, will do.

Post Reply

Return to “Gameplay Help”