Quiet@Remove["Global`*"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];
v:=(Subscript[α, #])&;

dat=Import["WPL18E_vykon_prikon.xlsx"][[1]];
teplsVoda=Drop[dat[[2]],1];
dats=Drop[dat,2];
teplsVzduch=First/@dats;
d1=Drop[#,1]&/@dats;
d2=(Partition[#,2]&/@(Riffle[teplsVoda,#]&/@d1));
d3[i_Integer]:=Prepend[#,teplsVzduch[[i]]]&/@d2[[i]];
d4=Partition[Flatten[d3/@Range[Length[d1]],1],4];
datVykon=Flatten[d4[[2#-1]]&/@Range[8],1];
datPrikon=Flatten[d4[[2#]]&/@Range[8],1];

ListPlot3D[{datVykon,datPrikon},Mesh->All];

intPtop[Ta_,Tw_]=Interpolation[datVykon,InterpolationOrder->{2,1}][Ta,Tw];
newDatVykon=Flatten[Table[{Ta,Tw,intPtop[Ta,Tw]},{Ta,-20,20,2},{Tw,35,60,5}],1];
ListPlot3D[newDatVykon,Mesh->All];
Plot3D[intPtop[Ta,Tw],{Ta,-20,20},{Tw,35,60},PlotRange->All];

Show[Plot[intPtop[Ta,#],{Ta,-20,20},PlotRange->All,PlotStyle->Hue[((#-35)/35)],FrameLabel->{"Ta [°C]","Ptop [kW]"},GridLines->All],ListPlot[Cases[datVykon,{_,#,_}]/.{Ta_,Tw_,P_}:>{Ta,P},PlotStyle->{Red,PointSize[0.015]}]]&/@teplsVoda;
plall=Show[%]

dat60=Table[{Ta,intPtop[Ta,60]},{Ta,-20,20,1}];
pl1=ListPlot[dat60,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
lin60[Ta_]=Fit[dat60,{1,Ta},Ta];
datRest60=dat60/.{Ta_,Ptop_}:>{Ta,Ptop-lin60[Ta]};
pl2=ListPlot[datRest60,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
model=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-3.5))))^2)]+v[3]*Exp[-(((v[4]*(Ta-7)))^2)]+v[5]*Exp[-(((v[6]*(Ta-19)))^2)];
params=Union@Cases[model,(Subscript[α, _]),{0,∞}];
fit=Quiet@FindFit[datRest60,model,params,{Ta},Method->NMinimize];
Pt[Ta_]=model/.fit;
Show[pl2,Plot[Pt[Ta],{Ta,-20,20}]];
Pt60[Ta_]=lin60[Ta]+Pt[Ta];
Show[pl1,Plot[Pt60[Ta],{Ta,-20,20}]]

dat55=Table[{Ta,intPtop[Ta,55]},{Ta,-20,20,1}];
pl1=ListPlot[dat55,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
lin55[Ta_]=Fit[dat55,{1,Ta},Ta];
datRest55=dat55/.{Ta_,Ptop_}:>{Ta,Ptop-lin55[Ta]};
pl2=ListPlot[datRest55,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
model55=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-4))))^2)]+v[3]*Exp[-(((v[4]*(Ta-7)))^2)]+v[5]*Exp[-(((v[6]*(Ta-19)))^2)];
params=Union@Cases[model55,(Subscript[α, _]),{0,∞}];
fit55=Quiet@FindFit[datRest55,model55,params,{Ta},Method->NMinimize];
Pt5a5[Ta_]=model55/.fit55;
Show[pl2,Plot[Pt5a5[Ta],{Ta,-20,20}]];
Pt55[Ta_]=lin55[Ta]+Pt5a5[Ta];
Show[pl1,Plot[Pt55[Ta],{Ta,-20,20}]];

dat45=Table[{Ta,intPtop[Ta,45]},{Ta,-20,20,1}];
pl1=ListPlot[dat45,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
lin45[Ta_]=Fit[dat45,{1,Ta},Ta];
datRest45=dat45/.{Ta_,Ptop_}:>{Ta,Ptop-lin45[Ta]};
pl2=ListPlot[datRest45,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
model45=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-2.5))))^2)]+v[3]*Exp[-(((v[4]*(Ta-7)))^2)]+v[5]*Exp[-(((v[6]*(Ta-17.3)))^2)];
params=Union@Cases[model45,(Subscript[α, _]),{0,∞}];
fit45=Quiet@FindFit[datRest45,model45,params,{Ta},Method->NMinimize];
Pt4a5[Ta_]=model55/.fit45;
Show[pl2,Plot[Pt4a5[Ta],{Ta,-20,20}]];
Pt45[Ta_]=lin45[Ta]+Pt4a5[Ta];
Show[pl1,Plot[Pt45[Ta],{Ta,-20,20}]];

dat35=Table[{Ta,intPtop[Ta,35]},{Ta,-20,20,1}];
pl1=ListPlot[dat35,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
lin35[Ta_]=Fit[dat35,{1,Ta},Ta];
datRest35=dat35/.{Ta_,Ptop_}:>{Ta,Ptop-lin35[Ta]};
pl2=ListPlot[datRest35,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Ptop [kW]"}];
model35=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-11.8))))^2)]+v[3]*Exp[-(((v[4]*(Ta-4)))^2)]+v[5]*Exp[-(((v[6]*(Ta-16)))^2)];
params=Union@Cases[model35,(Subscript[α, _]),{0,∞}];
fit35=Quiet@FindFit[datRest35,model35,params,{Ta},Method->NMinimize];
Pt3a5[Ta_]=model35/.fit35;
Show[pl2,Plot[Pt3a5[Ta],{Ta,-20,20}]];
Pt35[Ta_]=lin35[Ta]+Pt3a5[Ta];
Show[pl1,Plot[Pt35[Ta],{Ta,-20,20}]];

leg=LineLegend[Hue[((#-35)/35)]&/@DeleteDuplicates[teplsVoda],"(Subscript[T, wout])="<>ToString[Round[#]]<>"°C"&/@DeleteDuplicates[teplsVoda],LegendFunction->"Frame",LegendMargins->0.5,Background->White]

plPtopWPL18=Show[Plot[{Pt35[Ta],Pt45[Ta],Pt55[Ta],Pt60[Ta]},{Ta,-40,40},AxesOrigin->{0,0},PlotStyle->Dashed,GridLines->All,FrameLabel->{"Ta [°C]","PHP [kW]"},PlotLegends->Placed[leg,{Right,Bottom}],Frame->True],plall]
Export["plPtopWPL18.pdf",plPtopWPL18]

dPt35=Table[{Ta,35,Pt35[Ta]},{Ta,-40,40,1}];
dPt45=Table[{Ta,45,Pt45[Ta]},{Ta,-40,40,1}];
dPt55=Table[{Ta,55,Pt55[Ta]},{Ta,-40,40,1}];
dPt60=Table[{Ta,60,Pt60[Ta]},{Ta,-40,40,1}];
datsAll=Union[dPt35,dPt45,dPt55,dPt60];
intAll=Interpolation[datsAll,InterpolationOrder->{3,1}];

datPtop=Flatten[Table[{Ta,Tw,Quiet@intAll[Ta,Tw]},{Ta,-40,40,1},{Tw,20,60,2}],1];
intPtopFinal=Interpolation[datPtop,InterpolationOrder->{3,1}];
Plot3D[intPtopFinal[Ta,Tw],{Ta,-40,40},{Tw,20,60},PlotRange->All];

(*odtud prikon*)

intPel[Ta_,Tw_]=Interpolation[datPrikon,InterpolationOrder->{2,1}][Ta,Tw];
newDatPrikon=Flatten[Table[{Ta,Tw,intPel[Ta,Tw]},{Ta,-20,20,2},{Tw,35,60,5}],1];
ListPlot3D[newDatPrikon,Mesh->All];
Plot3D[intPel[Ta,Tw],{Ta,-20,20},{Tw,35,60},PlotRange->All];
Show[Plot[intPel[Ta,#],{Ta,-20,20},PlotRange->All,PlotStyle->Hue[((#-35)/35)],FrameLabel->{"Ta [°C]","Pel [kW]"},GridLines->Full],ListPlot[Cases[datPrikon,{_,#,_}]/.{Ta_,Tw_,P_}:>{Ta,P},PlotStyle->{Red,PointSize[0.015]}]]&/@teplsVoda;
plallel=Show[%]

dat60el=Table[{Ta,intPel[Ta,60]},{Ta,-20,20,1}];
pl1el=ListPlot[dat60el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
lin60el[Ta_]=Fit[dat60el,{1,Ta},Ta];
datRest60el=dat60el/.{Ta_,Ptop_}:>{Ta,Ptop-lin60el[Ta]};
pl2el=ListPlot[datRest60el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
model=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-2))))^2)]+v[3]*Exp[-(((v[4]*(Ta-7)))^2)]+v[5]*Exp[-(((v[6]*(Ta-19)))^2)];
params=Union@Cases[model,(Subscript[α, _]),{0,∞}];
fit=Quiet@FindFit[datRest60el,model,params,{Ta},Method->NMinimize];
Pel[Ta_]=model/.fit;
Show[pl2el,Plot[Pel[Ta],{Ta,-20,20}]];
Pel60[Ta_]=lin60el[Ta]+Pel[Ta];
Show[pl1el,Plot[Pel60[Ta],{Ta,-20,20}],AxesOrigin->{0,0},PlotRange->All];

dat55el=Table[{Ta,intPel[Ta,55]},{Ta,-20,20,1}];
pl1el=ListPlot[dat55el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
lin55el[Ta_]=Fit[dat55el,{1,Ta},Ta];
datRest55el=dat55el/.{Ta_,Ptop_}:>{Ta,Ptop-lin55el[Ta]};
pl2el=ListPlot[datRest55el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
model=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-2))))^2)]+v[3]*Exp[-(((v[4]*(Ta-6)))^2)]+v[5]*Exp[-(((v[6]*(Ta-19)))^2)];
params=Union@Cases[model,(Subscript[α, _]),{0,∞}];
fit=Quiet@FindFit[datRest55el,model,params,{Ta},Method->NMinimize];
Pel[Ta_]=model/.fit;
Show[pl2el,Plot[Pel[Ta],{Ta,-20,20}]];
Pel55[Ta_]=lin55el[Ta]+Pel[Ta];
Show[pl1el,Plot[Pel55[Ta],{Ta,-20,20}],AxesOrigin->{0,0},PlotRange->All];

dat45el=Table[{Ta,intPel[Ta,45]},{Ta,-20,20,1}];
pl1el=ListPlot[dat45el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
lin45el[Ta_]=Fit[dat45el,{1,Ta},Ta];
datRest45el=dat45el/.{Ta_,Ptop_}:>{Ta,Ptop-lin45el[Ta]};
pl2el=ListPlot[datRest45el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
model=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-2))))^2)]+v[3]*Exp[-(((v[4]*(Ta-8)))^2)]+v[5]*Exp[-(((v[6]*(Ta-18)))^2)];
params=Union@Cases[model,(Subscript[α, _]),{0,∞}];
fit=Quiet@FindFit[datRest45el,model,params,{Ta},Method->NMinimize];
Pel[Ta_]=model/.fit;
Show[pl2el,Plot[Pel[Ta],{Ta,-20,20}]];
Pel45[Ta_]=lin45el[Ta]+Pel[Ta];
Show[pl1el,Plot[Pel45[Ta],{Ta,-20,20}],AxesOrigin->{0,0},PlotRange->All];

dat35el=Table[{Ta,intPel[Ta,35]},{Ta,-20,20,1}];
pl1el=ListPlot[dat35el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"}];
lin35el[Ta_]=Fit[dat35el,{1,Ta},Ta];
datRest35el=dat35el/.{Ta_,Ptop_}:>{Ta,Ptop-lin35el[Ta]};
pl2el=ListPlot[datRest35el,PlotStyle->Hue[(0/35)],AxesLabel->{"Ta [°C]","Pel [kW]"},GridLines->All];
model=v[0]+v[1]*Exp[-(((v[2]*(Ta-(-3))))^2)]+v[3]*Exp[-(((v[4]*(Ta-9)))^2)]+v[5]*Exp[-(((v[6]*(Ta-17)))^2)];
params=Union@Cases[model,(Subscript[α, _]),{0,∞}];
fit=Quiet@FindFit[datRest35el,model,params,{Ta},Method->NMinimize];
Pel[Ta_]=model/.fit;
Show[pl2el,Plot[Pel[Ta],{Ta,-20,20}]];
Pel35[Ta_]=lin35el[Ta]+Pel[Ta];
Show[pl1el,Plot[Pel35[Ta],{Ta,-20,20}],AxesOrigin->{0,0},PlotRange->All];

pTopWPF=Show[plallel,Plot[{Pel35[Ta],Pel45[Ta],Pel55[Ta],Pel60[Ta]},{Ta,-40,40},AxesOrigin->{0,0},PlotStyle->Dashed,PlotLegends->Placed[leg,{Right,Bottom}]],AxesOrigin->{0,0},Frame->True]
Export["pTopWPF.pdf",pTopWPF]

dPel35=Table[{Ta,35,Pel35[Ta]},{Ta,-40,40,1}];
dPel45=Table[{Ta,45,Pel45[Ta]},{Ta,-40,40,1}];
dPel55=Table[{Ta,55,Pel55[Ta]},{Ta,-40,40,1}];
dPel60=Table[{Ta,60,Pel60[Ta]},{Ta,-40,40,1}];
datsAllel=Union[dPel35,dPel45,dPel55,dPel60];
intAllell=Interpolation[datsAllel,InterpolationOrder->{3,1}];

datPel=Flatten[Table[{Ta,Tw,Quiet@intAllell[Ta,Tw]},{Ta,-40,40,1},{Tw,20,60,2}],1];
intPelFinal=Interpolation[datPel,InterpolationOrder->{3,1}];
Plot3D[intPelFinal[Ta,Tw],{Ta,-40,40},{Tw,20,60},PlotRange->All];

{{intPelFinal,intPtopFinal},{"intPelFinal[Ta,tW]","intPtopFinal[Ta,tW]"}}>>"struct"

<<struct
%[[1,1]][20,30]