The right amount
-
- Manual Inserter
- Posts: 2
- Joined: Sun Mar 26, 2023 9:28 am
- Contact:
The right amount
Hello fellow builders !!
I'm quite new to the use of logic and wire systems.
I am trying to find a way to setup a system that knows how many stuff is on my belt.
i would like it to add X by default so the belt always hold X. And when a factory or any system consumes 1 it sends a signal to add one to the belt.
So the belt always contains a set value of X and is only fed if needed.
thank you for your science !!
I'm quite new to the use of logic and wire systems.
I am trying to find a way to setup a system that knows how many stuff is on my belt.
i would like it to add X by default so the belt always hold X. And when a factory or any system consumes 1 it sends a signal to add one to the belt.
So the belt always contains a set value of X and is only fed if needed.
thank you for your science !!
Re: The right amount
The easiest way would be to add a sensor on each and every belt you want to read the contents of. When building with bots from blueprints, red and green wires are free, so there is not even that much of additional cost. Just set every belt tile in "read contents", and you're done.
Koub - Please consider English is not my native language.
Re: The right amount
Reading every belt as Koub described is the simplest way, and is accurate and robust.chronosavenger wrote: ↑Sun Mar 26, 2023 9:42 amI am trying to find a way to setup a system that knows how many stuff is on my belt.
i would like it to add X by default so the belt always hold X. And when a factory or any system consumes 1 it sends a signal to add one to the belt.
A couple of alternatives are described in the Circuit network cookbook in the Wiki under Sushi Belts - this is a typical use case but the idea works just as well for a single item type. The first shows that you don't necessarily need to read every belt: if it is sufficient to make sure there are "some" of a given item on the belt, you can read a sample.
The Memory Cell Design gives an exact count, like reading every belt, and in my opinion looks a lot neater. There is a downside though, which is that the count can become incorrect in various ways: if you manually add or remove items, if you miss a circuit connection (this typically results in the belt filling or emptying over time), or if you have a severe power shortage. An incorrect count is a pain to fix.
One general point, regardless of approach: it's generally best to design the system so the belt has at least X rather than exactly X of the item. All this means is that the enable condition should be "item < X" rather than "item != X".
Re: The right amount
You can use a counter to remember the amount of items put on the belt. Increase the counter if an item is put on the belt, and decrease the counter if an item is taken from the belt.
In this example, the left inserter is set to read hand (pulse). This is what we use to increase the counter (combinator on the left). The right inserter is also set to read hand (pulse). Its value is multiplied by -1 by the combinator on the right, then also added to the counter, and since it's a negative number, the counter decreases.
The left inserter has an activation condition of item < 10, so it activates if the counter reports less than 10 items.
Activate the constant combinator to create the R signal to reset the counter.
I guess this is a direct answer to your question, however if you start to use this approach, you will see it has some annoying flaws.
In this example, the left inserter is set to read hand (pulse). This is what we use to increase the counter (combinator on the left). The right inserter is also set to read hand (pulse). Its value is multiplied by -1 by the combinator on the right, then also added to the counter, and since it's a negative number, the counter decreases.
The left inserter has an activation condition of item < 10, so it activates if the counter reports less than 10 items.
Activate the constant combinator to create the R signal to reset the counter.
I guess this is a direct answer to your question, however if you start to use this approach, you will see it has some annoying flaws.
Re: The right amount
The reason why I like the "sensor on every belt" solution is that it's totally impervious to power shortatges issues : as soon as the power comes back, it never loses track of where it was.
Combinator based solutions with integrated memory usually loose their memory when they lose power (which can easily be mitigated by a dedicated power circuit, but that's additional hassle to cope with.
Combinator based solutions with integrated memory usually loose their memory when they lose power (which can easily be mitigated by a dedicated power circuit, but that's additional hassle to cope with.
Koub - Please consider English is not my native language.
Re: The right amount
That's one of the annoyances I hinted at. It's actually not counting what's on the belt, it's counting what is put on and taken off the belt. However, I feel this general counting functionality should be present in the repertoire of one's circuit network recipes.
In spirit seems the original request similar to that from Sushi belts. If it comes to these, the only really satisfactory solution I found is a completely mechanical solution using the ratios you can get from cascading splitters. And completely filtering and feeding the leftovers back into the sources, not leaving leftovers on the belt and trying to add missing items. Every Sushi belt solution that was controlled by circuits was not accurate enough - sooner or later the items became not evenly distributed any more. Belts became filled with gapless batches of the least (or worse: currently not) used item, blocking space for frequently requested items, so the belt became a mix of large patches of the same item, which killed throughput of the machines using these items, because they had to wait for their items.
In spirit seems the original request similar to that from Sushi belts. If it comes to these, the only really satisfactory solution I found is a completely mechanical solution using the ratios you can get from cascading splitters. And completely filtering and feeding the leftovers back into the sources, not leaving leftovers on the belt and trying to add missing items. Every Sushi belt solution that was controlled by circuits was not accurate enough - sooner or later the items became not evenly distributed any more. Belts became filled with gapless batches of the least (or worse: currently not) used item, blocking space for frequently requested items, so the belt became a mix of large patches of the same item, which killed throughput of the machines using these items, because they had to wait for their items.
Re: The right amount
Combinators don't update if they have no power, but maintain their previous output. So a simple arithmetic combinator memory cell does not lose its memory if it becomes unpowered.
They are however unreliable in a severe power shortage. Not updating means that if they have insufficient power on the "wrong" tick, they will miss pulses, in this case due to items added or removed from the belt, leading to an incorrect count as I described.
-
- Manual Inserter
- Posts: 2
- Joined: Sun Mar 26, 2023 9:28 am
- Contact:
Re: The right amount
Tertius wrote: ↑Sun Mar 26, 2023 2:44 pmYou can use a counter to remember the amount of items put on the belt. Increase the counter if an item is put on the belt, and decrease the counter if an item is taken from the belt.
In this example, the left inserter is set to read hand (pulse). This is what we use to increase the counter (combinator on the left). The right inserter is also set to read hand (pulse). Its value is multiplied by -1 by the combinator on the right, then also added to the counter, and since it's a negative number, the counter decreases.
The left inserter has an activation condition of item < 10, so it activates if the counter reports less than 10 items.
Activate the constant combinator to create the R signal to reset the counter.
2023-03-26 16-37-34 start=1 length=30 fps=10.gif
I guess this is a direct answer to your question, however if you start to use this approach, you will see it has some annoying flaws.
ok thanks a lot, what now if instead of using inserter i want to cable the belt itself ? same procedure ?
And just to be sure, if i want to set a different number it's on the condition of the left arm that i should change the value right ?
thank you for you time and answer fellow builders
Re: The right amount
You probably want a certain density of items on the loop instead of a total count. Say one item every 3 belts or something. Putting N items on a belt loop has the problem that increasing the belt length will decrease the item density. So when you need to build bigger you have to change the number of items to put on the belt loop to keep the density the same.
So my suggestion is to put sensors on a few belts around where you insert new items and set it to "item < X". That way every time there is a gap of items on the belt loop it will insert some more. No matter the length of the loop it will automatically adjust and put more items on a longer loop.
So my suggestion is to put sensors on a few belts around where you insert new items and set it to "item < X". That way every time there is a gap of items on the belt loop it will insert some more. No matter the length of the loop it will automatically adjust and put more items on a longer loop.
Re: The right amount
Yes, set belt to read contents and pulse, just as you would for an inserter. The difference will be that you may get less precision on a belt vs an inserter, it depends on how important precision is for you. You may also want to set up the "counting" belt just after the "control" belt, so that it doesn't end up counting items that are on a disabled belt instead of in the loop.chronosavenger wrote: ↑Mon Mar 27, 2023 6:35 pm
ok thanks a lot, what now if instead of using inserter i want to cable the belt itself ? same procedure ?
Yes, to control how much is on the loop you want to put conditions on everything that adds items to the loop.chronosavenger wrote: ↑Mon Mar 27, 2023 6:35 pmAnd just to be sure, if i want to set a different number it's on the condition of the left arm that i should change the value right ?