old LTN discussion thread

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

SirBriguy
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Apr 07, 2017 5:25 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by SirBriguy »

I am having a problem when using the mod where it will make a delivery for 8000 items, but will then not schedule another delivery for several minutes, even when the stop is requesting more items. Is there some minimum time between deliveries for a single receiver? Or am I expected to set the requesting amount to a large enough number to last for several minutes of production?

I am trying the mod out for the first time, so I may have done something wrong, but I setup my providers and requester using the blueprints in the OP. It works, it just does not keep the requester full.
User avatar
Odhrean
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Mon Sep 15, 2014 7:49 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Odhrean »

Optera wrote:
DaveSh99 wrote:Hello,

Is there a way at a stop to read how much of things are available on the logistic train network? I.e, something like how you can determine how much of a thing is in the normal logistic network?

Thanks,

d.

ps, this mod is very cool, and works quite well.
With the zoomed map view of 0.15 I always hover over a pole with the wire feeding into a stop to get stats/stop.

I don't plan to add an UI. Coming up with a design to present lists of items/station, potentially filtering for certain items, and implementing it with the limitations of the ui api seems like a lot of work I simply don't want to do.
I wire all Provider Stations Chest contents (one way with every + combinator) to a central circuit network that is laid out with my railway blueprints to keep track of the summed up fill level of items every where I am.
Wexler
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 11, 2017 2:25 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Wexler »

I'm wondering if someone has come up with a nice way to deal with a requester that needs a small amount of one type of item, and a large amount of another?

My example is an outpost that requires ore (in large volumes, say 30k) and water barrels (which only stacks to 10, so I can't request 30k and have it fit on a train).

It seems obvious to set the requester threshold to fit the water barrels, e.g. 1000. If you do nothing else, this will cause a lot of requests for ore, every time you're short 1k ore. Setting the provider threshold high doesn't seem to affect this:

Code: Select all

[LTN] (GetProviders): found 1728(10000)/315998 item,angels-ore1 at LTN Saphirite1 ON priority: 0 minTraincars: 6 maxTraincars: 6 locked Slots: 0
[LTN] added new order 1 LTN Saphirite1 ON >> LTN Saph1In OnOff: 1728 in 9 stacks item,angels-ore1 min length: 6 max length: 6
[LTN] Creating Delivery: 1728 in 9 stacks item,angels-ore1, LTN Saphirite1 ON >> LTN Saph1In OnOff
I understand this is by design.

My attempt at working around it was to check if the ore signal was < -20000, and in that case output exactly -20000 ore to the LTN input. This worked in as far as waiting for a 20k delivery, but it caused some unexpected behaviour when the train started unloading.

Code: Select all

5805.218 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with train inventory: item,angels-ore1 -20000+19440=-560
5805.218 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with delivery: item,angels-ore1 -560+1440=0
5806.240 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with train inventory: item,angels-ore1 -20000+18576=-1424
5806.240 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with delivery: item,angels-ore1 -1424+1440=0
5807.218 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with train inventory: item,angels-ore1 -20000+17712=-2288
5807.218 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with delivery: item,angels-ore1 -2288+1440=-848
5808.216 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with train inventory: item,angels-ore1 -20000+16848=-3152
5808.216 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff updating requested count with delivery: item,angels-ore1 -3152+1440=-1712
5808.216 Script interface.lua:53: [LTN] (UpdateStop) LTN Saph1In OnOff requested item,angels-ore1 1712(1400), age: 19574140/19581160
5808.767 Script interface.lua:53: [LTN] (GetProviders): found 1712(10000)/317498 item,angels-ore1 at LTN Saphirite1 ON priority: 0 minTraincars: 6 maxTraincars: 6 locked Slots: 0
5808.767 Script interface.lua:53: [LTN] player, ltn-message.provider-found, LTN Saphirite1 ON, 0, 0, item-name.angels-ore1, 
5808.767 Script interface.lua:53: [LTN] added new order 1 LTN Saphirite1 ON >> LTN Saph1In OnOff: 1712 in 9 stacks item,angels-ore1 min length: 6 max length: 6
So as the train starts unloading, items go on belts (outside the unloading chests and main warehouse - so they can't be counted by me) and the mod decides i'm more than the requester threshold short of my requested amount - triggering several small deliveries after the big one.

I made a hacky workaround, by only outputing the requested -20k when the LTN lamp isn't yellow. This works fine - but could delay requests if the light is yellow for a long time waiting for delivery of other goods.

Has anyone solved a similar issue - and how? I considered simply pulsing the request for one tick when needing a delivery - but it seemed I'd need a lot of timers/control logic to make sure it reset properly or retransmitted if the delivery failed.
torne
Filter Inserter
Filter Inserter
Posts: 342
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by torne »

If you set the provider threshold for ore to a full trainload (and you don't mind doing that) that should work - the only downside is you'd need to do that at every ore loading station, and no ore-requesting station would be able to get smaller deliveries.

You could also set the minimum delivery size by combinators as well: one simple option that doesn't completely fix the problem is to set the minimum delivery size to a large number normally, but then reduce it to the smaller value when you're short of water barrels. This will still potentially cause small deliveries of ore to be dispatched during this time window, but not the rest of the time. If you have enough buffers, you could have it also suppress the ore request for this time, but then you won't get any ore while you're waiting for water.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Optera »

I'd either use two stops with different request thresholds or use one decider per item set to if item <= -desired then item = input count.
Wexler
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 11, 2017 2:25 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Wexler »

Optera wrote:I'd either use two stops with different request thresholds or use one decider per item set to if item <= -desired then item = input count.
Two stops would be easier for sure - but trying to keep it compact. As described, setting a decider to filter the input until it's large enough doesn't help - my problem is essentially that while items are unloading, when they are on belts between unloading chests and destination chest/warehouse, they are not included in my input count. Since the requester threshold is so low, and how the mod keeps counts updated while delivering, I repeatedly dip below the threshold. Anyhow - i have a hack that works - perhaps i can improve it to simply add in some extra item count while there is a delivery going on.
Wexler
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 11, 2017 2:25 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Wexler »

Sorry to double post - but I came over a separate issue that i wanted to ask about.

I'm playing with Angel's ores, and have two ore-sorting outposts set up. Station Bob1Out sorts Bobmonium into (uranium-ore, bauxite-ore, cobalt-ore, quartz, tin-ore, zinc-ore) and station Saph1Out sorts Saphirite into (copper-ore, iron-ore, nickel-ore, quartz, rutile-ore, zinc-ore).

The outputs of each is sorted into nine different warehouses, each aligned with a cargo wagon in the station. (Six ores into nine warehouses because the ratio is 3-2-1-1-1-1 for different ores). Whenever there is at least 16k of an ore available, the station input is set to 16k. Requester and provider tresholds on the invovled stations are both 16k. All stations have train limit set to 1 because the trains are large and loading/unloading takes a while.

Now i've got an ore sorting facility, OreSort UNLOAD B, which requests 1 million of each of the 14 Angel's ores.

For the most part, this is working fine. Merged deliveries are being generated to both Bob1Out and Saph1Out.

The problem is in my example Zinc-ore. It is the only ore provided by both stations in equal amounts. Looking at the mod logs, it looks like the mod is going through each requested item, and picking a source for it. For some reason zinc-ore is selected from Saph1Out, which is fine.

At the end of going through all the requested items, the mod has insertedthem into two orders: "1/2 LTN Bob1Out ON >> LTN OreSort UNLOAD B" and "2/2 LTN Saph1Out ON >> LTN OreSort UNLOAD B".

It picks a train for order 1, containing 5 different ores (out of the 6 available at the stop). It then realizes that the train limit is hit, and the second order is dropped.

I'm wondering if it's possible to optimize the logic, so that it ends up picking up all six available item-types on the order that goes through.

Edit: It should really pick up Zinc-ore from both stations, (add it to both the generated orders) - since i'm requesting way more than 2x 16k zinc-ore.
Relevant parts of logfile
adamcirillo
Inserter
Inserter
Posts: 34
Joined: Fri Feb 10, 2017 9:20 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by adamcirillo »

I'm trying to set up a LTN unloading stop with 4 train stops so I can have 4 trains come in and unload the resources they want as soon as I name the 4th stop the same name the light turns purple is there a way around this?
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Optera »

Wexler wrote:
Optera wrote:I'd either use two stops with different request thresholds or use one decider per item set to if item <= -desired then item = input count.
Two stops would be easier for sure - but trying to keep it compact. As described, setting a decider to filter the input until it's large enough doesn't help - my problem is essentially that while items are unloading, when they are on belts between unloading chests and destination chest/warehouse, they are not included in my input count. Since the requester threshold is so low, and how the mod keeps counts updated while delivering, I repeatedly dip below the threshold. Anyhow - i have a hack that works - perhaps i can improve it to simply add in some extra item count while there is a delivery going on.
I came up with a logic to filter signals to a mixed requester/provider: viewtopic.php?f=193&t=50373
One of its functions is to only let positive signals for non requested and only negative signals for requested items through.
The other is to filter negative signals from the logistic network.
Wexler wrote: For the most part, this is working fine. Merged deliveries are being generated to both Bob1Out and Saph1Out.

The problem is in my example Zinc-ore. It is the only ore provided by both stations in equal amounts. Looking at the mod logs, it looks like the mod is going through each requested item, and picking a source for it. For some reason zinc-ore is selected from Saph1Out, which is fine.

At the end of going through all the requested items, the mod has insertedthem into two orders: "1/2 LTN Bob1Out ON >> LTN OreSort UNLOAD B" and "2/2 LTN Saph1Out ON >> LTN OreSort UNLOAD B".

It picks a train for order 1, containing 5 different ores (out of the 6 available at the stop). It then realizes that the train limit is hit, and the second order is dropped.

I'm wondering if it's possible to optimize the logic, so that it ends up picking up all six available item-types on the order that goes through.

Edit: It should really pick up Zinc-ore from both stations, (add it to both the generated orders) - since i'm requesting way more than 2x 16k zinc-ore.

Code: Select all

23775.801 Script interface.lua:53: [LTN] LTN Bob1Out ON Request station train limit reached: 1(1)
23775.801 Script interface.lua:53: [LTN] LTN OreSort UNLOAD B Request station train limit reached: 1(1)
You limited provider and requester to 1 train. Once that train is sent out no more trains are allowed to either of those stops until the train has gone there.
In that configuration order 2 can only be shipped once the train shipping order 1 has left the requester.
If you want both orders shipped at once you will need to allow at least 2 trains at the requester.

Code: Select all

23774.804 Script interface.lua:53: [LTN] (GetProviders): found 975000(16000)/16000 item,zinc-ore at LTN Saph1Out ON priority: 0 minTraincars: 11 maxTraincars: 11 locked Slots: 0
23774.804 Script interface.lua:53: [LTN] (GetProviders): found 975000(16000)/16000 item,zinc-ore at LTN Bob1Out ON priority: 0 minTraincars: 11 maxTraincars: 11 locked Slots: 0
23774.804 Script interface.lua:53: [LTN] player, ltn-message.provider-found, LTN Saph1Out ON, 0, 0, item-name.zinc-ore, 

23774.805 Script interface.lua:53: [LTN] Creating Delivery: 16000 in 80 stacks item,uranium-ore, LTN Bob1Out ON >> LTN OreSort UNLOAD B
23774.805 Script interface.lua:53: [LTN] Creating Delivery: 16000 in 80 stacks item,bauxite-ore, LTN Bob1Out ON >> LTN OreSort UNLOAD B
23774.805 Script interface.lua:53: [LTN] Creating Delivery: 16000 in 80 stacks item,cobalt-ore, LTN Bob1Out ON >> LTN OreSort UNLOAD B
23774.805 Script interface.lua:53: [LTN] Creating Delivery: 32000 in 160 stacks item,quartz, LTN Bob1Out ON >> LTN OreSort UNLOAD B
23774.805 Script interface.lua:53: [LTN] Creating Delivery: 48000 in 240 stacks item,tin-ore, LTN Bob1Out ON >> LTN OreSort UNLOAD B
Not sure if you ask for prioritizing providers that could be merged into existing shipments.

adamcirillo wrote:I'm trying to set up a LTN unloading stop with 4 train stops so I can have 4 trains come in and unload the resources they want as soon as I name the 4th stop the same name the light turns purple is there a way around this?
Every stop requires an unique name.
Linking stops to logical units for faster un-/loading became pointless with 0.15.
Fluid loading is takes less than 3s using this design: viewtopic.php?f=194&t=46376#p267342
Item loading can be done in one stack inserter cycle at high enough Inserter capacity bonus.
Wexler
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 11, 2017 2:25 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Wexler »

Optera wrote:

Code: Select all

23775.801 Script interface.lua:53: [LTN] LTN Bob1Out ON Request station train limit reached: 1(1)
23775.801 Script interface.lua:53: [LTN] LTN OreSort UNLOAD B Request station train limit reached: 1(1)
You limited provider and requester to 1 train. Once that train is sent out no more trains are allowed to either of those stops until the train has gone there.
In that configuration order 2 can only be shipped once the train shipping order 1 has left the requester.
If you want both orders shipped at once you will need to allow at least 2 trains at the requester.
Yes - i understand that. What i'm (poorly) trying to say is that there might be some optimizations possible in this case.

1) Even if both orders were allowed (no train limits) zinc-ore would only be included in one of the orders - even though I'm requesting almost a million of it, and both stations offer 16k. Should it not be included in both orders, for maximum throughput?

2) This might be something you don't want, but when the mod realizes that only one order will be allowed (train limit), it could potentially recheck and see if there are any more items that can be included in this order, now that the other order has been discarded.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Optera »

Wexler wrote:
Optera wrote:

Code: Select all

23775.801 Script interface.lua:53: [LTN] LTN Bob1Out ON Request station train limit reached: 1(1)
23775.801 Script interface.lua:53: [LTN] LTN OreSort UNLOAD B Request station train limit reached: 1(1)
You limited provider and requester to 1 train. Once that train is sent out no more trains are allowed to either of those stops until the train has gone there.
In that configuration order 2 can only be shipped once the train shipping order 1 has left the requester.
If you want both orders shipped at once you will need to allow at least 2 trains at the requester.
Yes - i understand that. What i'm (poorly) trying to say is that there might be some optimizations possible in this case.

1) Even if both orders were allowed (no train limits) zinc-ore would only be included in one of the orders - even though I'm requesting almost a million of it, and both stations offer 16k. Should it not be included in both orders, for maximum throughput?

2) This might be something you don't want, but when the mod realizes that only one order will be allowed (train limit), it could potentially recheck and see if there are any more items that can be included in this order, now that the other order has been discarded.
Currently the dispatcher sorts providers by #trains, priority, amount available. In case they are equal on all accounts the stop with lower unit number wins.

The clean way would require to get all potential provider in a first pass and pick the best combination for merging deliveries in a 2nd pass.
This would cost too much performance for making sure items are delivered from as few different stations as possible.

Simply adding another sort parameter between priority and amount, prioritising the stop already designated as provider for a delivery shouldn't cost much performance. However this would make merging deliveries dependant on item order. If Zinc was the first item on the list, it would still pick that from Saph1Out and the other 5 from Bob1Out.
I'll experiment with this for the future.

I know the logic of LTN is not perfect. To keep it as lightweight as possible I had to cut some corners and make it more simplistic than I would have liked myself. Because of that it is capable of running this distributed 1RPM base with ~150 stops and 52 trains with a drain of only ~0.5 UPS on my old laptop. (In comparison entity update takes 12.2)
2017-07-01-13-26-03-9166395.jpg
2017-07-01-13-26-03-9166395.jpg (176.73 KiB) Viewed 10441 times
PrairForMercy
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Aug 11, 2015 7:05 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4 crash

Post by PrairForMercy »

hey i am getting a error when i try to delete a stop.
edit; also when i rename a station

Error while running event LogisticTrainNetwork::on_tick (ID 0)
__LogisticTrainNetwork__/control.lua:1307: attempt to get length of field '?' (a nil value)
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4 crash

Post by Optera »

PrairForMercy wrote:hey i am getting a error when i try to delete a stop.
edit; also when i rename a station

Error while running event LogisticTrainNetwork::on_tick (ID 0)
__LogisticTrainNetwork__/control.lua:1307: attempt to get length of field '?' (a nil value)
What's your current version of factorio and ltn and from which versions did you upgrade?
PrairForMercy
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Aug 11, 2015 7:05 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4 crash

Post by PrairForMercy »

Optera wrote:
PrairForMercy wrote:hey i am getting a error when i try to delete a stop.
edit; also when i rename a station

Error while running event LogisticTrainNetwork::on_tick (ID 0)
__LogisticTrainNetwork__/control.lua:1307: attempt to get length of field '?' (a nil value)
What's your current version of factorio and ltn and from which versions did you upgrade?
0.15.27 was on in when it stopped working.
i think i found out why it happens with a stop pasted with blueprint and the station name is the same as the original station. so same name but it wont turn purple and when i try to delete either one crash.
really hope you can fix it, mine save game of 100 hours is completely damaged now :( trows errors on all mods after i saved and tried reloading it.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4 crash

Post by Optera »

PrairForMercy wrote:
Optera wrote:
PrairForMercy wrote:hey i am getting a error when i try to delete a stop.
edit; also when i rename a station

Error while running event LogisticTrainNetwork::on_tick (ID 0)
__LogisticTrainNetwork__/control.lua:1307: attempt to get length of field '?' (a nil value)
What's your current version of factorio and ltn and from which versions did you upgrade?
0.15.27 was on in when it stopped working.
i think i found out why it happens with a stop pasted with blueprint and the station name is the same as the original station. so same name but it wont turn purple and when i try to delete either one crash.
really hope you can fix it, mine save game of 100 hours is completely damaged now :( trows errors on all mods after i saved and tried reloading it.
Please upload the save and all mods required to run it.
Coffee Daemon
Inserter
Inserter
Posts: 48
Joined: Tue May 03, 2016 1:02 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Coffee Daemon »

Having some issues with depots. I am running 2 sizes of trains, 3-8-3's and 1-1-1's. I have depot's for each, yet even with setting the train sizes I still get the 1-1-1's going to the 3-8-3 depot and vice versa. Any ideas if/what i'm doing wrong?

Also on an unrelated note I've gotten a storage area for coal with 2 3-8-3 train stops, one for loading and one unloading. Is it possible to stop trains from going in a loop?

Many thanks, Coffee
User avatar
Odhrean
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Mon Sep 15, 2014 7:49 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Odhrean »

Coffee Daemon wrote:Having some issues with depots. I am running 2 sizes of trains, 3-8-3's and 1-1-1's. I have depot's for each, yet even with setting the train sizes I still get the 1-1-1's going to the 3-8-3 depot and vice versa. Any ideas if/what i'm doing wrong?

Also on an unrelated note I've gotten a storage area for coal with 2 3-8-3 train stops, one for loading and one unloading. Is it possible to stop trains from going in a loop?

Many thanks, Coffee
You must give all Stations that belong to Depot 3-8-3 the same Name ( e.q. "LTN Depot 3-8-3") and all Stations for Depot 1-1-1 the same (e.g. "LTN Depot 1-1-1").
Then you must send the 3-8-3 Trains to Station "LTN Depot 3-8-3" and the 1-1-1 Trains to Station "LTN Depot 1-1-1".
Now the trains will always return to the Depot they were assigned to (They go to the closest Depot-Station, it is possible to have several pyhsical Locations for the same Depot).
RynTyrell
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Jun 29, 2017 11:54 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by RynTyrell »

Hi Optera is it possible to get a delivery started via cirquit network ? ive tried several designs but it just dont get the signal then or it usees the normal signal instead of waiting for activation. An answer would be nice if you are still active on this mod :)
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by Optera »

RynTyrell wrote:Hi Optera is it possible to get a delivery started via cirquit network ? ive tried several designs but it just dont get the signal then or it usees the normal signal instead of waiting for activation. An answer would be nice if you are still active on this mod :)
Why would i no longer be active? The last release was not even 2 weeks ago.
Deliveries are created at amount *-1 >= request threshold.
RynTyrell
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Jun 29, 2017 11:54 pm
Contact:

Re: [Mod 0.14/0.15] Logistic Train Network 1.3.4

Post by RynTyrell »

Optera wrote:
RynTyrell wrote:Hi Optera is it possible to get a delivery started via cirquit network ? ive tried several designs but it just dont get the signal then or it usees the normal signal instead of waiting for activation. An answer would be nice if you are still active on this mod :)
Why would i no longer be active? The last release was not even 2 weeks ago.
Deliveries are created at amount *-1 >= request threshold.
Thank you for the answer :)
Locked

Return to “Logistic Train Network”