old LTN discussion thread

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by Optera »

Here's an updated version of the universal provider & requester with a fix against getting stuck in loading cycle.
2017-02-11 Universal Station Description.jpg
2017-02-11 Universal Station Description.jpg (189.27 KiB) Viewed 9028 times
1) Counter
it's a basic counter nothing special
2) train composition filter
decodes train composition without polluting the item signals
3) loading cycle fix
requires constant combinator red = stack size and arithmetic combinator red * -stack size = red
Blueprint
Edit: Fixed bp string error
Last edited by Optera on Sat Feb 11, 2017 4:09 pm, edited 1 time in total.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by ssilk »

Optera wrote: I wanted a truly universal station, able to be provider & requester at the same time, making full use of the train composition signal to showcase what is possible. I hope others will showcase even better station designs utilizing LTN.
Well, the idea is right. But for me it still doesn't make sense, as it doesn't make sense to have any type of train in one map.

For example: In the current game - in which I want to really use logistic trains in a big scope - I have until now three types of trains:
- Bulk transport (LLCCCC),
- Bulk tank trains (LTTT)
- and now Supply (LCC)
And I doubt there will be more needed. (For example: As I want to have any outpost in a distance of 1500 tiles to another, reverseable trains make not so much sense.)

And depending on these three types of trains I (plan to) have 6 types of stations (eventually only 5, cause for the supply it is eventually really useful to have them work into both directions).
What I want to say is: A truly universal provider/requester station makes (in my eyes of course) not so much sense. :)
even when I designed something myself I often miss connections in this mess... There should be some form of "logic connection mode" showing at glance all connections and the signals on them, I bet you have a whole collection of requests for something like that.
:) Yes. I just looked (viewtopic.php?f=80&t=22760 , viewtopic.php?f=80&t=18153 , viewtopic.php?f=80&t=30845 and much mentions besides the threads). But not so much as I thought. :?
Maybe we should push this as a an important suggestion? cause I think this hinders really playing with a bit more complex circuits than standard. :)
To get rid of the glitch I thought about using a latch to switch between loading and unloading mode depending on loading signal signs. If I can make it work I'll update this post to include that design.
What I thought about is
a) integration of the item-count-combinator mod. This morning I used that and it was a big fun to see how easy the circuits become then.
b) enhancement of the train stop or a new combinator, which "provides clever stuff". Like:
- deliver a "Pre-requesting-signal" to pre-load the requester-chests before the train comes,
- signals that update with the train content and signal if this is now "loading" or "unloading" station.
- deliver 12 signal ports: For each inserter/chest on the train one. Well, that is complex.
- and some more vague ideas, that I would like to share only at a beer :)

On the other hand it is an interesting task to create such a train-stop! :) I tried now several hours.
But currently I see much too much glitches, I counted now 5 different states, where such a glitch can happen. And they are so difficult to reproduce. I come in several situations into the problem, that the train doesn't work anymore, cause it fills one too less or too much into the wagon. Well, I'm sure, normally you will never see that happen, cause I use that in an unusual way. But it's just frustrating.
This encoding would make those signals unusable for any other purpose and isn't very flexible.
Well, my opinion is, that this is barely understandable and I don't like to sit and calculate the binary decodings.

BTW: Why is the input in the example is decoded like that? I searched in this thread, but didn't found the reason.
Image
My encoding shows every possible mod added loco or wagon with it's own signal
I still think this isn't really needed. Yes, flexibility in the mod to try it out is a good idea, but if this mod might be implemented into vanilla (hmmmm....), this needs to change somehow into something, that is much easier to understand (not for everybody, but for the interested ones, and without calculator).
Optera wrote:Here's an updated version of the universal provider
Well, will try this of course.
Anson wrote:
ssilk wrote:For example for a LCCC train there are 3 signals:
[1] = 1, [2] = 2, [3] = 2, [4] = 1
And signal [0] contains the train-length (here 4)
So you can explain trains up to length of 36... :)
[1] to [4] are 4 signals (not 3), LCCC should be 1222, and 1221 would be LCCL,
and [1] to [9], plus [A] to [Z] are 35, since you use [0] for the length :-)
I think I was very tired yesterday. :roll: Thanks for correction. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by ssilk »

Hm I couldn't import this.

Blueprint-string cannot import:
Screen Shot 2017-02-11 at 14.15.56.png
Screen Shot 2017-02-11 at 14.15.56.png (393.94 KiB) Viewed 9025 times
Added also https://mods.factorio.com/mods/DaveMcW/ ... discussion
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by Optera »

ssilk wrote:Well, my opinion is, that this is barely understandable and I don't like to sit and calculate the binary decodings.

BTW: Why is the input in the example is decoded like that? I searched in this thread, but didn't found the reason.
XKnight's dark magic takes a bit to figure out, it's somewhat explained in later posts.
Basically the thing is using the internal binary representation of a 32bit signed int. The combinator holds the 2^n integer numbers for every position. When multiplied with the encoded signal matching positions overflow and become negative.
ssilk wrote:Hm I couldn't import this.

Blueprint-string cannot import:
Screen Shot 2017-02-11 at 14.15.56.png
Added also https://mods.factorio.com/mods/DaveMcW/ ... discussion
Sorry, seems like i grabbed the bp while one of my modded locomotives was at the station.
Not really a bug with bp-string. It tried to restore all signals to my stations constant combinator.
Blueprint

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by NiftyManiac »

The documentation says that stop_timeout is the "duration in ticks of inactivity before leaving un-loading stations"; but it seems to me that it affects both loading and unloading. I'd like to be able to have the train wait as long as needed to load up, but depart as soon as unloading finishes...

Even better, it'd be good to be able to command a train to leave the station, or specify the timeout via circuit. The main usecase is that certain unloading stations might want a very specific number of items, and if the train has extra cargo from a previous run it should be able to continue after inactivity if the unloading station stops unloading. Sorry if this has been suggested before.

At the least the documentation for stop_timeout should be fixed (unless I'm mistaken), but the other features would be useful... I might send a pull request your way when I have some time.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by Optera »

NiftyManiac wrote:The documentation says that stop_timeout is the "duration in ticks of inactivity before leaving un-loading stations"; but it seems to me that it affects both loading and unloading. I'd like to be able to have the train wait as long as needed to load up, but depart as soon as unloading finishes...
Wherever I write "un-loading" or (un-)loading I mean both loading and unloading.
stop_timeout is a timeout, a fail safe to force trains out of stations when (un-)loading fails. Stations should be designed in a way it's never used.
Even better, it'd be good to be able to command a train to leave the station, or specify the timeout via circuit. The main usecase is that certain unloading stations might want a very specific number of items, and if the train has extra cargo from a previous run it should be able to continue after inactivity if the unloading station stops unloading. Sorry if this has been suggested before.
Trains deliver exactly the requested amount. If they don't your station designs are flawed.
Trains leave providers once every requested item is loaded and leave requesters once every requested item is unloaded. It's up to the player to decide how and where to handle potential excess items. I prefer using stations smart enough to remove incorrectly loaded items.

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by NiftyManiac »

I get your point - timeouts should be a failsafe and not a part of the design - but unfortunately dealing with multiple items precisely is a pain otherwise. Let's say a station requests 1000 iron and 2 satellite parts with some regularity. Since I can't (yet) access train inventory, unloading a train precisely is much easier than loading it precisely: to achieve the latter I'd need to count the train inventory myself as I load it and reset the counter as the train leaves. Much nicer to have a filtered train with surplus and precise unloading, if it will be servicing the same order a lot.

Tbh my usecase isn't really in the spirit of this mod, since I've got trains with filtered wagons servicing specific stations determined by train-length settings. But that's pretty much due to my orders that require small amounts of many different items.

Basically this mod is great in that I think it's the only way to have blueprinted stations be automatically serviced without using GUIs (I don't think it's possible with Smart Trains... lmk if there's another way) but it'd be nice to have fine-grained circuit control of trains. Makes sense if that's out of this mod's scope though.

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.0

Post by NiftyManiac »

Bug report: things go poorly if you put logistic train stops adjacent to one another.
Factorio 0.14.21, Logistic Train Network 0.9.0
To reproduce: Start a new sandbox game. Lay down some rail and put down a logistic train stop. Put another one down as close as possible in front of the first, in the direction of train travel. Mine both train stops. Get error:

Code: Select all

Error while running event on_preplayer_mined_item (ID 11)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
	__LogisticTrainNetwork__/control.lua:757: in function 'RemoveStop'
	__LogisticTrainNetwork__/control.lua:162: in function <__LogisticTrainNetwork__/control.lua:159>
Somehow when I got this the first time I wasn't even able to load earlier saves, as I got the same error on load. So I had to remove the mod and put down all of my train stations again.

Looks like the combinator and lamp don't get put down properly when placing them adjacent, so it crashes when trying to remove the inexistent entities.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by Optera »

NiftyManiac wrote:I get your point - timeouts should be a failsafe and not a part of the design - but unfortunately dealing with multiple items precisely is a pain otherwise. Let's say a station requests 1000 iron and 2 satellite parts with some regularity. Since I can't (yet) access train inventory, unloading a train precisely is much easier than loading it precisely: to achieve the latter I'd need to count the train inventory myself as I load it and reset the counter as the train leaves. Much nicer to have a filtered train with surplus and precise unloading, if it will be servicing the same order a lot.

Tbh my usecase isn't really in the spirit of this mod, since I've got trains with filtered wagons servicing specific stations determined by train-length settings. But that's pretty much due to my orders that require small amounts of many different items.

Basically this mod is great in that I think it's the only way to have blueprinted stations be automatically serviced without using GUIs (I don't think it's possible with Smart Trains... lmk if there's another way) but it'd be nice to have fine-grained circuit control of trains. Makes sense if that's out of this mod's scope though.
Satellites stack to 1 so inserters should load them 1 at a time. A simple counter against the loading counts should do. Another method would be to use Inventory Sensor. (link in my signature)
NiftyManiac wrote:Bug report: things go poorly if you put logistic train stops adjacent to one another.
Factorio 0.14.21, Logistic Train Network 0.9.0
To reproduce: Start a new sandbox game. Lay down some rail and put down a logistic train stop. Put another one down as close as possible in front of the first, in the direction of train travel. Mine both train stops. Get error:

Code: Select all

Error while running event on_preplayer_mined_item (ID 11)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
	__LogisticTrainNetwork__/control.lua:757: in function 'RemoveStop'
	__LogisticTrainNetwork__/control.lua:162: in function <__LogisticTrainNetwork__/control.lua:159>
Somehow when I got this the first time I wasn't even able to load earlier saves, as I got the same error on load. So I had to remove the mod and put down all of my train stations again.

Looks like the combinator and lamp don't get put down properly when placing them adjacent, so it crashes when trying to remove the inexistent entities.
Thanks for reporting. Should be fixed in 0.9.1
adjacent stops
No idea why anyone would place stops like this though.

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by NiftyManiac »

Optera wrote:Satellites stack to 1 so inserters should load them 1 at a time. A simple counter against the loading counts should do.
OK, fine :). 2 inserters, then. Inventory Sensor looks useful though.
Optera wrote: No idea why anyone would place stops like this though.
Because I'm totally abusing this mod's capabilities. What I really wanted was to have depots also capable of loading items, but since they can't, instead I have a depot immediately followed by a loading station. That way the train can get loaded while it sits at the depot, and as soon as someone requests its resources, it'll briefly stop at the loading station and continue on its merry way if it has enough items. When it arrives, the unloading station will pull out only what it needs. A short timeout means it'll drive away quickly after unloading stops.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by ssilk »

Hm. To be honest: that makes no sense to load a satellite into a train, hoping that it is needed anywhere. It doesn't matter to do this with a fully loaded wagon of iron ore, but a satellite is worth much, much more. Pre-loading of this isn't really useful...
That is the reason, why this mod tries to load exactly the needed items.

You might think about using the smart train mod, which is in my opinion much better useable to achieve what you want. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by NiftyManiac »

ssilk wrote:You might think about using the smart train mod, which is in my opinion much better useable to achieve what you want. :)
Unfortunately Smart Trains doesn't let me blueprint a new station and have it connect automatically to the network unless I open a GUI. So it doesn't work for my use case.

ArienYolocron
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Nov 01, 2016 5:14 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by ArienYolocron »

Hi i seem to be having an issue with my logistics stations and tank trains. i have my tanks connected properly to be set as supply and requesting stations but my L-T train will not automate, i have also sent it to both stations in hopes of it creating a schedule?

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by Optera »

ArienYolocron wrote:Hi i seem to be having an issue with my logistics stations and tank trains. i have my tanks connected properly to be set as supply and requesting stations but my L-T train will not automate, i have also sent it to both stations in hopes of it creating a schedule?
With that amount of information I can only give you the generic hints.
  • Rail Tanker is the only supported fluid transportation
  • Make sure the tankers are empty
  • Never try connecting more than one fluid/station. Pumps don't reliable filter like inserters
  • Orders are generated when a stop see's item amount < (minimum delivery size * -1)
  • With best effort off (new default) only providers with item amount > minimum delivery size are used
  • Only trains parked in automatic mode at an LTN-stop with set depot signal and matching length and cargo type are used

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by steinio »

Hello,

is it possible to setup a central ore storage with train delivery and without creating an endless loop with trains?
Probably with min trainsize i guess?
Image

Transport Belt Repair Man

View unread Posts

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by Optera »

steinio wrote:Hello,

is it possible to setup a central ore storage with train delivery and without creating an endless loop with trains?
Probably with min trainsize i guess?
What do you mean by central storage? Mine -> Storage, Storage -> Furnaces?
It's possible, but useless. LTN is most efficient when used Mine -> Furnace.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by steinio »

Optera wrote:
steinio wrote:Hello,

is it possible to setup a central ore storage with train delivery and without creating an endless loop with trains?
Probably with min trainsize i guess?
What do you mean by central storage? Mine -> Storage, Storage -> Furnaces?
It's possible, but useless. LTN is most efficient when used Mine -> Furnace.
K, thanks.
Yes this was meant with storage.

It's nice to see how the trains work by itself.
Very good mod.
Image

Transport Belt Repair Man

View unread Posts

NiftyManiac
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Sat Jan 21, 2017 12:01 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by NiftyManiac »

Is there a max limit on the number of stations this mod supports? When outputting the debug info it looks like the provider list doesn't go above 32 (but maybe that's just how many you process per tick?) (Edit: nvm, see below)

I have a lot of provider train stations, probably over 100, and 5 requester stations. The requester stations all request a large amount of copper and a smaller amount of iron with a min delivery size of 1000 (and use_best_effort is true). Even though the copper providers are providing more than 1000 each while the iron ones are providing less, all 5 of my trains only visit the iron providers. How come? I was under the impression that more ore provided at a station meant that it had a higher visitation priority.

Log output level 3: http://pastebin.com/qymQ0mnv

Edit: Oooooh I think I figured it out. Each station is requesting both iron and copper. This is split into two orders, and a source of iron is found first just because it comes before copper in signal order or something. It's unlikely that the provider also has copper. Then it looks for a source of copper, can't merge it with the first, and now there's two orders but the depot only has one train. So it sends the iron delivery and copper gets dropped. The next train arrives and the same thing happens. Since use_best_effort is on, trains are always moving and there'll rarely be multiple trains at the depot.

It's an easy fix, I think; sort the orders with the same criteria as normal (priority, item count) before processing them.

Anson
Fast Inserter
Fast Inserter
Posts: 249
Joined: Sun May 22, 2016 4:41 pm
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by Anson »

Optera wrote:
ArienYolocron wrote:connected properly to be set as supply and requesting stations but my L-T train will not automate,
i have also sent it to both stations in hopes of it creating a schedule?
Only trains parked in automatic mode at an LTN-stop with set depot signal and matching length and cargo type are used
yes, since ArienYolocron only wrote about a pair of supply and requesting stations,
and sending a train to both stations, to me this seems to be the most probable cause.

someone had this problem (misunderstanding the components of a LTN network) on a
previous page of this thread, and this was my answer ...

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Mod 0.14] Logistic Train Network 0.9.1

Post by Optera »

NiftyManiac wrote:Is there a max limit on the number of stations this mod supports? When outputting the debug info it looks like the provider list doesn't go above 32 (but maybe that's just how many you process per tick?) (Edit: nvm, see below)

I have a lot of provider train stations, probably over 100, and 5 requester stations. The requester stations all request a large amount of copper and a smaller amount of iron with a min delivery size of 1000 (and use_best_effort is true). Even though the copper providers are providing more than 1000 each while the iron ones are providing less, all 5 of my trains only visit the iron providers. How come? I was under the impression that more ore provided at a station meant that it had a higher visitation priority.

Log output level 3: http://pastebin.com/qymQ0mnv

Edit: Oooooh I think I figured it out. Each station is requesting both iron and copper. This is split into two orders, and a source of iron is found first just because it comes before copper in signal order or something. It's unlikely that the provider also has copper. Then it looks for a source of copper, can't merge it with the first, and now there's two orders but the depot only has one train. So it sends the iron delivery and copper gets dropped. The next train arrives and the same thing happens. Since use_best_effort is on, trains are always moving and there'll rarely be multiple trains at the depot.

It's an easy fix, I think; sort the orders with the same criteria as normal (priority, item count) before processing them.
What you say doesn't match with the log you provided. The log clearly shows alternating iron and copper ore shipments to Ore dropoff, Crellas and Damian Mulligan.

Delivering one item of multiple requested is indeed pushing the requesting stop back to the end of the queue. If it's never filling to the point where requested amounts are satisfied your throughput is too low and no amount of coding on my end will help you.

PS: You should rename your stops to meaningful, unique names. Generated Backer Names are NOT unique and will mess up train schedules.

Locked

Return to “Logistic Train Network”