Train yard management - circuit conditions advice needed
Train yard management - circuit conditions advice needed
I need some advice on how to setup circuit conditions to manage a train yard.
My situation is as followed:
I have a train staging (parking) area well outside my main base. On it are 5 iron ore trains waiting.
In my main base, my iron ore unloading station has inventory level detection: set "I"=1 when iron ore = 0
My iron ore trains have a circuit condition at the yard location to wait until "I"=1
How can i prevent all iron trains to leave the train yard when they are triggered?
My situation is as followed:
I have a train staging (parking) area well outside my main base. On it are 5 iron ore trains waiting.
In my main base, my iron ore unloading station has inventory level detection: set "I"=1 when iron ore = 0
My iron ore trains have a circuit condition at the yard location to wait until "I"=1
How can i prevent all iron trains to leave the train yard when they are triggered?
My Mod list: Necormant co-author
Re: Train yard management - circuit conditions advice needed
How about just a waiting bay:
However, I recommend using that space for on-deck trains.
The chain signals only allow one train through, and you could replace the regular signal with another chain or just remove it if you want it to have a big gap between the waiting area and the station.However, I recommend using that space for on-deck trains.
Re: Train yard management - circuit conditions advice needed
I also use leitk’s design without the rail signal.
It works well if you have only a couple of different unloading station types. If it’s a long distance or a main line then it probably isn’t suitable.
Using this method you don’t need to use a circuit condition to tell trains to go to the unloading station as only one can enter that section at a time.
Also, using leitk’s method, if I want to keep trains in the waiting bays I set a circuit condition on the rail signal at the start of the unloading station so that I don’t have to wire all the way to the waiting bays. IF iron ore > x, then close signal.
It works well if you have only a couple of different unloading station types. If it’s a long distance or a main line then it probably isn’t suitable.
Using this method you don’t need to use a circuit condition to tell trains to go to the unloading station as only one can enter that section at a time.
Also, using leitk’s method, if I want to keep trains in the waiting bays I set a circuit condition on the rail signal at the start of the unloading station so that I don’t have to wire all the way to the waiting bays. IF iron ore > x, then close signal.
Re: Train yard management - circuit conditions advice needed
Thanks Leitk/DScoffers,
That design works if the parking is next to the train station. So the output of the parking is directly linked to the multiple train stations.
The challenge in my base is that the train stations are in the center without any room for a nearby parking.
I am checking if i can use some of this logic: https://www.reddit.com/r/factorio/comme ... automated/
The last comment might work with SR latch:
loading station empty > SET (I=1)
Train dispatches from yard > RESET (I=0)
Tough i wonder if it needs to be this complicated
That design works if the parking is next to the train station. So the output of the parking is directly linked to the multiple train stations.
The challenge in my base is that the train stations are in the center without any room for a nearby parking.
I am checking if i can use some of this logic: https://www.reddit.com/r/factorio/comme ... automated/
The last comment might work with SR latch:
loading station empty > SET (I=1)
Train dispatches from yard > RESET (I=0)
Tough i wonder if it needs to be this complicated
My Mod list: Necormant co-author
Re: Train yard management - circuit conditions advice needed
If your trains at the trainyard can receive the I=1 signal, then there's a wire connection.
If there's a wire connection, then you can wire one of the train signals at the exit of the trainyard and send a message in reverse direction, telling your base that a train has been dispatched. Then you can set I to 0 again, and wait for the train to arrive and unload before checking for inventory again.
Personally I would set up a state storage in this situation, which would take the values of: "inventory full", "need cargo", "need cargo, train dispatched" and "train unloading", with separate circuits to manage the switch between conditions. That would use more combinators, but would be easier to debug and expand.
If there's a wire connection, then you can wire one of the train signals at the exit of the trainyard and send a message in reverse direction, telling your base that a train has been dispatched. Then you can set I to 0 again, and wait for the train to arrive and unload before checking for inventory again.
Personally I would set up a state storage in this situation, which would take the values of: "inventory full", "need cargo", "need cargo, train dispatched" and "train unloading", with separate circuits to manage the switch between conditions. That would use more combinators, but would be easier to debug and expand.
Re: Train yard management - circuit conditions advice needed
You need 2 combinators at the train yard per line/station.
There has to be a signal (pulse) "C=1" to call 1 train.
1st combinator: Input train station (T), if T>0 then T1.
2nd combinator: Input the call signal and the output of the first combinator. Output (C) = C-T.
Connect the call signal also to the station (leave condiction C>0) and pass the output of the 2nd combinator to the next station in the yard as new call signal.
If you are not sure that there always is a train somewhere in the yard, you can connect the output of the last 2nd combinator to the input of the first station. Then a "C=1" goes round until a train (T>0) arrives and is dispatched.
There has to be a signal (pulse) "C=1" to call 1 train.
1st combinator: Input train station (T), if T>0 then T1.
2nd combinator: Input the call signal and the output of the first combinator. Output (C) = C-T.
Connect the call signal also to the station (leave condiction C>0) and pass the output of the 2nd combinator to the next station in the yard as new call signal.
If you are not sure that there always is a train somewhere in the yard, you can connect the output of the last 2nd combinator to the input of the first station. Then a "C=1" goes round until a train (T>0) arrives and is dispatched.
The problem is that you cannot predict how long it will take for a train to travel from the trainyard to the unloading station. Hence, you do not know when to call for the next train. There is also no way to identify if the stuff arriving at the unloading station is from a specific train that you called. Such a system will never be robust enough with just a few combinators.
Re: Train yard management - circuit conditions advice needed
Personally I would try to find some space to fit at least one extra train at your unloading station, maybe have 2 unloading stations side by side if you can't fit a waiting bay before it. And then use just 2 trains. Name all the ore mines the same and disable the mine when it doesn't have enough ore buffered for a train. Make the loading / unloading as fast as possible, load / unload from both sides with 12 stack inserters (24 express stack inserters if you are using Bobs mod).
If you can't keep your ore processing busy with that then it would be better to build a new one where you have more space and then ship in plates. If you remove the smelters you should have enough space for multiple train stops so you can unload plates better.
Alternatively try the LTN (logistics train network) mod. Doing this manually with combinators is complex and error prone.
If you can't keep your ore processing busy with that then it would be better to build a new one where you have more space and then ship in plates. If you remove the smelters you should have enough space for multiple train stops so you can unload plates better.
Alternatively try the LTN (logistics train network) mod. Doing this manually with combinators is complex and error prone.
Re: Train yard management - circuit conditions advice needed
I’m not on Factorio to test this, but I think it would work.
Using your example, the signal I=1 would be sent when iron ore = 0.
This signal would have a timer that stops I=1 being sent after around 2-3 seconds, this would allow only 1 train to exit the waiting bays.
A second timer allows the I=1 to only be sent again starting 60 seconds later (if it applies of course).
The 60 seconds timer should be long enough for the train to get to the unloading station and start unloading.
This will depend on the distance between the waiting bays and unloading station.
Problems could arise if the mainline backs up.
Using your example, the signal I=1 would be sent when iron ore = 0.
This signal would have a timer that stops I=1 being sent after around 2-3 seconds, this would allow only 1 train to exit the waiting bays.
A second timer allows the I=1 to only be sent again starting 60 seconds later (if it applies of course).
The 60 seconds timer should be long enough for the train to get to the unloading station and start unloading.
This will depend on the distance between the waiting bays and unloading station.
Problems could arise if the mainline backs up.
Re: Train yard management - circuit conditions advice needed
I've tried to design a test setup with three trains in a loop setup.
clock pulses every 600 ticks, pulse triggers green signal
unloading gives green signal when empty
train released when 2 green signals received at parking.
intended behavior: train dispatched from parking when inventory is empty AND pulse received every 10 seconds
however the trains are still leaving too early.
mod used:creative mode
clock pulses every 600 ticks, pulse triggers green signal
unloading gives green signal when empty
train released when 2 green signals received at parking.
intended behavior: train dispatched from parking when inventory is empty AND pulse received every 10 seconds
however the trains are still leaving too early.
mod used:creative mode
- Attachments
-
- A train yard test.zip
- (4.17 MiB) Downloaded 134 times
My Mod list: Necormant co-author
Re: Train yard management - circuit conditions advice needed
The logic sounds like it should work, but it depends on your setup.
So 2 greens circuit signal are being sent too early.
Run it for a while and report back why.
So 2 greens circuit signal are being sent too early.
Run it for a while and report back why.
Re: Train yard management - circuit conditions advice needed
I think i have it - see my save file
The setup is now:
The demand indicator for Iron: =1 if inventory = 0
The demand indicator for Copper: [C]=1 if inventory = 0
In RED box
A clock set to 1200 ticks (=20 secs) before reset: output [C]
A train selector [T] where T = C/400 + 1. This way train 1,2,3 is selected.
Every Iron train in Parking has two conditions:
For Iron: Enable if I=1 AND T=1 (or 2 or 3)
For Copper: Enable if C=1 AND T=1 (or 2 or 3)
In this setup:
400 = the longest amount of time for the train to reach the station - this depends on travel distance and train speed
And the 1200 = the 400 times the number of trains per unloading station (here: 3)
For DEBUG I have:
Lights indicating which train is currently selected if there is demand.
A way to remotely [R] empty the unloading stations.
The setup is now:
The demand indicator for Iron: =1 if inventory = 0
The demand indicator for Copper: [C]=1 if inventory = 0
In RED box
A clock set to 1200 ticks (=20 secs) before reset: output [C]
A train selector [T] where T = C/400 + 1. This way train 1,2,3 is selected.
Every Iron train in Parking has two conditions:
For Iron: Enable if I=1 AND T=1 (or 2 or 3)
For Copper: Enable if C=1 AND T=1 (or 2 or 3)
In this setup:
400 = the longest amount of time for the train to reach the station - this depends on travel distance and train speed
And the 1200 = the 400 times the number of trains per unloading station (here: 3)
For DEBUG I have:
Lights indicating which train is currently selected if there is demand.
A way to remotely [R] empty the unloading stations.
- Attachments
-
- Screenshot
- factorio.png (2.91 MiB) Viewed 9840 times
-
- A train yard test 2.zip
- Save file
- (4.3 MiB) Downloaded 150 times
My Mod list: Necormant co-author
Re: Train yard management - circuit conditions advice needed
I don't think that works. All trains would get the signal and leave the station. Then all but one is blocked at the signal. But when it has left the signal turns green and the next train can leave. They don't return to the station.DScoffers wrote:I’m not on Factorio to test this, but I think it would work.
Using your example, the signal I=1 would be sent when iron ore = 0.
This signal would have a timer that stops I=1 being sent after around 2-3 seconds, this would allow only 1 train to exit the waiting bays.
A second timer allows the I=1 to only be sent again starting 60 seconds later (if it applies of course).
The 60 seconds timer should be long enough for the train to get to the unloading station and start unloading.
This will depend on the distance between the waiting bays and unloading station.
Problems could arise if the mainline backs up.
Re: Train yard management - circuit conditions advice needed
Trblz wrote:I think i have it - see my save file
The setup is now:
The demand indicator for Iron: =1 if inventory = 0
The demand indicator for Copper: [C]=1 if inventory = 0
In RED box
A clock set to 1200 ticks (=20 secs) before reset: output [C]
A train selector [T] where T = C/400 + 1. This way train 1,2,3 is selected.
Every Iron train in Parking has two conditions:
For Iron: Enable if I=1 AND T=1 (or 2 or 3)
For Copper: Enable if C=1 AND T=1 (or 2 or 3)
In this setup:
400 = the longest amount of time for the train to reach the station - this depends on travel distance and train speed
And the 1200 = the 400 times the number of trains per unloading station (here: 3)
For DEBUG I have:
Lights indicating which train is currently selected if there is demand.
A way to remotely [R] empty the unloading stations.
If you use just one station for iron and one for copper and have a stacker berfore them then you don't need to select a train. Prevents the delay when the selected train station is empty and you need to wait an extra 400 ticks for the next train to be selected.
Re: Train yard management - circuit conditions advice needed
You’re right, it wouldn’t work with a stacker using train stations. I was thinking of using a stacker with chain signals, so the timed signal I=1 is sent to rail signals straight after the chain signals on each bay to only allow one train through.mrvn wrote: I don't think that works. All trains would get the signal and leave the station. Then all but one is blocked at the signal. But when it has left the signal turns green and the next train can leave. They don't return to the station.
I still think it would work, but not in Trblz example with a stacker on the main line.
Re: Train yard management - circuit conditions advice needed
In any other world setup i would totally agree, however i am working with space restrictions. It's a city-block world based on octagons with the plan to use more short trains too.mrvn wrote:If you use just one station for iron and one for copper and have a stacker berfore them then you don't need to select a train. Prevents the delay when the selected train station is empty and you need to wait an extra 400 ticks for the next train to be selected.Trblz wrote:...
Right now there is a stacker on the left - i plan to replace it with a bunch of unloading stations.
- Attachments
-
- map.png (360.97 KiB) Viewed 9775 times
My Mod list: Necormant co-author
Re: Train yard management - circuit conditions advice needed
Nice map.
It looks cool, but I don’t quite understand it. Why have you gone for this design?
1) It looks like only the raw resources are delivered by train. So why have all of the city block rails?
2) If you’re going to add in loading and unloading stations on the existing city blocks, won’t deadlock be fairly easy?
3) it’s hard to tell from the map view but it looks like trains have to take a zigzag path round blocks rather than travelling between columns or rows in a fairly straight line.
It looks cool, but I don’t quite understand it. Why have you gone for this design?
1) It looks like only the raw resources are delivered by train. So why have all of the city block rails?
2) If you’re going to add in loading and unloading stations on the existing city blocks, won’t deadlock be fairly easy?
3) it’s hard to tell from the map view but it looks like trains have to take a zigzag path round blocks rather than travelling between columns or rows in a fairly straight line.
Re: Train yard management - circuit conditions advice needed
This map is not for optimal input/output.
More about learning logic to optimze trains planning in an unnecessary complicated way
No fluid bus but short trains
No train parking near unloading stations
If i want to scale it up, i will have to side load circuits - more trains.
Zigzagging is indeed a problem, especially for me getting killed as trains are coming from everywhere
More about learning logic to optimze trains planning in an unnecessary complicated way
No fluid bus but short trains
No train parking near unloading stations
If i want to scale it up, i will have to side load circuits - more trains.
Zigzagging is indeed a problem, especially for me getting killed as trains are coming from everywhere
My Mod list: Necormant co-author