Train/Station management issue

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
HansMeiser
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Jul 13, 2022 8:15 pm
Contact:

Train/Station management issue

Post by HansMeiser »

Greetings!
I'm currently working out how trains, stations and the network works. So far, I have managed to make a train continously deliver goods from A to B.
Now I'm at the point, where B can't hold any more goods, so the train is delivering nonetheless and eventually block other trains when waiting at the station to unload (yeah, I have no bay for that, too small).
So, I figured out, how to use the network to enable and disable the stations A and B at a certain event, and activate station C (otherwise deactivated) for the train to go to in this case. So, it's now a "train on demand" and this works perfect.
So far, so good.

Now the issue (and I think it has to do on how the game is programed):
Layout:
Station A is receiving (left of the map), Station B is sending (right of the map), Station C is the "waiting place" for the train (center of the map). The train is going clockwise (A -> (C) -> B -> A -> (C) -> B ...).

When goods are under a limit at A, a signal is used to activate station A and B, station C will be deactivated. The train (normaly) is going to B, loads up, goes to A, unloads and starts again (B -> A -> B -> A ...), When the limit is reached, a signal is used to deactivate A and B and C gets activated. The train goes there and waits.
Now the issue:
When the limit drops again and A and B get activated (simultanously), the train now doesn't stop at B first to load up, but goes first to A (which is useless without cago) and then to B, starting the delivery circle.

Why I belive this is a issue with "how the game is programes" is as follows:
Looking at "autobuild", one can see, that ghost items, when build, are placed from "top left to bottom right".
In my case with the stations, A is left and B is right. Whent both stationas are activated at the same time it seems, the train "sees" station A first, and then station B. Because of that, it goes first to A rather B, regadless of what the schedule plan says (I reordered this several times without success).
To proof my thoughts, I turned this around and made B receving and A sending (and the train still going clockwise) and this worked as intended.

So, my idea was to get something simple as a "delayed signal" but after hours and hours of searching and looking and testing the absurdest circuit suggestions I could find, I gave up.
Because of this behaviour of the game, what I would need is a in-game device (or at least a very, very small circuit setup) that does nothing else but send a given signal after a selectable amound of seconds. So I could first activate the sending station, and then the receiving station, circumvent the "left to right" issue of the game.
Or maybe my brain is just molten after those hours of frustrating testing ... :D

So .. long text, thanks for reading that far. :mrgreen: Maybe someone has a good suggestion for me, maybe even a solving idea ... ?
I could even live with a MOD, that does/give me this ability/item. Would be awesome.
astroshak
Filter Inserter
Filter Inserter
Posts: 640
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Train/Station management issue

Post by astroshak »

I’m going to guess that the train’s schedule is A, B, C.

With Enable/Disable, the train SKIPS whatever stations are disabled. So, regardless of what it was doing, it goes to C (the one that is Enabled) when you turn C on and A+B off.

Assuming my guess is correct, it goes to A first because its the next stop on the schedule after C.

You can get around this by simply adjusting the train’s schedule such that B is right after C.

You could ALSO get around this by, instead of turning the stops on and off, use the Train Stop Limits. Leave C on, but set C as a stop without a wait. Leave A and B on, but set the loading station’s L (the default Limit signal) based on the amount of stuff on hand, and the unloading station’s L by the amount of space available for more stuff.

This will (fortunately? Unfortunately?) have the train cycling through all three stops, though with the lack of any Wait at C it will just zip on through. You may want to adjust the train’s schedule to A, C, B, C, so that regardless of whether the train is loaded or empty, it will stop at C after finishing its busniess, when the next A or B has nothing for it.
HansMeiser
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Jul 13, 2022 8:15 pm
Contact:

Re: Train/Station management issue

Post by HansMeiser »

Thanks for your thoughts.
I’m going to guess that the train’s schedule is A, B, C
No, actually it's C, B, A. But like I wrote, the order of the schedule doesn't change this behaviour, except I'm missing something there.
You could ALSO get around this by, instead of turning the stops on and off, use the Train Stop Limits. [...]
I haven't looked at the train limits yet, but I will check this in the meantime. What I want to avoid, is, that empty trains are on the the tracks. Hence the train depot (station C) I want to implement.

Thanks again for your comment, keep 'em going. :D
Nidan
Filter Inserter
Filter Inserter
Posts: 286
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Train/Station management issue

Post by Nidan »

As already mentioned, train limits are probably the best solution for your problem.
Disabling a station tells the approaching trains to go away, first to another station with the same name and if there are none to the next schedule entry. If there are no enabled stations in the schedule or none of the first set of enabled stations can be reached the train will stop dead at it's current position.
When reaching out exceeding the train limit a station won't accept any new trains, but the ones already one the way will continue to come.

In your case disabling C might work, but for B(unloading) train limits are probably better. From your description it sounds like A(loading) could be left unlimited.
HansMeiser wrote: Wed Jul 13, 2022 9:00 pm So, my idea was to get something simple as a "delayed signal" but after hours and hours of searching and looking and testing the absurdest circuit suggestions I could find, I gave up.
Because of this behaviour of the game, what I would need is a in-game device (or at least a very, very small circuit setup) that does nothing else but send a given signal after a selectable amound of seconds.
Each arithmetic and decider combinator has a delay of one tick (or 1/60th of a second at normal game speed). So chaining them in a way that only pushes the signal from one to the next will delay the signal. Quite a lot of combinators however, if you need multiple seconds.
With a memory (a combinator not modifying the inputs and feeding itself) for storing the signal you want to delay, a timer (also a combinator feeding itself, but adding one each tick) for measuring time and a decider to pass on the stored signal once enough time has passed, you can create arbitrary delays in three combinators (plus a few extra so the delay can reset itself).
HansMeiser
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Jul 13, 2022 8:15 pm
Contact:

Re: Train/Station management issue

Post by HansMeiser »

Thanks for your info.
The train limit, as I have understood it, affects all trains and not specific ones. Because other trains also pass those stations (yes, I know, it's my first serious one and I didn't thought enough ahead), this would result in a "destination full" for those trains. So, not really what I want/need.

As for the delay ... I will look into this again, maybe you can provide an example blueprint to get me in the right direction.
Thanks for your thoughts.
HansMeiser
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Jul 13, 2022 8:15 pm
Contact:

Re: Train/Station management issue

Post by HansMeiser »

Allright! Update!
My brain cooled down, now I have found a solution for this issue and it's dead simple.

Instead of enable and disable all involved stations, I just use the depot station and ... a rail signal! :D
Setup is as follows:
The depot station has a rail signal before it placed (last possible dot before the station). Disable "read signal" and enable "close signal".
Make receiver station watch the goods. If goods fall under a set limit, a signal (i.e. Green 1) is sended to the depot station and the connected rail signal.
The depot station is enabled if Green = 0 and the rail signal is closed when Green = 0
What happens now, is:
If Green = 0, all affected/assigned trains finish their circle and go to the depot and stop there (station is eneabled but rail signal is red).
If Green = 1, the depot station becomes disabled and the rail signal turns green. And because the depot station is disabled, all affected/assigned trains start their circle ignoring the depot station till Green = 0 again.
Also make the depot station the first in the schedule (first before a goods sending station) and all works automagically. :)

I hope this makes sense and has also some logic to a certain point. :lol:

Would like to read some opinions for that. :ugeek:
Thanks again for involving.
Last edited by HansMeiser on Thu Jul 14, 2022 10:35 am, edited 1 time in total.
Nidan
Filter Inserter
Filter Inserter
Posts: 286
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Train/Station management issue

Post by Nidan »

HansMeiser wrote: Thu Jul 14, 2022 7:09 am Thanks for your info.
The train limit, as I have understood it, affects all trains and not specific ones.
It affects all trains that would otherwise be heading to that particular station, same as disabling the station.
As for the delay ... I will look into this again, maybe you can provide an example blueprint to get me in the right direction.
Thanks for your thoughts.
When I find the time... But the main part are the three combinators mentioned above. Exact implementation depends on how the input and output signals work on your map (continuous vs pulse? must the value be preserved? other constraints?).


Edit: Tackling the problem from another angle also works ;)
mmmPI
Smart Inserter
Smart Inserter
Posts: 4029
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Train/Station management issue

Post by mmmPI »

HansMeiser wrote: Wed Jul 13, 2022 9:00 pm Now the issue (and I think it has to do on how the game is programed):
Layout:
Station A is receiving (left of the map), Station B is sending (right of the map), Station C is the "waiting place" for the train (center of the map). The train is going clockwise (A -> (C) -> B -> A -> (C) -> B ...).

When goods are under a limit at A, a signal is used to activate station A and B, station C will be deactivated. The train (normaly) is going to B, loads up, goes to A, unloads and starts again (B -> A -> B -> A ...), When the limit is reached, a signal is used to deactivate A and B and C gets activated. The train goes there and waits.
Now the issue:
When the limit drops again and A and B get activated (simultanously), the train now doesn't stop at B first to load up, but goes first to A (which is useless without cago) and then to B, starting the delivery circle.

Why I belive this is a issue with "how the game is programes" is as follows:
Looking at "autobuild", one can see, that ghost items, when build, are placed from "top left to bottom right".
In my case with the stations, A is left and B is right. Whent both stationas are activated at the same time it seems, the train "sees" station A first, and then station B. Because of that, it goes first to A rather B, regadless of what the schedule plan says (I reordered this several times without success).

So, my idea was to get something simple as a "delayed signal" but after hours and hours of searching and looking and testing the absurdest circuit suggestions I could find, I gave up.
Because of this behaviour of the game, what I would need is a in-game device (or at least a very, very small circuit setup) that does nothing else but send a given signal after a selectable amound of seconds. So I could first activate the sending station, and then the receiving station, circumvent the "left to right" issue of the game.
Or maybe my brain is just molten after those hours of frustrating testing ... :D
If i understand correctly, you have a situation where a train does A=>B=>A=>B, just fine, when it's unecessary the train goes to park in C station.

When the train resume its schedule, the train can go from C=>A=>B=>A=>B and this create 1 useless trip since when arriving at A from C the train is empty it should have gone to B first. like so : (C=>B=>A=>B=>A).

The easiest correction i could see would be to add 1 decider combinator to enable A only if B is enabled. ( say your condition are if iron < 10 000 open station B, add one 1 combinator for if B open , then open A) This can be explained/done in several steps : by making if iron < 10 000 send Green signal 1, if green signal >1 open station B and send 1 blue signal, if blue signal >0 open station A.

This means the trains will not see both A and B opening at the same time but will see the B station before the A station. ( the time for the blue signal to go through the last mentionned check of the previous sentence . Each combinator adds a 1 tick delay. The decider combinator i'm advising to add shall receive the signal that B station is opened ( 1 green signal) and 1 tick after will allow station A to open. ( the time needed for 1 operation/check on the blue signal to be emited once the green signal is detected)

This means any train parked at the C station will always go to a loading area when getting activated. Which is not perfect because you don't know if the train needs to load or not, it prevent 1 kind of useless trip, ( an empty train to unloading) but doesn't guarantee another kind of useless trip ( a full train to a loading ).


( another imo better option would be to not have a C station, but only A and B, and you would set up a high limit for the loading at B and some stacker track for train to waits before their loading and you would have your different A-unloading with a limit that goes from 0 to 1 or 2 when material is required. This would allow trains to move only towards unloading when 1) it's required at the unload area 2) the train is loaded of such material, 3) not too many trains goes there at the same time but only the precise amount you set-up as limit ( not all your iron trains would try to move to the outpost as soon as it open but only 1 or 2 if limit is 1 or 2.)
HansMeiser wrote: Wed Jul 13, 2022 9:00 pm No, actually it's C, B, A. But like I wrote, the order of the schedule doesn't change this behaviour, except I'm missing something there.
If you have a schedule (C)=>B=>A=>(C)=>B=>A, when a train is at C and both A and B are disabled, the train is in a state where it is immobile and waiting for a destination to open,( no destination) whichever A or B opens first will receive the train, you could even have the train end up doing A=>C=>A=>C or C=>B=>C=>B, if you open only 1 station A or B instead of the 2 at the same or very close time. ( the "skipping station" behavior)

That behavior is different if instead of disabling A and B you set their limit to 0. In this case the train when immobile and waiting at C, instead of waiting for any station to open, the train will "remember" that it need go to B ( destination full). It's not possible anymore to have the train do A=>C=>A=>C or B=>C=>B=>C. if the train came to C after an A, and you unlimit A while B is still limited to 0, the train will not go to A it will continue to show the purple message "destination full" because its aim is a station B and not going back to station A.

Your system of disabling station is blind to wether or not the train has material in it when stations disabled, which could cause a full train or an empty train to be parked in the C station. In this case it's probably better to use the limit mechanism to make sure trains don't skip station and empty train parked at C would resume their activity going to loading area while full train parked at C would resume their activity to unloading area.

Delaying signals to make sure no empty trains goes to unload when leaving the C parking, is not enough to guarantee that no full train parked in C could resume their schedule seeking yet another B loading station instead of an A-unload. ( this situation could happen if you have 2 trains going to deliver iron to a place, when the first train is unloaded ,it could lead to that station disabling itself, leaving the 2nd train forced to find a C station with its load, and "forgot" it is loaded later on when A and B open at the same time, or with 1 tick delay to force train toward loading, sometimes wrongly).

TL DR : You could probably do with A B and C using the limit mechanism, although using it probably neglect the use for the C station itself. Delaying signals to choose wether A or B opens first to direct trains parked at C there is possible but probably not the best option for pure efficiency ( risk of routing "filled" train to loading vs routing "empty" train to unloading) although it's probably necessary if you don't use the limit mechanism to have a minimum of control over your trains to prevent them from doing only useless trips in the "worst case scenario" where the no-control situation would lead to some trains doing A=>C=>A=>C=>A=>C for example.
mmmPI
Smart Inserter
Smart Inserter
Posts: 4029
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Train/Station management issue

Post by mmmPI »

HansMeiser wrote: Thu Jul 14, 2022 9:55 am Allright! Update!
My brain cooled down, now I have found a solution for this issue and it's dead simple.

I hope this makes sense and has also some logic to a certain point. :lol:

Would like to read some opinions for that. :ugeek:
Thanks again for involving.
I wrote the previous novel before your update, i think it's an original solution, that's always more interesting to me than proposing a widely used methods :).

It's hard to understand what signals are doing without any pictures though.

My main concern after reading your update is that if you have an increasing number of trains when the signal will turn green and the depot station disable allowing all trains to start their delivery schedule, you may run into the problem for which the limit was added, the "herd effect" that all your trains parked in the depot will start heading toward the same 1 station as soon as they are allowed to. If you use this mechanism and you have 20 or 50 trains of iron ore that used to be in the depot suddenly trying to all reach a remote area where you make concrete while the others are supposed to send iron ore to furnaces. It may cause trouble.

That would be another use of the limit, not setting it to 0 instead keeping it to 1 or 2 for every "unloading" station with few space, and say "10" or "12" as limit for the "loading" with more room for trains, and then having those station enable/disable as you do now. The remote area that produce concrete would have a limit of 2 for example, this way when it "enable" you don't get 50 iron train from the depot trying to go there and going back to the depot when the concrete area is disabling itself.
HansMeiser
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Jul 13, 2022 8:15 pm
Contact:

Re: Train/Station management issue

Post by HansMeiser »

I wrote the previous novel before your update, i think it's an original solution, that's always more interesting to me than proposing a widely used methods :).
Thanks, it's a bit hard to get your head around but bit by bit it becomes logical.
It's hard to understand what signals are doing without any pictures though.
I could build a sandbox map with it, if your really like.

Regarding the "herd effect" you mentioned: Yes, it will probably be like you said. And I guess for exactly that case the "limit train" option is for.
I guess it's also depending on how the trains are used. ATM, I use dedicated trains to do dedicated tasks for dedicated stations. I. e., 2 trains for only delivering iton plates and steel from production site to base. 4 small trains to deliver only coal to certain stations. 1 train to deliver stone and bricks, etc.
That way, only needed trains are on the rails. I added depot bays only recently because ... I didn't know about it before. :roll:

But for now, this solution works quite well, will see more in a few more playing hours ... :D
Post Reply

Return to “Gameplay Help”