# Which requirements and Tuning Methods in Control System Designer are needed to tune PID parameters in a cascaded loop when intput is an oscillating signal

8 views (last 30 days)
Iaroslav Gryshchuk on 28 Feb 2023
Answered: Sam Chak on 16 Mar 2023
The input signal (Requested Position) has following form:
Amplitude:1.1 mm;
Frequency: 1Hz. The Simulink modell looks like this: The transfer function block was estimated with Systemidentification Toolbox from the Requested Torque and Current Position signals from the real system:
Numerator: [-3.2239 52.4809];
Denominator: [1 0.09604 38.2613].
With default parameters Position Controller Kp=1, Speed controller Kp=1, Ki=1, I get following output signal(Curent Position) My goal is to make Current Position signal as equal as possible to Requested Position. It should happen automated.
So I thought about using Control System Designer Toolbox with one of the automated tuning methods. Unfortunately I don't know much about control theory, so I don't really know which requirements I have to set to tune the controllers, so CurrentPosition looks as equal as possible as Requested Position.
I am also unsure if I should use P- and PI- controller or P- and PID.
Do someone have any suggestions, how I can adress the task of tuning of this cascaded loop?

Sam Chak on 16 Mar 2023
The 2nd-order plant is non-minimum phase. I'm unable to track the relatively fast 1 Hz sinusoidal signal using your proposed configuration of the PID controllers, because the tuning method cannot produce a stable feedback loop.
However, using a 4th-order Compensator, the Reference sinusoidal signal can be tracked with a decent lag (phase shift). The compensator is designed to provide a fast response at 0.1 sec (10 times faster than Ref signal frequency) on the closed-loop system. The design is based on the Loop-shaping auto-tuning method provided by the controlSystemDesigner(Gp).  MATLAB
s = tf('s');
num = [-3.2239 52.4809];
den = [1 0.09604 38.2613];
% Plant
Gp = tf(num, den)
Gp = -3.224 s + 52.48 ----------------------- s^2 + 0.09604 s + 38.26 Continuous-time transfer function.
% Compensator
Gc = (1.905e+06*s^2 + 1.83e+05*s + 7.291e+07)/(s^4 + 270*s^3 + 4e+04*s^2 + 9.143e+06*s - 3.127e-09)
Gc = 1.905e06 s^2 + 183000 s + 7.291e07 -------------------------------------------------- s^4 + 270 s^3 + 40000 s^2 + 9.143e06 s - 3.127e-09 Continuous-time transfer function.
% Closed-loop system
Gcl = minreal(feedback(Gc*Gp, 1))
Gcl = -6.142e06 s^3 + 9.939e07 s^2 - 2.255e08 s + 3.826e09 ------------------------------------------------------------------------------------ s^6 + 270.1 s^5 + 4.006e04 s^4 + 3.016e06 s^3 + 1.018e08 s^2 + 1.244e08 s + 3.826e09 Continuous-time transfer function.
tau = 1;
Tf = 5;
Ts = 0.01;
[u, t] = gensig("sine", tau, Tf, Ts);
lsim(0.934*Gcl, u, t, Ts) Joel on 15 Mar 2023
Hi,
One way to tune your controller is by using the PID Tuner App:
1. Open Block parameters of the Position controller.
2. Under Automated tuning, select ‘Transfer function Based (PID Tuner App)’ and click on ‘Tune’.
3. The PID Tuner App will be launched.
4. Under Tuning tools, use the slider for response time and transient behaviour to get optimal results.
5. Click on ‘Show Parameters’ to view P,I values and other performance criterion.
6. Repeat the same steps for the Speed Controller.
These are the values that I have obtained using the PID Tuner App:
Position Controller: P = 0.01296
Speed Controller: P = 0, I = 64.7447
Iaroslav Gryshchuk on 15 Mar 2023
Hi,
Thank you for your answer. Unfortunately, I don't really understand how can I see in (PID Tuner App) that the results are optimal (Step 4).
My goal is to tweak the parameters of the controllers in such way that the Current Position Signal will be as close as possible to Requested Position signal, see examples of the Signals below. How can I see in (PID Tuner App) that my Requested Position Signal is as close as possible to Current Position signal.
It would be also nice, if there was a way in Simulink to do this control process automatically without playing with sliders. ### Categories

Find more on Real-Time PID Autotuning in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!