%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   slug_3D_linearize.m
%
%   Script for linearizing the simplified slug model made as 
%   an aid in tuning the model
%
%   Written by :    Espen Storkaas (espen.storkaas@chemeng.ntnu.no)
%   Date:           08.10.02
%   
%   For questions, comments or documentation, contact author
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
global data 
% Inputs for initialization
mG_in=0.362;
mL_in=8.64;
z=0.13;
P1_stasj=71.7e5;
h1_stasj=0.1;
P2_stasj=53.5e5;
gen_data
%Initialization
[x0,y_stasj,data]=initialize(z,mG_in,mL_in,P1_stasj,h1_stasj,P2_stasj);
if ~isreal(y_stasj);
    disp('something is wrong')
end
u=[z;mG_in;mL_in];
%Linearizing
[A,B,C,D]=linearize(@slug_3D_lin,[],x0(1:3),[],u);
%Computing poles
disp('Poles')
disp(eig(A)')