function main
global Tk
% Define data and initialize
DTmin = 5;
Tgco_air = 30+Tk;
Tvap_air = 20+Tk;
u = [Tgco_air; Tvap_air];
load optimalOperation
load scaling
load data
i_com = length(sc.com.x);
i_gco = length(sc.gco.x);
i_val = length(sc.val.x);
i_vap = length(sc.vap.x);
i_ihx = length(sc.ihx.x);
nair = x0(i_com+i_gco-2)*sc.gco.x(end-2);
aux.d = d;
aux.sc = sc;
aux.u = u;
res = Heatpump(x0, aux);
Qvap = 4000;

Avap = x0(i_com+i_gco+i_val+i_vap-1)*sc.vap.x(end-1);
Agco = x0(i_com+i_gco)*sc.gco.x(end);
Aihx = x0(end)*sc.ihx.x(end);
tic
Result = optimal_operation(x0, Agco, Avap, Aihx, Qvap, nair, u, d, sc);
toc
x0 = Result.x_k;
%  save optimalOperation x0

[P, h] = report(x0, d, u, sc);
Ph_plotter(P, h);
%laprint(1, 'Fig/PhTemp', 'scalefonts', 'off', 'asonscreen', 'off')
%close all
gco = x0(i_com+1:i_com+i_gco).*sc.gco.x;
ihx = x0(i_com+i_gco+i_val+i_vap+1:end).*sc.ihx.x;
gco_plotter(gco(d.ngco+1:2*d.ngco), gco(3*d.ngco+1:4*d.ngco));
%laprint(1, 'Fig/gcoTemp', 'scalefonts', 'off', 'asonscreen', 'off')
%close all
ihx_plotter(ihx(1:d.nihx), ihx(3*d.nihx+1:4*d.nihx));
%laprint(1, 'Fig/ihxTemp', 'scalefonts', 'off', 'asonscreen', 'off')
%close all
