Step Response Models The MPC Toolbox stores step response models in the following format s2 1)0 0 nout(2) 0 0 0 ( +2)×n where del t2 is the sampling time and the vector nout indicates if a particular utput is integrating or not nout(i)=0 if output i is integrating nout(i)= 1 if output i is stable The step response can be obtained directly from identification experiments, or generated from a continuous or discrete transfer function or state-space model. For example, if the discrete system description(sampling time T=0. 1)is yk)=-05y(k-1)+Wk-3) then the transfer function is g(2)=.2
Step Response Models 2-3 The MPC Toolbox stores step response models in the following format: where delt2 is the sampling time and the vector nout indicates if a particular output is integrating or not: nout(i) = 0 if output i is integrating. nout(i) = 1 if output i is stable. The step response can be obtained directly from identification experiments, or generated from a continuous or discrete transfer function or state-space model. For example, if the discrete system description (sampling time T = 0.1) is y(k) = –0.5y(k – 1) + v(k – 3) then the transfer function is plant S1 S2 Sn nout(1) 0 … 0 nout(2) 0 … 0 nout n y ( ) 0 … 0 ny 0 … 0 delt2 0 … 0 n ny ( ) ⋅ + + ny 2 × nv = … … … … g z( ) z –3 1 0.5z –1 + = --------------------------
2 MPC Based on Step Response Models The following commands(see mpctut. m) generate the step response model for this system and plot it del ay 2 g= pol y2tfd(num, den, del tl, del ay) Set up the model in tf format del t2= del t1 out pl ant tfd2step(tfi nal, del t2, nout, g) % Cal cul ate pl otstep(pl ant)% Plot the step response
2 MPC Based on Step Response Models 2-4 The following commands (see mpctut.m) generate the step response model for this system and plot it: num = 1; den = [1 0.5]; delt1 = 0.1; delay = 2; g = poly2tfd(num,den,delt1,delay); % Set up the model in tf format tfinal = 1.6; delt2 = delt1; nout = 1; plant = tfd2step(tfinal,delt2,nout,g); % Calculate the step response plotstep(plant) % Plot the step response 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 u1 step response : y1 TIME
Alternatively, we could first generate a state-space description applying the command tf2ss and then generate the step response with ss2step In this case,we need to pad the numerator and denominator polynomials to account for the time delay num=[000 num [den 00] Iphi, gam, c, d]= tf2ss(num, den); Convert to state-space pl ant ss2step(phi, gam, c, d, tfinal, del tl, del t2, nout); Cal cul ate step response Thi s is a matrix in MPC Step format sampl i ng time=0. 1 number of out puts=1 number of step response coefficients= 16 All outputs are stable
Step Response Models 2-5 Alternatively, we could first generate a state-space description applying the command tf2ss and then generate the step response with ss2step. In this case, we need to pad the numerator and denominator polynomials to account for the time delay. num = [0 0 0 num]; den = [den 0 0]; [phi,gam,c,d] = tf2ss(num,den); % Convert to state-space plant = ss2step(phi,gam,c,d,tfinal,delt1,delt2,nout); % Calculate step response We can get some information on the contents of a matrix in the MPC Toolbox via the command mpcinfo. For our example, mpcinfo(plant) returns: This is a matrix in MPC Step format. sampling time = 0.1 number of inputs = 1 number of outputs = 1 number of step response coefficients = 16 All outputs are stable
2 MPC Based on Step Response Models Model ldentification The identification routines available in the MPC Toolbox are designed for multi-input single-output(MISO)systems. Based on a historical record of the output y A) and the inputs t1(k);v2(4),……,Vn(4) v1(1)v2(1) v1(2)v2(2) = v1(3)V2(3) the step response coefficient 1,1",2,1 5.252251.n,2 are estimated For the estimation of the step response coefficients we write the SISO model in the form △y(k) where △y(A)=y(k)-y(k Si-si 2-6
2 MPC Based on Step Response Models 2-6 Model Identification The identification routines available in the MPC Toolbox are designed for multi-input single-output (MISO) systems. Based on a historical record of the output yl (k) and the inputs v1(k); v2(k), . . . , (k), the step response coefficients are estimated. For the estimation of the step response coefficients we write the SISO model in the form where ∆y(k) = y(k) – y(k – 1) and hi = si – si – 1 vnv yyl yl ( ) 1 yl ( ) 2 yl ( ) 3 = … v v1( ) 1 v2() … 1 vnv ( ) 1 v1( ) 2 v2() … 2 vnv ( ) 2 v1( ) 3 v2() … 3 vnv ( ) 3 = … … s l, , 1 1 s l, , 2 1 … s l, , nv 1 s l, , 1 2 s l, , 2 2 … s l, , nv 2 s l, , 1 i s l, , 2 i … sl nv … … , , … i … ∆y k( ) hi ∆v( ) k i – i = 1 n =
Model ldentification h are the impulse response coefficients. This model allows the designer to present all the input (v) and output() information in deviation form, which is often desirable. If the particular output is integrating, then the model △y(k))=△hAvk-n where △(△y(k)=△y(k)-△y(k-1) h-1 should be used to estimate Ah, and thus h; and si are given by h;=∑△hk ∑b=∑∑△hk For parameter estimation it is usually recommended to scale all the variables such that they are the same order of magnitude. This may be done via the MPC Toolbox functions autosc or scal. Then the data has to be arranged into the where Y contains all the output information(Ayk) for stable and A(Ayk) for integrating outputs)and Xall the input information(AMk)) appropriately arranged. e is a vector including all the parameters to be estimated(h, for table and Ah, for integrating outputs ). This rearrangement of the input and output information is handled by wrtreg. The parameters e can be estimated via multivariable least squares regression(mI r)or partial least squares(pl sr) Finally, the step response model is generated from the impulse respons coefficients via i mp2step. The following example(see mpctutid)illustrates this procedure 2-7
Model Identification 2-7 hi are the impulse response coefficients. This model allows the designer to present all the input (v) and output(yl ) information in deviation form, which is often desirable. If the particular output is integrating, then the model where ∆(∆y(k)) = ∆y(k) – ∆y(k – 1) ∆hi = hi – hi – 1 should be used to estimate ∆hi, and thus hi and si are given by For parameter estimation it is usually recommended to scale all the variables such that they are the same order of magnitude. This may be done via the MPC Toolbox functions autosc or scal. Then the data has to be arranged into the form Y = XΘ where Y contains all the output information (∆y(k) for stable and ∆(∆y(k)) for integrating outputs) and X all the input information (∆v(k)) appropriately arranged. Θ is a vector including all the parameters to be estimated (hi for stable and ∆hi for integrating outputs). This rearrangement of the input and output information is handled by wrtreg. The parameters Θ can be estimated via multivariable least squares regression (mlr) or partial least squares (plsr). Finally, the step response model is generated from the impulse response coefficients via imp2step. The following example (see mpctutid) illustrates this procedure. ∆ ∆() ∆ y k( ) hi ∆v( ) k i – i = 1 n = hi ∆hk k = 1 i = si hj j = 1 i ∆hk k = 1 j j = 1 i = =