Feature Request: Relative Request Threshold Signal

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

lois lane balancer
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Oct 04, 2020 3:48 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by lois lane balancer »

redis wrote:
Sun Oct 04, 2020 7:02 pm
LTN ALWAYS REQUESTS the THRESHOLD AMOUNT (+ extra a few items drop during time to get to issue an order).
Incorrect. What happens if the item signal suddenly and massively changes? For example, if we've got a Request Threshold of 1000 and the item signal at the lamp goes from 2000 to -48000? Does it ship just 1k? Or does it ship 48k?
Consider the behavior you see when you first set up a requester station. Does it ship many trains each carrying just the threshold amount? Why or why not? How can we exploit this behavior?
redis wrote:
Sun Oct 04, 2020 7:02 pm
Results of this:
1. if you have threshold 0 it means it will immediately issue request if it drops to <0 with train(s) arriving with couple of stacks only and keep doing so every damn few seconds. You will get near empty trains with 0 threshold!
2. Opposite if you have large threshold of 50000. It means small items signal need to wait to drop to -50000 too to get order issued. You may not want to stack up on that many and if you use small trains for small items it will send 5 trains right away to fullfil such large order.
1. Incorrect. You will not get trains, since the station is not requesting anything while item signals are positive. Read the question before answering next time.
2. You're so far off base I can't even call this an answer. The threshold is 0, why are you talking about large thresholds? Read the question before answering next time.
I'm not asking these questions as part of an argument, I'm asking these questions as a teaching method. If you're not answering them, you're not progressing towards an understanding of the solution. And frankly, I have a working solution, you don't, and I don't care if you get the solution to your problem or not. If you don't want this working solution, I'm not going to keep trying to force you to learn and this will be my last post in the thread.
redis wrote:
Sun Oct 04, 2020 7:02 pm
Sending Full trains actually would allow to set the small threshold (aka 0) and the train would not arrive with only a couple of stacks, but FULL and the next order would be issued after all the items are used up. If you can show circuitry which works with 0 threshold as is and sends full trains you are welcome rock star.
Good news then, it's in my first post in the thread!

redis
Inserter
Inserter
Posts: 44
Joined: Sat Aug 31, 2019 4:03 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by redis »

lois lane balancer wrote:
Sun Oct 04, 2020 7:29 pm
redis wrote:
Sun Oct 04, 2020 7:02 pm
LTN ALWAYS REQUESTS the THRESHOLD AMOUNT (+ extra a few items drop during time to get to issue an order).
Incorrect. What happens if the item signal suddenly and massively changes? For example, if we've got a Request Threshold of 1000 and the item signal at the lamp goes from 2000 to -48000? Does it ship just 1k? Or does it ship 48k?
Consider the behavior you see when you first set up a requester station. Does it ship many trains each carrying just the threshold amount? Why or why not? How can we exploit this behavior?
Yes, this is correct in this scenario too if you learn to read carefully. See my note "+ extra a few items drop during time to get to issue an order". If you have sudden drop then it goes in 2 steps. First It reached threshold and then immediately you removed those "extra few" 46k items. So the total order will be 48k. In this case it will work with 0 threshold or course and get you a big order, but normal use case is you have gradual decrease in number of items and first you hit the threshold and you get a dispatch of an empty train because your threshold to call a train is 0 or nearby. Clear?

P.S. Too bad I have to respond to a troll to have a discussion, but hopefully this issue can get some attention.

User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1603
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by jodokus31 »

Actually, the solution of @lois could work. Only send the request amount (as negative value) to the station, if the threshold of the individual item is reached.

I had the same problem, when i was requesting barrels with low amount and plates, etc. with high amounts
My solution was to use 2 different stations to have different thresholds

redis
Inserter
Inserter
Posts: 44
Joined: Sat Aug 31, 2019 4:03 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by redis »

jodokus31 wrote:
Mon Oct 05, 2020 11:48 am
Actually, the solution of @lois could work. Only send the request amount (as negative value) to the station, if the threshold of the individual item is reached.

I had the same problem, when i was requesting barrels with low amount and plates, etc. with high amounts
My solution was to use 2 different stations to have different thresholds
Ok, I agree it is possible to generate fixed negative numbers at threshold on decider combinator for each item or you can also normalize numbers relative to the threshold. Requires at least a pair of combinators for each signal. However, this is way too bulky solution at each station. You should not have to do this for such normal use case. Actually too bad there is such a crappy solution out there, which means there is no chance Optera will address this problem.

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

Re: Feature Request: Relative Request Threshold Signal

Post by Optera »

This thread went from relative percentages to always use full trains. Set Stack Thresholds match a full train and LTN will use full loads.

Ickis
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Nov 19, 2018 12:31 pm
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by Ickis »

lois lane balancer wrote:
Sun Oct 04, 2020 4:00 am
For each item you want to request, have a Decider subcircuit with logic [ITEM]<= [THRESHOLD] -> [ITEM @ REQUEST QUANTITY]. Have the input for this be on the chest side of the diode and the output going to the lamp. [ITEM @ REQUEST QUANTITY] is of course whatever you would have put in your Constant Combinator, such as -5000 IRON to request 5k Iron Plates.
Would you mind expanding on this? Struggling to understand the part about the decider. The comparing is obvious enough, but how are you outputting the "ITEMS @ REQUEST QUANTITY"? The decider only outputs 1 or "Input Count". Perhaps even a simple blueprint if you wouldn't mind?

Thanks!

lois lane balancer
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sun Oct 04, 2020 3:48 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by lois lane balancer »

Ickis wrote:
Sun Oct 11, 2020 7:32 pm
lois lane balancer wrote:
Sun Oct 04, 2020 4:00 am
For each item you want to request, have a Decider subcircuit with logic [ITEM]<= [THRESHOLD] -> [ITEM @ REQUEST QUANTITY]. Have the input for this be on the chest side of the diode and the output going to the lamp. [ITEM @ REQUEST QUANTITY] is of course whatever you would have put in your Constant Combinator, such as -5000 IRON to request 5k Iron Plates.
Would you mind expanding on this? Struggling to understand the part about the decider. The comparing is obvious enough, but how are you outputting the "ITEMS @ REQUEST QUANTITY"? The decider only outputs 1 or "Input Count". Perhaps even a simple blueprint if you wouldn't mind?

Thanks!
The subcircuit consists of a Decider Combinator and an Arithmetic Combinator. Set the Decider Combinator to output 1 of [ITEM], then feed that output directly into the Arithmetic Combinator set to [EVERYTHING] * [REQUEST QUANTITY] -> [EVERYTHING]. The end result will be an output of either [0] or [ITEM @ REQUEST QUANTITY] and have two ticks of latency.
You'll need one of these subcircuits for each item in the request set. You can have multiple Decider Combinators sharing an Arithmetic Combinator if they have the same request quantity, but that's not necessary.
Example showing a subcircuit that requests 1k Rocket Fuel if supply at station falls below 500.  <br />Red box contains a full subcircuit, green lines connect UI elements to combinators.
Example showing a subcircuit that requests 1k Rocket Fuel if supply at station falls below 500.
Red box contains a full subcircuit, green lines connect UI elements to combinators.
temp.gif (407.69 KiB) Viewed 3477 times

Ickis
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Nov 19, 2018 12:31 pm
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by Ickis »

Thank you very much. :)

Mr_Moal
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Dec 24, 2020 3:52 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by Mr_Moal »

A solution I kludged together after giving up reading the flame war on the first page (THANKS to ALL contributors of LTN. The train aspect of this game and killing biters is what does it for me, and LTN is AWSOME!!!)



I have a station that accepts stacked items and liquids. Start with your stacked items. and set up your output combinator as if you only care about them.

Say:
Coal: -15,000
Request threshold: 8,000
Petroleum Gas: -60,000

Problem now is Petroleum Gas will be constantly requesting more.

Use decider combinator. if Coal is "Greater than" 7,000, output all.
The Input is an output combinator with: Request threshold 32,000.
To get the amount of coal in network into the decider (without contaminating the network with the Request threshold 32,000), just run the signal thru a arithmetic combinator * x1 = *

When coal is low, your request threshold suddenly is 8,000, and you get coal (and Petroleum gas too some times).
otherwise, you only order in petroleum gas in batches of 40,000 because as soon as you have more than 7,000 coal, your request threshold is 40,000.


-----------------
Then I got to the second page of the forum, and saw the above solution, I think I'm giving that a try next. looks like a slicker method. But maybe someone could expand on my idea and make it work better (only tested on station with Max 1 train setting)?

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

Re: Feature Request: Relative Request Threshold Signal

Post by Optera »

LTN has a feature called stack threshold it will use instead of normal thresholds.
In your example set:
coal: -15k
stack request threshold: -160
petroleum: -60k
request threshold: -32k

LTN will then trigger on 160 stacks of coal missing and on 32k of pet missing.

Mr_Moal
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Dec 24, 2020 3:52 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by Mr_Moal »

So after reading your post :shock: , I only got to say doh :roll: . Darn that's simple.


But, for sake of argument (and for all the hours spent finding this solution :D ), if you wanted to get a station with fluid, and 2 different types of items, with all 3 things being of different ordering quantities.


1) timer
I used a simple timer using decider combinators so it would count to 3, then reset,
I assigned 3 decider combinators to 3 signal colors (white, grey, black). when count = 1, white = 1 and the rest = 0. and so on.

2) decider combinator gate
behind each decider combinator, is a constant combinator that outputs the item and re-order quantity you want.
Copper: -15k, threshold: 8k (100 per stack)
Petroleum Gas: -60k, Threshold: 30k
Blue circuits: 1,200, threshold 600 (200 per stack) (In this situation, the stack size vs required amount is completely backwards)

each of these is presented to the LTN station for 3-4 seconds at a time, then its the next item's turn.

3) unloading
When the train arrives, all 3 signals are presented to the LTN station to ensure appropriate filtered unloading. I've been testing this several cycles now (using void chests to simulate load), and so far LTN has not complained. It does not appear to cause any serious problems with LTN, but I've only got maybe 90 LTN stations and 40 trains, so this is not tested at Mega Base scale yet or take UPS (or whatever) into account.
Requestor Balanced 2 plus fluid 01.png
Requestor Balanced 2 plus fluid 01.png (2.05 MiB) Viewed 3194 times
BP to test (hopefully posting a BP here is not taboo, and didn't want to post it inline as it was way too big, it makes things easier to explain if someone tries it out)
Attachments
Requestor Balanced 2 plus fluid 01.txt
BP text
(6.13 KiB) Downloaded 75 times

redis
Inserter
Inserter
Posts: 44
Joined: Sat Aug 31, 2019 4:03 am
Contact:

Re: Feature Request: Relative Request Threshold Signal

Post by redis »

Mr_Moal wrote:
Sun Jan 17, 2021 5:24 am
So after reading your post :shock: , I only got to say doh :roll: . Darn that's simple.


But, for sake of argument (and for all the hours spent finding this solution :D ), if you wanted to get a station with fluid, and 2 different types of items, with all 3 things being of different ordering quantities.


1) timer
I used a simple timer using decider combinators so it would count to 3, then reset,
I assigned 3 decider combinators to 3 signal colors (white, grey, black). when count = 1, white = 1 and the rest = 0. and so on.

2) decider combinator gate
behind each decider combinator, is a constant combinator that outputs the item and re-order quantity you want.
Copper: -15k, threshold: 8k (100 per stack)
Petroleum Gas: -60k, Threshold: 30k
Blue circuits: 1,200, threshold 600 (200 per stack) (In this situation, the stack size vs required amount is completely backwards)

each of these is presented to the LTN station for 3-4 seconds at a time, then its the next item's turn.

3) unloading
When the train arrives, all 3 signals are presented to the LTN station to ensure appropriate filtered unloading. I've been testing this several cycles now (using void chests to simulate load), and so far LTN has not complained. It does not appear to cause any serious problems with LTN, but I've only got maybe 90 LTN stations and 40 trains, so this is not tested at Mega Base scale yet or take UPS (or whatever) into account.

Requestor Balanced 2 plus fluid 01.png

BP to test (hopefully posting a BP here is not taboo, and didn't want to post it inline as it was way too big, it makes things easier to explain if someone tries it out)
The problem is that your solution is not simple at all. Simple is when you have at most 1-2 combinators and it looks clean. If you have 100 stations this is ugly mess for a trivial problem. LTN is not fit for the task here. I solved my problem by writing my own dispatcher mod in lua, which works similarly to TSM, but automatically matches suppliers with requestors. Also since 1.1 everything can be done with the train limit logic.

Post Reply

Return to “Logistic Train Network”