Schedule a delivery only when there is a path?

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

cactusbanana
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Jun 01, 2019 2:47 am
Contact:

Schedule a delivery only when there is a path?

Post by cactusbanana »

Hi,

I have a somewhat conceptual question. My goal is to design an "infinitely-expansible" mega base with LTN functionality.

Suppose that I have a big base. If the factory is very big, I probably want to avoid LTN from scheduling deliveries between two stations that are too far from each other. To do this, I believe I can use the LTN's Network ID function. Essentially, I would divide my base into two (or more) regional blocks and assign the same Network ID to all LTN stations in the same block. This way, deliveries would be made only within the same block but not across the different blocks. (In fact, by setting binary codes appropriately, I think it is possible to configure that deliveries are made within the same block or adjacent blocks but not further than that, for example.)

Now, as the factory grows, the number of regional blocks increase. Given that the factorio's circuit numbers are 32bit interger (according to wiki), the maximum number of LTN's network IDs is also 32. I know 32 is already a very big number, but again my goal is to design an infinitely-expansible base, so I start to wonder what I could do if my base is so very very big that I would like to divide it into 33 (or more) regional blocks.

What I came up with for this problem is to build train-rail network so that blocks 1-32 and block 33 and up are disjoint. This means that all stations in blocks 1-32 are connected by train rails, but there is no path between stations in blocks 1-32 and stations in blocks 33 and up. And, I give the same LTN network ID to, say, all stations in block 1 and block 33. The problem of this method is that LTN seems to schedule a delivery between two stations of the same LTN network ID regardless of the presence of a path between them.

So, here is my question, which is the title of this post:

Is it possible to configure LTN so that it schedules a delivery only when there is a path between two stations?

Alternatively, is there any way to circumvent an issue that we can use different network IDs only up to 32?

Last but not least, thank you for a great mod.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Schedule a delivery only when there is a path?

Post by Optera »

cactusbanana wrote: Sat Jun 01, 2019 3:36 amIs it possible to configure LTN so that it schedules a delivery only when there is a path between two stations?
No. The api does not expose a way to check if there's a path between stops before sending a train loose.

cactusbanana wrote: Sat Jun 01, 2019 3:36 amAlternatively, is there any way to circumvent an issue that we can use different network IDs only up to 32?
No. Network ID has to be set through control signals, which are 32bit signed. It doesn't matter if lua internally could use 64 bit.
Workarounds like using 2 32bit signals would only double the number of networks but you'd still run into the same limit just a bit later.

I wouldn't bother with segregating networks this much. Generally even 10k SPM megabases work fine with one network per cardinal direction and maybe one for inner deliveries.
cactusbanana
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Jun 01, 2019 2:47 am
Contact:

Re: Schedule a delivery only when there is a path?

Post by cactusbanana »

Optera wrote: Sat Jun 01, 2019 5:11 am I wouldn't bother with segregating networks this much. Generally even 10k SPM megabases work fine with one network per cardinal direction and maybe one for inner deliveries.
Thank you for your reply. Your points are absolutely well taken. My question was anyway far fetched, and your kind answer nevertheless is really appreciated.

But please allow me to follow up with one more question: how about an idea of adding one more LTN signal for "unencoded block ID"?

I think, the idea of Encoded Network ID, especially the fact that it is binary encoded, makes it best suited for a situation where we appreciate a flexibility of making deliveries between stations of different IDs within a connected train-rail system. But, though my original scenario was rather unrealistic, there are realistic situations where we would not need this flexibility. For example, in your example of cardinal deliveries and inner deliveries, trains might only run between cardinal stations or between inner stations, but not across. (So we separate stations into two "blocks", one for cardinal deliveries and the other for inner deliveries, and there will be no inter-block deliveries.) Or, one might build several train-rail systems in the map, each of which is physically apart from the other systems.

Conceptually, with the new signal, we can divide the railroad network into up to 2^32 blocks (nearly infinite), and we can fine-tune deliveries within the same block by dividing stations into 32 sub-categories using the existing signal of Encoded Network ID. Also, the implementation of the new signal should be very similar to the encoded network ID, perhaps except for the evaluation of the signals either by = or by &.
Post Reply

Return to “Logistic Train Network”