% MKDELTA Make additive perturbation for Shell fractionator case-study
%
% For use with 'Predictive Control with Constraints' by J.M.Maciejowski,
% (Prentice-Hall 2001), Chapter 9. See section 9.1.6.
%
% This script file creates the system W(z) as an LTI object 'Wd'
% in transfer function form in the workspace.
% If P0(z) is the nominal model and P(z) is the actual transfer function of
% the fractionator, then P(z)=P0(z)+W(z)*Delta, where ||Delta|| < 1.
%
% A sampling interval Ts = 4 minutes is assumed.

% Copyright (C) J.M.Maciejowski, 9  August 2001.
% All Rights Reserved.

%%% Continuous-time perturbation (from Tables 9.2 and 9.4):
% Output 1:
w11=tf(2.11,[50,1]);
w12=tf(0.39,[60,1]);
w13=tf(0.59,[50,1]);
% Output 2:
w21=tf(3.29,[50,1]);
w22=tf(0.57,[60,1]);
w23=tf(0.89,[40,1]);
% Output 3:
w31=tf(3.11,[33,1]);
w32=tf(0.73,[44,1]);
w33=tf(1.33,[19,1]);

% Now put them together into a 3x3 multivariable model:
Wc = tf([w11,w12,w13 ; w21,w22,w23 ; w31,w32,w33]);

% Insert delays (from Table 9.2):
set(Wc,'ioDelayMatrix',[27,28,27; 18,14,15; 20,22,0]);

% Convert to discrete time:
Wd = c2d(Wc,4);  % Ts=4 minutes
Wd = delay2z(Wd); % include delays

% End of MKDELTA