thehoneybadger
Member
OP
Thank you for the elegant solution Robert. I am a big fan of elegant solutions (as you know).Here is the FSC code. Simple, Fast, "Elegant" (inside joke). Could be combined onto a single rung, but for easy readability, multiple rungs.
To initiate, simply toggle Start_Find to ON.
After reading your FSC suggestion, i read up on what it is here:
https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm003_-en-p.pdf
Page 457.
After reading this description, i imagine this is exactly what i am looking for. According to the manulal,

This tells me the instruction will iterate until the expression evaluates True.
For this reason, after generating B_Next_Water[...] values, i SRT them from small to high. This way, the first value that the expression evaluates to be is TRU is the first positive value after 0. The .POS will show which position in the B_Next_Water[...] array is the Ntarget.
I gave it a shot, but .POS never moved past 0.
I reviewed what values are greater than 0, these are the first few:

I thought maybe PLC identified B_Next_Water[0] = 0 to be expression TRUE.
To test, i changed the expression to find the first value greater than 300.
Same result as before; .POS never moved past 0.
This is my code after i changed the expression:

I cannot seem to make the FSC process the data.