Tuning PI controller from Simulink model with an m-file

17 views (last 30 days)
I have a simulink model which simulates the behavior and control of a process. I built a script to change an run the model to evaluate different scenarios and settings. Since different scenarios would require different settings for the optimal controller, I want to tune it from the m-file. I would like to mimic the tuning of the block if you doubleclick on the block and press the 'Tune...' button (because I assume that is how it should be tuned).
This is what I do:
io(1)=linio('model/controlleroutput',1,'input');
io(2)=linio('model/processoutput',1,'openoutput');
linsys = linearize('model',io);
pi = pidtune(linsys,'PI');
That is, I linearize the process I want to control and use that to tune the PI controller. However, I get a different result if I click on the 'Tune...' button. Hence, I'm doing something different.
Can someone tell me what part of the model I should linearize to do what the 'Tune...' button does? As you can read, I'm not really used to the field of control, and the only understanding of 'tuning' that I have is that it sounds reasonable to understand the dynamic behavior of the process before setting the PI settings. But I've no idea what I should linearize to tune it correctly. In my system I have a combination of feedback and feedforward.
Kind regards, Jos
  1 Comment
Jos
Jos on 15 Nov 2013
I found the solution: io(1) should be set to the controller output and io(2) to the controller input (that is, to the output of the block that gives the input to the controller). Now I should try to understand how the linearization exactly works, to see whether it makes sense to tune it in this way.
Regards, Jos

Sign in to comment.

Accepted Answer

Arkadiy Turevskiy
Arkadiy Turevskiy on 19 Nov 2013
You are correct, PID Tuner linearizes the model from PID controller output to PID controller input. This is explained in the doc here.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!