%%Three Product Petlyuk Column
%Constant Relative Voltality
% Initializes the model and runs
%%
clear all; close all; clc;
global coldata dyndata hydraulic termodata UU alfa tend NI
%% COLUMN DATA %%

% Number of stages
coldata.Nt = [20 20 20 20 20 20];
% Initial holdup stages
coldata.M0 = [1 1 1 1 1 1 1 1 1 1 1 1];
termodata.P = 1.0;
hydraulic.k1 = 1/0.063;
%% THERMODYNAMIC DATA %%
alfa=[4.215374389	2.102194688	1] %ethanol propanol butanol

%% load nominal x u
load Nominal
UU=[];
i=0;
indmat_Yes_S1
dyndata.x_nom = x_nom;
dyndata.u_nom=u_nom;
%%
NI=8; % Number of integerators
options = odeset('MaxStep',10)
tend=20000
[t,x]=ode15s(@CS2,[0 tend],[zeros(NI,1);dyndata.x_nom],options);
%%
xf=x(end,NI+1:end)';
u_nom=UU(end,2:12)';
dxdt = norm(Petlyuk_dxdt(0,[u_nom; xf]))
Plot_Profiles