How can i get the control effort/output of the PID?

86 views (last 30 days)
sys = (2.293*s + 9.172)/(s^2 + 10.29*s + 25.17);
Kp = 5; Ki = 50; Kd = 0.5;
  7 Comments
Rupali Gawde
Rupali Gawde on 22 Sep 2020
Edited: Rupali Gawde on 22 Sep 2020
Find code in attachment. Please help and check the last section "Control Effort". Please help correct the code if needed. I need to find the output from all the 4 controllers -ZN-PID, GA-PID, PSO-PID, ABC-PID, TLBO-PID.
Thanks.
Jon
Jon on 22 Sep 2020
Now I see what you are doing I will post my response as an "Answer". Hope this helps. If it answers your question you can accept it. Otherwise please follow up with further comments to the "Answer".

Sign in to comment.

Accepted Answer

Jon
Jon on 22 Sep 2020
So I see you are on the right track, you are trying to define the appropriate closed loop transfer functions but using MATLAB's feedback function instead of doing the block diagram algebra by hand. That seems like a good approach. I think you just need to look more at the details of how you are applying the feedback function.
I see you want the closed loop output of the controller to a setpoint change. In this case the forward path would be the PID controller's transfer function, but the feedback path would be the rest of the elements in the closed loop, in this case, the plant or as you call it sys. Note in your case the closed loop always consists of two elements the controller and the plant, but what part of it is the forward path and what part is the feedback path depends upon what output you are interested in. When you are interested in the plant output as the "output" then the controller and the system are in the forward path with unity feedback, that is 1 in the feedback path. When you want the controller output as the "output" then the forward path is just the controller, and the feedback path is the system.
So, for example for your y_zn calculation you should use
y_zn = lsim(feedback(zn_cont,sys),sp,t);
similar for the others.
  13 Comments
Jon
Jon on 9 Nov 2020
Why, you will get the same answer as with lsim.
Jon
Jon on 9 Nov 2020
Is it for an academic assignment just to get experience using Simulink? If so then what problem are you having using Simulink? If you don't have much experience using Simulink I would recommend first completing the Simulink on-ramp training. It will get you going very quickly https://www.mathworks.com/learn/tutorials/simulink-onramp.html

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!