MATLAB Answers

Simulink PID Controller Tuning

43 views (last 30 days)
Alan
Alan on 3 Apr 2011
Commented: mira ismail on 10 May 2015
Hi,
I am a new user to Simulink. I created a model and added a PID controller. When I tune the controller it says the response should be about 1 second with a 20% overshoot. When I run the model the reality is 1000 seconds with 10,000% overshoot. What could cause this to happen?
I created my own PID controller and modified the coefficients and it seems to be working, but I would definitely like to get the built-in PID controller working since I am spending about 5 hours just to tune my homemade controller.
I have been debugging for about a week now, I am not sure what look for. Any assistance would be greatly appreciated.
Thank you,
Alan
  3 Comments
Arnaud Miege
Arnaud Miege on 13 Apr 2011
This might be due to the linearisation process that is used to tune the PID controller. Do you have many non-linearities in your model? Could you upload your model on a file-sharing site so that we can have a look at it?

Sign in to comment.

Accepted Answer

Arkadiy Turevskiy
Arkadiy Turevskiy on 22 Apr 2011
Alan actually sent me his model. He is trying to control the quadrotor position and orientation by controlling 4 rotor speeds.
1) In the most general case this is a coupled MIMO system, and PID Tuner would not work - it only works for SISO systems or MIMO systems that can be designed as a set of SISO loops. For a MIMO system like the quadrotor, the right tools are Robust Control Toolbox and/or Simulink Design Optimization.
2) The specific case Alan was working with is to make the quadrotor go up from 0 to 1 m, without changing x and y positions, and while keeping all attitude angles at zero. In this specific case all 4 rotor speeds are the same. The system effectively becomes a SISO loop described by the equation
zdotdot=lift/m -g,
where z is altitude, lift is PID Controller output, m is mass, and g is gravity. Alan applied PID Tuner to this system. When he accepted the design and ran it in Simulink, he observed huge overshoots he wrote about in his question.
This happened because PID Tuner works by linearizing the Simulink model. When linearizing the model zdotdot=lift/m-g, the resulting linearized model is zdotdot=lift/m. In other words, the tuner cannot see g - gravity, which in this case can be thought of as a huge input disturbance (10 times larger than the reference signal). So there is no error in the tuner here - it just does not know about the huge input disturbance acting on the system.
There are 2 ways to deal with this:
A. The better way: compensate for gravity in the feedforward path. You know what the gravity is, so just cancel it. Effectively your PID will then be calculating the lift force required in addition to gravity, not the total lift force. To do this in Simulink, add a constant term, equal to g*m to PID output.
B. The other, not recommended option - crank the bandwidth of the PID all the way up to cancel input disturbance. Not recommended as option 1 makes more sense in this case.
HTH.
Arkadiy
  1 Comment
mira ismail
mira ismail on 10 May 2015
Hi, would u mind to check my simulation? I am doing quadrotor control using LQR, but the output i think does not valid at all because its not follow the desired input.

Sign in to comment.

More Answers (1)

Seth Popinchalk
Seth Popinchalk on 17 Apr 2011
Try setting the Max Step Size to a small number (.1 or .01). It is possible that the model steps are too large to capture the fast dynamics of the step.

Community Treasure Hunt

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

Start Hunting!