Download jMPC Toolbox v3.11 User`s Guide
Transcript
mdist(220:260,2) = Tf-linspace(0,20,41); %Slow cooling of Tf
mdist(261:end,2) = Tf-20; %Tf final
%Set Initial values at linearization point
Plant.x0 = xop;
Model.x0 = xop;
Step 7 - Set MPC Options
For advanced settings of the MPC controller or simulation you can use the jMPCset function to create
the required options structure. For this example we wish to set the plot titles and axis, as well as setting
the initial control input (at k = 0) to the linearization point:
%Set Options
opts = jMPCset(‘InitialU’,u0,... %Set initial control input at linearization point
‘InputNames’,{‘Feed Concentration’,‘Feed Temperature’,‘Jacket Temperature’},...
‘InputUnits’,{‘mol/m^3’,‘K’,‘K’},...
‘OutputNames’,{‘Reactor Concentration’,‘Reactor Temperature’},...
‘OutputUnits’,{‘mol/m^3’,‘K’})
Step 8 - Build the MPC Controller and Simulation Options
Now we have specified all we need to build an MPC controller and Simulation environment, we call the
two required constructor functions:
%-- Build MPC & Simulation --%
MPC1 = jMPC(Model,Np,Nc,uwt,ywt,con,Kest,opts);
simopts = jSIM(MPC1,Plant,T,setp,[],mdist);
MPC1 is created using the jMPC constructor, where the variables we have declared previously are passed
as initialization parameters. Simulation options simopts is created similarly, except using the jSIM
constructor.
Step 9 - Run the MPC Simulation and Plot Results
With the controller and environment built, we can run the simulation, and plot the results. We use
Simulink as the evaluation environment as it runs significantly faster than Matlab for nonlinear simulations:
%-- Simulate & Plot Result --%
simresult = sim(MPC1,simopts,‘Simulink’);
plot(MPC1,simresult,‘detail’);
As shown in Figures 31 and 32 the system shows good control with minimal overshoot even for large
step changes. This particular problem presents a considerable challenge to linear MPC based on the
unstable operating point and significant nonlinearities of the system. However correct tuning can give
good results, even when responding to disturbances.
43