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



figure(1)
subplot(2,1,1)
plot(t,P1,t(1200:2470),0.115,'r.')
ylabel('P1 [barg]')
xlabel('time [min]')
legend('Pressure P1','Setpoint')
subplot(2,1,2)
plot(t,z/100)
ylabel('Valve postition [-]')
xlabel('time [min]')

clear all

load simP1;
t=t/60;
figure(2)
subplot(2,1,1)
plot(t,y_m-1.013,t(19500:33050),0.11,'r.')
legend('Pressure P1','Setpoint')
ylabel('P1 [barg]')
xlabel('time [min]')
subplot(2,1,2)
plot(t,u)
ylabel('valve position [-]')
xlabel('time [min]')


break


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
