I don't believe i've said Elmo this much in a conversation or in a chat before. For that achievement and your lesson i would like to humbly thank you @drbitboy
Haha!
Well done! You analyzed and described it perfectly. I especially agree with your observation that there are both latch a latch-release aspects to the circuit, i.e. it's related to the Sealed-In, State/Fault, and Start/Stop patterns (cf.
this link; the Start/Stop pattern is the one almost every introduction to ladder logic uses).
Generically that circuit is an implementation of an XOR (eXclusive OR: [a AND NOT b] OR [NOT a AND b]; also [a OR b] AND NOT [a AND b]).
Practically, with the condition that the Set_And_Forget_from_HMI boolean is a one-shot trigger (i.e. true for one program scan only at a time), it's called a
flip-flop i.e. it inverts (
flips from 0 to 1 or
flops from 1 to 0) the output from its initial state for each scan when the trigger is 1. So the upper branch [NO trigger NC output] does double-duty, i.e. executing EITHER a
flip OR a
flop, on the single scans when trigger is 1, and the lower branch [NC trigger NO output] does the latch or "seal-in" on all other scans, i.e. when trigger is 0.
If you search for "flip-flop electronics" you will find several versions of a specific integrated circuit; this is closest to the the "T flip-flop," with the trigger signal "T" called the "clock" or "strobe."
There are other ways to code it, and I think there is an ancient thread on this forum that has a few dozen different approaches; to me this has the best aesthetic. Note that that the SUB instruction in my final approach, Output = 100 - Output, where Output is only either 0 or 100, is in itself a form of flip-flop when triggered by the _ONS tag (consider B = 1 - B, where B is only ever 0 or 1 i.e. a Boolean).
The reason I bring it up is that I tried very hard to use this particular arrangement in the current thread, but it just wouldn't fit for this application.
Also, I wanted you to see that a
flip-flop was more or less what you were looking for. And although @Steve Bailey already covered this ground, this provides an alternate path to understanding why the logic could not be split, as you were initially trying to do, between the HMI and PLC
after the introduction of the analog I/O field: because the flip-flop
needs to know the initial state of the output (motor speed), where the Start/Stop 1/0 button in the HMI was simply writing values to the PLC without regard to the state of the motor.