I was trying to set up a Trash Train system and I was running into issues. I got around most of them but one. The not quite full problem. Yes, I can use has cargo. But that just mean Not empty. And with a trash system, you may never get to a full condition either. What I am looking for is a mostly full condition. But with varying stack sizes and unknown contents, I can't just do a simple item count with a constant. So, my suggestion is quite simple.
Along with the empty, has cargo, and full conditions, I want a "slots full" condition. Meaning, if all the stacks on the wagons have at least something in them with no slot empty, then trip the condition. At least this is the only way I can see that you can have a "mostly full" condition.
I don't care if all the stacks are maxed out. I do care if I can add something new or not. I want to get my trash trains as full as I can before sending them home.
New condition, slots full
Moderator: ickputzdirwech
Re: New condition, slots full
I could even work with a slot count. AKA the number of slots occupied.
Re: New condition, slots full
It depends on the situation, but in some cases you can just use the inactivity for this. Meaning: inserters can't insert more into the train, so it goes inactive, and you know it's ok to go/leave.
Re: New condition, slots full
Read contents of train.
Get stack sizes of everything in the train (selector combinator)
Divide contents of train by stack sizes (used to derive number of full slots)
Modulo contents of train by stack size and then divide result by itself to yield 1s if any signal is non-zero (used to derive number of partially filled slots)
Sum these two multi-signal values into a single signal - N for eg.
You may need to add some insert delays (each * 1 => each for eg) to avoid any multipath signal glitching while signals propagate through the resulting circuit if that matters to you for your intended use.
N is number of slots used assuming contents of a wagon are stacked (cant remember offhand if non-packed slots can happen other than by manual intervention, for eg several slots of the same thing with only a few in each rather than all being fully stacked except one with a few items).
Also slot filter reservations in a wagon will break assumption of 40-N yielding number of free slots (40 being total number of slots in a wagon unless modded to something else).
It will be easier and likely just as useful to have an inactivity timeout on the train.
Get stack sizes of everything in the train (selector combinator)
Divide contents of train by stack sizes (used to derive number of full slots)
Modulo contents of train by stack size and then divide result by itself to yield 1s if any signal is non-zero (used to derive number of partially filled slots)
Sum these two multi-signal values into a single signal - N for eg.
You may need to add some insert delays (each * 1 => each for eg) to avoid any multipath signal glitching while signals propagate through the resulting circuit if that matters to you for your intended use.
N is number of slots used assuming contents of a wagon are stacked (cant remember offhand if non-packed slots can happen other than by manual intervention, for eg several slots of the same thing with only a few in each rather than all being fully stacked except one with a few items).
Also slot filter reservations in a wagon will break assumption of 40-N yielding number of free slots (40 being total number of slots in a wagon unless modded to something else).
It will be easier and likely just as useful to have an inactivity timeout on the train.