# How do I reverse the effect of an integral block?

5 vues (au cours des 30 derniers jours)
Janith Wijekoon le 19 Avr 2022
Commenté : Paul le 23 Avr 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?
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Sam Chak le 19 Avr 2022
Modifié(e) : Sam Chak le 19 Avr 2022
Thanks for showing the comparison.
Without the derivative block, you are measuring the angular speed directly. If you look closely at the 1 second (horizontally stretched image), you can see the original output is a high-frequency oscillatory signal that quickly dies down in that split second. This effect is caused by the setpoint jump at 1 second and the selection of the 'aggressive' PID gains.
Naturally, when the derivative block is used on the angular position signal to recover the angular speed, the high-frequency oscillatory signal will cause the excitation effect in the derivative block, and amplified by the 60-Gain block. This excitation effect is sufficient to cause a degradation in the motor performance, if it isn't sufficient to destabilize the motor system.
Janith Wijekoon le 20 Avr 2022
I see. that makes sense, thanks. So potential fixes would be :
1. Tuning the PID to have a smoother approach to the reference
2. Running the feedback signal through some low pass filter

Connectez-vous pour commenter.

### Réponse acceptée

Paul le 20 Avr 2022
Modifié(e) : Paul le 20 Avr 2022
Hi Janith
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.
##### 6 commentairesAfficher 4 commentaires plus anciensMasquer 4 commentaires plus anciens
Janith Wijekoon le 23 Avr 2022
@Sam Chak thanks, I tried using both a filtered step as well as a ramp input instead of a step, it works much better! I should be able to program this thing to only recieve gradual changes in speed as a solution.
Paul le 23 Avr 2022
Hi Janith,
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)

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Classical Control Design dans Help Center et File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by