% Example of how to export figures of diffrent sizes to eps
% Gisle Otto Eikrem
% 14.08.03

close all;
clear all;

load('pipeline_model.mat'); %Load the Shell Gas Lift Exp data

conv_bara = 1e-5; 

scrsz = get(0,'ScreenSize');



% %----------------------------------
% figure 1
xstart = 1;
ystart = 110;
figure('Position',[scrsz(1) scrsz(2)+ystart scrsz(3)-xstart scrsz(4)-ystart-30])

set(gcf, 'PaperUnits', 'centimeter');
set(gcf, 'PaperType', 'A4');
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 29.7 21]);%A4
%set(gcf, 'PaperPosition', [0 0 42 29.7]);%A3
%set(gcf, 'PaperPosition', [0 0 35 21]);
set(gcf, 'PaperOrientation', 'landscape');
%set(gcf, 'PaperOrientation', 'portrait');

subplot(2,1,1);
plot(p_bottom_riser_bara,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Pressure in bottom of riser');
%legend('Model','OLGA');
ylabel('Pressure (bara)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(2,1,2);
plot(u_PC_simple,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Valve opening');
%legend('Model','OLGA');
ylabel('Opening (-)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);




% %----------------------------------
% figure 1
xstart = 1;
ystart = 110;
figure('Position',[scrsz(1) scrsz(2)+ystart scrsz(3)-xstart scrsz(4)-ystart-30])

set(gcf, 'PaperUnits', 'centimeter');
set(gcf, 'PaperType', 'A4');
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 29.7 21]);%A4
%set(gcf, 'PaperPosition', [0 0 42 29.7]);%A3
%set(gcf, 'PaperPosition', [0 0 35 21]);
set(gcf, 'PaperOrientation', 'landscape');
%set(gcf, 'PaperOrientation', 'portrait');

subplot(3,2,1);
plot(hours,m(1,:),'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Mass of Gas in Riser');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,2);
plot(hours,m(2,:),'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Mass of Oil in Riser');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,3);
plot(hours,m(3,:),'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Mass of Gas in Pipeline');
%legend('Model','OLGA');
ylabel('Mass (kg)');
xlabel('Time (hours)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,4);
plot(hours,m(4,:),'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('Mass of Oil in Pipeline');
%legend('Model','OLGA');
ylabel('Mass (kg)');
xlabel('Time (hours)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

% 
% subplot(3,2,6);
% plot(u_PC);
% hold on;
% %plot(time_min_lab,u_PC_lab, 'r');
% hold off;
% grid;
% title('Opening of Production Choke');
% legend('OLGA2000 & Model','Laboratory');
% ylabel('Valve Opening (-)');
% xlabel('Time (min)');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
% set(gca, 'YLimMode', 'manual');
% set(gca, 'YLim', [0.3, 1.1]);

%print -r150 -depsc2 sglw_states.eps

% %----------------------------------
% figure 2
figure('Position',[scrsz(1) scrsz(2)+ystart scrsz(3)-xstart scrsz(4)-ystart-30])

set(gcf, 'PaperUnits', 'centimeter');
set(gcf, 'PaperType', 'A4');
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 29.7 21]);%A4
%set(gcf, 'PaperPosition', [0 0 42 29.7]);%A3
%set(gcf, 'PaperPosition', [0 0 35 21]);
set(gcf, 'PaperOrientation', 'landscape');
%set(gcf, 'PaperOrientation', 'portrait');

subplot(3,2,1);
plot(w_gas_bottom,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('w gas bottom');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,2);
plot(w_oil_bottom,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('w oil bottom');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,3);
plot(w_gas_pc,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('w gas pc');
%legend('Model','OLGA');
ylabel('Mass (kg)');
xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,4);
plot(w_oil_pc,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('w oil pc');
%legend('Model','OLGA');
ylabel('Mass (kg)');
xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

% 
% subplot(3,2,6);
% plot(u_PC);
% hold on;
% %plot(time_min_lab,u_PC_lab, 'r');
% hold off;
% grid;
% title('Opening of Production Choke');
% legend('OLGA2000 & Model','Laboratory');
% ylabel('Valve Opening (-)');
% xlabel('Time (min)');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
% set(gca, 'YLimMode', 'manual');
% set(gca, 'YLim', [0.3, 1.1]);

%print -r150 -depsc2 sglw_states.eps

% %----------------------------------

% %----------------------------------
% figure 3
figure('Position',[scrsz(1) scrsz(2)+ystart scrsz(3)-xstart scrsz(4)-ystart-30])

set(gcf, 'PaperUnits', 'centimeter');
set(gcf, 'PaperType', 'A4');
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 29.7 21]);%A4
%set(gcf, 'PaperPosition', [0 0 42 29.7]);%A3
%set(gcf, 'PaperPosition', [0 0 35 21]);
set(gcf, 'PaperOrientation', 'landscape');
%set(gcf, 'PaperOrientation', 'portrait');

subplot(3,2,1);
plot(p_bottom_pipeline_bara_oil,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('p bottom pipeline bara oil');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,2);
plot(p_bottom_riser_bara,'b-');
hold on;
plot(p_bottom_riser_onlyoil_bara,'r-');
hold off;
grid;
title('p bottom riser bara');
legend('pressure','pressure only oil');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,3);
plot(p_top_pipeline_bara,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('p top pipeline bara');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,4);
plot(p_top_riser_bara,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('p top riser bara');
%legend('Model','OLGA');
ylabel('Mass (kg)');
xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);

subplot(3,2,5);
plot(p_bottom_pipeline_bara_gas,'b-');
hold on;
%plot(GG_Wellhead,'r-');
hold off;
grid;
title('p bottom pipeline bara gas');
%legend('Model','OLGA');
ylabel('Mass (kg)');
%xlabel('Time (time steps)');
%set(gca, 'XLimMode', 'auto');
%set(gca, 'YLimMode', 'manual');
% set(gca, 'XLimMode', 'manual');
% set(gca, 'XLim', [0,30]);
%set(gca, 'YLim', [20,40]);
%print -r150 -depsc2 sglw_states.eps
