


load reguleringkaskP1_1.txt;
P1k=reguleringkaskP1_1(:,3);
zk=reguleringkaskP1_1(:,7);
t=cumsum(reguleringkaskP1_1(:,1));
tk=t/1000;
Wk=reguleringkaskP1_1(:,6);
Wsk=reguleringkaskP1_1(:,5);
P1k1=sgolayfilt(P1k,3,21);
Wk1=sgolayfilt(Wk,3,21);
Wsk1=sgolayfilt(Wsk,3,21);
figure(1)
plot(tk(5000:6000),Wk(5000:6000))
ylabel('Massflow [kg/min]')
xlabel('time')

figure(2)
subplot(3,1,1)
plot(tk(3000:7600),P1k(3000:7600),tk(4100:6050),0.110)
ylabel('P1 [barg]')
xlabel('time')
subplot(3,1,2)
plot(tk(3000:7600),Wk1(3000:7600),tk(3000:7600),Wsk1(3000:7600))
ylabel('Massflow [kg/min]')
xlabel('time')
subplot(3,1,3)
plot(tk(3000:7600),zk(3000:7600))
ylabel('Valve position')
xlabel('time')

break
clear all
start=1000
slutt=4000
load reguleringP1_1.txt;
data=reguleringP1_1(start:slutt,:);
P1=data(:,3);
z=data(:,7);
tid=cumsum(data(:,1));
t=tid/1000



figure(1)
subplot(2,1,1)
plot(t,P1,t,0.115,'r-')
ylabel('P1 [barg]')
xlabel('time [min]')
legend('Pressure P1','Setpoint')
subplot(2,1,2)
plot(t,z)
ylabel('Valve postition')
xlabel('time [min]')
break

load bifurkation.txt;
p=bifurkation(:,3);
q=bifurkation(:,5);
figure(1)
plot(p(1:100),q(1:100),'*')

break


figure(1)
plot(t,Q,'r',t,W)
ylabel('massflow')
xlabel('time')
legend('flow inlet','estimated mass flow')



break

load valvedata.txt
z=valvedata(10:28,1);
y=valvedata(10:28,11);
z(19)=0
y(19)=0
figure(1)
plot(z,y,'*')
ylabel('Q/SQRT(dP)')
xlabel('valve opening')
legend('datapoints','f(z)')





load linear_valve.txt
Q=linear_valve(1:27,1);
X=linear_valve(1:27,4);
figure(1)
plot(X,Q,'*')
ylabel('Q [l/min]')
xlabel('z*SQRT(dP)')


load est.txt
figure(2)
subplot(2,1,1)
plot(est(:,1),est(:,2),'.')
ylabel('Pressure drop [barg]')
xlabel('valve opening % ')
subplot(2,1,2)
plot(est(:,1),est(:,3),'.')
xlabel('Valve opening % ')
ylabel('Liquid flow rate [l/min]')