I have a train that waits until 2 circuit network signals, A, and B, are equal in value. A is the output of a selector combinator which is set to "Count Inputs" with it's input being the train currently being at the stop — ie it counts the number of unique items within the train. B is the output of a decider combinator which checks if each input signal (input from the train) is greater than a constant value, N — it counts the number of unique items that are of a certain stack size. So I'm just checking if each item count within the train is above a certain amount, and to wait if not.
What I'm finding is that for a split second, despite B < A, it will evaluate as true (yet I can see, in the train, B = A despite B < A). It's almost as if there's a slight counting delay from the selector combinator or the decider combinator where it sees both values as equal for a moment until it finishes counting, so it evaluates as true for the train.
As a workaround, I have the train set to wait for 1 second or less to account for this delay.
Is this expected behavior?
Re: Is this expected behavior?
It takes each combinator 1 tick to process input to output. If you want to make sure that you are comparing results from the train contents at the same instant, your two chains of combinators have to be the same length. If one is a step longer than the other you can insert a 'dummy' step before comparing them (e.g. an arithmetic combinator that adds 0 or multiplies by 1).
Re: Is this expected behavior?
The signal needs 1 tick to get through the combinators calculating A and B. The very first tick the train is connected to the station, the signals from the train are at the input of the combinators but the combinators didn't yet process them, so they still output nothing (which means A=0 and B=0), and this is A=B, so your condition is true for the 1st tick.
The most easy workaround is probably to add a condition like AND A>0 as waiting condition, i. e. not only all items need to be above some threshold, there should also be counted at least 1 item from the train.
The most easy workaround is probably to add a condition like AND A>0 as waiting condition, i. e. not only all items need to be above some threshold, there should also be counted at least 1 item from the train.