Rail Signal to restrict certain train combinations

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
MCDewy
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Sep 13, 2018 3:36 pm
Contact:

Rail Signal to restrict certain train combinations

Post by MCDewy »

TL;DR
Rail /Chain Signal to restrict certain train combinations (like LTN train length restrictions)

What ?
Rail / Chain signals to be configurable via click/menu to place restrictions. For example to restrict a signal from turning green except for train lengths 3, or configuration LCC.
Why ?
One use case is large regional supply trains bringing either raw or tier 1, (plates, etc..) materials into the main base/transfer station to be distributed as needed. The new signals would prevent the large trains from pathing into the main base. The smaller trains could still traverse this restriction.

The workaround is to physically separate track systems.

Thank you.

Soul-Burn
Inserter
Inserter
Posts: 28
Joined: Sun Jan 31, 2021 9:07 pm
Contact:

Re: Rail Signal to restrict certain train combinations

Post by Soul-Burn »

The game Sweet Transit (made by a former Factorio dev!) has this feature.
It lets you put requirements on signals according to various attributes - train length, train speed, certain routes, and more.

Amarula
Filter Inserter
Filter Inserter
Posts: 511
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Rail Signal to restrict certain train combinations

Post by Amarula »

Like adding a filter to a splitter... it does sound cool and useful... great idea for a mod!
My own personal Factorio super-power - running out of power.

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

Re: Rail Signal to restrict certain train combinations

Post by mrvn »

You can actually detect the train length of a passing train by placing rail signals along the track and counting how many of them are red at the same time. Then using a latch you can enable rail signals depending on the length of the train and reset the latch when the train has passed. Like this:
Train length sorter
Train length sorter
train-length.png (2.68 MiB) Viewed 526 times


One probelm with this solution is that you have to turn the signal red before the breaking point of the train reaches that signal or it will ignore a red signal. In the above this is done by stopping the trains at the length detection. This allows the fork to be right after the detection but means trains always stop. If you detect the length far in advance of the fork then you can avoid stopping the train but then you have to ensure that only one train is ever in between the length detection and the fork or you have to implement some form of pipeline to handle a sequence of train lengths.

Another problem is that trains pick their path early depending on the occupancy and signals at that time and only switch paths when they are blocked at a chain signal for some time. You will notice the trains frequently pause at the chain signal when the path they initially picked isn't the one they are allowed to take. I think you can work around that by using train stops, but then you have to include the train stop for each such fork a train will pass in the schedule. In larger networks you don't want to force trains to take specific forks. If you have multiple stops with the same name (e.g. all iron ore sources are named Iron Mine and all iron smelter are named Iron Smelter) you don't know which fork a train will take.


For this problem I actually don't think a rail signal is actually the right entity. A different entity that gives a more static right-of-way for trains on a rail would be better. One that would be honored when path finding and doesn't change by trains passing through. Let's call it a restriction-signal. The most useful restriction would be the train length I believe, optionally settable via circuit connection. Setting minimum and maximum length would be good and only trains in that range are allowed to pick that path.
Attachments
length-relevant-signal.png
length-relevant-signal.png (266.22 KiB) Viewed 526 times

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Rail Signal to restrict certain train combinations

Post by Illiander42 »

mrvn wrote:
Tue Dec 05, 2023 7:08 pm
For this problem I actually don't think a rail signal is actually the right entity. A different entity that gives a more static right-of-way for trains on a rail would be better. One that would be honored when path finding and doesn't change by trains passing through. Let's call it a restriction-signal. The most useful restriction would be the train length I believe, optionally settable via circuit connection. Setting minimum and maximum length would be good and only trains in that range are allowed to pick that path.
Sounds sensible.

Might as well go full composition with all the options LTN gives for stations at that point though.

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

Re: Rail Signal to restrict certain train combinations

Post by mrvn »

Illiander42 wrote:
Tue Dec 05, 2023 7:37 pm
mrvn wrote:
Tue Dec 05, 2023 7:08 pm
For this problem I actually don't think a rail signal is actually the right entity. A different entity that gives a more static right-of-way for trains on a rail would be better. One that would be honored when path finding and doesn't change by trains passing through. Let's call it a restriction-signal. The most useful restriction would be the train length I believe, optionally settable via circuit connection. Setting minimum and maximum length would be good and only trains in that range are allowed to pick that path.
Sounds sensible.

Might as well go full composition with all the options LTN gives for stations at that point though.
Well, LTN only honors 3 things when picking trains and stops: The min/max length, the train count and the network ID. I believe min/max length is easy enough to grasp and is the most useful feature. The train count makes no sense for this idea I think. And network ID isn't a property of the train so the signal wouldn't know what that is.

The concept of the train composition bit-masks in LTN is rather complex, only works for trains up to 32 entities and is just informational output at the train stop. While it would be applicable to the signal idea I'm not sure the developers would go for that idea.

How would you even use this? If you set a signal to LC then a fluid train won't be allowed to pass. Do you then allow multiple train compositions to be configured for a signal (e.g. LC or LF) or do you introduce wildcards (L*, where the * would be any non locomotive). What if you have different types of locomotives? What if you want LC and LF trains but not LA (artillery wagon) trains. Do you add negation: L!A? What does it even matter to the signal where the locomotive is in a train? An LLCCCC and LCCCL train are the same for the purpose of signaling.

Note: Train composition could be a feature for train stops. But the same problem there with allowing multiple combinations, wildcards or negation. For those different names probably solves the problem well enough.

I believe the full train compositon adds to much complexity to the idea compared to the gains. A much reduced composition view might be feasable, just options to allow / deny by type of wagon regardless of where or how many the train has. E.g. the signal may only allows trains with a fluid wagon or deny trains with an artillery wagon. A simple whitelist / blacklist + filter for the wagon type much like a filter inserter has for items.
signal-composition.png
signal-composition.png (187.74 KiB) Viewed 503 times
Note: "Read signals" could then output the simplified composition, just the number of locomotives, cargo wagons, fluid wagons and artillery wagons of the current train (nothing if green). But that's another suggestion.

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Rail Signal to restrict certain train combinations

Post by Illiander42 »

mrvn wrote:
Tue Dec 05, 2023 8:12 pm
Illiander42 wrote:
Tue Dec 05, 2023 7:37 pm
mrvn wrote:
Tue Dec 05, 2023 7:08 pm
For this problem I actually don't think a rail signal is actually the right entity. A different entity that gives a more static right-of-way for trains on a rail would be better. One that would be honored when path finding and doesn't change by trains passing through. Let's call it a restriction-signal. The most useful restriction would be the train length I believe, optionally settable via circuit connection. Setting minimum and maximum length would be good and only trains in that range are allowed to pick that path.
Sounds sensible.

Might as well go full composition with all the options LTN gives for stations at that point though.
The concept of the train composition bit-masks in LTN is rather complex, only works for trains up to 32 entities and is just informational output at the train stop. While it would be applicable to the signal idea I'm not sure the developers would go for that idea.
I thought LTN used is as an additional requirement.

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

Re: Rail Signal to restrict certain train combinations

Post by mrvn »

Illiander42 wrote:
Wed Dec 06, 2023 12:20 pm
mrvn wrote:
Tue Dec 05, 2023 8:12 pm
Illiander42 wrote:
Tue Dec 05, 2023 7:37 pm
mrvn wrote:
Tue Dec 05, 2023 7:08 pm
For this problem I actually don't think a rail signal is actually the right entity. A different entity that gives a more static right-of-way for trains on a rail would be better. One that would be honored when path finding and doesn't change by trains passing through. Let's call it a restriction-signal. The most useful restriction would be the train length I believe, optionally settable via circuit connection. Setting minimum and maximum length would be good and only trains in that range are allowed to pick that path.
Sounds sensible.

Might as well go full composition with all the options LTN gives for stations at that point though.
The concept of the train composition bit-masks in LTN is rather complex, only works for trains up to 32 entities and is just informational output at the train stop. While it would be applicable to the signal idea I'm not sure the developers would go for that idea.
I thought LTN used is as an additional requirement.
No, it's just an output. The use case for this is so that you can refuel locomotives or so that you don't unload an artillery wagon by accident. But really I don't know anyone that actually uses this in general. Normally people just standardize their trains so the locomotives are always at the same position, if they mix different train length in the same depot / station at all.

Post Reply

Return to “Ideas and Suggestions”