Figure 3: Transition with gain-scheduled cascade controller.
Controller Tuning in MATLAB
Alternatively, you can tune the gain schedules directly in MATLAB without using the
slTuner interface. First parameterize the gains as quadratic functions of Cr as done
above.
TuningGrid = struct('Cr',CrEQ);
ShapeFcn = @(Cr) [Cr , Cr^2];
Kp = tunableSurface('Kp', 0, TuningGrid, ShapeFcn);
Ki = tunableSurface('Ki', -2, TuningGrid, ShapeFcn);
Kt = tunableSurface('Kt', 0, TuningGrid, ShapeFcn);
a = tunableSurface('a', 0, TuningGrid, ShapeFcn);
b = tunableSurface('b', 0, TuningGrid, ShapeFcn);
Use these gains to build the PI and lead controllers.
PI = pid(Kp,Ki,'Ts',Ts,'TimeUnit','min');
PI.u = 'ECr'; PI.y = 'TrSP';
LEAD = Kt * tf([1 -a],[1 -b],Ts,'TimeUnit','min');
LEAD.u = 'ETr'; LEAD.y = 'Tc';
Use connect to build a closed-loop model of the overall control system at the five design
points. Mark the controller outputs TrSP and Tc as "analysis points" so that loops can be
opened and stability margins evaluated at these locations. The closed-loop model T0 is a
5-by-1 array of linear models depending on the tunable coefficients of Kp,Ki,Kt,a,b.
Each model is discrete and sampled every half minute.
Gd.TimeUnit = 'min';
S1 = sumblk('ECr = Cref - Cr');
S2 = sumblk('ETr = TrSP - Tr');
T0 = connect(Gd(:,'Tc'),LEAD,PI,S1,S2,'Cref','Cr',{'TrSP','Tc'});
Finally, use systune to tune the gain schedule coefficients.
T = systune(T0,[R1 R2 R3],R4);
Final: Soft = 1.21, Hard = 0.99993, Iterations = 212
The result is similar to the one obtained above. Confirm by plotting the gains as a function
of Cr using the tuned coefficients in T.
Gain-Scheduled Control of a Chemical Reactor