Quantcast

Simulink Control Design

Batch Linearization to Obtain Multiple Transfer Functions for Varied Parameter Values

This example shows how to use the slLinearizer interface to batch linearize a Simulink model. You vary model parameter values and obtain multiple open- and closed-loop transfer functions from the model.

You can perform the same analysis using the linearize command. However, when you want to obtain multiple open- and closed-loop transfer functions, especially for a large-scale model, slLinearizer can be more efficient.

Cascaded Loop Model

The scdcascade model contains a pair of cascaded feedback control loops. Each loop includes a PI controller. The plant models, G1 (outer loop) and G2 (inner loop), are LTI models.

Use the slLinearizer interface to initially analyze the inner-loop dynamics. Then, analyze the outer-loop dynamics.

mdl = 'scdcascade';
open_system(mdl);

Create slLinearizer Interface for scdcascade

sllin = slLinearizer(mdl)
 
slLinearizer linearization interface for "scdcascade":

No analysis points. Use the addPoint command to add new points.
No permanent openings. Use the addOpening command to add new permanent openings.
Properties with dot notation get/set access:
      Parameters         : [] 
      OperatingPoints    : [] (model initial condition will be used.)
      BlockSubstitutions : []
      Options            : [1x1 linearize.LinearizeOptions]

Vary Inner-Loop Controller Gains

For inner-loop analysis, vary the gains of the inner-loop PI controller block, C2. Vary the proportional gain (Kp2) and integral gain (Ki2) in the 15% range.

Kp2_range = linspace(Kp2*0.85,Kp2*1.15,6);
Ki2_range = linspace(Ki2*0.85,Ki2*1.15,4);
[Kp2_grid, Ki2_grid] = ndgrid(Kp2_range,Ki2_range);

params(1).Name = 'Kp2';
params(1).Value = Kp2_grid;
params(2).Name = 'Ki2';
params(2).Value = Ki2_grid;

sllin.Parameters = params;

Kp2_range and Ki2_range specify the sample values for the Kp2 and Ki2 parameters. To obtain a transfer function for each combination of Kp2 and Ki2, you use ndgrid and construct a 6x4 parameter grid, with grid arrays Kp2_grid and Ki2_grid. You configure the Parameters property of sllin with the structure params. This structure specifies the parameters to be varied and their grid arrays.

Analyze Overall Closed-Loop Transfer Function for Inner Loop

The overall closed-loop transfer function for the inner loop, with the outer loop open, is equal to the transfer function from u1 to y2. To eliminate the effects of the outer loop, break the loop at e1, y1m, or y1. For this example, break the loop at e1.

Add u1 and y2 as analysis points, and e1 as a permanent opening of sllin.

addPoint(sllin,{'y2','u1'});
addOpening(sllin,'e1');

Obtain the transfer function from u1 to y2.

r2yi = getIOTransfer(sllin,'u1','y2');

r2yi, a 6x4 ss model array, contains the transfer function for each specified parameter combination. The software uses the model initial conditions as the linearization operating point.

Because e1 is a permanent opening of sllin, r2yi does not include the effects of the outer loop.

Plot the step response for r2yi.

stepplot(r2yi);

The step response for all the models varies in the 10% range. The settling time for most models is less than 1.5 seconds.

Analyze Inner-Loop Transfer Function at Plant Output

Obtain the inner-loop transfer function at y2, with the outer loop open at e1.

Li = getLoopTransfer(sllin,'y2',-1);

Because the software assumes positive feedback by default and scdcascade uses negative feedback, you specify the feedback sign using the third input argument. Now, Li = -G2C2.

Plot the bode response for Li.

bodeplot(Li);

The magnitude plot for all the models varies in the 3dB range. The phase plot shows the most variation, approximately 20 degrees, in the [1 10] rad/s interval.

Vary Outer-Loop Controller Gains

For outer-loop analysis, vary the gains of the outer-loop PI controller block, C1. Vary the proportional gain (Kp1) and integral gain (Ki1) in the 20% range.

Kp1_range = linspace(Kp1*0.8,Kp1*1.2,6);
Ki1_range = linspace(Ki1*0.8,Ki1*1.2,4);
[Kp1_grid, Ki1_grid] = ndgrid(Kp1_range,Ki1_range);

params(1).Name = 'Kp1';
params(1).Value = Kp1_grid;
params(2).Name = 'Ki1';
params(2).Value = Ki1_grid;

sllin.Parameters = params;

Similar to the workflow for configuring the parameter grid for inner-loop analysis, you create the structure, params, that specifies a 6x4 parameter grid. You reconfigure sllin.Parameters to use the new parameter grid. sllin now uses the default values for Ki2 and Kp2.

Analyze Closed-Loop Transfer Function from Reference To Plant Output

Remove e1 from the list of permanent openings for sllin before proceeding with outer-loop analysis.

removeOpening(sllin,'e1');

To obtain the closed-loop transfer function from the reference signal, r, to the plant output, y1m, add r and y1m as analysis points to sllin.

addPoint(sllin,{'r','y1m'});

Obtain the transfer function from r to y1m.

r2yo = getIOTransfer(sllin,'r','y1m');

Plot the step response for r2yo.

stepplot(r2yo);

The step response in underdamped for all the models.

Analyze Outer-Loop Sensitivity at Plant Output

To obtain the outer-loop sensitivity at the plant output, use y1 as the analysis point. Add y1 as an analysis point to sllin.

addPoint(sllin,'y1');

Obtain the outer-loop sensitivity at y1.

So = getSensitivity(sllin,'y1');

Plot the step response of So.

stepplot(So);

This plot indicates that it takes approximately 15 seconds to reject a step disturbance at the plant output, y1.

Close the Simulink model

bdclose(mdl);