% Parameters

% Number of stages (including reboiler and total condenser: 
NT = 41; 

% Location of feed stage (stages are counted from the bottom):
NF = 21;

% Relative volatilities: alpha = [alpha1 alpha2...alphaNC]
alpha = [2.0 1.5 1.0]; %We want a three-component system here!

% Number of components
NC = length(alpha);

% Parameters for Franci's Weir Formula L(i) = K*Mow(i)^1.5
Kuf = 21.65032;         % Constant above feed
Kbf = 29.65032;         % Constant below feed
Muw = 0.25;             % Liquid holdup under weir (kmol)

% Prices
% pV  = 0.1;
% pF  = 10;
% pD  = 20;
% pB1 = 10;
% pB2 = 20;

% Maximum and minimum boilup: Maximum is to avoid flooding and minimum is
% to allow for basic column operation. Moreover, with a minimum boilup, it
% is possible to minimize energy use only, i.e. J = VB, since without VBmin
% J would be always 0 (zero) with the mole fraction constraint on xD always
% satisfied. This is because there will be always liquid level in the last 
% tray (or reflux drum) with the given specification.
% VBmax = 10;
% VBmin = 0.01;

% Input data (bias)
% Fbias  = 1.0;
% qFbias = 1.0;
% zFbias = [0 0.5 0.5 0];
% LTbias = 2.70629;
% VBbias = 3.20629;
% Dbias  = 0.5;
% Bbias  = 0.5;

% Output data (bias)
% load steadystate % y0
% xbias = y0(1:(NC-1)*NT);
% Mbias = y0((NC-1)*NT+1:NC*NT);
% Iu    = reshape(1:(NC-1)*NT,NT,NC-1);
% xbias = xbias(Iu);
% ybias = [xbias(NT,:) xbias(1,:) Mbias(NT) Mbias(1)];

% P-controllers for control of reboiler and condenser hold up.
KcB = 10;  KcD = 10;                     % controller gains
MDs = 0.5; MBs = 0.5;                    % Nominal holdups - these are rather small  
Ds  = 0.5; Bs  = 0.5;                    % Nominal flows
LT0_1=2.3436;                          % Nominal reflux, column 1
VB0_1=2.7576;                          % Nominal boilup, column 1
LT0_2=1.3542;                          % Reflux
VB0_2=1.5344;                          % Boilup

KcL1 = -25 ; KcV1 = -25 ; %Controller gain for composition controllers
tauiL1 = 75 ; tauiV1 = 75; %Integral time for composition controllers

KcL2 = -10 ; KcV2 = -10.0 ; %Controller gain for composition controllers
tauiL2 = 25 ; tauiV2 = 10 ; %Integral time for composition controllers
