% **************************************************************************
% CASCADE-FEEDFORWARD CONTROL SIMULATOR 
% COPYRIGHT (C) 1994, T.E. MARLIN
%
% FILENAME : CFFDAT.M
% WRITTEN BY : F.BOUDREAU
% VERSION : 2.0
% LAST UPDATED : NOVEMBER  1994
% DESCRIPTION OF FILE :
%    EXTERNAL DATA FILE CALLED BY MAIN MENU (CFF.M).
%    THIS FILE SHOULD BE USED AS A TEMPLATE FOR DEFINING DEFAULT
%    PARAMETER VALUES AND SETTINGS FOR THE SIMULATOR. IT ALSO
%    CONTAINS SETTINGS THAT CANNOT BE CHANGED FROM WITHIN THE
%    SIMULATOR MENUS (E.G. MEASUREMENT NOISE DEFINITION).
% ALL FILES IN THIS PACKAGE :
%    FB_FF   .M  - MAIN MENU AND ENTRY POINT
%    CFFDAT  .M  - EXTERNAL DATA FILE
%    CFFGRAPH.M  - PLOTS SIMULATION RESULTS
%    CFFM1   .M  - MENU FOR PROCESS T.F. EDITING
%    CFFM2   .M  - MENU FOR PID TUNING
%    CFFM3   .M  - MENU FOR DISTURBANCE T.F. EDITING
%    CFFMFF  .M  - FEEDFORWARD CONTROLLER MENU
%    CFFMSIM .M  - SIMULATION OPTIONS MENU
%    CFFNAME .M  - MENU FOR VARIABLES NAMES, INITIAL VALUES, BOUNDS
%    CFFSIM  .M  - EXECUTES SIMULATION
% **************************************************************************

% PROCESS INFORMATION
% ----------------------------------
% ELEMENTS IN POSITION 1 ARE ASSOCIATED WITH PRIMARY LOOP,
% AND 2 WITH SECONDARY LOOP
K = [ 1  1] ;                   % PROCESS GAIN
D = [20.0 2.0];                 %  " DEAD TIME
TA = [0.0 0.0];                 %  " NUMERATOR TERM
T1 = [15.0 5.0];                %  " 1ST TIME CONSTANT
T2 = [0.0 0.0];                 %  " 2ND TIME CONSTANT
Yinit = [.0 .0];                %  " INITIAL VALUE

% CONTROLLER INFORMATION
% ----------------------
% ELEMENTS IN POSITION 1 ARE ASSOCIATED WITH PRIMARY LOOP,
% AND 2 WITH SECONDARY LOOP
KC = [0 0];                     % PID CONTROLLER GAIN
TI = [0 0];                     %  " INTEGRAL TIME
TD = [0.0 0.0];                 %  " DERIVATIVE TIME
maxC = [100 100.0];             %  " MAXIMUM CONTROL ACTIONS ALLOWED 
minC = [-100.0 -100.0];             %  " MINIMUM CONTROL ACTIONS ALLOWED 
SP_PRC = [0.0 0.0];             %  " SET-PT FOR PROCESS REACTION CURVE
MVinit = 0.0;                  % MANIPULATED VARIABLE INITIAL VALUE
Kff = 0;                     % FF CONTROLLER GAIN
Dff = 0;                       %  " DEAD TIME
Tld = 10;                       %  " LEAD TIME (NUMERATOR CONST.)
Tlg = 10;                      %  " LAG TIME (DENOMINATOR CONST.)
CASCADE = 0;                    % 0 = SINGLE-LOOP; 1 = CASCADE
PRC = 0;                        % 0 = NO PRC; 2 = INNER; 1 = OUTER

% DISTURBANCE TRANSFER FUNCTIONS
% ------------------------------
% ELEMENTS IN POSITION 1 ARE ASSOCIATED WITH PRIMARY LOOP,
% AND 2 WITH SECONDARY LOOP
Kd = [1 1.0];                   % DISTURBANCE GAIN
Dd = [30.0 0.0];                %  " DEAD TIME
TAd = [0.0 0.0];                %  " NUMERATOR TERM (LEAD)
T1d = [30.0 5.0];               %  " 1ST TIME CONSTANT (LAG)
T2d = [0.0 0.0];                %  " 2ND TIME CONSTANT (LAG)
Dinit = [0.0 0.0];              %  " INITIAL VALUE

% VARIABLE NAMES
% --------------
MVnam = 'MV' ;                  % MANIPULATED VARIABLE
Y1nam = 'CV1';                  % PRIMARY CONTROLLED VARIABLE
Y2nam = 'CV2';                   % SECONDARY CONTROLLED VARIABLE
D1nam = 'D1' ;                   % PRIMARY LOOP DISTURBANCE
D2nam = 'D2' ;                   % SECONDARY LOOP DISTURBANCE

% SIMULATION PARAMETERS
% ---------------------
tstart = 0.0;                   % SIMULATION STARTING TIME              
tstep = 1.0;                    % TIME STEP
tend = 300.0;                   % SIMULATION ENDING TIME
maxit = 7000;                   % MAX NO OF ITERATIONS ALLOWED
EXECUTION = 0;                  % INITIAL SETTING SHOULD BE LEFT AS ZERO

% PRIMARY SET-POINT INFORMATION
% -----------------------------
% NOTE : The time to introduce S-P change is specified as a percentage
% of the total simulation length (tend-start).  It cannot be modified
% from within the menus.
% NOTE : The time of step specified here is also used for generating
% process reaction curves.
SPtstep = 5;                    % % of TIME TO INTRODUCE S-P STEP CHANGE
SPdelta = 0.0;                  % STEP MAGNITUDE

% STEPS IN DISTURBANCES
% ---------------------
% ELEMENTS IN POSITION 1 ARE ASSOCIATED WITH PRIMARY LOOP,
% AND 2 WITH SECONDARY LOOP
% NOTE!! : The time to introduce step changes is specified as a percentage
% of the total simulation length (tend-start).  It cannot be modified
% from within the menus.
Dtstep = [15.0 15.0]./300.*100; % TIME OF STEP
Ddelta = [0.0 -10.0];           % MAGNITUDE OF STEP

% NOISE CHARACTERISTICS
% ---------------------
% MEASUREMENT ERRORS ARE DEFINED AS 2ND ORDER AUTO-REGRESSIVE
% TIME-SERIES SUCH AS (1-d1*B-d2*B)*N(t) = a(t);
% For each noise sequence, specify d1,d2, the variance of a(t),
% and an integer seed for the random numbers generator.
NOISE = 0;                      % 0 = noise off; 1 = noise on
% MEASUREMENT ERROR ON THE (MEASURED) PRIMARY DISTURBANCE, D1:
dD1 = [0.5 0.0];                % d1 and d2
SaD1 = 0.001;                   % variance of a(t)
SeedD1 = 0;                     % seed
% MEASUREMENT ERROR ON THE PRIMARY CONTROLLED VARIABLE, Y1:
dY1 = [0.5 0.0];                % d1 and d2
SaY1 = 0.001;                   % variance of a(t)
SeedY1 = 0;                     % seed
% MEASUREMENT ERROR ON THE SECONDARY CONTROLLED VARIABLE, Y2:
dY2 = [0.5 0.0];                % d1 and d2
SaY2 = 0.001;                   % variance of a(t)
SeedY2 = 0;                     % seed
