How do I reverse the effect of an integral block?
2 views (last 30 days)
Quick summary of the system I'm designing. This is a model of a PID speed controller for a motor driving a lead screw. The problem comes with modelling the encoder which reads the rotor position, and differentiates it to get the speed for the feedback loop.
The reason I'm calculating the speed like this is because it's a more accurate representation of the actual system.
The controller works fine when I take the speed feedback directly (before the "convert to rotations" integral block), but for some reason when I take the output of the integral block and differentiate it, it completely breaks the controller.
Shouldn't taking the derrivative of the position give me the speed at that point, or at least a close approximation of it? Is there something fundamentally wrong that I am doing with this setup?
Paul on 20 Apr 2022
Edited: Paul on 20 Apr 2022
Are you sure the encoder is a pure differentiator? Even if it is, the simulation is likely to have problems with the Derivative block in the loop for reasons already pointed by @Sam Chak. If you haven't already, read the doc page for the Derivative block for more discussion and caveats.
To address the problem, maybe consider:
a) Make the maximum step size of the solver smaller than it is now.
b) Replace the Derivative block with a Transfer Function block of the form
s/(s/wh + 1)
where wh is greater than 5 - 10 times the oscillation frequency (in rad/sec) of the transient at the set point jump (when feedback back the integrator input). This approach will result in very high frequency pole in the loop, make sure to control the solver step size appropriately.
c) If allowed in your problem, consider adding a low pass filter at the output of the PID controller with bandwidth high enough so as not to have much impact on the low frequency portion of the control loop, but with bandwidth low enough to attenuate that oscillation.
d) As @Sam Chak implied, perhaps revisit the PID parameters.
Or maybe a combination of the above.