Encoded Network ID, how does it work?

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

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

Re: Encoded Network ID, how does it work?

Post by mrvn »

Your forgot one.
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 276
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by Omnifarious »

mrvn wrote:Your forgot one.
Which one? 2^31? I wasn't sure if I should include it because that's the sign bit and I thought it might confuse people enormously to have a large negative number (-2147483648) on the list.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by steinio »

Omnifarious wrote:The simple answer to this question is this:

If you want separate networks, make your network id one of the numbers in this list:

1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824

The other numbers are for doing fancy things that allow a station to be part of multiple networks.

If you want a station to be a member of more than one network, just add the ids of all the networks you want it to be a part of together.

This is based on a numbering system called 'binary' that a lot of programmers know well because it's the number system that computers use internally.

But, you don't have to know about any of that unless you want to. Just follow the rules I gave and you'll be good.
So you think, if you explain the same stuff here the 128th time, the last should understand it finally?
I have doubts.
Image

Transport Belt Repair Man

View unread Posts
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 276
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by Omnifarious »

steinio wrote:So you think, if you explain the same stuff here the 128th time, the last should understand it finally?
I have doubts.
Yeah, looking at the history more, you're correct. My post is basically a repeat of mbr26's post. :-/ I've been feeling punchy and irritable lately and letting it affect how I post.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Encoded Network ID, how does it work?

Post by mrvn »

It might be easier to use a arithmetic combinator and 1 << N.
User avatar
tanuki_san
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Jun 02, 2016 10:16 am
Contact:

Re: Encoded Network ID, how does it work?

Post by tanuki_san »

Simply, it needs a setting for default networkID and a description that tells about "networkID must to be written in binary" .
(*note* binary might be not default in almost setting values of generally gaming.)
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Encoded Network ID, how does it work?

Post by Optera »

tanuki_san wrote:Simply, it needs a setting for default networkID and a description that tells about "networkID must to be written in binary" .
(*note* binary might be not default in almost setting values of generally gaming.)
Read the Manual, it clearly states:
Encoded Network ID - Binary coded signal assigning a stop to specific networks. (defaults to 0xFFFFFFFF = all networks)
User avatar
Mmmmmmorten
Long Handed Inserter
Long Handed Inserter
Posts: 88
Joined: Sat Mar 30, 2019 6:04 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by Mmmmmmorten »

OK - I get how the LTN ID works (I think) and how too, either have several in the same network (01 and 10 would be in same network as 11 [1 & 2 would be in 3] etc.), or keep them all totally separated (just move the 1 one left for each station - 00001, 00010, 00100, 01000 and 10000 [1,2,4,8,16]).

But what do you use this for?
Do you have i.e. copper in one and iron in another and depot in the joint network?
Trying to understand the benefits of segregated (well I can see that) and interlinked networks (not sure on this one).
Are there internal computing limits on LTN that makes having several networks beneficial?

Do you use joint network id's on Depots or is that a bad idea? Why or why not?

Love some examples of Do's and Don'ts, and good suggestions based on your experience with LTN (I have almost none).

/old dude
:geek:
AUT VIAM INVENIAM AUT FACIAM
DaleStan
Filter Inserter
Filter Inserter
Posts: 371
Joined: Mon Jul 09, 2018 2:40 am
Contact:

Re: Encoded Network ID, how does it work?

Post by DaleStan »

I don't have much experience with LTN networks, but this is what I've gathered:

I believe the design purpose is to use networks to tell LTN which stations are connected. If trains from Depot 1 might attempt to deliver cargo from Provider 2 to Requester 3, and you want to prevent this (either to reduce congestion, or because there's no path), make sure there's no network bit shared by all three stations.

You typically don't need to have separate networks for iron and copper; no train is going to attempt to deliver iron ore to a copper requester or vice versa. The only reason I can come up with for this is if you want to reserve these two trains for copper only, and those two trains for iron only. You'd also have to put the trains in depots with different names and different network IDs. (Unless the train lengths are different; then you can use the train-length filters.)

If you don't want trains to load at "Iron Mine East 3" and then unload at "Iron Smelting West 2", then you probably want to set up two networks, and put the East and West stations on separate networks. You could then have one depot set to network -1 and serve both sides, or you could have East Depot and West Depot with separate networks.
If you have non-overlapping minimum and maximum train lengths (maybe you use only 2-4 trains on the west side, and only 3-6 on the east side) you can use that to control which trains go where, in either a shared-depot (instead of network ID) or split depot (possibly with network ID) arrangement.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by steinio »

It's also nice for trash stations like with Angel's mods. Byproducts get hauled and stored in a separate overflow station.

To don't create an endless provider requester loop both stations need to be in separate networks.
Image

Transport Belt Repair Man

View unread Posts
boran_blok
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Mar 01, 2019 7:56 am
Contact:

Re: Encoded Network ID, how does it work?

Post by boran_blok »

indeed, preventing loops is a big one.

My main base omni station is at 2, my main basde omni requester is at 4, this way no trains will loop around supplying rocket fuel from the main base, to the main base.

Regionality is also handy, but not something I have used yet.

In my current game I mainly use it to limit traffic for small trains. Network 1 is the "main" network and everything there gets carried by full 1-4-1 trains, no half loads, network 2 and 4 can use smaller trains that are not 100% full.
eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by eduran »

Mmmmmmorten wrote: Sun Apr 07, 2019 9:54 pm But what do you use this for?
Do you have i.e. copper in one and iron in another and depot in the joint network?
Trying to understand the benefits of segregated (well I can see that) and interlinked networks (not sure on this one).
Are there internal computing limits on LTN that makes having several networks beneficial?

Do you use joint network id's on Depots or is that a bad idea? Why or why not?

Love some examples of Do's and Don'ts, and good suggestions based on your experience with LTN (I have almost none).
Don't use too many different networks. The point of LTN is to allow a single train to run different routes as needed. If every item ends up on a different network you might as well use vanilla trains. Do think about your plans early on. Changing dozens/hundreds of stations later is not great.

Here is an annotated screenshot of one part of my current base, to showcase some options:

network_id.JPG
network_id.JPG (172.23 KiB) Viewed 9434 times

Explanation:
  • Eastern mines are set to ID 64, together with a nearby depot. That avoids drawing trains from all over the map for pick-ups.
  • There are more set-ups like this with IDs 32, 128, 256 (north, south, west).
  • Ore requesters for the iron smelter are set to ID 224 = 32 + 64 + 128. This allows them to draw from mines north, south and east, but not from western mines (they are too far away).
  • The iron plate provider is set to ID 8 and shares that ID with a dedicated depot. This is to dedicate a number of trains specifically to this high-throughput station.
  • A depot with ID -1 (= part of all networks) provides additional trains to all stations. It serves stations without a dedicated depot (e.g. the nearby rocket fuel provider). But it is also a backup if depot 8 or 64 run out of trains.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Encoded Network ID, how does it work?

Post by mrvn »

One case for the Network ID is loops:

For example in Angels mod Mud is a waste product that accumulates if you don't consume it. On the other hand there are things you need Mud for. And you can produce Mud by throwing away salt water. So to be safe you need both a endless drain and infinite producer for Mud. But there is no point in moving Mud from the infinite producer to the endless drain. That just wastes energy. So put them both in different networks while every other station can use both networks.

But there is another case:

There are mod that create additional surfaces. Trains can't travel from one surface to another and LTN ignores that fact. So if you have a provider on one surface and a requester on another then a train will be scheduled to pick up the items on one surface and deliver them to the other. The train then sits at the station showing "No Path". Using a different Network ID on each surface prevents that.
User avatar
Mmmmmmorten
Long Handed Inserter
Long Handed Inserter
Posts: 88
Joined: Sat Mar 30, 2019 6:04 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by Mmmmmmorten »

eduran wrote: Mon Apr 08, 2019 7:24 am
Mmmmmmorten wrote: Sun Apr 07, 2019 9:54 pm But what do you use this for?
Here is an annotated screenshot of one part of my current base, to showcase some options:
  • A depot with ID -1 (= part of all networks) provides additional trains to all stations. It serves stations without a dedicated depot (e.g. the nearby rocket fuel provider). But it is also a backup if depot 8 or 64 run out of trains.
Super Eduran - thanks!
This is exactly what I hoped for and more - thanks for taking the time...
And it makes all kinds of sense too... I've been puzzling the Depot placement and ID setup of my plate trains that are all 18x (6+12+0) and how to make all 2 (possible 3) depots run smoothly, and as fast as possible. So one west and east with different id's and a central mutual depot might be the answer... Only testing will show I guess at this point.

Your last list item is also something that has been on my mind. I know -1 is all networks, but are all stations left without it's specific Network ID code in -1 network? Was kind of hoping they would be in the [All "other" networks] category, but think they are all in -1, or?

/old dude
:geek:
QUIDQUID LATINE DICTUM SIT, ALTUM VIDETUR...
theblindironman
Inserter
Inserter
Posts: 34
Joined: Wed May 31, 2017 8:31 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by theblindironman »

Question or a request. Does someone have/can write a script to set all existing stations to network 1. Currently, they are all -1 (all).

Now that I understand this better and see some good use cases, I want to set this up in my own pyMods factory. Unfortunately, I have a ton of stations set as -1 network ID (as a reference, I am past chemical science and I am setting up production science). I can see my trains running all over heck and back when I could use 4 cardinal networks, instead of one central network. If I could set all of them to network 1, then slowly start moving stations to different networks, I think this would be less breaking than slowly peeling off stations.

For example, "most" of my Circuit 2 is built on the west-side of factory. I would like to set up a depot and network on the west-side that just moves the intermediates for Circuit 2 between themselves. This would eliminate a lot of dead heading of my centrally located depot. Then I could do the same for the raw ore processing in the south.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Encoded Network ID, how does it work?

Post by Optera »

Migrating from any to specific network(s) is less prone to error than from 1 to other network(s).

Easiest way is to make a blueprint of the constant combinator and stamping it over all stops of a network.
theblindironman
Inserter
Inserter
Posts: 34
Joined: Wed May 31, 2017 8:31 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by theblindironman »

Ok, I think I got it. I set up a second depot to see if I could get things to work. Now I have two depots and 2 networks, the ALL(-1) and the WEST(8). Here are my assumptions/observations:
  1. A request in the WEST network will be satisfied in the following order
    1. A provider in the WEST network using a train from WEST depot
    2. A provider in the WEST network using a train from ALL depot
    3. A provider in the ALL network using a train from WEST depot
    4. A provider in the ALL network using a train from ALL depot
  2. A request in the ALL network will be satisfied in the following order
    1. A provider in the ALL network using a train from the ALL depot
    2. A provider in the ALL network using a train from the WEST depot
    3. A provider in the WEST network using a train from ALL depot
    4. A provider in the WEST network using a train from WEST depot
    When I add the EAST(2) network, I would assume the following:
  3. A request in the EAST network will be satisfied in the following order
    1. A provider in the EAST network using a train from EAST depot
    2. A provider in the EAST network using a train from ALL depot
    3. A provider in the ALL network using a train from EAST depot
    4. A provider in the ALL network using a train from ALL depot
At no point in time will ALL train pick up in the EAST and take it to the WEST or vice versa, unless I designate the station an EAST-WEST(10). Or if I have an ALL station the requests from EAST and provides to the WEST.
User avatar
Mmmmmmorten
Long Handed Inserter
Long Handed Inserter
Posts: 88
Joined: Sat Mar 30, 2019 6:04 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by Mmmmmmorten »

theblindironman wrote: Tue Apr 16, 2019 5:39 pm Ok, I think I got it. I set up a second depot to see if I could get things to work. Now I have two depots and 2 networks, the ALL(-1) and the WEST(8). Here are my assumptions/observations:

At no point in time will ALL train pick up in the EAST and take it to the WEST or vice versa, unless I designate the station an EAST-WEST(10). Or if I have an ALL station the requests from EAST and provides to the WEST.
It all depends on what LTN ID you use on each station (provider and requester). You will have to have a depot that can service both.

In my case i.e.: I have Ore North ID 32 and Ore South ID 64. Both have their own depot with the same ID and all Iron, Copper or Steel Providers in that area are on either ID 32 or 64.

When I request items, and if I do not care where I get the goods from (and I usually do not as most requester are centrally located between Ore North and South) I request from LTN 96 (sum of 32 + 64) - thus receiving goods from both provider networks.
I have one depot centrally located that has a wide range of trains: 2-4, 4-8 and 6-12 (both cargo and fluid). These are all for processed goods (plastic, circuits, modules, science, low density structures, rocket fuel solid fuel etc.). Depot and all providers are on LTN ID 16.

In some cases i.e. Utility science, I had a requester station request from Network ID 112 (both plate networks 32+64 + processed goods 16) all delivered to the same requester station.

I also did the transition to multiple ID's after testing a while in my starter city (now ID 10). Fuel train was moved to 1 and nothing left on -1 (but still can see all using LTN Tracker as everything shows with -1).

In your case.. as long as you have a depot 2 and 8 and providers under both ID's. You can request from either 2,8 or 10 as you say. All up to you and what is needed. So sound like you have it correct and same as my setup just with lower ID numbers.

Hope that helped?

/old dude
:geek:
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Encoded Network ID, how does it work?

Post by mrvn »

I've been working with more and more networks lately and maybe it is time to redesign this part. So lets start some brainstorming:

What is the encoded network ID needed for?

1) Trains on different surfaces need to stay on their surface. Those are completely isolated from one another, no overlap possible.
2) Factory complexes may have internal train networks inside that are disconnected from the outside. Again those are completely isolated from one another, no overlap possible.
3) Maybe a station in the far west should not request from a station in the far east. While the distance probably prevents this splitting networks makes sure of it.
4) Sometimes you have factories that produce purified water if demand is such or require purified water if demand is such. So the factory has bot a provider and requester for purified water. To prevent the factory serving itself the networks need to be split.
5) Sometimes you want to selectively stop providing items to stations without enabling/disabling them all. So you use circuit logic to change the network ID and put the requester in different networks.

Are there other cases I'm forgetting?

What am I seeing so far:

1) Surfaces should be handled by LTN internally. No need for the user to mess with encoded network IDs for that.
2+3) This would be simpler with using a number or even better name for networks. I could have a [item=electonic-circuit-board] network or EastOres and WestOres. Making these unique would prevent sharing trains between them but I think that's a good thing.
4+5) Here the encoded network ID as mask comes into play. But the mask is limited to 32 bit and the numbers quickly become unreadable. It would be nice if one could just use e.g. the lower 4 bits of the mask over and over with something other to keep them unique.

So far my feeling is that the network ID should be split into a Network Name and Network Mask. The Network name could be set fixed in the LTN stop GUI and only the mask would be signal driven. Internally LTN could prefix each network name with the surface name to keep surfaces separate at the same time. That way you could have a station set to "Noveus: Plastic Factory" mask=0x14 instead of 0x280000 (2621440). Cut&Paste the factory, including station names, to the Blueprint Lab surface and it becomes "TheLab: Plastic Factory" mask=0x14 and work out of the box without breaking the original (and vice versa).
zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Encoded Network ID, how does it work?

Post by zOldBulldog »

LTN novice here, a bit stumped.

My main network is working fine so far. I did not use an encoded network ID, just stuck to the default.

I created a small additional network with the constant combinators configured as follows:

DEPOT:
- Network ID = 2
- Is Depot
- Train length <= 3 (for 1-2 train)
* With the train assigned to it, the lamp shows blue.

PROVIDER:
- Network ID = 2
- Number of trains = 1
- Train length <= 3
* When ready to provide the lamp receives the signal NuclearReactor=1

REQUESTER:
- Network ID = 2
- Number of trains = 1
- Train length <= 3
- NuclearReactor = -1
* Chests usually output NuclearReactor=1, which combined with the constant cobinator's -1 = 0 = no request to the lamp/network. Under specific conditions the chests output 0, causing a NuclearReactor = -1 sent to the lamp/network.

Problem... LTN is not generating a schedule.

Any idea where I might have gone wrong?

EDIT: SOLVED --- I needed to specify provider and requester thresholds of 1
Post Reply

Return to “Logistic Train Network”