global data 
%% Inputs for initialization
uL=2.39; %vannmengde inn l/min
uG=1.58; %luftmengde inn l/min
P_feed=1.325;
z=0.19;
uLs=uL/1000/60/pi/(0.0195/2)^2;
P1_stasj=1.133;
h1_stasj=0.019/2*0.6;
P2_stasj=1.036;
P0=1.013; %Bar
temp=293;


Ml=28.84/1000; %Molarmasse luft [kg/mol]
uLs=uL/1000/60/pi/(0.0195/2)^2; %Water rate (m/S)  %må endres
R=0.08205783*1.013; %l bar K^-1 mol^-1
rho_in= P1_stasj*Ml/R/temp;   %[kg/l]
mG_in= rho_in*uG/60; %(6.1717e-5)*1.5; % [kg/s] Endres 


%% Nominal Initialization
[x0,y_stasj,data]=initialize(z,mG_in,P1_stasj,h1_stasj,P2_stasj,P0,P_feed,uLs);

%% Defining operating point
load Stationary
OPz=1;
index=find(abs(z-OPz)==min(abs(z-OPz)));
P1(index);
u=[z(index);mG_in;P_feed;P0];
%u=[z(index);mG_in;P_feed;P0/1e5];
%Linearizing
[A,B,C,D,E,F]=Linearize(@slug_3D_lin,[],xs(1:3,index),[],u(1),u(2:4));
G=ss(A,B,C,D);
Gd=ss(A,E,C,F);
poles=pole(G)
for i=1:5
    zeros=zero(G(i))
end

