function [y u x] = OLGA_get_measurement(var)
%Written by: Henrik Hjelseth Hansen, 27.01.2012

%% Valves, aka, controllers
u1_read=read(var.prod_choke);
u1=u1_read.Value; % Production Choke

%u2_read=read(var.gas_choke);
%u2=u2_read.Value; % Production Choke


%% Pressures
p_bh_read=read(var.p_bh);
p_bh=p_bh_read.Value; %Bottom Hole Pressure

p_tt_read=read(var.p_tt);
p_tt=p_tt_read.Value; %Tubing top pressure

p_at_read=read(var.p_at);
p_at=p_at_read.Value; %Top pressure in Annulus

p_ab_read=read(var.p_ab);
p_ab=p_ab_read.Value; %Annulus Pressure at injection Point

%% Flows and Liquid Volume Fraction
%rho_M_t_read=read(var.rho_M_t);
%rho_M_t=rho_M_t_read.Value; %Mixture Density in top of tubing

alpha_lt_read=read(var.alpha_lt);
alpha_lt=alpha_lt_read.Value; %Liquid Volume fraction top tubing

wmix_r_out_read=read(var.wmix_r_out);
wmix_r_out=wmix_r_out_read.Value; %mass production flow

w_Ga_in_read=read(var.w_Ga_in);
w_Ga_in=w_Ga_in_read.Value; %Gas mass flow into annulus

%% States
x1_read=read(var.x1);
x1=x1_read.Value;

x2_read=read(var.x2);
x2=x2_read.Value;

x3_read=read(var.x3); %Tubing Branch
x3=x3_read.Value;

x3_2_read=read(var.x3_2); %Bottom Branc
%x3_2=x3_2_read.Value;
%x3=x3+x3_2;

%% Mixture Density Top
rho_M_t_read=read(var.rho_M_t);
rho_M_t=rho_M_t_read.Value;

%% DATA VECTORS
y= [w_Ga_in wmix_r_out alpha_lt p_ab/1e5 p_at/1e5 p_tt/1e5 p_bh/1e5 rho_M_t];    % Mangler w_g_a_in, q_out rho_M_t og alpha_lt
u = [u1];                                                 % Valve opening vector
x=[x1;x2;x3];
end

