function [] = plotting(u,y,t,y0,ControlStart,disturbanceStart,y_est,U_inner,X)
titleSize=18;
labelSize=15;
gcaSize=15;

%% Inputs and Disturbances

%% Production Choke
figure(45722)
clf
set(gcf,'Color',[1,1,1])

subplot(2,1,1)
plot(t/60,u(:,1)*100,'k','linewidt',1);
title('Control Signal: Production Choke Opening (z1)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',15)
ylabel('[Percent]','FontSize',15)
ylim([-10 110]);
set(gca,'FontSize',gcaSize);

%% Bottom Hole Pressure and production flow and disturbance
if (0)
figure(5774)
set(gcf,'Color',[1,1,1])
subplot(4,1,1)
plot(t/60,y(:,5),'k','linewidth',1);
hold on;
setpoint= linspace(1,1,length(t))*y0(5);
plot(t/60,setpoint,'--b','linewidth',1);
hold on;
plot(ControlStart/60,setpoint(1) , 'rx','MarkerSize',15,'Linewidt',2);
hold on;
plot(disturbanceStart/60,setpoint(1) , 'k+','MarkerSize',15,'Linewidt',2);
title('Bottom Hole Pressure ','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
legend('measurement','setpoint','Control Start','Disturbance Start');
set(gca,'FontSize',gcaSize);
end

if(0)
subplot(4,1,2)
plot(t/60,y(:,6),'k','linewidth',1);
title('Mass Production Flow','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[kg/s]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,1,3)
plot(t/60,u(:,1)*100,'k','linewidt',1);
title('Control Signal: Production Choke Opening (z1)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',15)
ylabel('[Percent]','FontSize',15)
ylim([-10 110]);
set(gca,'FontSize',gcaSize);

subplot(4,1,4)
plot(t/60,u(:,4),'k','linewidt',1);
title('Disturbance: Pressure in Reservoir','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',15)
ylabel('[bara]','FontSize',15)
set(gca,'FontSize',gcaSize);
end

%% Bottom Hole Pressure and production flow no disturbance
if (0)
figure(5774)
set(gcf,'Color',[1,1,1])
subplot(3,1,1)
plot(t/60,y_est(:,5),'-r','linewidth',1);
hold on;
plot(t/60,y(:,5),'--b','linewidth',1);
hold on;
setpoint= linspace(1,1,length(t))*y0(5);
plot(t/60,setpoint,'--k','linewidth',1);
hold on;
plot(ControlStart/60,setpoint(1) , 'rx','MarkerSize',15,'Linewidt',2);
title('Bottom Hole Pressure ','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
legend('estimate','real value','setpoint','control start');
set(gca,'FontSize',gcaSize);

subplot(3,1,2)
plot(t/60,y(:,6),'k','linewidth',1);
title('Mass Production Flow','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[kg/s]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(3,1,3)
plot(t/60,u(:,1)*100,'k','linewidt',1);
title('Control Signal: Production Choke Opening (z1)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',15)
ylabel('[Percent]','FontSize',15)
ylim([-10 110]);
set(gca,'FontSize',gcaSize);
end


%% Cascade
figure(553964)
set(gcf,'Color',[1,1,1])

subplot(4,1,1)
plot(t/60,y(:,2),'k','linewidth',1);
hold on;
setpoint= linspace(1,1,length(t))*y0(2);
plot(t/60,setpoint,'--b','linewidth',1);
hold on;
plot(ControlStart/60,setpoint(1) , 'rx','MarkerSize',15,'Linewidt',2);
%hold on;
%plot(disturbanceStart/60,setpoint(1) , 'k+','MarkerSize',15,'Linewidt',2);
title('Annulus Top Pressure (outer loop)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
%legend('measurement','setpoint','Control Start','Disturbance Start');
legend('measurement','setpoint','Control Start');
set(gca,'FontSize',gcaSize);

subplot(4,1,2)
plot(t/60,y(:,3),'k','linewidth',1);
hold on;
setpoint= U_inner;
plot(t/60,setpoint,'--b','linewidth',1);
hold on;
plot(ControlStart/60,setpoint(floor(ControlStart/60)) , 'rx','MarkerSize',15,'Linewidt',2);
%hold on;
%plot(disturbanceStart/60,setpoint(1) , 'k+','MarkerSize',15,'Linewidt',2);
title('Tubing Top Pressure (inner loop)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
%legend('measurement','setpoint','Control Start','Disturbance Start');
legend('measurement','setpoint','Control Start');
set(gca,'FontSize',gcaSize);
ylim([0 100]);

subplot(4,1,3)
plot(t/60,y(:,6),'k','linewidth',1);
title('Mass Production Flow','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[kg/s]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,1,4)
plot(t/60,u(:,1)*100,'k','linewidt',1);
title('Control Signal: Production Choke Opening (z1)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[Percent]','FontSize',labelSize)
ylim([-10 110]);
set(gca,'FontSize',gcaSize);

%subplot(5,1,5)
%plot(t/60,u(:,4),'k','linewidt',1);
%title('Disturbance: Pressure in Reservoir','FontSize',titleSize,'FontWeight','bold')
%xlabel('[minutes]','FontSize',15)
%ylabel('[bara]','FontSize',15)
%set(gca,'FontSize',gcaSize);

%% ONly INputs and dist

inputs=figure(1);
clf
set(gcf,'Color',[1,1,1])

subplot(2,1,1)
plot(t/60,u(:,1)*100,'k','linewidt',1);
title('Control Signal: Production Choke Opening (z1)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',15)
ylabel('[Percent]','FontSize',15)
ylim([-10 110]);
set(gca,'FontSize',gcaSize);

subplot(2,1,2)
plot(t/60,u(:,2)*100,'k','linewidt',1);
title('Control Signal: Gas Choke Opening (z2)','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[Percent]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

% subplot(4,2,3)
% plot(t/60,u(:,4),'k','linewidt',1);
% title('Disturbance: Pressure in Reservoir''FontSize',titleSize,'FontWeight','bold')
% xlabel('[minutes]')
% ylabel('[bara]')
% 
% subplot(4,2,4)
% plot(t/60,u(:,5),'k','linewidt',1);
% title('Disturbance: Pressure in Gas Source','FontSize',titleSize,'FontWeight','bold')
% xlabel('[minutes]')
% ylabel('[bara]')
% 
% subplot(4,2,5)
% plot(t/60,u(:,3),'k','linewidt',1);
% title('Disturbance: GOR','FontSize',11,'FontSize',titleSize,'FontWeight','bold')
% xlabel('[minutes]')
% ylabel('[bara]')


%% Measurements and outputs
outputs=figure(2);
clf
set(gcf,'Color',[1,1,1])

subplot(4,2,1)
plot(t/60,y(:,1),'k','linewidth',1);
title('Injected gas into annulus [kg/s]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[kg/s]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,2)
plot(t/60,y(:,2),'k','linewidth',1);
title('Pressure at top of annulus [bara]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,3)
plot(t/60,y(:,3),'k','linewidth',1);
title('Pressure at top of tubing [bara]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,4)
plot(t/60,y(:,4),'k','linewidth',1);
hold on;
%setpoint= linspace(1,1,length(t))*y0(4);
%plot(t/60,setpoint,'--b','linewidth',1);
title('Pressure at bottom of annulus [bara]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,5)
plot(t/60,y(:,5),'k','linewidth',1);
hold on;
setpoint= linspace(1,1,length(t))*y0(5);
plot(t/60,setpoint,'--b','linewidth',1);
hold on;
plot(ControlStart/60,setpoint(1) , 'rx','MarkerSize',15,'Linewidt',2);
title('Pressure at bottom hole [bara]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[bara]','FontSize',labelSize)
legend('measurement','setpoint','Control Start');
set(gca,'FontSize',gcaSize);

subplot(4,2,6)
plot(t/60,y(:,6),'k','linewidth',1);
title('Mass Production Flow [Kg/s]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[Kg/s]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,7)
plot(t/60,y(:,7),'k','linewidth',1);
title('Mixture density at top of riser [kg/m^3]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[kg/m^3]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);

subplot(4,2,8)
plot(t/60,y(:,8),'k','linewidth',1);
title('Liquid volume fraction at top of riser [-]','FontSize',titleSize,'FontWeight','bold')
xlabel('[minutes]','FontSize',labelSize)
ylabel('[fraction]','FontSize',labelSize)
set(gca,'FontSize',gcaSize);



end