Threshold and Stack Threshold

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

wookz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Apr 12, 2016 12:30 am
Contact:

Provider stacks vs threashold

Post by wookz »

In a system with the default item threshold of 1000, and a stack threshold of 2:
  • Requesting 2000 space science. Meeting the item threshold, but not the stack threshold. (I thought space science stack was 1000, not 2000.)
  • Requesting 320 nuclear fuel elements. Meeting stack threshold, but not item threshold.
Neither of these got delivered.

I'm not sure why, but I had assumed this was either/or to make a valid request, but not both. The documentation doesn't really say for sure, tho I guess in hindsight it kind of implies both. I was already all-in on stack thresholds, so I just fixed this by setting the global item threshold to 0. But I spent an hour or two re-adjusting my assumptions that I'd kinda like back. :(
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Provider stacks vs threashold

Post by Optera »

No, for items threshold signals overrides mod setting thresholds and stack threshold signals overrides threshold signals.
mrvn
Smart Inserter
Smart Inserter
Posts: 5873
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Provider stacks vs threashold

Post by mrvn »

Don't forget to mention that liquids always use the item threshold since they have no stacks.
wookz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Apr 12, 2016 12:30 am
Contact:

Re: Provider stacks vs threashold

Post by wookz »

Optera wrote: Mon Aug 03, 2020 7:28 pm No, for items threshold signals overrides mod setting thresholds and stack threshold signals overrides threshold signals.
Hmmm. I am positive that it wasn't delivering nuke fuel until the threshold signal was lowered to below what a train carries. I can do the experiment I guess. I'm also still on the older version too, might make a difference.
mrvn
Smart Inserter
Smart Inserter
Posts: 5873
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Provider stacks vs threashold

Post by mrvn »

wookz wrote: Wed Aug 05, 2020 4:19 pm
Optera wrote: Mon Aug 03, 2020 7:28 pm No, for items threshold signals overrides mod setting thresholds and stack threshold signals overrides threshold signals.
Hmmm. I am positive that it wasn't delivering nuke fuel until the threshold signal was lowered to below what a train carries. I can do the experiment I guess. I'm also still on the older version too, might make a difference.
I've been using a default threshold of 1000000000 for ages and never had a problem witht the stach threshold overriding it.

Are you sure you didn't forget a wire or connected it wrong? Or misread the stack size for atomic fuel? I had plenty of cases where I accidentally connected the wire from the buffer chest to the train stop instead of the lamp as an example.
Verliezer
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Sep 30, 2020 1:39 pm
Contact:

Stacksize treshhold and Requests

Post by Verliezer »

Hi,

Kinda new and could not find what I was looking for, so excuse me if I address something old :)

To start with, LTN is a great mod, really adds a nice dimension of playing to the game!!!

My question, I don't want to think about different stack sizes in my providing and requesting. I can't remember all the different max stack sizes of each item in Factorio. Just keep forgetting. So the idea of Stack Size tresholds is briljant ..... however ..... I still need to request in single items numbers.

How can I put out a request for a number of stacks in stead of single items?

Example:
Provider treshold: 10 stacks
Requestor treshold: 5 stacks
Request = -10 (stacks) << this seems to be impossible?
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Threshold and Stack Threshold

Post by Optera »

I'm going to collect various threshold related threads into this one.
redis
Inserter
Inserter
Posts: 44
Joined: Sat Aug 31, 2019 4:03 am
Contact:

Re: Threshold and Stack Threshold

Post by redis »

LTN is a great system, but here is a seemingly normal use case scenario where it is terrible and could possibly be addressed in future. The problem is with shared requesters.

Setup: Multiple providers of different items (providers setup don't matter). Lets use iron plates and speed module as an example. We have one shared requester station requesting those items. Here is the problem:

These items have drastically different volumes and it seems impossible to request appropriate volumes for them into 1 station. For example, you may want to send(request) 1 wagon train for speed modules and 5 wagon for iron. Because the station threshold setting is the same for both of these items you end up either having to low orders for iron with almost empty trains. Or you end up keeping huge volume of speed modules and it may dispatch several one wagon trains once the level drops below threshold. I have tried all possible combinator contraptions to bypass this problem, but it is not possible if the threshold is fixed and the same for all item types.

The addition of STACK threshold addressed exactly this problem, but only for stack variability (there is also train length variability). This could be solved by giving the threshold in PERCENTAGE terms of the amount set for each item on the constant combinator. If you set -16k for iron and -2k for modules and set your threshold at 50% then it would request at -8k and -1k thresholds respectively giving you exactly behavior you want.

Edit: I understand though that you are not reading the constant combinator item numbers and this change could require it and might be complication to implement.

Edit: Another idea, which would approach to solving different length trains problem in LTN is to allow a MODE where it composes a schedule instead of of items requested exact difference it could just do "full cargo inventory"! This would allow to have the shared threshold low, but trains would not dispatch half empty for large volume items.

Thanks.
bobdabuilda
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Sep 16, 2020 12:05 pm
Contact:

Re: Threshold and Stack Threshold

Post by bobdabuilda »

Hi guys - was going to post up a question of my own on thresholds, but noticed Optera has been compiling things in here to keep it tidy... so will add my question in here, as I'm all kinds of confused ;)

My issue is with stack thresholds, and how they are working in my (rather basic at this stage) scenario.

NOTE - I am using, among other things, the "Bulk Rail Loader" mod. I have the loaders connected to each other, and the LTN Combinator and then the LTN lamp, via green wires, so it can read the contents of the loaders.

I have a provider station for copper ore. Currently sitting with 63k ore.
I have a requestor station, requesting -8000 copper ore.

The requestor is set up with settings:
Same LTN network as all my other stations
"Request Stack Threshold" of 160
Output: -8000

The issue I am seeing, is that LTN will ONLY set up a new request for ore if/when the Bulk Loaders are completely empty. These things can hold a LOT of ore (320 stacks each - and I have 4 per station to suit my 4-carriage trains. That's 1280 stacks total available to unload to), and are also offloading into chests with quite a buffer size also in total. I'd like for the trains to keep coming while the Bulk Loaders can still take a full train load.

I played around with the Stack Threshold setting - setting it higher than 160 resulted in no deliveries scheduled (I only have 4-carriage trains), and setting it lower resulted in smaller deliveries scheduled.

Once again, I've watched the video turorials from Nilaus, tuplex and Diablo... read the manual, etc. but there's not really much referenced in any of them with regard to the Stack Thresholds, it's primarily all based around item thresholds instead. However, I am obviously missing something quite basic, but can't for the life of my put my finger on it... suggestions, please, on how to get the trains to keep coming til the Loaders are almost full??

With any luck, this will be the last piece in the puzzle for me to really get my head around this thing and how it works - because it really IS a very useful mod (have used it in a couple of previous maps, and obviously got a tad lucky with how I had it set up - even if I had the occasional issue with mixed loads, etc. that got me learning about combinators more... there's always something new! ;) )
User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1622
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Threshold and Stack Threshold

Post by jodokus31 »

The stack threshold of 160 just translates to 160*50 => 8000 copper ore
If you set your requester to request with -8000, then the train is scheduled, as soon the request station is empty -> 8000 - 8000 = 0
Try increasing your request amount to like -16000, then a train get scheduled, as soon as only 8000 copper ore is left to fill up to 16000 again.
bobdabuilda
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Sep 16, 2020 12:05 pm
Contact:

Re: Threshold and Stack Threshold

Post by bobdabuilda »

jodokus31 wrote: Tue Oct 06, 2020 12:16 pm The stack threshold of 160 just translates to 160*50 => 8000 copper ore
If you set your requester to request with -8000, then the train is scheduled, as soon the request station is empty -> 8000 - 8000 = 0
Try increasing your request amount to like -16000, then a train get scheduled, as soon as only 8000 copper ore is left to fill up to 16000 again.
Ahhh, I see! Thanks for the info - heading to bed now, but will have a play with this tomorrow when I get a chance and see how it goes. I obviously misunderstood the way the two settings interacted... will let you know how I get one.

Thanks again :)

EDIT: Couldn't help myself. Fired it back up and did a quick test, and it appears to be working as you said. Excellent :) So - essentially, the request amount for a "standard" operation, should be set either at, or just below (for a little head-room) what the requestor point can hold/handle, and the stack threshold set to how many stacks less than the requested amount are in the requestor point.

Ok, think I finally have a handle on this lol. Thanks again! Might get to sleep a bit sooner now lol.
User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1622
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Threshold and Stack Threshold

Post by jodokus31 »

bobdabuilda wrote: Tue Oct 06, 2020 12:35 pm EDIT: Couldn't help myself. Fired it back up and did a quick test, and it appears to be working as you said. Excellent :) So - essentially, the request amount for a "standard" operation, should be set either at, or just below (for a little head-room) what the requestor point can hold/handle, and the stack threshold set to how many stacks less than the requested amount are in the requestor point.
I would formulate it like that:
the "threshold" (stack or normal doesn't matter) is the amount you want to transport with one train load. (if its bigger than a train load, LTN will issue multiple trains)
The "request amount" is the amount, you want to have max. in the request station.
"request amount" minus "threshold" is what you want min. in the request station before the next train is scheduled.

Since your factory should work, while the train is on its way, you should always request a good amount more than the threshold to have a buffer to work with. This depends on you train network and how long the delivery takes
MisterFister
Fast Inserter
Fast Inserter
Posts: 104
Joined: Tue Jun 27, 2017 1:12 am
Contact:

Re: Threshold and Stack Threshold

Post by MisterFister »

This seems to be the consolidated thread for my issue so I'll post here. If this is instead an unwelcome necro, I'll repost [EDIT: typo "report"] as a new thread.
I am tinkering with a save (I think the map was initially started back in v0.17 if this is relevant, as that ended up being silently relevant to another mod) where I am attempting to completely eliminate any mixed-freight trains.
  • Relevant context:
  • All trains L-CCCC or L-TTTT
  • Global dispatcher-threshold intentionally set to 10^10, to ensure no mixed-load and no partial-load trains -- all trains are full-unmixed
  • Angel's Warehouse mods (6x6 footprint chests at stations)
  • Miniloaders (filtering-miniloader variants available for higher tech-cost and crafting-cost) -- converting map builds to this mod away from Loader Redux
  • Loader Redux (no non-filtering variants, but removing mod entirely will break certain map locations that haven't been converted to Miniloader)
  • Small-ish city-block format (all train stations using large Warehouses instead of chests is part of the design challenge I've set for myself)
  • At some requester-locations, the city-block size dictates that a single trainstop can be used to receive two different types of freight [EDIT: to clarify the following] using miniloader-filters when offloading the train wagons
As an example, one requester station receives full trainloads of copper plate (160 stacks, individual stack=100) and a full trainload of raw sulfur (160 stacks, individual stack=50) is where I simply specify that station's combinator r-threshold of being 160 stacks, so that the same requester trainstop can receive both full-trainload types.

Can anyone alert me to possible instances where this might lead to other problems? Is my solution of resorting to stack-count thresholds the same way others would address this type of fringe-case?

EDIT: formatting, minor typos
Last edited by MisterFister on Tue Sep 07, 2021 10:29 pm, edited 7 times in total.
nuhll
Filter Inserter
Filter Inserter
Posts: 946
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Threshold and Stack Threshold

Post by nuhll »

I dont get it.

I have a "universal" provider (from your thread), ive set min items to 10.

I have created a normal requester station with min item 200 and min stack 20.

LTN creates 10 fuel cell deliverys?

Doesnt ltn prio requester over provider?

edit:
i think i found the workaround Oo you have to REMOVE the limits on the provider (???) then ltn uses the limits from the reuqester (???)

atleast its working -.-

edit: no, if you dont have min item set for provider it wont provide anything, this is so frustrating, i dont get it.
torne
Filter Inserter
Filter Inserter
Posts: 342
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: Threshold and Stack Threshold

Post by torne »

nuhll wrote: Fri May 14, 2021 8:18 pm I have a "universal" provider (from your thread), ive set min items to 10.
This means that LTN will not send a train to this provider unless the provider has at least 10 items available pick up.
I have created a normal requester station with min item 200 and min stack 20.
This means that LTN will not send a train to this requester unless the requester wants at least 20 stacks. (stacks takes priority over items if both are set)
LTN creates 10 fuel cell deliverys?
Yes - the thresholds do *not* directly control the size of the delivery, only whether a delivery is created at all. So, if there are currently exactly 10 fuel cells at the provider, then the provider is active and a delivery can be created, which will only have 10 fuel cells in it because that's all that's available. If there were 15 fuel cells available it would make a delivery for 15, and so on up to the amount the requester is asking for or the capacity of the train, whichever is smaller.

If you want it to only make deliveries of at least 20 stacks you need to set *both* stations to a threshold of 20 stacks. That way, it won't create a delivery at all until there's at least 20 stacks available at the provider, and at least 20 stacks needed at the requester.
nuhll
Filter Inserter
Filter Inserter
Posts: 946
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Threshold and Stack Threshold

Post by nuhll »

This is just stupid. "how we could make the system as complex as possible"

I guess you also cant have specific limits for specific items.

Can i atleast blacklist some items? Or whitelist.

I really want a "universal" provider starting at 1 stack.

I cant understandw hy its not like it respects the provider AND requester.

So if provider WOULD provide at 1 stack and requester WOULD request 10 stack it would only send when there are 10 stacks avaible, this just sounds logic. So you could have one station request 1 stack, one station request 5 stacks, one station request 20 stacks... which could be all fullfilled by ONE provider...?

This is not ment to be mean or anything, i really respect the work the mod author did. Its just really frustrating.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Threshold and Stack Threshold

Post by Optera »

nuhll wrote: Sat May 15, 2021 8:31 pm So if provider WOULD provide at 1 stack and requester WOULD request 10 stack it would only send when there are 10 stacks avaible, this just sounds logic. So you could have one station request 1 stack, one station request 5 stacks, one station request 20 stacks... which could be all fullfilled by ONE provider...?

This is not ment to be mean or anything, i really respect the work the mod author did. Its just really frustrating.
No idea where that weird confusion comes from 4 years down the road.

Thresholds are simply when LTN sees cargo at stations.
It uses the provider with most of X to satisfy requests first.

In your example it will send 1 stack to the 10 stack requester.

When there's multiple stations it's first come first served.
Once a delivery is created the requester is removed from the open request list. If the delivery is not enough and it's still below request threshold it will be added again to the bottom of the queue.


Delivery size = difference between requested amount and request threshold.
Provided amounts can only reduce delivery sizes when there is not enough supply.
Train capacity also can reduce delivery size when there's no large enough train available.
boran_blok
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Fri Mar 01, 2019 7:56 am
Contact:

Re: Threshold and Stack Threshold

Post by boran_blok »

To jump in on this a bit. I think a truly universal reaquester station would have to be done with circuits, and is a nice game problem to solve.

In essence you want to only put things on the requester when they are over their specific threshold. I experimented a bit already with these, but I ended up with concurrency issues, if I needed 200 sapphires and my iron dropped under the 10k I started getting 200 iron deliveries as well. The solution would be to queue requests and not let iron get through at all until it has reached the minimum delivery size you want.

In short, I do not think it it something up to LTN to try and fix, but can be made within the game.
torne
Filter Inserter
Filter Inserter
Posts: 342
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: Threshold and Stack Threshold

Post by torne »

nuhll wrote: Sat May 15, 2021 8:31 pm I guess you also cant have specific limits for specific items.

Can i atleast blacklist some items? Or whitelist.
You can't have per-item limits in LTN itself; you can do things with combinators as boran_blok suggests but depending how you implement it it may or may not have undesirable edge cases.

You can easily filter out specific items by just also connecting up a constant combinator with those items set to -100000000 or some similar large number - if you set the requester limit to an even bigger number to make sure the station doesn't become a requester that's enough, otherwise you need a decider to filter out the negative signals. Whitelisting can be done similarly: have a constant combinator that *adds* a large amount for the items you want, then filter out all the items below that amount, then subtract that amount from everything again.
I really want a "universal" provider starting at 1 stack.
That depends what you mean by "universal". If you just set the provider threshold to 1 stack then that.. is a universal provider starting at one stack. Deliveries will be as big as possible given the amount requested, the amount available, and the size of available trains. If your "universal" provider is the only source of a given item, and that item is being produced slower than it's being consumed, then yes, this will result in more frequent small deliveries. If there were other sources of the item that had more available, it would make the deliveries from those first instead. If you were producing more than you were consuming, then it would "catch up" and eventually always have enough in stock to make full size deliveries. This generally hasn't been a problem for me, but that's how it behaves.
I cant understandw hy its not like it respects the provider AND requester.
That might result in deliveries never happening at all. Nothing says that the requesters and providers have to have similarly sized buffers; it's totally valid to have the requester threshold be bigger than the maximum amount that any provider will ever be able to provide, or bigger than a single trainload, or similar. LTN assumes that if the requester threshold has been reached then the station *needs* more items, and would rather have some than none.
So if provider WOULD provide at 1 stack and requester WOULD request 10 stack it would only send when there are 10 stacks avaible, this just sounds logic. So you could have one station request 1 stack, one station request 5 stacks, one station request 20 stacks... which could be all fullfilled by ONE provider...?
You can have that now. You can just set the provider to 1 stack and make sure it has room for at least 20 stacks in its buffers. If you're producing more than you're consuming then it will, once buffers are sufficiently full, make deliveries of 1/5/20 stacks respectively to those requesters; smaller deliveries will only be a temporary situation while it's getting up to speed. If you're not producing more than you're consuming then the behaviour you're describing would result in the 20 stack requester potentially never being serviced at all, because the entire producer's buffer would be at risk of being sent out to the 1 or 5 stack requester as soon as there was enough, and there may *never* be enough to deliver 20 stacks at once.

You can, also, just set the provider to 20 stacks as the threshold anyway. That will still happily create 1 stack deliveries to the 1 stack requester, or 5 stack deliveries to the 5 stack requester - it will just not make *any* deliveries until there's 20 stacks available in total. Again, if you're producing more than you're consuming then this is fine; it just won't make any deliveries until the buffers initially fill up enough. If you're producing less than you're consuming then this will result in less frequent deliveries to the requesters that are asking for smaller amounts, but it will probably be *better* for the requester that wants 20 stacks, as at least it will get a chance to get a delivery.


So yes, it may not work the way you assumed, and it may not be directly possible to get the specific behaviour you are imagining. The mod is designed for a particular model of how deliveries should work; stations can be configured in many different ways with enough circuit logic, but the actual delivery generator has a fixed set of logic with a fixed set of parameters. If you have a specific goal in mind that you can't see how to achieve with LTN then maybe discussing the actual goal more might make it possible for someone to suggest something, but if you just want to get it to work then you might just be overthinking the details; as long as your stations are hooked up properly then the exact parameters you choose for thresholds/etc don't make a huge difference overall until you reach the point where you have so many trains on your network that you're running into traffic problems, and if your base is that big then you can probably just afford to set all the thresholds high and buffer more things :)
nuhll
Filter Inserter
Filter Inserter
Posts: 946
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Threshold and Stack Threshold

Post by nuhll »

Optera wrote: Sun May 16, 2021 8:11 pm
nuhll wrote: Sat May 15, 2021 8:31 pm So if provider WOULD provide at 1 stack and requester WOULD request 10 stack it would only send when there are 10 stacks avaible, this just sounds logic. So you could have one station request 1 stack, one station request 5 stacks, one station request 20 stacks... which could be all fullfilled by ONE provider...?

This is not ment to be mean or anything, i really respect the work the mod author did. Its just really frustrating.
In your example it will send 1 stack to the 10 stack requester.
i just dont get why you cant say:

station 1
provide at 1 item

station 2
request min 200 items

station 3
request min 400 items

station 4
request min 1 item


Station 2 wants 100 items, cant request because it will only request when it needs atleast 200. (so the lowest transported volume would be 200 items, but could be more)


Where item can be replaced with stack.
Wouldnt that be usefull and more logic? Is that more CPU intensive or something?

Why?

It would make it possible to have ONE station to supply all the low demand stuff, every reuqester could have his own "min limit" and therefore it wouldnt request small quantities (ammo outpost lets say min 200, fuell cells min 20, building stations min 1)


Also, cant it be possible to have LTN display the generated trains (which include the [ITEM= tag to have JUST display the IMAGE instead of the TEXT AND the image, like factorio itself does it?)
Post Reply

Return to “Logistic Train Network”