CHAPTER 4

image

Robust Predictive Control

Predictive Control Strategies: The Model Predictive Control Toolbox

The Model Predictive Control Toolbox is a complete set of tools which can be used to implement model predictive control strategies. Model predictive control strategies are often used in chemical engineering and in other industries.

The most important characteristics of this toolbox are:

  • Modeling, identification and validation.
  • Support for MISO, MIMO, step response and state-space models.
  • Analysis of systems.
  • Conversion between state-space, transfer function and step response models.

Model predictive control approximates a linear dynamic plant model to predict future changes and the effect of manipulating variables. The online optimization problem is formulated as a quadratic program which is resolved repeatedly using the most recent measurements.

The Model Predictive Control Toolbox includes more than 50 specialized MATLAB functions which help you to design, analze and simulate dynamical systems using a model predictive control approach. The toolbox supports finite step (or impulse) response, discrete and continuous-time transfer function and state-space formats. The toolbox handles non-square systems and supports a wide variety of state estimation techniques. Simulation tools test systems response with or without restrictions. For the identification of models, the toolbox has an interface that makes it easy to use models developed using the system identification toolbox.

ID Commands

[mx, ax, stdx] = autosc (x)

sx = scal(x,mx)

sx = scal(x,mx,stdx)

rx = rescal(x,mx)

rx = rescal(x,mx,stdx)

Scales an input matrix or vector x by its column means (mx) and standard deviations (stdx) automatically and outputs mx and stdx as options. By using scal, the input can also be scaled by some specified means and/or standard deviations. rescal converts scaled data back to the original data.

plant = imp2step(delt,nout,theta1,

theta2,…,  theta25)

Builds a MIMO (multi-input multi-output) model in MPC step format. Each thetai is an n×m matrix corresponding to the impulse response coefficients for output i. n is the number of the coefficients and m is the number of inputs. delt is the sampling interval used for obtaining the impulse response coefficients. nout is the output stability indicator.

[theta, yres] = mlr (xreg, yreg, ninput)

[theta, yres] = mlr (xreg yreg, ninput, plotopt,

wtheta, wdeltheta)

Determines impulse response coefficients for a multi-input single-output system via Multivariable Least Squares Regression or Ridge Regression. xreg and yreg are the input matrix and output vector produced by routines such as wrtreg. ninput is number of inputs. Least Squares is used to determine the impulse response coefficient matrix,theta. Columns of theta correspond to impulse response coefficients from each input. Optional output yres is the vector of residuals, the difference between the actual outputs and the predicted outputs.

Optional inputs include plotopt, wtheta, and wdeltheta. No plot is produced if plotopt is equal to 0 which is the default; a plot of the actual output and the predicted output is produced ifplotopt=1; two plots -- plot of actual and predicted output, and plot of residuals -- are produced for plotopt=2. Penalties on the squares of theta and the changes in theta can be specified through the scalar weights wtheta and wdeltheta, respectively (defaults are 0).

[theta, yres, w, cw, ssqdif] = plsr(xreg,yreg,ninput,lv)

[theta, yres, w, cw, ssqdif] = plsr(xreg,yreg,ninput,lv, plotopt)

Determines the impulse response coefficients for a multi-input single-output system via Partial Least Squares (PLS).

yres = validmod (xreg, yreg, theta)

yres = validmod (xreg yreg, theta, plotopt)

Validates an impulse response model for a new set of data.

[xreg, yreg] = wrtreg (x, y, n)

Writes input and output data matrices for a multi-input single-output system so that they can be used in regression routines mlr and pls for determining impulse response coefficients.

Information Matrix Plotting Commands

mpcinfo(mat)

Returns information about the type and size of the matrix mat.

plotall(y,u) plotall(y,u,t)

Plots outputs and manipulated variables from a simulation. Input variables y and u are matrices of outputs and manipulated variables, respectively. (t = period).

plotfrsp(vmat)

plotfrsp(vmat,out,in)

Plots the frequency response generated by mod2frsp as a Bode plot. vmat is the array containing the data.

ploteach(y)

ploteach(y, u)

ploteach([ ], u)

ploteach(y, [], t)

ploteach([], u, t)

ploteach(y, u, t)

Plots outputs and manipulated variables from a simulation on separate graphs. Input variables y and u are matrices of outputs and manipulated variables, respectively. (t = period).

plotstep(plant)

plotstep(plant,opt)

Plots multiple step responses. plant is a step-response matrix in the MPC step format created by mod2step, ss2step or tfd2step. opt is an optional scalar or row vector that allows you to select the outputs to be plotted.

Model Conversion Commands

c2dmp

Converts a state-space model from continuous-time to discrete-time. (Equivalent to c2d in the Control System Toolbox)

[numd,dend] = cp2dp(num,den,delt)

[numd,dend] = cp2dp(num,den,delt,delay)

Converts a single-input-single-output, continuous-time transfer function in standard MATLAB polynomial form (including an optional time delay) to a sampled-data transfer function. (delt is the sampling period and delay is the time delay.)

d2cmp

Convertsa  state-space model from discrete-time to continuous-time. (Equivalent to d2c in the Control System Toolbox.)

newmod = mod2mod (oldmod, delt2)

Changes the sampling period of a model in MPC mod format. oldmod is the existing model in MPC mod format. delt2 is the new sampling period for the model.

[phi,gam,c,d] = mod2ss(mod)

[phi,gam,c,d,minfo] = mod2ss(mod)

Extracts the standard discrete-time state-space matrices and other information from a model stored in the MPC mod format.

plant = mod2step(mod,tfinal)

[plant,dplant] = mod2step(mod,tfinal,delt2,nout)

Uses a model in the mod format to calculate the step response of a SISO or MIMO system in MPC step format.

g = poly2tfd(num,den)

g = poly2tfd(num,den,delt,delay)

Converts a transfer function (continuous or discrete) from the standard MATLAB poly format into the MPC tf format.

pmod = ss2mod(phi,gam,c,d)

pmod = ss2mod(phi,gam,c,d,minfo)

Converts a discrete-time state-space system model into the MPC mod format.

plant = ss2step(phi,gam,c,d,tfinal)

plant = ss2step(phi,gam,c,d,tfinal,delt1,delt2,nout)

Uses a model in state-space format to calculate the step response of a SISO or MIMO system, in MPC step format.

ss2tf2

Converts state-space model to transfer function. (Equivalent to ss2tf in the Control System Toolbox.)

tf2ssm

Converts a transfer function to a  state-space model. (Equivalent to t f 2ss in the Control System Toolbox.)

model = tfd2mod(delt2,ny,g1,g2,g3,…,g25)

Converts a transfer function (continuous or discrete) from the MPC tf format into the MPC mod format, converting to discrete time if necessary.

plant = tfd2step(tfinal,delt2,nout,g1)

plant = tfd2step(tfinal,delt2,nout,g1,…,g25)

Calculates the MIMO step response of a model in the MPC tf format. The resulting step response is in the MPC step format.

umod = th2mod(th)

[umod,emod] = th2mod(th1,th2,…,thN)

Converts a SISO or MISO model from the theta format (as used in the System Identification Toolbox) to one in the MPC mod format. Can also combine such models to form a MIMO system.

Model Building Commands - MPC Mod Format

model = addmd (pmod, dmod)

Adds one or more measured disturbances to a plant model in the MPC mod format.

pmod = addmod (mod1, mod2)

Combines two models in the MPC mod format such that the output of one combines with the manipulated inputs of the other.

model = addumd (pmod, dmod)

Adds one or more unmeasured disturbances to a plant model in MPC mod format.

pmod = appmod (mod1, mod2)

Appends two models to form a composite model that retains the inputs and outputs of the original models.

pmod = paramod (mod1, mod2)

Puts two models in parallel by connecting their outputs.

pmod = sermod (mod1, mod2)

Puts two models in series by connecting the output of one to the input of the other.

Control Design and Simulation Commands - MPC Step Format

yp = cmpc(plant,model,ywt,uwt,M,P,tend,r)

[yp,u,ym] = cmpc(plant,model,ywt,uwt,M,P,tend,...)

Simulates closed-loop systems with hard bounds on manipulated variables and/or outputs using models in the MPC step format. Solves the MPC optimization problem by quadratic programming.

[clmod] = mpccl(plant,model,Kmpc)

[clmod,cmod] = mpccl(plant,model,Kmpc,tfilter,…

dplant, dmodel)

Combines a plant model and a controller model in MPC step format, yielding a closed-loop system model in the MPC mod format.

KMPC = mpccon (model)

KMPC = mpccon (model, ywt uwt, M, P)

Calculates MPC controller gain using a model in MPC step format.

yp = mpcsim(plant,model,Kmpc,tend,r)

[yp,u,ym] = mpcsim(plant,model,Kmpc,tend,r,usat,…

tfilter, dplant, dmodel, dstep)

Simulates closed-loop systems with saturation constraints on the manipulated variables using models in the MPC step format.

nlcmpc

Model predictive controller for simulating closed-loop systems with hard bounds on manipulated variables and/or controlled variables using linear models in the MPC step format for nonlinear plants represented as Simulink S-functions.

nlmpcsim

Model predictive controller for simulating closed-loop systems with saturation constraints on the manipulated variables using linear models in the MPC step format for nonlinear plants represented as Simulink S-functions.

Control Design and Simulation Commands - MPC Mod Format

yp = scmpc(pmod,imod,ywt,uwt,M,P,tend,r)

[yp,u,ym] = scmpc(pmod,imod,ywt,uwt,M,P,tend, …

r,ulim,ylim,Kest,z,d,w,wu)

Simulates closed-loop systems with hard bounds on manipulated variables and/or outputs using models in the MPC mod format. Solves the MPC optimization problem by quadratic programming.

[clmod,cmod] = smpccl(pmod,imod,Ks)

[clmod,cmod] = smpccl(pmod,imod,Ks,Kest)

Combines a plant model and a controller model in the MPC mod format, yielding a closed-loop system model in the MPC format.

Ks = smpccon(imod)

Ks = smpccon(imod,ywt,uwt,M,P)

Calculates MPC controller gain using a model in MPC mod format.

[Kest] = smpcest(imod,Q,R)

Sets up a state-estimator gain matrix for use with MPC controller design and simulation routines using models in MPC mod format.

yp = smpcsim(pmod,imod,Ks,tend,r)

[yp,u,ym] = smpcsim(pmod,imod,Ks,tend,r,usat,…

Kest, z, d, w, wu)

Simulates closed-loop systems with saturation constraints on the manipulated variables using models in the MPC mod format.

Script Analysis Commands

frsp = mod2frsp(mod,freq)

[frsp,eyefrsp] = mod2frsp(mod,freq,out,in,balflg)

Calculates the complex frequency response of a system in MPC mod format.

g = smpcgain(mod)

poles = smpcpole(mod)

Calculates the steady-state gain matrix or poles for a system in the MPC mod format.

[sigma, omega] = svdfrsp (vmat)

Calculates the singular values of a varying matrix, for example, the frequency response generated by mod2frsp.

Robust Control Systems: The Robust Control Toolbox

The Robust Control Toolbox provides tools for the design and analysis of robust multivariate control systems. It includes systems in which it is possible to model errors, and dynamic systems with uncertain elements or with parameters that can vary during the life of the product. The powerful algorithms included in this toolbox allow you to run complex calculations, allowing for a large number of variations in the parameters.

The most important characteristics of this toolbox are:

  • H2 and H∞ control based on LQG (synthesis).
  • Multivariate frequency response.
  • Construction of state-space models.
  • Unique values based on model conversion.
  • Reduction of high-order models.
  • Spectral and inner-outer factorization.

Optional Data Structure System Commands

[b1,b2,…,bn] = branch(tr,PATH1,PATH2,…,PATHN)

Recovers the matrices packed in a mksys or tree variable selectively. The branches returned are determined by the paths  PATH1, PATH2,…, PATHN.

TR = graft(TR1,B)

TR = graft(TR1,B,NM)

Adds root branch B onto a tree variable TR1 (previously created by tree or mksys). If TR1 has N branches, then the numerical index of the new branch is N+1; and the numerical indices of other root branches are unchanged.

[i,TY,N] = issystem(S)

Returns a value for i of either 1 (true) or 0 (false) depending on whether or not the variable S is a system created by the function mksys. Also returned is the type of system TY and the number N of variable names associated with a system of type TY, except that if S is not a system then TY = [ ]; and N = 0.

[i] = istree(T)

[i,b] = istree(T,path)

Checks whether a variable T is a tree or not. When the second input argument path is present, the function istree checks the existence of the branch specified by path.

S = mksys(a,b,c,d)

S = mksys(v1,v2,v3,vn, TY)

Packs several matrices describing a system of type TY into a MATLAB variable S, under “standard” variable names determined by the value of the string TY.

T = tree(nm,b1,b2,bn)

Creates a tree data structure T containing several variables and their names.

[VARS,N] = vrsys(NAM)

Returns a string VARS and an integer N where VARS contains the list (separated by commas) of the N names of the matrices associated with a system described by the string name NAM.

Modeling Commands

[a,b1,b2,c1,c2,d11,d12,d21,d22] = …

augss(ag,bg,aw1,bw1,aw2,bw2,aw3,bw3) [a,b1,b2,c1,c2,d11,d12,d21,d22] = …

augss(ag,bg,aw1,bw1,aw2,bw2,aw3,bw3,w3poly)

[a,b1,b2,c1,c2,d11,d12,d21,d22] = …

augtf(ag,bg,cg,dg,w1,w2,w3)

[tss] = augss(ssg,ssw1,ssw2,ssw3,w3poly)

[tss] = augtf(ssg,w1,w2,w3)

[tss] = augss(ssg,ssw1,ssw2,ssw3)

State-space or transfer function plant augmentation for use in weighted mixed-sensitivity H2 and H design.

[acl,bcl,ccl,dcl] = interc(a,b,c,d,m,n,f)

[sscl] = interc(ss,m,n,f)

Multivariate general interconnection of systems.

Model Conversion Commands

[ab,bb,cb,db] = bilin(a,b,c,d,ver,type,aug)

[ssb] = bilin(ss,ver,type,aug)

Computes the effect on a system of the frequency-variable substitution

image

The variable ver is either 1 ( forward transform: s to z) or -1 (reverse transform: z to s) (S or z). The variable type denotes the type of bilinear transformation and can be  ‘BwdRec’ (backward rectangular), ‘FwdRec’ ( forward rectangular),  ‘S_Tust’ (shifted Tustin), ‘S_ftjw’ (shifted jω-axis, bilinear pole-shifting, continuous-time to continuous-time) or ‘G_Bilin’ (general bilinear, continuous-time to continuous-time). aug = [α,β,γ,δ].

[aa, bb, cc, dd] = des2ss(a,b,c,d,E,k)

[ss1] = des2ss (ss, E, k)

Converts a descriptor system into SVD state-space form.

[a,b1,b2,c1,c2,d11,d12,d21,d22] =

lftf(A,B1,B2,a,b1,b2,)

[aa,bb,cc,dd] =

lftf(a,b1,b2,c1,c2,d11,d12,d21,d22,aw,bw,cw,dw)

[aa,bb,cc,dd] =

lftf(aw,bw,cw,dw,a,b1,b2,c1,c2,d11,d12,d21,d22)

tss = lftf(tss1,tss2)

ss = lftf(tss1,ss2)

ss = lftf(ss1,tss2)

Two-port or one-port state-space linear fractional transformation.

[ag,bg1,dg22,at,bt1,dt21,dt22] = sectf(af,bf1,df22,secf,secg)

[ag,bg,cg,dg,at,bt1,dt21,dt22] = sectf(af,bf,cf,df,secf,secg)

[tssg,tsst] = sectf(tssf,secf,secg)

[ssg,tsst] = sectf(ssf,secf,secg)

State-space sector bilinear transformation.

[a1,b1,c1,d1,a2,b2,c2,d2,m] = stabproj(a,b,c,d)

[a1,b1,c1,d1,a2,b2,c2,d2] = slowfast(a,b,c,d,cut)

[ss1,ss2,m] = stabproj(ss)

[ss1,ss2] = slowfast(ss,cut)

Stable and antistable projection. Slow and fast modes decomposition.

[a,b,c,d] = tfm2ss(num,den,r,c)

[ss] = tfm2ss(tf,r,c)

Converts a transfer function matrix (MIMO) into state-space form.

Utility Commands

[p1,p2,lamp,perr,wellposed,p] = aresolv(a,q,r)

[p1,p2,lamp,perr,wellposed,p] = aresolv(a,q,r,Type)

[p1,p2,lamp,perr,wellposed,p] = daresolv(a,b,q,r)

[p1,p2,lamp,perr,wellposed,p] = daresolv(a,b,q,r,Type)

Solves the continuous generalized Riccati equation ATP + PAPRP + Q = 0 where P = p = p1/p2.

Solves the discrete generalized Riccati equation

ATPAPATPB(R + BTPB)− 1BTPA + Q = 0

where P = p + p2/p1 is the solution for which the eigenvalues of ARP are inside the unit disk.

[tot] = riccond(a,b,qrn,p1,p2)

[tot] = driccond(a,b,q,r,p1,p2)

Provides the condition numbers of the continuous Riccati equation.

Provides the condition numbers of the discrete Riccati equation.

[v,t,m] = blkrsch(a,Type,cut)

[v,t,m,swap] = cschur(a,Type)

Block ordered real Schur form.

Ordered complex Schur form via complex Givens rotation.

Commands for Bode Multivariate Graphics

[cg, ph, w] = cgloci (a, b, c, d(,Ts))  [cg, ph, w] = cgloci (a, b, c, d(,Ts), ‘inv’)  [cg, ph, w] = cgloci (a, b, c, d(,Ts), w)  [cg, ph, w] = cgloci (a, b, c, d(,Ts), w, ‘inv’)[cg, ph, w] = cgloci (ss)

Continuous characteristic gain loci frequency response.

[cg, ph, w] = dcgloci (a, b, c, d(,Ts)) [cg, ph, w] = dcgloci (a, b, c, d(,Ts), ‘inv’) [cg, ph, w] = dcgloci (a, b, c, d(,Ts), w) [cg, ph, w] = dcgloci (a, b, c, d(,Ts), w, ‘inv’) [cg, ph, w] = dcgloci (ss)

Discrete characteristic gain loci frequency response.

[sv,w] = dsigma(a,b,c,d(,Ts))

[sv,w] = dsigma(a,b,c,d(,Ts),‘inv’)

[sv,w] = dsigma(a,b,c,d(,Ts),w)

[sv,w] = dsigma(a,b,c,d(,Ts),w,‘inv’)

[sv, w] = dsigma (ss…)

Computes the discrete version of the singular value Bode plot.

[sv,w] = sigma(a,b,c,d(,Ts))

[sv,w] = sigma(a,b,c,d(,Ts),‘inv’)

[sv,w] = sigma(a,b,c,d(,Ts),w)

[sv,w] = sigma(a,b,c,d(,Ts),w,‘inv’)

[sv, w] = sigma (ss…)

Computes the singular value Bode plot.

[mu,ascaled,logm,x] = muopt(a)

[mu,ascaled,logm,x] = muopt(a,k)

Computes an upper bound on the structured singular value using the multiplier approach.

[mu,ascaled,logd] = osborne(a)

[mu,ascaled,logd] = osborne(a,k)

Computes an upper bound on the structured singular value via the Osborne method.

[mu] = perron (a)

[mu] = perron (a, k)

[mu,ascaled,logd] = psv(a)

[mu,ascaled,logd] = psv(a,k)

Computes an upper bound on the structured singular value via the Perron eigenvector method.

[mu,logd] = ssv(a,b,c,d,w)

[mu,logd] = ssv(a,b,c,d,w,k)

[mu,logd] = ssv(a,b,c,d,w,k,opt)

[mu,logd] = ssv(ss,)

Computes the structured singular value (multivariable stability margin) Bode plot.

EXERCISE 4-1

Given the double-input single-output model y(s) defined below, whose input and output data are in the mlrdat file, determine the standard deviation of the input data using the autoesc function and scale the input by its standard deviation only. Arrange the input and output data in a form which allows you to calculate the impulse response coefficients (35 coefficients) and find these coefficients using mlr. Finally, scale theta based on the standard deviation of the input, convert the model to MPC step format and plot the step response coefficients.

image

The following MATLAB syntax is used to generate the plots shown in Figure 4-1:

>> load mlrdat;
>> [ax, mx, stdx] = autosc (x);
>> mx = [0,0];
sx = scal(x,mx,stdx);
>> n = 35;
[xreg, yreg] = wrtreg (sx, y, n);
>> ninput = 2;
plotopt = 2;
[theta, yres] = mlr (xreg, yreg, ninput, plotopt);

The scaling of theta, model conversion and plotting of the step response coefficients (see Figure 4-2), with a sample time of 7 minutes to find the impulse, uses the following syntax:

>> theta = scal(theta,mx,stdx);
>> nout = 1;
delt = 7;
model = imp2step(delt,nout,theta);
>> plotstep (model)

EXERCISE 4-2

Convert the continuous-time transfer function model G(s) defined below to the corresponding MPC transfer function model. Perform the same task, assuming a delay of 2.5, and find the equivalent discrete transfer function.

The model G(s) without delay is defined as:

image

which is converted into transfer function format as follows:

>> g = poly2tfd(0.5*[3 -1],[5 2 1])

g =
         0    1.5000   -0.5000
    5.0000    2.0000    1.0000
         0         0         0

If there is a delay of 2.5 the model is represented as:

image

and the conversion to transfer function format is as follows:

>> g = poly2tfd(0.5*[3 -1],[5 2 1],0,2.5)

g =

         0    1.5000   -0.5000
    5.0000    2.0000    1.0000
         0    2.5000         0

To find the equivalent discrete transform function using a sampling period of 0.75 units, use the following syntax:

>> delt=0.75;
[numd,dend]=cp2dp(0.5*[3 -1],[5 2 1],delt,rem(2.5,delt))

numd =

0.1232 0 - 0.1106 - 0.0607

DEnd =

1.0000 - 1.6445 0.7408 0

EXERCISE 4-3

Given the following system build separate variables to create response models u and w with a sample time of  T = 3 and combine them to form a model of the complete system.

image

>> g11=poly2tfd(12.8,[16.7 1],0,1);
g21=poly2tfd(6.6,[10.9 1],0,7);
g12=poly2tfd(-18.9,[21.0 1],0,3);
g22=poly2tfd(-19.4,[14.4 1],0,3);
delt=3; ny=2;
umod=tfd2mod(delt,ny,g11,g21,g12,g22);
gw1=poly2tfd(3.8,[14.9 1],0,8);
gw2=poly2tfd(4.9,[13.2 1],0,3);
wmod=tfd2mod(delt,ny,gw1,gw2);
pmod=addumd(umod,wmod)

pmod =

Columns 1 through 14

3.0000 13.0000  2.0000       0  1.0000  2.0000      0       0      0      0       0         0      0       0
NaN     1.5950 -0.6345       0       0       0      0       0      0      0       0         0      0       0
0       1.0000       0       0       0       0      0       0      0      0       0         0      0       0
0            0  1.0000       0       0       0      0       0      0      0       0         0      0       0
0            0       0  1.0000       0       0      0       0      0      0       0         0      0       0
0            0       0       0  1.0000       0      0       0      0      0       0         0      0       0
0            0       0       0       0       0 1.6788 -0.7038      0      0       0         0      0       0
0            0       0       0       0       0 1.0000       0      0      0       0         0      0       0
0            0       0       0       0       0      0  1.0000      0      0       0         0      0       0
0            0       0       0       0       0      0       0      0 1.6143 -0.6514         0      0       0
0            0       0       0       0       0      0       0      0 1.0000       0         0      0       0
0            0       0       0       0       0      0       0      0      0  1.0000         0      0       0
0            0       0       0       0       0      0       0      0      0       0    1.0000      0       0
0            0       0       0       0       0      0       0      0      0       0         0 1.0000       0
0       1.4447 -0.4371 -0.5012       0       0      0 -2.5160 2.0428      0       0    0.2467 0.2498 -0.3556
0            0       0  1.1064 -0.4429 -0.4024      0 -3.6484 3.1627      0  0.9962   -0.8145      0       0

Columns 15 through 17

0         0         0
1.0000    0         0
0         0         0
0         0         0
0         0         0
0         0         0
0    1.0000         0
0         0         0
0         0         0
0         0    1.0000
0         0         0
0         0         0
0         0         0
0         0         0
0         0         0
0         0         0

EXERCISE 4-4

For the following system build individual variables to form the transfer function model and calculate and plot its MIMO step response.

image

The following syntax is used to create the graph shown in Figure 4-3:

>> g11=poly2tfd(12.8,[16.7 1],0,1);
g21=poly2tfd(6.6,[10.9 1],0,7);
g12=poly2tfd(-18.9,[21.0 1],0,3);
g22=poly2tfd(-19.4,[14.4 1],0,3);
delt=3; ny=2; tfinal=90;
plant=tfd2step(tfinal,delt,ny,g11,g21,g12,g22,gw1,gw2);
plotstep(plant)

Percent error in the last step response coefficient
of output yi for input uj is :
0.48% 1.6% 0.41%
0.049% 0.24% 0.14%

EXERCISE 4-5

For the linear system described in the previous problem,  measure the effect of setting a limit of 0.1 in the exchange rate and a minimum of − 0.15 for u2 and u1. Then apply a lower limit of zero for both outputs.

We build the model using the following syntax:

>> g11=poly2tfd(12.8,[16.7 1],0,1);
g21=poly2tfd(6.6,[10.9 1],0,7);
g12=poly2tfd(-18.9,[21.0 1],0,3);
g22=poly2tfd(-19.4,[14.4 1],0,3);
delt=3; ny=2; tfinal=90;
model=tfd2step(tfinal,delt,ny,g11,g21,g12,g22);
plant=model;
P=6;  M=2;  ywt=[ ]; uwt=[1 1];
tend=30;  r=[0 1];
Percent error in the last step response coefficient
of output yi for input uj is :
0.48% 1.6%
0.049% 0.24%

The effect of the restrictions can be seen using the following syntax (see Figure 4-4):

>> ulim=[-inf -0.15 inf inf 0.1 100];
ylim=[ ];
[y,u]=cmpc(plant,model,ywt,uwt,M,P,tend,r,ulim,ylim);
plotall(y,u,delt),pause

Time remaining 30/30
Time remaining 0/30
Simulation time is 0.03 seconds.

A lower limit of zero is applied to both outputs by using the following syntax (see Figure 4-5):

>> ulim=[-inf -0.15 inf inf 0.1 100];
ylim=[0 0 inf inf];
[y,u]=cmpc(plant,model,ywt,uwt,M,P,tend,r,ulim,ylim);
plotall(y,u,delt),pause

Time remaining 30/30
Time remaining 0/30
Simulation time is 0.03 seconds.

EXERCISE 4-6

For the linear system described in the previous exercises, design a controller for setting model parameters, calculate the closed loop of the system and check the poles for stability. Then create a graph of the frequency response of the sensitivity and complementary sensitivity and calculate and graph the singular values of the sensitivity.

>> g11=poly2tfd(12.8,[16.7 1],0,1);
g21=poly2tfd(6.6,[10.9 1],0,7);
g12=poly2tfd(-18.9,[21.0 1],0,3);
g22=poly2tfd(-19.4,[14.4 1],0,3);
delt=3; ny=2;
imod=tfd2mod(delt,ny,g11,g21,g12,g22);
pmod=imod;

>> P=6;.
M=2;
ywt=[ ];
uwt=[ ];
Ks=smpccon(imod,ywt,uwt,M,P);
>> clmod=smpccl(pmod,imod,Ks);
maxpole=max(abs(smpcpole(clmod)))

maxpole =

0.8869

The graphs of the frequency response of the sensitivity (Figure 4-6) and complementary sensitivity (Figure 4-7) are generated as follows:

>> freq = [-3,0,30];
in = [1:ny]; % input is r for comp. sensitivity
out = [1:ny]; % output is yp for comp. sensitivity
[frsp,eyefrsp] = mod2frsp(clmod,freq,out,in);
plotfrsp(eyefrsp); % Sensitivity
pause;

over estimated time to perform the frequency response: 0.61 sec

The syntax for the complementary sensitivity graph is as follows:

>> plotfrsp(frsp); % Complementary Sensitivity pause;

To calculate and graph the singular values for the sensitivity (see Figure 4-8) we use the following syntax:

>> [sigma, omega] = svdfrsp (eyefrsp);
CLG;
semilogx(omega,sigma);
title('Singular Values vs. Frequency');
xlabel('Frequency (radians/time)');
ylabel('Singular Values');

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset