%% Plot report
load('pipeline_model.mat');
%

figure(1)
%subplot(3,2,3)
plot(hours, p_top_pipeline_bara,'LineWidth',1.5);
ylabel('Bottomhole pressure [bara]');
xlabel('Time [hours]');
%title('Bottomhole pressure [bara]');
%axis([0 18 0 10]);
set(gca,'PlotBoxAspectRatio',[1 0.5 1])
%save2pdf('..\Report\figs\coupled\scaled\linear_inflow\Pbh.pdf',1,600);
% 
figure(2)
plot(hours,w_oil_in+w_gas_in,'LineWidth',1.5);
ylabel('Total inlowrate [kg/s]');
xlabel('Time [hours]');
%axis([0 18 0.2 1.4]);
%title('Oil flow from reservoir [kg/s]');
set(gca,'PlotBoxAspectRatio',[1 0.5 1])
%save2pdf('..\Report\figs\coupled\scaled\linear_inflow\inflow.pdf',2,600);

try
    
figure(3)
mesh(hours,xl,P(:,1:end-1));
ylabel('Length [m]');
xlabel('Time [hours]');
zlabel('Pressure [bara]');
catch 
    disp('No plot of reservoir availeble, try flow_type=reservoir')
    
end

% %subplot(3,2,1);
% figure(3)
% plot(hours, w_oil_in,'LineWidth',1.5);
% ylabel('Oil inlowrate [kg/s]');
% xlabel('Time, [Hours]');
% %title('Oil flow from reservoir [kg/s]');
% set(gca,'PlotBoxAspectRatio',[1 0.5 1])
% %save2pdf('..\Report\figs\coupled\smal_scale\constant_inflow\oil_inflow.pdf',1,600);
% 
% figure(4)
% %subplot(3,2,2)
% plot(hours, w_gas_in,'LineWidth',1.5);
% ylabel('Gas inlowrate [kg/s]');
% xlabel('Time, [Hours]');
% %title('Gas flow from reservoir [kg/s]');
% set(gca,'PlotBoxAspectRatio',[1 0.5 1])
% %save2pdf('..\Report\figs\coupled\smal_scale\constant_inflow\gas_inflow.pdf',2,600);
% 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');
figure(4)
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

