Can the position PID send a negative value of the SP to the speed PID?
If the position PID does send a negative value of the SP to the speed PID, will the speed PID see the negative value, or does the speed PID clamp negative SP values to 0 (zero)?
...
Code:
[B]
[I][COLOR=#ff0000] ELSIF #Result_RPM < #LOW_LIMIT THEN[/COLOR][/I][/B]
#Result_RPM [B][I][COLOR=#ff0000]:= #LOW_LIMIT;[/COLOR][/I][/B]
#OUT := #Result_RPM;
------------------------------------------------------
Values :
LOW_LIMIT Real [B][I][COLOR=#ff0000]0.0[/COLOR][/I][/B]
...
That is my PID code. ...
Called that one, didn't I? And before @Peter even had the popcorn made
.
So how did I (as well as a few dozen others watching this soap opera) know that? Look at the PID equation. Think about what it is doing. Differential equations and Laplace transforms are nice for going deeper, but they are not necessary to understand what this dead-nuts simple, linear algorithm called PID* (cf. here) is
doing.
You wrote the code: do you not understand what you wrote; can you not simulate the
discrete,
cyclic 10Hz,
closed-loop (motor
plus PID) system in your head?
Those are not rhetorical questions; neither am I mocking you, though I will unabashedly own my bluntness. I would prefer you figure this out on your own, because that is how you, and not chatGPT, will
know it for the rest of your life.
The trick to programming PLCs is not figuring out what you
want the PLC to do. The trick to programming PLCs is figuring out how to
tell the PLC to do what you want it to do.
* actually PI only, most likely
Hint #1: try calculating and tracing (trending, plotting) the error (#ERR).