Page 1 of 1

Train depot

Posted: Wed Jun 26, 2019 1:38 pm
by JaJe
Hello again,

Yesterday while playing Factorio I got into a situation where I needed to create a train depot and I noticed that in the current situation is not possible to do so without wiring EVERYTHING between long distance stations which is not pretty nice.

Situation:

We have 2 trains;
* Train 1: For transporting Sulfuric Acid
* Train 2: For transporting Uranium ore

We have 6 stations;
* Station 1a: Uranium ore extractor; Station 1b: Empty Sulfuric Acid. (Both stations are in same area)
* Station 2a: Uranium ore extractor; Station 2b: Empty Sulfuric Acid. (Both stations are in same area)
* Station 3: Uranium extractor for my centrifuges and Filling train with Sulfuri Acid (1 station for 2 trains).
* Station 4: Train depot where the Train 1 should awaits the signal.

Normally you would suggest me to separate Station 3 to 2 stations, one for each train or just moving the pump to Station 4 and the problem is solved itself, but I like to complicate things, to challenge myself and better understand mechanics of this game.

Problem:

Train 1, the one that transport Sulfuric Acid, have the following path:
Station 4 (Received signal, go to destination) -> Station 1/2b (empty H2SO4) -> Station 3 (Fill H2SO4) -> Station 4 (Awaits new signal).

Stations 1/2b have a circuit signal connected to local tank storage, if Sulfuric Acid is less than 5k send signal A with enable/disable value.
So if the current station has enough Sulfuric Acid to keep miners working, disable the station.

The problem happens when both stations are filled with Sulfuric Acid and both stations are disabled the Train 1 keep going between Station 4 -> Station 3 in a loop.

I cannot use AND/OR conditions because I wouldn't know when Station1/2 needs another deliver of Sulfuric Acid and the only solution is to wiring the entire network from Station1/2 to Station 4 which in some circumstance it would be very impractical, expecially on very long distances. So I don't have any solution to keep Train 1 blocked in Station 4 until Station 1 or Station 2 is enabled again.

Solution:

Add another conditions for trains, Wait for next station to be available, not skipping the disabled one.

Re: Train depot

Posted: Wed Jun 26, 2019 3:30 pm
by Darinth
Not gonna lie... you acknowledged that you've chosen to make things more complicated when there's a perfectly valid existing solution but that you don't want to do the work created by previously mentioned complication. I believe that's an important point of contemplation.

I can see the use for this, but I feel like there are a number of more pressing features that have been requested by people to improve trains and fix problems that aren't fixable through other reasonable means. I feel like the better option is what you've already mentioned. Station 3 needs to be 2 stations, and that is where the sulfuric acid train should be parking at. Now the train schedule gets simplified to "Station 3b (sulfuric acid pickup) -> station 1b/2b (sulfuric acid dropoff)" and the train will nicely sit at the acid pickup until something needs the acid.

Re: Train depot

Posted: Wed Jun 26, 2019 4:29 pm
by SkiCarver
I guess I am just not using the game to its full potential .... I have a three car uranium train ... the middle car is a fluid wagon for the Sulphuric acid and is loaded at the uranium ore drop off station .... simples!

Re: Train depot

Posted: Wed Jun 26, 2019 5:10 pm
by mmmPI
What if you delete station 4 and let the trains await in station 3, as all the station on schedule will be disabled he will stop moving instead of going in a loop ?
Whenever a station 1 or 2 opens , the trains will go there and come back to station 3 and waits.

not sure i am understanding your setup

Re: Train depot

Posted: Wed Jun 26, 2019 8:19 pm
by JaJe
mmmPI wrote: Wed Jun 26, 2019 5:10 pm What if you delete station 4 and let the trains await in station 3, as all the station on schedule will be disabled he will stop moving instead of going in a loop ?
Whenever a station 1 or 2 opens , the trains will go there and come back to station 3 and waits.

not sure i am understanding your setup
If I remove station 4, then Train 2 loaded with Uranium have nowhere to unload stuff.

Re: Train depot

Posted: Thu Jun 27, 2019 9:59 am
by mmmPI
I didn''t understood your setup then;

Only train 1 get (H2SO4) in station 3 then goes to station 4 to wait a signal to unload (H2SO4)in station 1b or 2b. Then comes back to station 3 = > 4 => 1b or 2b => 3 => 4 ect


Not sure what train 2 does in station 3 ? unload ? then goes to station 4 to wait ? => 1a or 2a to get uranium => then goes to station 3 ? => then goes to station 4 .

Is that the actual behavior of your train ?

Then if you delete station 4 you may have train 1 waiting in station 3 for 1a or 1b to open preventing train 2 from unloading there right ?

You do not mean train 2 unload in station 4 right ?

What you need if i understand is a way to put one train in a parking instead of having it go a loop which means that parking shouldn't be in its regular pathing because there is another train using the same pathing that doesn't need the parking and would be blocked by the first one.

Right ?

There may be some things to test with the train ID. Each station has the possibility to read a train ID when there is one that is stopped. Maybe you could still delete the station 4. For that I am thinking about modifying your station 3.

First you need a way to know if train 1 is blocking train 2 or not, for that you can use " read signal " in a signal that you put where train 2 would be standing when blocked by train 1 . IF there is a train for say more than 20 second , it send signal O like occupied.

Then you add another 2x2 train station called station 3 exactly like the one you already have, Just the rail piece before the one you have and having turned off by default.

Now you ask your actual station 3 to read train ID and to turn off when it receive the "signal O" while train 1 is there.

If it receive "signal O" but train 1 is not there it means train 2 is first and train 1 behind so it will behave as it was behaving before for that train.

When train 1 arrive at station 3 it will wait there (in case of acid tanks full everywhere aka the problematic case) until station receive "signal O".

Now you switch for let say 1 second your 2 different station 3 opens/ close , and you switch them back just after.

The train 1 that had nowhere to go because all the station on his path are disabled will find itself 2 tiles off the new station 3 for like 1 second, like the station temporarily move 2 tile behind where it is parked.

This will make him wants to leave the area and join the new station so basically loop around, letting the train 2 access the station.

I am not sure this would work fine at first try i may be forgetting some conditions to make it properly function, and it does seems overcomplicated :D but hey sometimes you got this idea and you challenge yourself to realize it, that's how you discover the easier method and learn stuff i guess, and it feels good when it works.

Would that seems to help in the situation ? Maybe you'd prefer to implement something around station 4.


My idea here is to somehow let your system know when a identified event is occuring using the positions of train, and give it ways to auto-adapt, rather than preventing the event to happen using wire, both can give information and triggers an answer, one may handle it locally by reading the consequences of what is happening far away.

I do understand that this is a suggestion, maybe if there are no easy work around to that problem or the setup described has lots of flaws it will weight FOR the suggestion, thought it is highly possible someones propose a simpler alternative to that particular case, you had some solutions yourself, that is kind of a counter-argument as why would someone spend time implementing something.

Re: Train depot

Posted: Thu Jun 27, 2019 10:56 am
by JaJe
mmmPI wrote: Thu Jun 27, 2019 9:59 am I didn''t understood your setup then;

Only train 1 get (H2SO4) in station 3 then goes to station 4 to wait a signal to unload (H2SO4)in station 1b or 2b. Then comes back to station 3 = > 4 => 1b or 2b => 3 => 4 ect


Not sure what train 2 does in station 3 ? unload ? then goes to station 4 to wait ? => 1a or 2a to get uranium => then goes to station 3 ? => then goes to station 4 .

Is that the actual behavior of your train ?

Then if you delete station 4 you may have train 1 waiting in station 3 for 1a or 1b to open preventing train 2 from unloading there right ?

You do not mean train 2 unload in station 4 right ?

Nope, Train 2 only goes to Station 1a, Station 2a and Station 3 to unload uranium, it's not going to Station 4.
mmmPI wrote: Thu Jun 27, 2019 9:59 am What you need if i understand is a way to put one train in a parking instead of having it go a loop which means that parking shouldn't be in its regular pathing because there is another train using the same pathing that doesn't need the parking and would be blocked by the first one.

Right ?
All I need is a condition that once all stations are disabled except Station 3 for loading H2SO4 and Station 4 for waiting to not skip the disabled station.
Example, I setup my train with the following condition
1. Station 4 (awaits)
2. Station 1b unload H2SO4 - currently the station is disabled so its marked as red
3. Station 2b unload H2SO4 - currently the station is disabled so its marked as red
4. Go to station 3 to fill with H2SO4
5. Return to Station 4.

During this situation, while Station 1b and 2b are disabled the train have the following path in a loop until one of the disabled station is returning back online.
1. Station 4 (awaits)
4. Go to station 3 to fill with H2SO4
5. Return to Station 4.
[/quote]
mmmPI wrote: Thu Jun 27, 2019 9:59 am
There may be some things to test with the train ID. Each station has the possibility to read a train ID when there is one that is stopped. Maybe you could still delete the station 4. For that I am thinking about modifying your station 3.

First you need a way to know if train 1 is blocking train 2 or not, for that you can use " read signal " in a signal that you put where train 2 would be standing when blocked by train 1 . IF there is a train for say more than 20 second , it send signal O like occupied.
Train 1 does block Train 2 on Station 3 because that station is used for both unloading uranium and loading H2SO4, all other stations are independent for each train.
mmmPI wrote: Thu Jun 27, 2019 9:59 am
Then you add another 2x2 train station called station 3 exactly like the one you already have, Just the rail piece before the one you have and having turned off by default.

Now you ask your actual station 3 to read train ID and to turn off when it receive the "signal O" while train 1 is there.

If it receive "signal O" but train 1 is not there it means train 2 is first and train 1 behind so it will behave as it was behaving before for that train.

When train 1 arrive at station 3 it will wait there (in case of acid tanks full everywhere aka the problematic case) until station receive "signal O".

Now you switch for let say 1 second your 2 different station 3 opens/ close , and you switch them back just after.

The train 1 that had nowhere to go because all the station on his path are disabled will find itself 2 tiles off the new station 3 for like 1 second, like the station temporarily move 2 tile behind where it is parked.

This will make him wants to leave the area and join the new station so basically loop around, letting the train 2 access the station.

I am not sure this would work fine at first try i may be forgetting some conditions to make it properly function, and it does seems overcomplicated :D but hey sometimes you got this idea and you challenge yourself to realize it, that's how you discover the easier method and learn stuff i guess, and it feels good when it works.

Would that seems to help in the situation ? Maybe you'd prefer to implement something around station 4.


My idea here is to somehow let your system know when a identified event is occuring using the positions of train, and give it ways to auto-adapt, rather than preventing the event to happen using wire, both can give information and triggers an answer, one may handle it locally by reading the consequences of what is happening far away.

I do understand that this is a suggestion, maybe if there are no easy work around to that problem or the setup described has lots of flaws it will weight FOR the suggestion, thought it is highly possible someones propose a simpler alternative to that particular case, you had some solutions yourself, that is kind of a counter-argument as why would someone spend time implementing something.
Thank you for your reply, but I've came in conclusion that in the current situation of the game, the only way I can do this train depot is by wiring stations 1b/2b all the way till station 4 and creating some conditions directly from those stations and send it to station 4.

Re: Train depot

Posted: Thu Jun 27, 2019 1:53 pm
by Ranger_Aurelien
SkiCarver wrote: Wed Jun 26, 2019 4:29 pm I guess I am just not using the game to its full potential .... I have a three car uranium train ... the middle car is a fluid wagon for the Sulphuric acid and is loaded at the uranium ore drop off station .... simples!
I do this as well, but Loco<Fluid(h2so4)<Cargo(U)<Cargo(U)<Cargo(U). It seemed proper to me to put the fluid wagon at the start, and allow for unlimited extension for longer trains. My U mining trains only have wait condition (Wait 30 seconds) at both Stations. :P

This seems so efficient; maybe I should have the track spell out my name or use relay stations across a river...

Re: Train depot

Posted: Thu Jun 27, 2019 2:07 pm
by mmmPI
I have quite some free time, so I tried to make the example i was describing above , It doesn't work, the train doesn't loop around the 2nd station 3 unless you manually ask it to repath, i will try some more contraption because i like this aspect of the game.

I think https://mods.factorio.com/mods/Optera/L ... ainNetwork would achieve what you want, but is not in the vanilla base game that i understand.


I had question when trying to reproduce the setup you decribed, how do you have your train 2 scheduled to choose from 1a or 2a ? 1A=>3=>2A=>3=>1A=>3 ect ? or 1A=>2A=>3=>1A=>2A=>3 ect ? and which condition ?

And for the Train 1, what condition do you set for the station 1B and 2B ? when both station need acid , the train goes to station 1B leaves when acid > 5K and then to station 2B, and refill at the end , or refill between each ?

I like those setups, once i've made on that barrel the sulfuric acid and only use 1 cargo wagon with filter to share ore , full and empty barrel :D

Re: Train depot

Posted: Thu Jun 27, 2019 2:57 pm
by Reika
I did something similar for my last save, and paired AutoTrainDepot and RadioNetwork - for the depot management and signal transmission respectively - to accomplish it.

Re: Train depot

Posted: Thu Jun 27, 2019 3:25 pm
by mrvn
For station disabling to work you need a schedule with just 2 stops. Otherwise you get that loop you seen. But you can add another station and play tricks with the station names and locations.
  • Name Stations 1b/2b "Sulfuric Acid Unload".
  • Name Station 3 "Sulfuric Acid Load"
  • Add a Station 3b after Station 3 named "Sulfuric Acid Unload" and set it to enable only when Station 3 reports a train with Sulfuric Acid on board. Add a constant combinator to Station 3B with "green = 1".
  • Name Station 4 "Sulfuric Acid Load" and place it so that Train 1 will go there after Station 3b and not before passing through Station 3. Add a constant combinator to Station 3B with "green = 1".
Train 1 then gets a schedule:
  • Sulfuric Acid Load: Full or Circuit condition "green = 1"
  • Sulfuric Acid Unload: Empty or Circuit condition "green = 1"
So Train 1 has a schedule with just 2 stops. Perfect for disabling stations. It will go to Station 3 and load up on acid. This enables Station 3b and it will go there next. Then it goes to Station 4 and waits till Station 1b or 2b gets enabled. When they do it delivers it's cargo and the whole thing starts over.

Note: the "green = 1" for station 4 is just a fall back in case Train 1 ever reaches the station empty.

Re: Train depot

Posted: Thu Jun 27, 2019 3:35 pm
by mmmPI
I have done some further experiment and managed to have a functionning version of what i described.

this how it look on the map, North and East are the supposed uranium patch, i used infinity chest, and water instead of acid, you could just add or move the tank to simulate a tank that need acid.
20190627172132_1.jpg
20190627172132_1.jpg (140.54 KiB) Viewed 5891 times
Here is the station 3 and 4 that are mashed together, and i still doubled the station 3 to make the thing work.
20190627172115_1.jpg
20190627172115_1.jpg (440.75 KiB) Viewed 5891 times
What happens is the train full of water always occupy the station.
If water needed somewhere it moves and come back to fill in and wait.

If the other train arrive there are 2 option =>
1) water wagon is full => loop around and let other train unload.
2) water wagon is not full => other train waits at a signal that will turn green when water is full and go to option1)

It does provide with a station 4 where the train waits it just happen to be on top of the station 3 :D

I attached a save, let me know if i made a mistake somewhere i tested a bit until i could not see problems. this version worked flawlessly to me.
No wiring attempts 5.zip
(4.32 MiB) Downloaded 108 times

Re: Train depot

Posted: Thu Jun 27, 2019 3:42 pm
by JaJe
mmmPI wrote: Thu Jun 27, 2019 2:07 pm I had question when trying to reproduce the setup you decribed, how do you have your train 2 scheduled to choose from 1a or 2a ? 1A=>3=>2A=>3=>1A=>3 ect ? or 1A=>2A=>3=>1A=>2A=>3 ect ? and which condition ?

And for the Train 1, what condition do you set for the station 1B and 2B ? when both station need acid , the train goes to station 1B leaves when acid > 5K and then to station 2B, and refill at the end , or refill between each ?
Station 1a and Station 2a have the same name actually, I just named 1a, 1b for the purpose of this tread which mean the train goes to the nearest train station available to do the job and return. Same goes for the 1b and 2b.

So basically for Train 2, the one that transport uranium is something like that: 3=>Either 1A or 2A => 3

For Train 1, the one that transport Sulfuric Acid is the same rule: 4 (with full of fluid and awaiting => Either 1B or 2B depends which one is enabled => 3 Refill => 4

If both 1B and 2B is enabled, it first goes to the nearest one to fill with Sulfuric Acid and the station goes offline (disabled) and it remains the other one available that needs Sulfuric Acid.

Re: Train depot

Posted: Thu Jun 27, 2019 4:37 pm
by JaJe
I've made a save to show the situation,
I only used -CREATIVE MOD

Test yourself by turning on/off Constant combinators near red lights.

Bust most important is check fluid wagon path settings, as you see I have no ideea what to choose for Station 4 in order to prevent loop until one of Station 1b or 2b is back online.

I Hope this make everything simple to understand why I make this suggestion.

Place the .zip file to -> %appdata%\factorio\saves

Re: Train depot

Posted: Fri Jun 28, 2019 10:27 am
by mmmPI
Hey i was a bit disappointed that the method proposed was not good enough, so I took your save, and try to implement the "loop around to make room" thing on your setup.
20190628121320_1.jpg
20190628121320_1.jpg (495.11 KiB) Viewed 5834 times
I wanted to look at both of them at the same time, your version and mine, and then i realised there is a VERY EASY way to achieve what you describe:


If you want the train to wait for the next station to enable, you just need to build a station with the same name as those that are disabled/enabled.

You build it on a isolated piece of rail, and have the statioon enable always.
20190628121308_1.jpg
20190628121308_1.jpg (504.84 KiB) Viewed 5834 times
The train will indicate " No path" instead oof skipping the disabled station, and will wait for one to open exactly as you want.

here is the save with both method , the one on the right side is much much better in my opinin as it allow the exact same behavior as the sugested one.
Creative Train Depot Attempt 4.zip
(4.57 MiB) Downloaded 121 times

Now to go further, maybe the way it function cost more CPU usage than what could be used with the new condition for train that is suggested, that would still be a reason in favor of the suggestion, or maybe you need to upload another save to explain to me why this doesn't work in all situations :D , you know i like trying to solve puzzle if it can make it easier to implement that's great, idc about proving my point here , I still think the suggestion is valid as this seems like a hack, but hey it's part of the game too :)

Re: Train depot

Posted: Fri Jun 28, 2019 1:24 pm
by redfoxrommy
Why dont you set a train 2 cargo and 1 fulid wagons and set item count 4k uranium

Re: Train depot

Posted: Fri Jun 28, 2019 2:09 pm
by Darinth
mrvn wrote: Thu Jun 27, 2019 3:25 pm For station disabling to work you need a schedule with just 2 stops. Otherwise you get that loop you seen. But you can add another station and play tricks with the station names and locations.
  • Name Stations 1b/2b "Sulfuric Acid Unload".
  • Name Station 3 "Sulfuric Acid Load"
  • Add a Station 3b after Station 3 named "Sulfuric Acid Unload" and set it to enable only when Station 3 reports a train with Sulfuric Acid on board. Add a constant combinator to Station 3B with "green = 1".
  • Name Station 4 "Sulfuric Acid Load" and place it so that Train 1 will go there after Station 3b and not before passing through Station 3. Add a constant combinator to Station 3B with "green = 1".
Train 1 then gets a schedule:
  • Sulfuric Acid Load: Full or Circuit condition "green = 1"
  • Sulfuric Acid Unload: Empty or Circuit condition "green = 1"
So Train 1 has a schedule with just 2 stops. Perfect for disabling stations. It will go to Station 3 and load up on acid. This enables Station 3b and it will go there next. Then it goes to Station 4 and waits till Station 1b or 2b gets enabled. When they do it delivers it's cargo and the whole thing starts over.

Note: the "green = 1" for station 4 is just a fall back in case Train 1 ever reaches the station empty.
Talk about using abusing the train pathing system to do weird things... it took me a minute to reason through what you'd done here but it's really cool if it all works like I think it does.

Train goes to the real loading station, the real loading station enables a fake unloading station just ahead of itself. As soon as the train leaves the real loading station, it heads for the nearest unloading station which is the fake one. When the train leaves the real loading station, the fake unloading station get disabled. At this point the train will path to the next closest unloading station if one is active.

It'll now go in it's normal loop... until both acid drops offs are disabled. Once that happens, when the train leaves the pickup station heading for the fake drop off station, it gets disabled and that means all of the drop off stations are disabled. It will repath to the closest pick up station, which you need to design your train network to make sure that is the fake pickup station. Now the train just waits there until one of the drop off stations are enabled.

I have to acknowledge... that's really cool. Not something that I can ever see myself using... but still really cool.

Re: Train depot

Posted: Sat Jun 29, 2019 7:46 am
by JaJe
mmmPI wrote: Fri Jun 28, 2019 10:27 am Creative Train Depot Attempt 4.zip


Now to go further, maybe the way it function cost more CPU usage than what could be used with the new condition for train that is suggested, that would still be a reason in favor of the suggestion, or maybe you need to upload another save to explain to me why this doesn't work in all situations :D , you know i like trying to solve puzzle if it can make it easier to implement that's great, idc about proving my point here , I still think the suggestion is valid as this seems like a hack, but hey it's part of the game too :)
I just tested your save file and I have to admit that's a wonderful trick you did there, kind of hacky If I can say so but it's working.
However yes, the suggestion is still valid.

Re: Train depot

Posted: Mon Jul 01, 2019 12:50 am
by mrvn
mmmPI wrote: Fri Jun 28, 2019 10:27 amI wanted to look at both of them at the same time, your version and mine, and then i realised there is a VERY EASY way to achieve what you describe:


If you want the train to wait for the next station to enable, you just need to build a station with the same name as those that are disabled/enabled.

You build it on a isolated piece of rail, and have the statioon enable always.

20190628121308_1.jpg

The train will indicate " No path" instead oof skipping the disabled station, and will wait for one to open exactly as you want.

here is the save with both method , the one on the right side is much much better in my opinin as it allow the exact same behavior as the sugested one.

Creative Train Depot Attempt 4.zip


Now to go further, maybe the way it function cost more CPU usage than what could be used with the new condition for train that is suggested, that would still be a reason in favor of the suggestion, or maybe you need to upload another save to explain to me why this doesn't work in all situations :D , you know i like trying to solve puzzle if it can make it easier to implement that's great, idc about proving my point here , I still think the suggestion is valid as this seems like a hack, but hey it's part of the game too :)
Careful with that. If the real station gets disabled while the train is between stations then it will stop with "No path" in the middle of the tracks. As soon as you want to expand to 2 trains for the schedule that is a certainty.

Re: Train depot

Posted: Mon Jul 01, 2019 1:49 am
by mmmPI
mrvn wrote: Mon Jul 01, 2019 12:50 am Careful with that. If the real station gets disabled while the train is between stations then it will stop with "No path" in the middle of the tracks. As soon as you want to expand to 2 trains for the schedule that is a certainty.
That is true, I had fiddle around and came up with a fix,it is just a dummy station. It seems to function properly with 3 trains in the example, it is not perfect as the 3 trains leaves no matter wether only 1 or 2 station are enabled, so if you were to have 12 train you woud need a 12 train stacker everywhere, but it doesn't get stuck in my tests. I added some extra rail for safety reasons.
fixV2.png
fixV2.png (1.83 MiB) Viewed 5725 times
Here is the save :
Creative Train Depot Attempt 6.zip
(4.68 MiB) Downloaded 114 times
EDIT: this is a "fix" it is not a proper solution, it could still break for the same reasons, if one train repath exatly when it is in the fork, it will get stuck to the dummy station. The fork is only 1 block, it would be very unfortunate that a station closes just at the same time a train is exactly past the chain signal, but before the fork. It if this happens , you won't have to drive everything manually back, just ask the one train stuck to drive past the signal.

I guess the suggestion is still valid