main content

tuning multiloop control systems -凯发k8网页登录

this example shows how to jointly tune the inner and outer loops of a cascade architecture with the systune command.

cascaded pid loops

cascade control is often used to achieve smooth tracking with fast disturbance rejection. the simplest cascade architecture involves two control loops (inner and outer) as shown in the block diagram below. the inner loop is typically faster than the outer loop to reject disturbances before they propagate to the outer loop. (simulink® is not supported in matlab® online.)

open_system('rct_cascade')

plant models and bandwidth requirements

in this example, the inner loop plant g2 is

$$ g_2(s) = \frac{3}{s 2} $$

and the outer loop plant g1 is

$$ g_1(s) = \frac{10}{(s 1)^3} $$

g2 = zpk([],-2,3);
g1 = zpk([],[-1 -1 -1],10);

we use a pi controller in the inner loop and a pid controller in the outer loop. the outer loop must have a bandwidth of at least 0.2 rad/s and the inner loop bandwidth should be ten times larger for adequate disturbance rejection.

tuning the pid controllers with systune

when the control system is modeled in simulink, use the sltuner interface in simulink control design™ to set up the tuning task. list the tunable blocks, mark the signals r and d2 as inputs of interest, and mark the signals y1 and y2 as locations where to measure open-loop transfers and specify loop shapes.

st0 = sltuner('rct_cascade',{'c1','c2'});
addpoint(st0,{'r','d2','y1','y2'})

you can query the current values of c1 and c2 in the simulink model using showtunable. the control system is unstable for these initial values as confirmed by simulating the simulink model.

showtunable(st0)
block 1: rct_cascade/c1 =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.1, ki = 0.1
 
name: c1
continuous-time pi controller in parallel form.
-----------------------------------
block 2: rct_cascade/c2 =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.1, ki = 0.1
 
name: c2
continuous-time pi controller in parallel form.

next use "loopshape" requirements to specify the desired bandwidths for the inner and outer loops. use $0.2/s$ as the target loop shape for the outer loop to enforce integral action with a gain crossover frequency at 0.2 rad/s:

% outer loop bandwidth = 0.2
s = tf('s');
req1 = tuninggoal.loopshape('y1',0.2/s); % loop transfer measured at y1
req1.name = 'outer loop';

use $2/s$ for the inner loop to make it ten times faster (higher bandwidth) than the outer loop. to constrain the inner loop transfer, make sure to open the outer loop by specifying y1 as a loop opening:

% inner loop bandwidth = 2
req2 = tuninggoal.loopshape('y2',2/s); % loop transfer measured at y2
req2.openings = 'y1';                  % with outer loop opened at y1
req2.name = 'inner loop';

you can now tune the pid gains in c1 and c2 with systune:

st = systune(st0,[req1,req2]);
final: soft = 0.859, hard = -inf, iterations = 67

use showtunable to see the tuned pid gains.

showtunable(st)
block 1: rct_cascade/c1 =
 
             1            s    
  kp   ki * ---   kd * --------
             s          tf*s 1 
  with kp = 0.0521, ki = 0.0186, kd = 0.0473, tf = 0.00696
 
name: c1
continuous-time pidf controller in parallel form.
-----------------------------------
block 2: rct_cascade/c2 =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.721, ki = 1.23
 
name: c2
continuous-time pi controller in parallel form.

validating the design

the final value is less than 1 which means that systune successfully met both loop shape requirements. confirm this by inspecting the tuned control system st with viewgoal

viewgoal([req1,req2],st)

note that the inner and outer loops have the desired gain crossover frequencies. to further validate the design, plot the tuned responses to a step command r and step disturbance d2:

% response to a step command
h = getiotransfer(st,'r','y1');
clf, step(h,30), title('step command')

% response to a step disturbance
h = getiotransfer(st,'d2','y1');
step(h,30), title('step disturbance')

once you are satisfied with the linear analysis results, use writeblockvalue to write the tuned pid gains back to the simulink blocks. you can then conduct a more thorough validation in simulink.

writeblockvalue(st)

equivalent workflow in matlab

if you do not have a simulink model of the control system, you can perform the same steps using lti models of the plant and control design blocks to model the tunable elements.

figure 1: cascade architecture

first create parametric models of the tunable pi and pid controllers.

c1 = tunablepid('c1','pid');
c2 = tunablepid('c2','pi');

then use "analysis point" blocks to mark the loop opening locations y1 and y2.

ls1 = analysispoint('y1');
ls2 = analysispoint('y2');

finally, create a closed-loop model t0 of the overall control system by closing each feedback loop. the result is a generalized state-space model depending on the tunable elements c1 and c2.

innercl = feedback(ls2*g2*c2,1);
t0 = feedback(g1*innercl*c1,ls1);
t0.inputname = 'r';
t0.outputname = 'y1';

you can now tune the pid gains in c1 and c2 with systune.

t = systune(t0,[req1,req2]);
final: soft = 0.859, hard = -inf, iterations = 118

as before, use getiotransfer to compute and plot the tuned responses to a step command r and step disturbance entering at the location y2:

% response to a step command
h = getiotransfer(t,'r','y1');
clf, step(h,30), title('step command')

% response to a step disturbance
h = getiotransfer(t,'y2','y1');
step(h,30), title('step disturbance')

you can also plot the open-loop gains for the inner and outer loops to validate the bandwidth requirements. note the -1 sign to compute the negative-feedback open-loop transfer:

l1 = getlooptransfer(t,'y1',-1);       % crossover should be at .2
l2 = getlooptransfer(t,'y2',-1,'y1');  % crossover should be at 2
bodemag(l2,l1,{1e-2,1e2}), grid
legend('inner loop','outer loop')

see also

(simulink control design) | (simulink control design)

related topics

    网站地图