Unconstrained Model predictive Control Increasing the noise filter time constant makes the system more robust and the unmeasured disturbance response more sluggish. Increasing the disturbance time constant increases the lead in the loop, making the control action somewhat more aggressive, and is recommended for disturbances which have a slow effect on the output. All controllers designed with the MPC Toolbox track steps asymptotically error-free(Type 1). If the unmeasured disturbance model or the system itself is integrating, ramps are also tracked error-free(Type 2) Example:(see mpctutst. m) Pl ant transfer functi on: g=5. 72exp(-14s)/(60s+1) Di sturbance transfer functi on: gd=1. 52exp(-15s)/ Bui ld the step response model s for a sampl i ng peri od of 7 del t1=0: del ayl=14: num1=5.72; den1=[601] g=pol y2tfd(numl, denl, del tl, del ay 1); tfinal=24 del t2=7 no outl=1 pl ant=tfd2step(tfi nal, del t2, nout 1, g) num2=1.52; gd=pol y2tfd(num2, den2, del tl, del ay2); out2=1 dpl ant=tfd2step(tfinal, del t2, nout2, gd) Cal cul ate the MPC controller gai n matrix for Out put Wei ght It Wei ght=O % Input Hori zon=5, Out put Hori zon=20 model =pl ant ywt=l: uwt=0 2-13
Unconstrained Model Predictive Control 2-13 Increasing the noise filter time constant makes the system more robust and the unmeasured disturbance response more sluggish. Increasing the disturbance time constant increases the lead in the loop, making the control action somewhat more aggressive, and is recommended for disturbances which have a slow effect on the output. All controllers designed with the MPC Toolbox track steps asymptotically error-free (Type 1). If the unmeasured disturbance model or the system itself is integrating, ramps are also tracked error-free (Type 2). Example: (see mpctutst.m) % Plant transfer function: g=5.72exp(-14s)/(60s+1) % Disturbance transfer function: gd=1.52exp(-15s)/ % (25s+1) % % Build the step response models for a sampling period % of 7. delt1=0; delay1=14; num1=5.72; den1=[60 1]; g=poly2tfd(num1,den1,delt1,delay1); tfinal=245; delt2=7; nout1=1; plant=tfd2step(tfinal,delt2,nout1,g); delay2=15; num2=1.52; den2=[25 1]; gd=poly2tfd(num2,den2,delt1,delay2); delt2=7; nout2=1; dplant=tfd2step(tfinal,delt2,nout2,gd); % % Calculate the MPC controller gain matrix for % No plant/model mismatch, % Output Weight=1, Input Weight=0 % Input Horizon=5, Output Horizon=20 model=plant; ywt=1; uwt=0;
2 MPC Based on Step Response Models M5;P=20; Kmpcl=mpccon(model, ywt, uwt, M P Si mul ate and plot response for unmeasured and measured step di turbance through dpl ant tend=245 r=[|; usat=[ ]: filter=[ I dmodel=[1 dstep=1 lyl, ul]=mpcsi m(pl ant, model, Kmpcl, tend, r, usat, filter, d dpl ant, dmodel, dstep) el =dpl ant: measured di turbance Ly2, u2]=mpcsi m(pl ant, model, Kmpcl, tend, r, usat, filter, dpl ant, dmodel, dstep pl otall(lyl, y2], [ul, u2], del t2); pause; Perfect rej ecti on for measured di turbance case. Outputs Manipulated Variables Time Cal cul ate a new MPC controller gai n matrix for No pl ant/model mi smatch, ut put Wei ght=l, Input Wei ght=10 2-14
2 MPC Based on Step Response Models 2-14 M=5; P=20; Kmpc1=mpccon(model,ywt,uwt,M,P); % % Simulate and plot response for unmeasured and measured % step disturbance through dplant. tend=245; r=[ ]; usat=[ ]; tfilter=[ ]; dmodel=[ ]; dstep=1; [y1,u1]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); dmodel=dplant; % measured disturbance [y2,u2]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); plotall([y1,y2],[u1,u2],delt2); pause; % Perfect rejection for measured disturbance case. % % Calculate a new MPC controller gain matrix for % No plant/model mismatch, % Output Weight=1, Input Weight=10 0 50 100 150 200 250 0 0.2 0.4 0.6 0.8 1 Outputs Time 0 50 100 150 200 250 −0.7 −0.6 −0.5 −0.4 −0.3 −0.2 −0.1 0 Manipulated Variables Time
Unconstrained Model predictive Control % Input Hori zon=5, Out put Hori zon=20 model =plant ywt=l; uwt=10 M5;P=20; mpc2=mpccon(model, ywt, uwt, M P) Simul ate and pl ot response for unmeasured and measured step di turbance through dpl ant 1: filter=[ dmodel=[ 1; ly3, u3]=mpcsi m(pl ant, model, Kmpc2, tend, r, usat, filter, dpl ant, dmodel, dstep) dmodel =dpl ant; % measured di turbance ly4, u4=mpcsi m(pl ant, model, Kmpc2, tend, r, usat, filter, pl tall(ly3, y4],[u3, u4 2-15
Unconstrained Model Predictive Control 2-15 % Input Horizon=5, Output Horizon=20 model=plant; ywt=1; uwt=10; M=5; P=20; mpc2=mpccon(model,ywt,uwt,M,P); % % Simulate and plot response for unmeasured and measured % step disturbance through dplant. tend=245; r=[ ]; usat=[ ]; tfilter=[ ]; dmodel=[ ]; dstep=1; [y3,u3]=mpcsim(plant,model,Kmpc2,tend,r,usat,tfilter,... dplant,dmodel,dstep); dmodel=dplant; % measured disturbance [y4,u4]=mpcsim(plant,model,Kmpc2,tend,r,usat,tfilter,... dplant,dmodel,dstep); plotall([y3,y4],[u3,u4],delt2); pause; 0 50 100 150 200 250 −0.2 0 0.2 0.4 0.6 0.8 1 1.2 Outputs Time 0 50 100 150 200 250 −0.35 −0.3 −0.25 −0.2 −0.15 −0.1 −0.05 0 Manipulated Variables Time
2 PC Based on step re Models % Simul ate and plot response for unmeasured step di turbance through dpl ant wi th uwt=( wi th and wi thout noi se filtering filter=[ I pl ant, model, Kmpcl filter=20: noi se fi l teri ng time constant =20 ly6, u6]=mpcsi m(pl ant, model, Kmpcl, tend, r, usat, filter, dpl ant, dmodel, dstep) pl tall(ly5, y6],[u5, u6]
2 MPC Based on Step Response Models 2-16 % % Simulate and plot response for unmeasured % step disturbance through dplant with uwt=0, % with and without noise filtering. tend=245; r=[ ]; usat=[ ]; dmodel=[ ]; tfilter=[ ]; dstep=1; [y5,u5]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); tfilter=20; % noise filtering time constant=20 [y6,u6]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); plotall([y5,y6],[u5,u6],delt2); pause; 0 50 100 150 200 250 0 0.2 0.4 0.6 0.8 1 Outputs Time 0 50 100 150 200 250 −0.7 −0.6 −0.5 −0.4 −0.3 −0.2 −0.1 0 Manipulated Variables Time
Unconstrained Model predictive Control % Simul ate and pl ot response for unmeasured step di stur bance through dpl ant wi th uwt=O, wi th and wi t hout unmeasured di sturbance time constant bei ng speci fied tend=245 r=[ ] usat=[ ]; dmodel=[ I filter=[ dstep=1 ly7, u7]=mpcsi m(pl ant, model, Kmpcl, tend, r, usat, filter dpl ant, dmodel, dstep); filter=[ 0: 25: unmeasured di turbance time constant ly8, u8]=mpcsi m(pl ant, model, Kmpcl, tend, r, usat, filter, dpl ant, dmodel, dstep) plotall(ly7, y8],[u7, u8]. del t2) Outputs Manipulated Variables 2-17
Unconstrained Model Predictive Control 2-17 % % Simulate and plot response for unmeasured % step disturbance through dplant with uwt=0, % with and without unmeasured disturbance time constant % being specified. tend=245; r=[ ]; usat=[ ]; dmodel=[ ]; tfilter=[ ]; dstep=1; [y7,u7]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); tfilter=[0;25]; % unmeasured disturbance time constant=25 [y8,u8]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,... dplant,dmodel,dstep); plotall([y7,y8],[u7,u8],delt2); pause; 0 50 100 150 200 250 0 0.2 0.4 0.6 0.8 1 Outputs Time 0 50 100 150 200 250 −1.5 −1 −0.5 0 Manipulated Variables Time