How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Bobbymoe
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Oct 31, 2024 6:08 pm
Contact:

How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by Bobbymoe »

Hello,

I'm trying to make an outpost resupply train for my defensive walls. I already figured out how to make sure the train doesn't show up unless it's needed, but I can't figure out how to stop the inserter from putting the supplies in the buffer chest when it is no longer requesting it. Any help would be appreciated!

Here's a sc of my current setup
Screenshot_1.png
Screenshot_1.png (1.05 MiB) Viewed 607 times
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by IsaacOscar »

You use a green/red wire, just connect it from the chest to the inserter and set the enable condition to be item-typ <= desired-ammount - inserter-stack-size
Bobbymoe
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Oct 31, 2024 6:08 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by Bobbymoe »

IsaacOscar wrote: Tue Nov 26, 2024 1:56 am You use a green/red wire, just connect it from the chest to the inserter and set the enable condition to be item-typ <= desired-ammount - inserter-stack-size
I have multiple items in the chest so I don't think I can set a desired amount for all of them with just one inserter/chest
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by IsaacOscar »

Bobbymoe wrote: Tue Nov 26, 2024 11:51 pm
IsaacOscar wrote: Tue Nov 26, 2024 1:56 am You use a green/red wire, just connect it from the chest to the inserter and set the enable condition to be item-typ <= desired-ammount - inserter-stack-size
I have multiple items in the chest so I don't think I can set a desired amount for all of them with just one inserter/chest
Oh you need the inserter to filter based on what items are full, ok then:
  • put a constant combinator with the desired amounts of each resource
  • connect the constant combinator to an arithmetic combinator with "each - <inserter-stack-size>" set to output "each".
  • use a decider combinator with condition "each (g) <= each (r)" and output "each = 1".
  • connect a red wire from the arithmetic output to the decider combinator
  • connect a green wire from the buffer chest to the decider
  • connect the decider output to the inserter
  • check the "set filter" box on the inserter.
It would be great if you could "read requests" separately from "read contents" on a buffer chest, than the constant combinator wouldn't be needed.
Bobbymoe
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Oct 31, 2024 6:08 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by Bobbymoe »

IsaacOscar wrote: Tue Nov 26, 2024 11:59 pm
Bobbymoe wrote: Tue Nov 26, 2024 11:51 pm
IsaacOscar wrote: Tue Nov 26, 2024 1:56 am You use a green/red wire, just connect it from the chest to the inserter and set the enable condition to be item-typ <= desired-ammount - inserter-stack-size
I have multiple items in the chest so I don't think I can set a desired amount for all of them with just one inserter/chest
Oh you need the inserter to filter based on what items are full, ok then:
  • put a constant combinator with the desired amounts of each resource
  • connect the constant combinator to an arithmetic combinator with "each - <inserter-stack-size>" set to output "each".
  • use a decider combinator with condition "each (g) <= each (r)" and output "each = 1".
  • connect a red wire from the arithmetic output to the decider combinator
  • connect a green wire from the buffer chest to the decider
  • connect the decider output to the inserter
  • check the "set filter" box on the inserter.
It would be great if you could "read requests" separately from "read contents" on a buffer chest, than the constant combinator wouldn't be needed.


Man I see this as soon after I figure it out, after some thinking and banging my head on the desk I actually got to a slightly simpler solution. It uses a constant combinator and an arithmetic combinator, but no decider combinator. I have the constant outputting the desired amount for each item, then the arithmetic subtracts the *each* option from chest and constant (so *each* chest - *each* constant), giving me a positive number of each item I do not have in the chest. The output of the arithmetic is given to the inserter which only has "set filter" checked. As soon as the item amount is satisfied the inserter no longer has it in the filter slot. Once every item is satisfied the inserter has nothing on the white list so it will no longer grab it.

Here's the blueprint for anyone who might also be trying to figure this out.

User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by IsaacOscar »

Bobbymoe wrote: Wed Nov 27, 2024 1:01 am Man I see this as soon after I figure it out, after some thinking and banging my head on the desk I actually got to a slightly simpler solution. It uses a constant combinator and an arithmetic combinator, but no decider combinator. I have the constant outputting the desired amount for each item, then the arithmetic subtracts the *each* option from chest and constant (so *each* chest - *each* constant), giving me a positive number of each item I do not have in the chest. The output of the arithmetic is given to the inserter which only has "set filter" checked. As soon as the item amount is satisfied the inserter no longer has it in the filter slot. Once every item is satisfied the inserter has nothing on the white list so it will no longer grab it.
Nice! I didn't know the set filter ignored negative inputs.
Tertius
Smart Inserter
Smart Inserter
Posts: 1083
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How do I stop inserters from putting items in a buffer chest when it's no longer requesting them?

Post by Tertius »

Unloading a set of mixed items is much more a challenge than loading. You need to check for many things at the same time:
- use a constant combinator to define a set of items
- unload up to the point where there are as many items available locally as defined in the cc
- don't try to unload what's not in the train
- use inserter stack size to not unload 12 items when you just want to unload 1

The general idea is this:
- determine what you want locally. Define things to unload with 1 constant combinator per wagon [A]
- determine what you have locally. You can wire all chests and read their content or you can use passive provider chests(*) and read a roboport to cover the whole area [B)
- determine what you have in the train. Read train from the train station. [C)
- determine what you need to unload. Compute [D] := [A]-[B)
- determine what you CAN actually unload (the train might not carry enough of what you need to unload!). Compute the minimum of [C) and [D]. [E] := MIN([D], [C))
- if you always use the EACH operator, you have now in [E] all items you can feed one at a time to one inserter to unload from the train. Use 1 inserter per wagon.
- to feed one item at the time, use the ANY operator to pick some item. Use another combinator to determine the amount into variable [S), so you can feed the item as filter and [S) as stack size to the inserter

(*) why no other logistics chest: no storage chest, because robots will put items in there, filling all stacks with no space to unload from the train. No buffer chest, because you will not request items (instead, inserters put items into it). No active provider chest, because it's useless. No requester chest, because these don't offer their content to the logistic network.

All that subtracting (computing the minimum also involves subtracting), use EACH * -1 in an arithmetic combinator, then use the negated values where appropriate.

I implemented this, see:
viewtopic.php?p=636620#p636620
However, it does a bit more than that, because I added waste disposal, opening/closing the station according to demand and a hysteresis to not call a train unless there are more than half of the required items are missing - don't call a train just for a single repair kit that got used up. Additionally, it feeds logistic robots into the roboport for bootstrap and maintaining their amount in case of loss, so you don't need to do this manually.
Post Reply

Return to “Gameplay Help”