old LTN discussion thread

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

teenkertoy
Inserter
Inserter
Posts: 37
Joined: Fri Nov 11, 2016 5:03 am
Contact:

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

Post by teenkertoy »

Optera wrote: LTN does not know about special stations being able to load only some items to some wagons like in your screenshot.
For example LTN will use this L-CC train for a 4k coal delivery, expecting this provider able to load both wagons.
Hmm, I didn't think of that. I guess I could hard limit the capacity of the coal chests for this particular station by red X'ing most of the slots in the buffer chests. Then this particular station would never show more than 2k coal is available to the LTN system, and no trains that want more than one-wagon-load of coal would stop here. Thanks for the idea.
SootStack
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Aug 12, 2016 3:46 pm
Contact:

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

Post by SootStack »

This is about car lengths, not about simultaneous deliveries.

Code: Select all

 949.241 Script interface.lua:66: [LTN] (UpdateStop) Yvonne provides item,coal 56817
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 57600/1 item,coal at @coal - 2 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at @coal - 1 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at Yvonne priority: 0 minTraincars: 3 maxTraincars: 3 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] added new order 1 @coal - 2 >> Vít Brunner: 2001 in 41 stacks item,coal min length: 8 max length: 3
 949.437 Script interface.lua:66: [LTN] 1/4077807 updating stopID 76375
 949.437 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 2 provides item,copper-ore 57600
 949.440 Script interface.lua:66: [LTN] 2/4077808 updating stopID 76382
 949.440 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 1 provides item,copper-ore 57600
 949.444 Script interface.lua:66: [LTN] 3/4077809 updating stopID 76396
 949.444 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 3 provides item,copper-ore 55408
 949.449 Script interface.lua:66: [LTN] 4/4077810 updating stopID 77325
 949.452 Script interface.lua:66: [LTN] 5/4077811 updating stopID 96809
 949.457 Script interface.lua:66: [LTN] 6/4077812 updating stopID 96813
 949.457 Script interface.lua:66: [LTN] (UpdateStop) @iron - ore 1 provides item,iron-ore 57600
 949.462 Script interface.lua:66: [LTN] 7/4077813 updating stopID 98608
 949.462 Script interface.lua:66: [LTN] (UpdateStop) @coal - 2 provides item,coal 57600
 949.466 Script interface.lua:66: [LTN] 8/4077814 updating stopID 104871
 949.469 Script interface.lua:66: [LTN] 9/4077815 updating stopID 104970
 949.469 Script interface.lua:66: [LTN] (UpdateStop) @coal - 1 provides item,coal 56817
 949.474 Script interface.lua:66: [LTN] 10/4077816 updating stopID 105645
 949.477 Script interface.lua:66: [LTN] 11/4077817 updating stopID 105652
 949.482 Script interface.lua:66: [LTN] 12/4077818 updating stopID 105666
 949.487 Script interface.lua:66: [LTN] 13/4077819 updating stopID 105749
 949.487 Script interface.lua:66: [LTN] (UpdateStop) Vít Brunner requested item,coal 2001, age: 4004739/4077819
 949.491 Script interface.lua:66: [LTN] 14/4077820 updating stopID 105760
 949.491 Script interface.lua:66: [LTN] (UpdateStop) Yvonne provides item,coal 56817
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 57600/1 item,coal at @coal - 2 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at @coal - 1 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at Yvonne priority: 0 minTraincars: 3 maxTraincars: 3 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] added new order 1 @coal - 2 >> Vít Brunner: 2001 in 41 stacks item,coal min length: 8 max length: 3
This repeats indefinitely. So I did not include the remaining 2mb of it.

It doesn't mention it here but the max and min length is set to 3 on the requester station.
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.2.2

Post by Optera »

SootStack wrote:This is about car lengths, not about simultaneous deliveries.

Code: Select all

 949.241 Script interface.lua:66: [LTN] (UpdateStop) Yvonne provides item,coal 56817
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 57600/1 item,coal at @coal - 2 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at @coal - 1 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at Yvonne priority: 0 minTraincars: 3 maxTraincars: 3 locked Slots: 0
 949.432 Script interface.lua:66: [LTN] added new order 1 @coal - 2 >> Vít Brunner: 2001 in 41 stacks item,coal min length: 8 max length: 3
 949.437 Script interface.lua:66: [LTN] 1/4077807 updating stopID 76375
 949.437 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 2 provides item,copper-ore 57600
 949.440 Script interface.lua:66: [LTN] 2/4077808 updating stopID 76382
 949.440 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 1 provides item,copper-ore 57600
 949.444 Script interface.lua:66: [LTN] 3/4077809 updating stopID 76396
 949.444 Script interface.lua:66: [LTN] (UpdateStop) @copper - ore 3 provides item,copper-ore 55408
 949.449 Script interface.lua:66: [LTN] 4/4077810 updating stopID 77325
 949.452 Script interface.lua:66: [LTN] 5/4077811 updating stopID 96809
 949.457 Script interface.lua:66: [LTN] 6/4077812 updating stopID 96813
 949.457 Script interface.lua:66: [LTN] (UpdateStop) @iron - ore 1 provides item,iron-ore 57600
 949.462 Script interface.lua:66: [LTN] 7/4077813 updating stopID 98608
 949.462 Script interface.lua:66: [LTN] (UpdateStop) @coal - 2 provides item,coal 57600
 949.466 Script interface.lua:66: [LTN] 8/4077814 updating stopID 104871
 949.469 Script interface.lua:66: [LTN] 9/4077815 updating stopID 104970
 949.469 Script interface.lua:66: [LTN] (UpdateStop) @coal - 1 provides item,coal 56817
 949.474 Script interface.lua:66: [LTN] 10/4077816 updating stopID 105645
 949.477 Script interface.lua:66: [LTN] 11/4077817 updating stopID 105652
 949.482 Script interface.lua:66: [LTN] 12/4077818 updating stopID 105666
 949.487 Script interface.lua:66: [LTN] 13/4077819 updating stopID 105749
 949.487 Script interface.lua:66: [LTN] (UpdateStop) Vít Brunner requested item,coal 2001, age: 4004739/4077819
 949.491 Script interface.lua:66: [LTN] 14/4077820 updating stopID 105760
 949.491 Script interface.lua:66: [LTN] (UpdateStop) Yvonne provides item,coal 56817
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 57600/1 item,coal at @coal - 2 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at @coal - 1 priority: 0 minTraincars: 8 maxTraincars: 8 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] (GetProviders): found 56817/1 item,coal at Yvonne priority: 0 minTraincars: 3 maxTraincars: 3 locked Slots: 0
 949.683 Script interface.lua:66: [LTN] added new order 1 @coal - 2 >> Vít Brunner: 2001 in 41 stacks item,coal min length: 8 max length: 3
This repeats indefinitely. So I did not include the remaining 2mb of it.

It doesn't mention it here but the max and min length is set to 3 on the requester station.
I see what's happening there.
That's why I always warned how easy it is to produce deadlocks with min/max train length.

Edit: I'll delay 1.2.3 to add the fix to that version.
Last edited by Optera on Tue May 09, 2017 9:59 am, edited 2 times in total.
nagapito
Filter Inserter
Filter Inserter
Posts: 362
Joined: Fri Jul 29, 2016 12:18 am
Contact:

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

Post by nagapito »

Optera wrote:
teenkertoy wrote:Image


I finally made a count-perfect loader for single items and multiple items into a cargo wagon.
LTN does not know about special stations being able to load only some items to some wagons like in your screenshot.
For example LTN will use this L-CC train for a 4k coal delivery, expecting this provider able to load both wagons.
And does it matter? Abstract the wagons, requests are not assigned to wagons but instead to trains. For LTN, this train will pick and deliver 4k coal, it doesnt matter if its on one wagon or divided by multiple.
Now, if the user overbooks the train, configuring the system to request more then 4k.... its the user fault.

I actually would like to see some screens of those combinators settings. Are you gradually reducing the the stack inserter item amount to guarantee precise numbers?
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.2.3

Post by Optera »

Re-released 1.2.3
These desyncs viewtopic.php?f=23&t=46873 should be fixed. I havn't got time or others to test it thoroughly

Providers are only picked if their train length settings allow at least one train size to be serviced by it and the requester.
Will still fail in endless loops if no matching train exists. Just use sensible length settings.

Improved performance of checking duplicate names by using new events from 0.15. Also checks against any base or other mod added train-stop names.
TaztheRotten
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Mar 06, 2017 2:38 pm
Contact:

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

Post by TaztheRotten »

The Mod is working fine for me. TY Opt

I have a request, a suggestion. On the stop itself, I find it hard to connect wires to the proper part because they are bunched up together . Often, I connect wires badly because I simply clicked sloppy. Maybe the stop itself could be laid out in a way that us fumblers are less likely to miss our intended target?
SootStack
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Aug 12, 2016 3:46 pm
Contact:

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

Post by SootStack »

Thanks so much!
I realized not every station needs a full 4-4 train full of items; So having the ability to haul large and small amounts is rather handy.
hedikin
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Mar 14, 2017 7:04 pm
Contact:

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

Post by hedikin »

Hello.

I been reading the last few pages of this forum post and I cant seem to figure out if this is a bug or not...

I got a train station that supplies Coal. I told train station that it needs to deliver so and so much, how ever the train NEVER stops loading and fills up the train so it times out.

Oh and I'm using the lastest version of LTN.

there is a 'AND' to much in the conditions. if I remove it, the train functions as I want it to, and how it used to work.
there is a AND to much in the conditions. if I remove it the train functions as I want it to, and how it used to work.
there is a AND to much in the conditions. if I remove it the train functions as I want it to, and how it used to work.
Untitled.png (1.07 MiB) Viewed 8104 times
So please is this a bug or a new feature? or is it something I have to manually disable somewhere?
Untitled2.png
Untitled2.png (1.12 MiB) Viewed 8104 times
Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

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

Post by Mobius1 »

hedikin wrote:Hello.

I been reading the last few pages of this forum post and I cant seem to figure out if this is a bug or not...

I got a train station that supplies Coal. I told train station that it needs to deliver so and so much, how ever the train NEVER stops loading and fills up the train so it times out.

Oh and I'm using the lastest version of LTN.

there is a 'AND' to much in the conditions. if I remove it, the train functions as I want it to, and how it used to work.
Untitled.png
So please is this a bug or a new feature? or is it something I have to manually disable somewhere?
Untitled2.png
Use some combinator magic dude, pick a wire from the station stop to an arithmetic combinator with the setup "each * -1 | each", get a wire from the yellow combinator of the station to the output of that combinator, the wire needs to be the same color tho. Remember to set the station to "read train contents" then you hook up another wire from that combinator to your requester chest configured to "set requests", remember, wire with the same color.
hedikin
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Mar 14, 2017 7:04 pm
Contact:

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

Post by hedikin »

Mobius1 wrote:
hedikin wrote:Hello.

I been reading the last few pages of this forum post and I cant seem to figure out if this is a bug or not...

I got a train station that supplies Coal. I told train station that it needs to deliver so and so much, how ever the train NEVER stops loading and fills up the train so it times out.

Oh and I'm using the lastest version of LTN.

there is a 'AND' to much in the conditions. if I remove it, the train functions as I want it to, and how it used to work.
The attachment Untitled.png is no longer available
So please is this a bug or a new feature? or is it something I have to manually disable somewhere?
The attachment Untitled2.png is no longer available
Use some combinator magic dude, pick a wire from the station stop to an arithmetic combinator with the setup "each * -1 | each", get a wire from the yellow combinator of the station to the output of that combinator, the wire needs to be the same color tho. Remember to set the station to "read train contents" then you hook up another wire from that combinator to your requester chest configured to "set requests", remember, wire with the same color.
Thanks i already do that, but thats not my problem. the problem is that Extra AND line in Conditions
Capture4.PNG
Capture4.PNG (1.59 MiB) Viewed 8101 times
Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

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

Post by Mobius1 »

hedikin wrote:Thanks i already do that, but thats not my problem. the problem is that Extra AND line in Conditions
Capture4.PNG
See, in that picture of yours, you're using a belt-based loading, so you still need that combinator magic but instead of linking it to a provider chest you hook it up to your filter insterters and on the inserters you check "Set filters". By looking at the picture, that combinator is useless since that station would request either coal or coke so you should do this:
1- Place an arithmetic combinator with the config: "each * -1 | each"
2- Grab a Red wire from the station to the combinator input, set the station to "read train contents"
3- Grab a red wire from the yellow combinator to the output of the arithmetic combinator
4- Grab a red wire from the output of the arithmetic combinator to the inserters, set the inserters to "set filters"

That works like this: the train arrives with a signal requesting 2000 coal, the combinator outputs a constant signal of +2000, the station outputs 0 when the train arrives. Since the signal is positive, it'll set the filters on the inserters to that type of item. As the train fills up, each item inside of the train will become a negative signal added to the positive signal the combinator is outputting, so if the train has 1000 coal, the Arithmetic combinator will output -1000 and will add with the constant +2000 outputting the final +1000 signal. When the train fills up with 2000 coal, the signal that is sent to the inserters is 0coal, since 0 doesn't set any filters, the inserters will stop loading the train and it'll leave the station.
hedikin
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Mar 14, 2017 7:04 pm
Contact:

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

Post by hedikin »

Mobius1 wrote:
hedikin wrote:Thanks i already do that, but thats not my problem. the problem is that Extra AND line in Conditions
Capture4.PNG
See, in that picture of yours, you're using a belt-based loading, so you still need that combinator magic but instead of linking it to a provider chest you hook it up to your filter insterters and on the inserters you check "Set filters". By looking at the picture, that combinator is useless since that station would request either coal or coke so you should do this:
1- Place an arithmetic combinator with the config: "each * -1 | each"
2- Grab a Red wire from the station to the combinator input, set the station to "read train contents"
3- Grab a red wire from the yellow combinator to the output of the arithmetic combinator
4- Grab a red wire from the output of the arithmetic combinator to the inserters, set the inserters to "set filters"

That works like this: the train arrives with a signal requesting 2000 coal, the combinator outputs a constant signal of +2000, the station outputs 0 when the train arrives. Since the signal is positive, it'll set the filters on the inserters to that type of item. As the train fills up, each item inside of the train will become a negative signal added to the positive signal the combinator is outputting, so if the train has 1000 coal, the Arithmetic combinator will output -1000 and will add with the constant +2000 outputting the final +1000 signal. When the train fills up with 2000 coal, the signal that is sent to the inserters is 0coal, since 0 doesn't set any filters, the inserters will stop loading the train and it'll leave the station.

I dont use bots, but thanks
Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

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

Post by Mobius1 »

hedikin wrote:I dont use bots, but thanks
Uhm... the solution I posted is related to belt-loading setup not bot setup.
teenkertoy
Inserter
Inserter
Posts: 37
Joined: Fri Nov 11, 2016 5:03 am
Contact:

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

Post by teenkertoy »

nagapito wrote:And does it matter? Abstract the wagons, requests are not assigned to wagons but instead to trains. For LTN, this train will pick and deliver 4k coal, it doesnt matter if its on one wagon or divided by multiple.
Now, if the user overbooks the train, configuring the system to request more then 4k.... its the user fault.

I actually would like to see some screens of those combinators settings. Are you gradually reducing the the stack inserter item amount to guarantee precise numbers?
I think the point being made was since there could be more than 2k coal in stock at that particular station, the system would send a train there expecting to be loaded with more than 2k worth of coal (more than one wagon worth) which the station would not be capable of since it can only load coal into one wagon the way I have it configured. So I suggested I can limit the amount of coal in stock to exactly 2k and not any more, then no train would arrive at the station expecting such a condition.

The combinator settings are a little hard to explain, but you can pick it all up in the blueprint string I posted earlier.

Essentially a single stack inserter works all the time and it picks up the first stack of coal. The single inserter pulses 12 coal to the combinators which subtract this from the output from the LTN train stop, then divide the remainder of the request by the number of other inserters (factorio seems to always round-down any fractional answer), and send that number to the other inserters. So if I want 50 coal, the first inserter picks 12. The combinators do
roundDown[ (50-12)/11 ] = 3 so each of the other eleven inserters pick 3 coal and load it.

Now 12 coal has been loaded by the first inserter plus 33 coal has been loaded by the other eleven inserters. Now the "counter" is outputting -45 coal so the single inserter sees +5 coal remaining and it loads the last 5 coal. Since there is zero remaining, the other inserters do not load any more.

For a single item loaded by a single inserter, it works very similar but there is no math needed for the other inserters and therefore less combinators are needed.

full blueprint again, if needed

The image below is resized smaller. To see full size, right click, view image.

Image
nuhll
Filter Inserter
Filter Inserter
Posts: 946
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

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

Post by nuhll »

Sorry if its asked already. Is it possible to disable "AND wait 2 sec inactiv" on some stations? :)
tuttifrectte
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Apr 24, 2017 5:13 pm
Contact:

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

Post by tuttifrectte »

teenkertoy wrote:
Image
Btw, is there a way to generate these pictures (with all the circuit settings in it) or did you photoshop it by yourself?
nuhll
Filter Inserter
Filter Inserter
Posts: 946
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

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

Post by nuhll »

nuhll wrote:Sorry if its asked already. Is it possible to disable "AND wait 2 sec inactiv" on some stations? :)

I mean, the problem is, that i have a station which supplies all which is needed for my outposts... filter inserters filter and everything is working great... but since its "AND 2 sec inactive" it just keep addon ammo... and more ammo... and ... way to much ammo, even if i just request 50...
nagapito
Filter Inserter
Filter Inserter
Posts: 362
Joined: Fri Jul 29, 2016 12:18 am
Contact:

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

Post by nagapito »

nuhll wrote:
nuhll wrote:Sorry if its asked already. Is it possible to disable "AND wait 2 sec inactiv" on some stations? :)

I mean, the problem is, that i have a station which supplies all which is needed for my outposts... filter inserters filter and everything is working great... but since its "AND 2 sec inactive" it just keep addon ammo... and more ammo... and ... way to much ammo, even if i just request 50...
Use some quick circuit network on the inserters to only load the requested amount, so they stop, train goes idle for 2 seconds and leaves
nagapito
Filter Inserter
Filter Inserter
Posts: 362
Joined: Fri Jul 29, 2016 12:18 am
Contact:

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

Post by nagapito »

Somehow, it seems I have a lost delivery in the system...

One of my provider stations, that actually is a priority provider has the station light at yellow and no request is being made to it. The request for oxygen go all for station 2 (which is also a priority provider) and station 3, normal priority. Seems like the station is blocked waiting for something that will never come. All trains are parked at the depot, no orders for them to complete!
teenkertoy
Inserter
Inserter
Posts: 37
Joined: Fri Nov 11, 2016 5:03 am
Contact:

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

Post by teenkertoy »

tuttifrectte wrote: Btw, is there a way to generate these pictures (with all the circuit settings in it) or did you photoshop it by yourself?
I photoshop'ed that by hand. I doubt there is a tool that will do something like that for you.
Locked

Return to “Logistic Train Network”