How to use the train limit with double headed trains/stations

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 858
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: How to use the train limit with double headed trains/stations

Post by Impatient »

mrvn wrote: ↑
Thu Oct 07, 2021 11:55 pm
... As such a train can do a U-turn by going through any of the stations, ... . If a train is west of the destination then it wants to go to the bottom stop. But if you only enable the top stop then it will move past the station, make a U-turn and go to the top stop. ...
Ah yes, they can also go past that station and then turn around. Darn. I only thought about up until the target station.

A silly solution attempt would be to have all stops of emtpy stations alternate in sync AND also the station exit signals of all stations alternate in the same sync. So in one cycle trains find only a path westward to top stations and in the next cycle vice versa. But would that even make a difference? Assuming there is a large number of trains on the westward track and a lot of red signals, one more would not do the trick. I have no in depth knowledge about the pathing penalty system. Not to mention that trains, ready to go east, would have to wait for the next cycle. Pro: You would only need one meta alternator for the whole map. ;)

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

Impatient wrote: ↑
Fri Oct 08, 2021 12:51 am
mrvn wrote: ↑
Thu Oct 07, 2021 11:55 pm
... As such a train can do a U-turn by going through any of the stations, ... . If a train is west of the destination then it wants to go to the bottom stop. But if you only enable the top stop then it will move past the station, make a U-turn and go to the top stop. ...
Ah yes, they can also go past that station and then turn around. Darn. I only thought about up until the target station.

A silly solution attempt would be to have all stops of emtpy stations alternate in sync AND also the station exit signals of all stations alternate in the same sync. So in one cycle trains find only a path westward to top stations and in the next cycle vice versa. But would that even make a difference? Assuming there is a large number of trains on the westward track and a lot of red signals, one more would not do the trick. I have no in depth knowledge about the pathing penalty system. Not to mention that trains, ready to go east, would have to wait for the next cycle. Pro: You would only need one meta alternator for the whole map. ;)
A red signal just has a high cost. Trains still plan to path through them if there is no cheaper way. And once they picked a station they stick to that unless it gets disabled. So no, that wouldn't help. If the only available station needs an U-turn through another station and through red signals then the train will take that path and wait on the signal. If it's blocked by a red signal long enough it tries to find another way but that's it. I don't think it ever changes stations unless it gets into a no-path situation.

But maybe playing with the signals has merit. A train won't move forward even for a single tick if it's waiting on a red signal. So I could turn all signals of occupied stations red. Then set the train limit of empty stations to 1 and check if any double booking occur. If so disable one of the stops for a tick so the train looses interest. Same time drop the train limit of all stations back to 0. Next tick turn signals of occupied stations green so the trains with a target can leave. Blocking in trains with red signals prevents them from stuttering into the traffic lane and gives time to resolve double bookings.

Doing this once a second should be often enough even if it adds half a second to each train ride on average.

mmmPI
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: How to use the train limit with double headed trains/stations

Post by mmmPI »

mrvn wrote: ↑
Fri Oct 08, 2021 12:08 am
If it's in the same tick then OK. But if it only stops the train the next tick then that doesn't solve the problem. It would make sense that the station gets a train and changes its output but only on the next tick it gets disabled. Avoids problems with the status of a station changing multiple times per tick. From my stuttering example I know there is a delay either in the station or the trains.
torne wrote: ↑
Fri Oct 08, 2021 12:10 am
Yes, it might still take one tick for the disabling to take effect if that's how the engine works and if so then there's no way to entirely prevent that just by disabling the stations on demand like this, but this setup if it works should be the shortest possible delay.
I'm pretty sure you have at least 2 ticks when the station opens maybe 3; there is a delay on the train, first tick of new station enabled the train notices it but do not move yet, next tick the pathfinding request is issued, train still doesn't move, 3rd tick the train start to move if the station is still open. I had played with that some time ago :viewtopic.php?t=72635.

If a station is open 2 ticks, then closed 1 tick, then again open 2 tick, then closed 1 tick, a static train heading towards it never has time to start moving.
Not sure how it translate for your case.




Apart from that, 9 wagon trains, 1 per 10 minutes, make sense, that's a scale that intuitively doesn't hurt my brain anymore :),to me it feels the same order of magnitude than 30 minutes compared to like 25 sec which i'm more familiar to and wrongfully assumed you'd be close to.

I'm not familiar with Nullius mod, but feedback loop as i picture it from bob-angel with waste water for example could be handled the same way as regular assembly that have intermediate as output, the ratio of the buildings is not going to change once it's built, same for the number of train. Instead of schematically trains being filled up when going east, and empty when going west, to match previous example it would just be the opposite.

If you build your subfactory between ore patches, and one of them deplete, it's ok because will have room to make a waiting bay in case you need 2 trains to fetch ressources if it's required because the replacement patch is far away. Or if your assembly line are thin, you may just to do, as you say for furnaces, just remove and build somewhere else. It just may break other steps in the chain if it was more interconnected than just the furnaces though.
mrvn wrote: ↑
Thu Oct 07, 2021 11:47 pm
For more advanced products I will use shorter trains while trying to keep it to the same 10 minutes interval.
Makes total sense to have different approach for raw material and intermediates, and refined intermediates, especially the one you mention.

I still can't picture what the train that get its path cancelled should do. Where is it gonna wait ? or do you just expect it to find another train stop somewhere else on the map and reroute it while still filled up ?

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

mmmPI wrote: ↑
Fri Oct 08, 2021 11:38 am
I still can't picture what the train that get its path cancelled should do. Where is it gonna wait ? or do you just expect it to find another train stop somewhere else on the map and reroute it while still filled up ?
That's the thing. The train that gets cancelled must remain in its original station. A train must never be cancelled while on route or it has nowhere to go and blocks traffic.

But just because a train is in the original station doesn't mean it is at one of the stops. Haven't checked but at least I think a train with "Destination full" which might have moved a few ticks doesn't still count towards the train limit of the last stop. So more logic there to keep the train limit = 0 as long as a train is within the rail block of the station.

farcast
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: How to use the train limit with double headed trains/stations

Post by farcast »

You could periodically switch which stop gets the train limit signal, and use train count to pause the clock. Maybe also include a gap where neither station gets it to give time for the train count signal to update. No disabling stops, so no stutter, and there won't be a situation where both stations are receiving a train.
Efficient inefficient design.

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

farcast wrote: ↑
Fri Oct 08, 2021 8:20 pm
You could periodically switch which stop gets the train limit signal, and use train count to pause the clock. Maybe also include a gap where neither station gets it to give time for the train count signal to update. No disabling stops, so no stutter, and there won't be a situation where both stations are receiving a train.
That just leads to U-turns because when only the sub-optimal station is activated the train will path through another station to make an U-turn and arrive at the stop from the other direction.

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

I've made a better test world to play with this (savegame attached):
train-station-fight.png
train-station-fight.png (4.63 MiB) Viewed 1142 times
There are three test stations for unloading on the concrete all with the same name. Left and right of the concrete are the loading stations that would be e.g. ore mines.

For all stations a green LED means the station is ready for a train to arrive. Meaning loading stations have coal and unloading stations need coal. A yellow light means a train is on the way to the station. For the unloading stations there is also a red light that shows when 2 trains are targeting the same station. That's the first error that is to be fixed. Last there are blue lights next to train stops to show if the stop is enabled (where there is logic to disable the stop). Left and right on the outside are rails for a U-turn so trains will not try to go through a blocked station and deadlock. Any train taking a U-turn will be held for a while to simulate this being a bad idea. U-turns, red lights, trains stuttering or trains parking on the traffic lane with "Destination full" are to be avoided.

From right to left the 3 unloading stations are:

right most: no control logic at all
middle: disable stop if other stop has a train, MAJOR stuttering for trains
left most: The idea to prefer the top station with T>B logic and constant combinator to offset the T.
torne wrote: ↑
Thu Oct 07, 2021 9:36 pm
Idea for left most station


That is as far as I've come implementing ideas from the past days when I noticed the following:

The left most station becomes ready, needs a train. So two trains will path to the 2 stops of the station. One chooses the red path reaching the train limit for the stop. So the other train chooses the green path using an U-turn. I really want the red path in this case, not the green. But the control logic prefers the top stop. If I reverse that and prefer the bottom stop then the same happens with 2 trains from the right.
bad-u-turn.png
bad-u-turn.png (5.24 MiB) Viewed 1142 times
I haven't implemented the idea with jailing trains using circuit controlled signals till a double booking of a station is resolved. Because that wouldn't help in this case. Can't see from the signals the train stop emits if a train is going to U-turn. So I can't disable the station with an U-turn and keep the other train.

So what is left that I could try? Mess with the trains schedule? Have the train leave when "cargo full" AND "circuit condition: G=1" and "cargo empty" AND "circuit condition: G=1". And then when a station needs a train somehow figure out which train to send the G=1 signal?

Maybe encode trains ready to leave as bitfield. The first iron ore sets iron ore=1, second iron ore sets iron ore=2, the third sets iron ore=4, ... That gives me 32 bit for 32 iron ore fields. After that I would need multiple wires. Then each turn the station with highest ID picks a train from the bitfield, enables the right stop and subtrackts the bit from the wire (turning it off). The iron ore field station can detect that and set G=1 to send the train.

Better ideas? Send a blueprint.
Attachments
train-station-fight.zip
Test world
(4.41 MiB) Downloaded 163 times

farcast
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: How to use the train limit with double headed trains/stations

Post by farcast »

mrvn wrote: ↑
Fri Oct 08, 2021 11:33 pm
farcast wrote: ↑
Fri Oct 08, 2021 8:20 pm
You could periodically switch which stop gets the train limit signal, and use train count to pause the clock. Maybe also include a gap where neither station gets it to give time for the train count signal to update. No disabling stops, so no stutter, and there won't be a situation where both stations are receiving a train.
That just leads to U-turns because when only the sub-optimal station is activated the train will path through another station to make an U-turn and arrive at the stop from the other direction.
Since both stops need to stay enabled, then the only way to avoid stuttering that I can think of is to clock the release of trains to one at a time (per station name, if clock speed is a concern.

Note: a train should only be released if a station is available & the clock says it's its turn.
Efficient inefficient design.

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

farcast wrote: ↑
Sat Oct 09, 2021 12:28 am
mrvn wrote: ↑
Fri Oct 08, 2021 11:33 pm
farcast wrote: ↑
Fri Oct 08, 2021 8:20 pm
You could periodically switch which stop gets the train limit signal, and use train count to pause the clock. Maybe also include a gap where neither station gets it to give time for the train count signal to update. No disabling stops, so no stutter, and there won't be a situation where both stations are receiving a train.
That just leads to U-turns because when only the sub-optimal station is activated the train will path through another station to make an U-turn and arrive at the stop from the other direction.
Since both stops need to stay enabled, then the only way to avoid stuttering that I can think of is to clock the release of trains to one at a time (per station name, if clock speed is a concern.

Note: a train should only be released if a station is available & the clock says it's its turn.
With 1000 trains that would be > 5 minutes to go through all the trains. Assuming consecutive train IDs. See my last post. Trains with different destinations can be done in parallel and we can be smart finding the train to release.

But oh what a combinator mess this would be ....

mmmPI
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: How to use the train limit with double headed trains/stations

Post by mmmPI »

I made a testingbench :
minimalader.png
minimalader.png (404.02 KiB) Viewed 1052 times
ribbontesting.zip
(3.15 MiB) Downloaded 60 times
I was starting it at least. You can reduce the limit of the unloading station to 0 by turning off the constant combinator. If the lamp doesn't turn from green to off but stays white it means 1 trains is incoming, finishing its route.

I was expecting to see the problem occur when switch them on/off very fast , less fast, slowly ... but it didn't so i had a look at your map.

I started to retrofit it to be somewhat similar to the thing i thought functioned on the other map :
train-station-fight 2.zip
(5.67 MiB) Downloaded 59 times
I think the signals placement not only the signal types play a roles. Either this or the fact that my load station are double headed too.

i can't explain why the difference in track layout would make the maps behave differently i think it's the signals placed just after the train in my map that differs on the retrofited version it may be close enough to the train that the train doesn't move at all when stopped by the signal and look like it stay at the station. which was the original problem if i'm correct.

The use of mainly chain signals in my test bench was done because you said 1 train per 10 minutes per station as order of magnitude. I thought that if there was only ever 1 train to come at the station at all time simultaneously, ( because 2 trains would mean a trip of more than 10 minutes ) then it wouldn't need all that much throughput. I expected to be sluggish, but the test version seemed quite fast, despite all chain signals you can have several trains at the same time on the horizontal track provided they do not have to use the same pieces of track which may or not be ok with the (long) train you plan to use ?

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

You aren't looking close enough. You actually get lots of double bookings. The signals just prevent the second train from leaving so it looks like it isn't going to the same station as another. You can check the destination of all trains and you will notice some go to the same spot.

Easier to see if you reduce the clutter. So first turn of all the constant combinators. Then you have to wait a while for all the trains to do another unload run. Takes a bit and stations might get multiple trains before everything stops. Do wait till all trains show "Destination full".

Pause the game. Go to one of the copper unload stations between 2 trains. turn on the constant combinator and then advance the game a few ticks ticks and you will get:
ribbontest-fail.png
ribbontest-fail.png (620.32 KiB) Viewed 1049 times
Notice how 2 trains are heading to copper unload?

You can also attach a power pole with a green wire to the train stop and hover over the pole. It shows a train count of 2, one from each station.

If you add some space between the train stops and the first signals you would also see the trains moving ahead and stopping at the signal. With the current layout the train stops at the same position for the train stop and signal or close enough to be overlooked.

mmmPI
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: How to use the train limit with double headed trains/stations

Post by mmmPI »

mrvn wrote: ↑
Fri Oct 22, 2021 1:11 am
You aren't looking close enough. You actually get lots of double bookings. The signals just prevent the second train from leaving so it looks like it isn't going to the same station as another. You can check the destination of all trains and you will notice some go to the same spot.
I'm still unsure of what you consider a problem tbh x)

i thought it was the consequences of that double booking when they transform into a train stopping in the main track. This caused by the cancellation of 1 train path( of those 2) that should occur while leaving that train in its station and not occur too late or that train could pass a signal and be a problem already. this cancellation required because otherwise 2 train would path to the same station and the 2nd would be unable to park and would block the main rail.

i understand now the double booking itself cause problem even it if resolve peacefully overtime not having trains stuck anywhere weird. ( at the cost of troughput using chain everywhere).

Then even if you decide to only open 1 station a few tick before the other and clear the booking of that other by closing it, the problem is inneficient pathing right ? Even with double headed train station for the loading ?

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

mmmPI wrote: ↑
Fri Oct 22, 2021 1:37 am
mrvn wrote: ↑
Fri Oct 22, 2021 1:11 am
You aren't looking close enough. You actually get lots of double bookings. The signals just prevent the second train from leaving so it looks like it isn't going to the same station as another. You can check the destination of all trains and you will notice some go to the same spot.
I'm still unsure of what you consider a problem tbh x)

i thought it was the consequences of that double booking when they transform into a train stopping in the main track. This caused by the cancellation of 1 train path( of those 2) that should occur while leaving that train in its station and not occur too late or that train could pass a signal and be a problem already. this cancellation required because otherwise 2 train would path to the same station and the 2nd would be unable to park and would block the main rail.

i understand now the double booking itself cause problem even it if resolve peacefully overtime not having trains stuck anywhere weird. ( at the cost of troughput using chain everywhere).

Then even if you decide to only open 1 station a few tick before the other and clear the booking of that other by closing it, the problem is inneficient pathing right ? Even with double headed train station for the loading ?
Having a train stop on the tracks would be absolutely fatal. And if your design wouldn't be only chain signals so more than one train can move on the rails at the same time you would run into that case. A big base will be kilometers wide and having a single train block the whole rail from start to end would make trains too slow, wven with the 10 minutes per station. I'm already at 200 stations, which is a train every 3 seconds. They need to move in parallel, which means signals on the main rails, no just chain signals.

Stations also use the train limit to signal when they need items and have the buffer space to unload. If 2 trains are send when the buffer can only unload one train then the second train gets stuck. Think what that would do for the green electronic circuit board factory. It requests 1 iron plate train and gets 2. The second sits in the station and can't unload. Now the factory runs out of copper plates. It can't order a copper plate train because the iron plate train is still in the station. It's a deadlock.

A less drastic case would be items with only a few trains. Say 2 trains just to be mean. If the second train gets stuck not unloading somewhere then the throughput for the item is cut in half.


Overall if I say the limit is 1 train I need it to be 1 train.

mmmPI
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: How to use the train limit with double headed trains/stations

Post by mmmPI »

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
I'm already at 200 stations, which is a train every 3 seconds.
what is the system you use ? it functions properly meaning you found your answer ? or is it workaround for no double headed train stop which doesn't replicate the same behavior ? or just a functionning system but with stuff you consider imperfect ?

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
Stations also use the train limit to signal when they need items and have the buffer space to unload. If 2 trains are send when the buffer can only unload one train then the second train gets stuck. Think what that would do for the green electronic circuit board factory. It requests 1 iron plate train and gets 2. The second sits in the station and can't unload. Now the factory runs out of copper plates. It can't order a copper plate train because the iron plate train is still in the station. It's a deadlock.
how does that work exactly if you name your station the same ? does it require the iron and copper train at the same time ? how do you pick up one ?

also like how can you unload iron that would block copper on station named the same ? (copper train can't acces station "iron-unload" ?).

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
A less drastic case would be items with only a few trains. Say 2 trains just to be mean. If the second train gets stuck not unloading somewhere then the throughput for the item is cut in half.
well you could deal with that with the schedule conditions and inactivity no ? if a train doesn't unload, it moves away ?

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
Overall if I say the limit is 1 train I need it to be 1 train.
is that what you have now ?

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

mmmPI wrote: ↑
Fri Oct 22, 2021 9:21 am
mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
I'm already at 200 stations, which is a train every 3 seconds.
what is the system you use ? it functions properly meaning you found your answer ? or is it workaround for no double headed train stop which doesn't replicate the same behavior ? or just a functionning system but with stuff you consider imperfect ?

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
Stations also use the train limit to signal when they need items and have the buffer space to unload. If 2 trains are send when the buffer can only unload one train then the second train gets stuck. Think what that would do for the green electronic circuit board factory. It requests 1 iron plate train and gets 2. The second sits in the station and can't unload. Now the factory runs out of copper plates. It can't order a copper plate train because the iron plate train is still in the station. It's a deadlock.
how does that work exactly if you name your station the same ? does it require the iron and copper train at the same time ? how do you pick up one ?

also like how can you unload iron that would block copper on station named the same ? (copper train can't acces station "iron-unload" ?).

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
A less drastic case would be items with only a few trains. Say 2 trains just to be mean. If the second train gets stuck not unloading somewhere then the throughput for the item is cut in half.
well you could deal with that with the schedule conditions and inactivity no ? if a train doesn't unload, it moves away ?

mrvn wrote: ↑
Fri Oct 22, 2021 1:48 am
Overall if I say the limit is 1 train I need it to be 1 train.
is that what you have now ?
I'm currently using LTN which has it's own train limit logic. So that works around the problem. Also means I can order both iron plates and copper plate to the same station.

You are right that in vanilla that would be a problem as there is no good way to tell which train should come to an iron-or-copper-unload station.

As for using inactivity: That would have the train drive back to the loading stop and then pick a different stations, true. But it would be a waste of time for the train and lower throughput. Not as bad as the old thundering herd problem with all trains going to a station and then most turning back but still not ideal.

mmmPI
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: How to use the train limit with double headed trains/stations

Post by mmmPI »

i played with LTN some times ago, it does solve your problems, allow you some impossible designs in vanilla, but also artificially increase the distances between stations due the route to the depot,mandadory, in the schedule.

For purely vanilla you could instead of inactivity only opens the stations when the buffer is enough for 2 trains. This means both train would contribute whenever moving, not just 1 to reduce the amount of useless trip and make the more use of the limited throughput. thinking that because if you plan to only use 1 rail for each side with 200+ trains, be them 9 wagons, you will have a hard limitation on material throughput anyway.


I know you'll correct me if i'm ever slightly wrong in your opinion, so please allow me this attempt at reformulating the possiblities to make sure we're on the same page:

1) open 2 station at the same time => cancel 1/2 reservation => problem because if you cancel bottom station, train coming from the left side of the map will have to U-turn to reach the only left opened station. ( and detecting to choose what to cancel seem impossible so you pick random at worst).

2) open only 1 station at a time => problem because if you open the top station first, train coming from left side of the map will have to U-turn ( or possibly won't be able )to reach the 1rst and only station open.


3)double headedtrain stop : only one unchoosen train from left or right of the map would be picked, and directed toward the most accessible station without U-turn.
(The double headed train stop would pick an unchoosen train then compute 2 path for top or bottom arrival to the doubleheadedtrain stop, then choose the correct station).



for 1) i just proposed to only allow station opening when buffer is enough for 2 trains. Which could be done with chain signal but maybe also with incorporating "waiting area" in paralel horizontal, between subfactory gated with regular signal, in order to cut down the too large trip that train would need to reserve in 1 go with chain signals. Playing with dummy station to make the detour seemingly not one.

for 2) the question becomes: which station to open top or bottom ? ( at least to me that is not looking for theoric perfection but rather something that would be interesting to test if it works depending on the scale) I understand that is still not as good as what you expect from 3) or LTN.
I would try to take advantage that all station can have an alignment point since it's a ribbon world. If you consider station A B C D E F G, A bein iron load, should ouput 1 iron to B; B being iron load too, should add 1 iron and transmit 2 iron to C, C being copper mine doesn't add 1 to iron instead add 1 copper, and transmit 2 iron 1 copper to D, D requesting iron, knows from wire that there are 2 iron load on its left, and could read the amount of station on its right if you do the same method on both direction. It could be an easy-to-blueprint thing.

You could try and refine it further knowing there's 2 station on one side and 12 on the other could trigger more often one side than the other. You could also mesure the response time of each train when coming from one side or another and increment them together then divide by the total amount of train from each side and compare which of top or bottom is faster. ( despite the U turn !) :).

You could also instead of transmitting how many station there is for a specific ressources on each side, transmit how many OPEN station there is, and also why not their number of incoming trains ,or the number of train with full cargo ready to unload on each side, or the side that has the most buffer from this material in existing chests...


3) doesn't mean the closest train will be choosen, only that the choosen train will go to the closest station between top and bottom right ?

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

Re: How to use the train limit with double headed trains/stations

Post by mrvn »

mmmPI wrote: ↑
Fri Oct 22, 2021 2:45 pm
i played with LTN some times ago, it does solve your problems, allow you some impossible designs in vanilla, but also artificially increase the distances between stations due the route to the depot,mandadory, in the schedule.

For purely vanilla you could instead of inactivity only opens the stations when the buffer is enough for 2 trains. This means both train would contribute whenever moving, not just 1 to reduce the amount of useless trip and make the more use of the limited throughput. thinking that because if you plan to only use 1 rail for each side with 200+ trains, be them 9 wagons, you will have a hard limitation on material throughput anyway.
With a factory that's 400 train length )or whatever I have now) wide having 200 trains on 4 rails still leaves a lot of gaps between trains on average. If you place satelite factories not too far from their resources then most trains will just travel locally. You would be amazed of how many goods you can transport like that. Without LTN you would have to name stations differently though to ensure local deliveries instead of random ones.

That is if no train ever decides to stop on the highway. They must all be moving or you get a massive pileup of trains all waiting for the one before it.
mmmPI wrote: ↑
Fri Oct 22, 2021 2:45 pm
I know you'll correct me if i'm ever slightly wrong in your opinion, so please allow me this attempt at reformulating the possiblities to make sure we're on the same page:

1) open 2 station at the same time => cancel 1/2 reservation => problem because if you cancel bottom station, train coming from the left side of the map will have to U-turn to reach the only left opened station. ( and detecting to choose what to cancel seem impossible so you pick random at worst).

2) open only 1 station at a time => problem because if you open the top station first, train coming from left side of the map will have to U-turn ( or possibly won't be able )to reach the 1rst and only station open.

3)double headedtrain stop : only one unchoosen train from left or right of the map would be picked, and directed toward the most accessible station without U-turn.
(The double headed train stop would pick an unchoosen train then compute 2 path for top or bottom arrival to the doubleheadedtrain stop, then choose the correct station).


for 1) i just proposed to only allow station opening when buffer is enough for 2 trains. Which could be done with chain signal but maybe also with incorporating "waiting area" in paralel horizontal, between subfactory gated with regular signal, in order to cut down the too large trip that train would need to reserve in 1 go with chain signals. Playing with dummy station to make the detour seemingly not one.
Already explained. The canceled train stops with "Destination full", but before that it moves just a tick and eventually drifts onto the highway if it gets canceled too often. That the not-canceled might make an U-turn is a minor annoyance compared to that.
mmmPI wrote: ↑
Fri Oct 22, 2021 2:45 pm
for 2) the question becomes: which station to open top or bottom ? ( at least to me that is not looking for theoric perfection but rather something that would be interesting to test if it works depending on the scale) I understand that is still not as good as what you expect from 3) or LTN.
I would try to take advantage that all station can have an alignment point since it's a ribbon world. If you consider station A B C D E F G, A bein iron load, should ouput 1 iron to B; B being iron load too, should add 1 iron and transmit 2 iron to C, C being copper mine doesn't add 1 to iron instead add 1 copper, and transmit 2 iron 1 copper to D, D requesting iron, knows from wire that there are 2 iron load on its left, and could read the amount of station on its right if you do the same method on both direction. It could be an easy-to-blueprint thing.

You could try and refine it further knowing there's 2 station on one side and 12 on the other could trigger more often one side than the other. You could also mesure the response time of each train when coming from one side or another and increment them together then divide by the total amount of train from each side and compare which of top or bottom is faster. ( despite the U turn !) :).

You could also instead of transmitting how many station there is for a specific ressources on each side, transmit how many OPEN station there is, and also why not their number of incoming trains ,or the number of train with full cargo ready to unload on each side, or the side that has the most buffer from this material in existing chests...
You mean 1 train stop. The station (in this thread at least) is the pair of train stops. That would be the same as having just one stop on the station. 50% of the time the train U-turns. If the train would not be able to reach the station then that would be OK. It would remain where it is and pick a different station later. But if there is no better way then trains path through other stations even if there is a train parked in there. Or through red signals, even circuit controlled ones. That's just expensive.

You can optimize it as you say be prefering the direction trains are most likely to come from. It's no garantee the train will actually come from there. In fact in vanilla I think you get the train that has been searching for a train stop the longest.

So unless you build all your ore mines on one side and further and further advanced stuff on the other side the direction is random. And building the factory in order of how advanced stuff is doesn't allow expansion. I would have to leave space for all the smelters I will ever build right from the start.
mmmPI wrote: ↑
Fri Oct 22, 2021 2:45 pm
3) doesn't mean the closest train will be choosen, only that the choosen train will go to the closest station between top and bottom right ?
If two or more stations open on the same tick (which is quite unlikely) then the cheaper one is chosen. This can be the one further away if the other has more red signals or other things that increase cost on top of the distance. A U-turn through another stations is really expensive and trains will go a long way before cross a train stop. So the train will naturally try to avoid congested paths. The anti-lemming. But it's the train making the choice in vanilla.

This is something where LTN helps too. It picks a Depot station that is near and dispatches a train from there. You just have to build a train depot every once in a while so there actually is a near train to dispatch.

Post Reply

Return to β€œGameplay Help”