Trains: Failover/Alternate stops.

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Trains: Failover/Alternate stops.

Post by zOldBulldog »

I was thinking about train routes and the best ways to manage trains and how to keep belts full and compressed.

I came up with this plan, using iron ore as an example:

- A load stop at each iron deposit. All iron deposit stops are called Iron Load (we don't care which deposit the iron comes from). Use circuits to make the stops unavailable unless the chests are full and ready to load.

- Give each location that needs iron ore it's own stop name. For example Iron Unload 1, Iron Unload 2, Iron Unload 0. Each of these locations have 2 stops each, where either can keep the belts saturated.

- Have at least 3 or 4 trains scheduled from Iron Load (aka any iron deposit) to the location (i.e.: Iron Unload 1). The idea is to always have one train unloading and almost always a second one unloading too. Because of the oversupply, these trains may have to wait here to fully empty. Add more trains to the route as the deposits get further away.

- If a train arrives and finds both of the location stations full, instead of just sitting in a stack to wait for a turn to unload, ignore the planned stop and go unload at a Failover stop.

The last step is where I am having trouble. Is it even possible to tell a train to ignore an unload stop if it finds it fully occupied and just go on to the next stop in the route? If possible, how would I go about doing it?

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

Re: Trains: Failover/Alternate stops.

Post by Terukio »

I've tried this, and with how mechanics are currently working (as intended) what you want is clunky at best.

The best I came up with required loops so when a train station got shut off, the train was able to turn around at any intersection and go to its next destination.

I had a "parking lot" for trains to go when their corresponding stations were all closed. This alleviated any issues where the train would just stop anywhere on the tracks...which sounds a lot like what you're trying to do.

You can close stations by counting the red train signals behind each train in the stack, say max of 5 spots in the stack. Wire all the signals up to their corresponding train station and then open the train station is #red signals <5 OR tick >0 (more on this later) This will pose an issue when 5 trains are in the stack however as none will be allowed to go to the station...for this, you could try setting a combinator to send a pulse to the station and tell it to open for a couple of ticks so one train can make it to the station, freeing up a position in the stack. In order for this to work kinda well (still clunky) you need two signals at the end of each train in the stack, that way the train moving into the station only has to go a small distance before allowing the signal behind it to turn green, thus keeping the station open due to a free spot in the stack.

If you need clarification let me know.

EDIT - Can't test this right now, but I don't remember if closing a station forces the current train at the station to leave or not...

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

Re: Trains: Failover/Alternate stops.

Post by gsezz »

I can think of a few solutions. The easiest would be to give the failover stop the same name as your unloading stations, and block it off with a controlled signal as long as the unloading stations are not saturated. This works only if its nearby, and you can use chain signals from the stacker to the failover.

Or deactivate your unload stations while saturated. -> train will skip to next station in schedule. Also deactivate failover station when smelting is not saturated, to keep your empty trains from going there after they've been unloaded.

Or build a "fake" unloading station with the same name, but without unloading, blocked off with a signal like above. The train dosen't skip the station, but doesn't get unloaded.


I'm interested in how you use the same station name for your iron mines. Wouldn't all your trains always go to the same mine, whichever is the nearest active at the moment? This bottlenecks your iron output almost to the speed of loading one train at a time. I've tried something like this, but couldn't find a solution.

What happens with the stuff in your failover storage? You direct it to the smelting area later, where it should have gone in the first place? The only thing you gain from this is more pollution by mining more than you need at the moment. Let the trains wait in the stacker. This will slow down your mines to exactly the speed you need, and produce the least pollution possible.
EDIT - Can't test this right now, but I don't remember if closing a station forces the current train at the station to leave or not...
It is possible to deactivate a station while a train is being unloaded, and the train will stay until it's empty. But there are circumstances in wich the train will leave early. I think it depends on the leaving condition of the train. "Wait till empty" works for me.

dood
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Mar 21, 2018 8:36 am
Contact:

Re: Trains: Failover/Alternate stops.

Post by dood »

zOldBulldog wrote:- If a train arrives and finds both of the location stations full, instead of just sitting in a stack to wait for a turn to unload, ignore the planned stop and go unload at a Failover stop.
You could wire it up to disable a location station if a train is unloading and if both are disabled, enable failover stop but what's the point of this?
zOldBulldog wrote:I'm interested in how you use the same station name for your iron mines. Wouldn't all your trains always go to the same mine, whichever is the nearest active at the moment? This bottlenecks your iron output almost to the speed of loading one train at a time. I've tried something like this, but couldn't find a solution.
Image
Last edited by dood on Wed Apr 11, 2018 2:12 pm, edited 1 time in total.

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

Re: Trains: Failover/Alternate stops.

Post by zOldBulldog »

Terukio wrote: I've tried this, and with how mechanics are currently working (as intended) what you want is clunky at best.
The best I came up with required loops so when a train station got shut off, the train was able to turn around at any intersection and go to its next destination.
I had a "parking lot" for trains to go when their corresponding stations were all closed. This alleviated any issues where the train would just stop anywhere on the tracks...which sounds a lot like what you're trying to do.
Thanks for the info. I was hoping as it would have been more efficient, but I guess I'll just make more stacks/parking lots and more trains.

- For this area I am using only 1 loco, 2 wagon trains. That makes things very flexible, and they are pretty fast.

- Ideally I want 3 trains per route. 1 unloading, one (usually) loading at an ore depot, and one either in-route or waiting behind the train that is unloading. Maybe more trains per route as distances increase (although that means increasing the waiting space at the arrival area) but not much as I can always keep this portion small and use transshipping station with plenty of buffer chests to keep these little trains always full and busy.

- I have a main unloading branch where my unload stations are, and the unload stations are each on its own branch-off. That keeps the main line free and moving fast. I just have to be careful crossing it, as it has a LOT of traffic.

- I thought of using a stacker/parking lot design at the entrance of the main unloading branch, but I would want one that is shared by all the unload stations and I don't think the pathfinding would be smart enough to keep them waiting there instead of trying to send them down the main branch and clogging the way for all the other stations when an individual station's mini-branch is full.

So, as you can see I was hoping for an alternative that would allow me to (1) always have at least one train unloading at each station, (2) minimize space usage and (3) minimize how many full trains are waiting for a slot to unload. TBH, I am stumped trying to find better than what I got so far, and what I got feels inadequate.
gsezz wrote:
The easiest would be to give the failover stop the same name as your unloading stations, and block it off with a controlled signal as long as the unloading stations are not saturated.
I saw your post just as I was finishing my reply to Terukio.

- I thought of using the same name for all the iron unload stations and I will definitely do that as then I will be able to place all my smelter arrays with the same type of raw ore together. But I can't do that in this world without a huge amount of work, as I currently have separate smelter arrays for Iron on the bus, Iron to make Green Circuits, Iron for Steel, and Iron to supply my chemical plants. If I used the same name, chances are that pathfinding would send most trains to the closest arrays... and when some of the ore deposits start running out it would starve the rest.

- I think I like the idea of deactivating a station when saturated. I didn't realize that if a station is deactivated the train would skip to the next one. Also, I thought that deactivation was achieved by setting a red light at the entry branch which doesn't really deactivate the stop. If I can wire a circuit to the stop itself that tells it to deactivate... it can really work: I'd set the route Load -> Do Nothing right before Unload -> Unload -> Failover Unload. Then if Unload and Do Nothing are both full, deactivate them so that trains go to failover. If failover is full already, deactivate it.

Answering your questions:

- I have not implemented yet the iron mine thing. I do want the trains to go to the nearest mine (and exhaust it) if it is unoccupied and has full chests. My thought was to disable the stop (I had found a tutorial - probably from before you could disable a stop itself - that could turn a light red on the entry to its branch-off and thus send the train to another mine by the same name). But now that you can disable the stop itself... that might be even better.

- The stuff to failover has a belt backfeeding the other areas. It is redundant, just in case I don't notice that a destination is running low on ore. It makes for a small ore bus behind the smelters. The alternative would be a single unload area and a huge raw ore bus behind the smelters (I have a total of 10 copper, 13 iron, and I think 2 stone smelters). After the fact I realized that what I really need to do is put all smelting clustered "by ore" and a single unload area per ore type and a short wide bus of just the one ore type going to its smelters, but I figured it out too late and now it would be a huge re-engineering effort. Maybe I'll do that in the future and move smelting to its own outposts.

dood
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Mar 21, 2018 8:36 am
Contact:

Re: Trains: Failover/Alternate stops.

Post by dood »

zOldBulldog wrote:- I thought of using a stacker/parking lot design at the entrance of the main unloading branch, but I would want one that is shared by all the unload stations and I don't think the pathfinding would be smart enough to keep them waiting there instead of trying to send them down the main branch and clogging the way for all the other stations when an individual station's mini-branch is full.
Image
Works pretty easy.
zOldBulldog wrote:- I thought of using the same name for all the iron unload stations and I will definitely do that as then I will be able to place all my smelter arrays with the same type of raw ore together. But I can't do that in this world without a huge amount of work, as I currently have separate smelter arrays for Iron on the bus, Iron to make Green Circuits, Iron for Steel, and Iron to supply my chemical plants. If I used the same name, chances are that pathfinding would send most trains to the closest arrays... and when some of the ore deposits start running out it would starve the rest.
Don't do that then.
If you must transport ore, have 1 big, centralized smelter and transport the plates where they are needed.
If you have 1 place to pick up stuff from, it also serves to equally distribute the output of all your ore outposts.

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

Re: Trains: Failover/Alternate stops.

Post by Terukio »

- I thought of using the same name for all the iron unload stations and I will definitely do that as then I will be able to place all my smelter arrays with the same type of raw ore together. But I can't do that in this world without a huge amount of work, as I currently have separate smelter arrays for Iron on the bus, Iron to make Green Circuits, Iron for Steel, and Iron to supply my chemical plants. If I used the same name, chances are that pathfinding would send most trains to the closest arrays... and when some of the ore deposits start running out it would starve the rest.
I've also done this, and to alleviate the concern of the trains all going to the nearest station, I just disabled the ore pickup station if there was not enough ore there for a full load anyways. Doesn't matter if they're all going to the closest station or not if there is enough ore to support all the trains. Just have to make sure the trains have an exit condition if the station closes while they're waiting for pickup.

Again, this is clunky at best. There is a mod for more control over trains. I have yet to dig deep into it yet as it is very complicated and more effort that I was willing to put in.

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

Re: Trains: Failover/Alternate stops.

Post by zOldBulldog »

Good advice dood, I am very tempted to do exactly what you just posted... even if it means tearing out all of my smelters and doing the setup from scratch.

Doesn't work for my current base layout (the distance from the stacker to each stop would be fairly long and not a good idea on a rail segment with no intermediate stops, but maybe instead of constantly trying to fix the table leg I need to bite the bullet and get a new table. Time to beef up my bot setup and then tackle this :)

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

Re: Trains: Failover/Alternate stops.

Post by gsezz »

I've also done this, and to alleviate the concern of the trains all going to the nearest station, I just disabled the ore pickup station if there was not enough ore there for a full load anyways. Doesn't matter if they're all going to the closest station or not if there is enough ore to support all the trains.
It matters a lot when your base gets bigger, and you need the output (items per minute) of multiple outposts. There has to be a train being loaded at every outpost the whole time. You can't have all your trains waiting in a line at a single outpost.


@dood If I'm correct this disables the station when there is a train. But how would that help to direct only one train at a time to one outpost. Train one starts from base to outposts, travels about a minute. During this minute 4 more trains are starting to this station. Train one arrives, station deactivates, the other 4 trains turn around and go to another outpost, possibly in the complete opposite direction. another minute passes, two more trains are starting from the base to outpost 2. Now there are 6 trains heading to a station that will only accept 1 of them, and the others will turn around and hope for better luck next time. Outpost one opens again, all trains are going there again. In the meantime the furthest outposts 5 and 6 probably haven't seen a train for a long time, because the trains are always going back and forth between two or maybe three outposts which shut their doors in front of them. Eventually fuel runs out and you have a traffic jam.

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

Re: Trains: Failover/Alternate stops.

Post by zOldBulldog »

It took a lot of hours but I finally figured out the first step for this, coming up with the circuit logic to disable the stops when occupied and just the way I wanted it (with exactly one backup train waiting just behind the one that is loading/unloading.

But... as I have not been spending time reengineering my train stuff I have not consumed new materials and after a bit all of my trains and unloading stations were full. With that my unloading stations all became disabled.

And the trains went nuts, going from loading station to loading station nonstop... Since they were already full.

I think I now need a way to tell all full trains that have no unload stations available to go park themselves in a stack of until such a time when an unloading stations need supplies again. Frustrating.

Is that even possible?

Post Reply

Return to “Gameplay Help”