ADD Instruction executing in Rung False Condition
I want to start by noting that I am running this in Simulation.
Controller: AXC F 1152 FW:2022.0.2 LTS (22.0.2.51)) - I couldn't get the newer controllers in Sim to work.
Software: PLCNext Engineer 2023.0.1 (Build 6.0.339.0 Revision 97eb7ae5) installed.
-----------------------------------------------------
See attached Screenshot. This is after nearly a day of trying to understand what is happening.
I have an HMI button that when pressed, I want to add an offset to tag 'RecNumber'. I have a clamp upstream in logic that clamps 'RecNumber' between 0 to 50.
On initial download, this rung (15, or Code Network 6) does not execute (as expected), but once I press the eHMI button, this rung goes is in a runaway state.
So even with 'ExecuteRecipeSelect" being FALSE, the value within 'RecNumber' runs away to the 40's. Then as I click on my HMI reference that updates the offset, I see 'RecNumber' update to 40+offset.
If I make 'RecNumber' = 0, it will roll itself up in the 40s + my offset.
I have tried quite a number of hooks, initially I thought that is was executing over a number of scans and I couldn't see it. But then realized that even with the 1st instruction condition being false, the remainder of the compares instructions and Add instruction continue to execute.
What am I doing wrong? I have does this on other platforms and not had this issue.
Regards,
Vin
EDIT: updated screenshot with higher resolution
Comments
If I'm reading your code correctly the issue is with the first LE function and then cascades to the other comparison functions beyond it.
I think there is a misunderstanding as to how EN works when applied to a function. When EN = true, the function is enabled and when EN = false the function is disabled. This means the function is not processed when EN= false. When a function is not processed, the output of the function is not reset. Instead the output of the function remains at it's previous value (last value when EN = true) as the function is not being process to change the output.
From the PLCnext engineer help:
So in your code:
Instead you should have the function Enabled (EN=true) all the time and AND the output of the function with your ExecuteRecipeSelect, so that the result in only true when both elements are true. Example below:
I hope this helps.
Regards
Andrew Ellis
Phoenix Contact UK
Thank you for the response.
But that is a very Function Block oriented logic in a Ladder Editor selected routine. I never would have come up with that specific solution.
I guess a potentially easier solution to your example would be to AND the ENO of the compare and Compare output to formulate a True non-retentive output condition? I'll have to try that.
[slightRant]
If I duplicate my logic in other Ladder logic controllers, the ADD instruction does not execute due to PLC Scan processing from Left to Right, Top to Bottom as all boolean instruction state outputs disable on instruction enable going to, and being FALSE.
This platform is being presented in Canada (and I've been to multiple sales, practicality and technical sessions) as an alternative/replacement to major competing PLC manufacturers with more functionality.
A compare instruction should not function like a memory instruction. On EN=False the output state of the boolean compare should not remain TRUE.
[/slightRant]
Regards and again, thank you for the platform insight.
Vin