Concurrent Train Restriction


Restrict amount of trains trying to reach station simultaneously by circuit network. UPDATED: * Added migration to native factorio train limits. tldr: Train stop limit.

Content
3 years ago
0.15 - 1.1
2.31K
Trains

b Compatibility with other mod

5 years ago
(updated 5 years ago)

In the other thread i mentioned how i can't make it to work, despite very simple instruction you put in the description.
Other player in another old thread is baffled as well how to use this mod.

Turns out, this mod doesn't get along with other mod.
Namely, the one that i figured out is with FARL (Fully Automated Train Layer).
https://mods.factorio.com/mod/FARL

Thus why the signal were not respected / recognized by the mod.
I think because FARL takeover locomotive entity, it show in the description info as Base -> Fully Automated Rail.

The fix is quite simple, disable the FARL, the game will go auto restart, then re-enabled again.

After that, this mod will work.
In short, this mod have to be loaded before FARL.
For user that read this, just to be clear, you still CAN use FARL, but FARL need to be activated AFTER this mod.

If this mod were loaded last, it will not even show-up in debug overlay, "script-update".
Basically the mod is not even active. Thus why some player didn't managed to get it to work.

Furthermore, i'm gonna test if this mod can work together with Train Supply Manager.
https://mods.factorio.com/mod/train-pubsub
It would be powerful combination if this two can work together.
If not, i hope you can provide support to TSM mod (it use modded train stop, not vanilla)

5 years ago
(updated 5 years ago)

Just test it, it doesn't work together with Train Supply Manager (TSM).
Man, i wish this mod somehow can work together with TSM.
The functionality complement each other perfectly for those that want to use a shared / same name in TSM Requester station,
It would be a killer combo mod.

5 years ago

I tried FARL and it looks for me working both ways - either loaded before or after. If this is still bothering you, could you please provide more details/saves/logs.

I am afraid I could not make it compatible with TSM.
But it looks like TSM have their own train limit setup - https://factorioprints.com/view/-LT5-R_wHt-BJBHxoNVl
Also I suppose everything from TSM could be done with this mode alone :)

5 years ago
(updated 5 years ago)

Oh, this report is from many months ago, well..maybe not exactly FARL that cause it.
But i can assure you it's still happening even as of last night, i disable this mod (plus many other) to test out a set of other mod.
When this mod get re-enabled, then i loaded a save. it doesn't work.
There's not even a script-update activity from this mod whatsoever.
This is also happening with your other mod "Train Skipped Fulfilled Station".

However, the solution is either the one i posted earlier (this mod were activated before FARL/everything else;usually a newly installed mod),
OR, and this a more reliable "fix":
After the save is loaded, i need to re-save it, then either reload the save file, or sometimes i even i completely exit the game / relaunch.


No, there's something that this mod can't do.
Well, actually it's not this mod fault with the functionality being offered.

I setup the rail like this
A (Load/outpost) -> B (waiting/supply) -> C (unload)

In B they're waiting a signal from C to depart (When C reach lower threshold, sent X number of train, stop sending above upper threshold)

The non TSM way (with only Train Concurrent) is i just sent the signal through circuit wire.
Problem is, let's say there's only 1 train demand, but there are 10 train waiting,
When the signal is received in B, all 10 train managed to depart, although 9 of them will goes to a loop because 1 already managed to lock the target by Train Concurrent.

During my test, it appear i need to delay about 10 ticks before Concurrent TrainStop mod recognize that there are train already depart.
It goes like this :
The very 1st B trainstop get signal instantly, while the next train stop only get them after 10 ticks delay, then the next one is also 10 ticks delay after the 2nd one, and so on.
Only with that approach that a correct number of train managed to depart.

Problem is, on huge demand, let's say 30 train demand = 30x10 ticks=300 ticks.
So the order took 5 seconds to finished.
This pose a problem because the late game plan setup will be much-much bigger than this.

That's where TSM comes in.
It took care of that timing. So no need for me to determined timing.

But, TSM didn't like if the unload station were given the same name.
So, a wrong amount of train can be arrived at wrong target station (usually the closest one)
While other station that also giving the order never received a train.

So the idea was to combine that two benefit. TSM will take care the timing problem and dispatched the amount of train needed, while the Train Restriction will took care the distribution of that train.

Basically it's not the way TSM is intended to use, but there is much bigger potential with combination of this two mod.

What's even greater is the way TSM and this mod counting/restrict the amount of needed train is exactly the same.
I don't even need to change the circuit setup in unload for this mod for TSM at all, it's exactly the same setup.

Just to be clear, i'm not forcing you to make it compatible with TSM, but if only...

TLDR, the benefit :
- Exactly the same circuit setup in Unload/requester. No need to change anything.
- No need to naming the target uniquely (TSM problem). Which in result is a neater naming.

Edit 1 :
Wait a minute, i just realize that if you can somehow fix the behaviour of train managed to departing on signal cue despite being restricted by Concurrent mod , then there's no need for me to use TSM at all.
Or is it can't be done ? Vanilla train signal took over priority ?

Edit 2 :
Just test it on small scale test world, only 9 train.
The "still departing due signal" behaviour didn't happen at all, a correct number of train is the only departing one.
The other were stay in the stop.
But i swear it happened from my last playthrough, reproducible, constant behaviour.
Thus why i have to resolve it using delay.
Perhaps a big number of train that this mod handle at that time prompt that behaviour ?
This is weird, but if this were fixed then i'm a very happy player 😁

5 years ago

On mod activation / script update activity:
If this will happen again could you please provide save (first one, before re-save, when the mod is still not working), mod-list.json, mod-settings.dat and factorio logs so I will try to figure it out.

On 10 ticks:
It is exactly how mod done now - it updates state once per 10 ticks.
Not sure I could understand what signal to B you are talking about. I suppose there is signal to C with number of requested trains.
I would like to change 'once per 10 ticks' to actual train depart event. Probably this will fix edit 1. Could you please share your heavy train save so I will see how this affect UPS.

On edit 2:
Could this be fixed by last update - I have no idea :)
If this will be a case again - as always could you please share save

5 years ago
(updated 5 years ago)

On mod activation / script update activity, yes it's still happening.
But it would be much easier if you test it on new game (with creative mode), than me to provide the (before and after save file), log, mod-list.json, mod-setting.dat.

Because the problem exist in a new game (with my current list of mods).

Besides, if i post the save game, even the one which built on new game, and sent it to you, it means when you load that save file it will "activate" this mod. Thus the problem may looks didn't exist at all.

To reproduce:
This zip files below contains mod-list.json, mod-setting.dat, config.ini, factorio log.
https://www.dropbox.com/s/owpp8b0lr1wn9xh/Files%20For%20Concurrent%20Mod.zip?dl=0
Note :
There is 1 mod is not on the portal, that's my own mod, i didn't published it.
But it's only a custom virtual signal, the absence of it will not affecting the result (i think..)

To make things easier for you, i create a blueprint of very simple test;
Blueprint :
https://pastebin.com/h0wiESDU

Steps :
1. Created new game
2. Enable creative mode (or not using it, didn't matter)
3. Import blueprint above, build it.
4. Set both train to automatic.
5. Turn on the green signal combi to start the test.

Result :
Both train will depart one after another, while it should only just one.
If you check script-update, there none from this mod.

IF you save that game, then reload, the mod is activated, only one train is correctly depart.


On 10 ticks :
So, i accidentally know how the mod work internally by knowing the 10 ticks thing ? Kinda awesome to hear that.😁

Yeah it's still happening, but it's probably due the way i setup my rail network.
Although not as severe as before, because i setup a bit differently this time.

I can't sent you the save files right now, because my chain production probably confusing for you to tell whether the "correct" number of train departing or not.
I will try to reproduce the issue with simpler map, creating from a scratch, probably tomorrow.

But i do worry about UPS, i wish there's something you can do, to optimize it..somehow....
This mod is the biggest UPS consumer among other mod that i install.
On my current playthrough, it's already hitting above 1.X script-update, and this is not even a full scale production.

My UPS/FPS hasn't drop yet, still at 60, but it will once i go full scale.

5 years ago

Thank you for such detailed reproduction steps!
I think mod activation is finally fixed

5 years ago

Nice, just test it, now it activates properly. 👍😍
I think the same problem also happen in "Train Skip Fulfilled Station", might worth check it out.
Although i didn't test it, but i remember it didn't activate properly like this mod.

New response