How do I reverse the effect of an integral block?
1 view (last 30 days)
Show older comments
Janith Wijekoon on 19 Apr 2022
Commented: Paul on 23 Apr 2022
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.
Paul on 23 Apr 2022
According to the doc page, that parameter c is only used when the model is linearlized, but it is not used during simulation. Note the phrase "used for linearization" in the dialog box.
I can't say what's standard practice, but I'm pretty sure that using the Derivative block can be problematic in simulation. So even if the encoder truly is an analog differentiator, it may still to be prudent to model it as an approximate differentiator (exactly as can be done for linearization with c)
More Answers (0)
Find more on Real-Time PID Autotuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!