Daandriks wrote: ↑Sun Feb 26, 2023 8:42 am
Thnx for the input. But the logic for the % I don't understand to be honest. What is that doing?
The modulo % could be seen as giving the remainder in a division there. So 53 % 5 or 53 % 10 would give 3 both, because if you divide 53 by 5 it will be 10 with a remainder of 3, and if you divide it by 10 it will be 5 with a remainder of 3, the operation % in the circuit network only output the remainder whereas the classic division gives the other number. I thought it would be necessary to use such operation to implement the logic precisely but the blueprint doesn't use this. At the very end is explained a risk of the blueprint's approach.
Daandriks wrote: ↑Sun Feb 26, 2023 8:42 am
And the downside is that I really don't understand how it works. It has wiring from the input of one combinator to the output of another. I don't get what that is supposed to do...
The combinator looping on itself ac as a memory in the blueprint, it is easier to see if you slow down or pause the time which you can do from the editor, if you type /editor in command. It is considered a cheat and will disable achievement but to understood those i find it necessary
. When a request is being fullfilled, this combinators input and ouput is the amount of material that has been grabbed by an inserter but is not yet in the end chest.
This is tricky, it requires to know and understand that every frame the value of the circuit network are updated, so a decider combinator like in the blueprint with each >= 0 output each, will take its output in a frame and use it as input in the next if it is positive or 0. This is how you can make it act as a memory. If you have such combinator setup , then when an inserter on the left grab an item with "read hand content" and "pulse" it will write on this memory, because during one frame there will be a value. Say the inserter on the left grab 5 iron on one frame, it will send a pulse with the value "5" on the channel "iron" during only 1 tick in proper wording. ( a pulse means sending a value during only1 tick ).
Then next tick, when the value are updated, this combinator will ouput the result it was given previous tick, so again "5 iron". And at this point the original input from the inserter on the left is gone, it's 0. But the next tick the combinator looping on itself will output its previous input if it meet the condition of > or = 0, so it will output "5 iron" , and again and again every tick as long as the condition is met.
If the inserter on the left grab a second time some iron, this time 3, it will happen that during 1 tick, the input will be the looping "5 iron" and "3iron" in addition, which will make the combinator loop "8 iron" from this point on.
The inserter on the left grabbing things is only 1 of the thing that write on the memory. it only adds up thing. But one also need a mechanism to write material off when they have reached the end chest.
This is more the task of the 2 combinators on the right part of the block of 4. This is another way to write on the memory, or in other word another way to provide value only during 1 tick similar as when an inserter grab something with the setting "read hand content" "pulse".
It takes advantage of the way the circuit network update every tick. If you make a long line of combinator where each one takes the output of the previous one and add 1. if you give a new signal at the beginning, the signal will propagate, it will take 1 tick to update the first combinator, and another for the second, and another for the third and another for the fourth and so one. So if you use 60 combinators the result is visible with 1 second of delay. 60 ticks.
Now in this case the red wire is split into 2 branch. One branch would be like a line of 0 combinator, and the other branch a line of 1 combinator. And then they meet again in the top right combinator of the block. It is not easy to see things this way because other things are happening but what this does is that it creates a delay of exactly 1 tick when the quantity on the red wire coming from the end part is changing. While other time canceling each other for the purpose of being the input of the top right decider combinator. That is a way to create a signal that last only 1 tick, which is a pulse, but this time a pulse with a negative value. Since the delay occur on the longer branch, which is longer because it does 1 operation on the signal, which is * -1.
So whenever the inserter on the left grab something the memory increase, whenever the quantity in the end chest changes, the memory decrease.
You cannot break/increase the memory by adding things on the end chest, because the top right combinator only allow negative value.
There is one thing left, which is how to set the stacksize with all this. The stack size is the difference between the quantity in the end chest and the request PLUS the quantity stored in the memory of material "on their way to the end chest". The PLUS and difference is done when the green and red wire value are added to act as input of the bottom left combinator. So if the request is 50 iron, the stack size is set to 50, which would in game translate to the max stack size. Whenever inserter on the left grab material they reduce their stacksize by the amount they grabbed. When the request is only 2 difference from the quantity in the end chest and the thing coming in on the belt, the stack size is 2. When the difference is 1, the stack size is one.
Daandriks wrote: ↑Sun Feb 26, 2023 8:42 am
But it seems to work. And with some expantion it seem to work. But the downside is that if you interupt the proces it seem to break the fix aswell
One need to follow the wires to see this but it shows that there is a risk of overload if you use more than 1 inserter for the same ressource. Because if the stack size is set to 5 then 2 or more inserter can pick up 5 things at the same time while there would only be 5 things missing, not 10 or 15. Which will lead to too much material in the end chest. However, the memory will not be corrupted, the extra material that could be dispatched in such case would be accounted for if you request 500 iron later and there was an extra 10 from previous time , there will be a 490 request on the red wire, so it will not accumulate overtime which may spare the need for looping belt ?
Is this what you experienced when it broke ? It is an advanced blueprint ! I think it should work if used as intented but it's unclear how it was intented to be used