Off[General::"spell1", General::"spell", 
      FindMinimum::"lstol"]

T = 50  ;
S = 15*8*4;
inf  =  1.03   ;
Elup  =  
        1.05  ;
Plup  =  
        1.03  ;
Drup  =  
        1.03  ;
Prace =  100000  ;
cenael = 250;   
cenapl = 
      200;   
cenadr = 
      100;   
Tv = 
      25;    
Ta = 
      0;   
αv = 
      5;    
d = 
      0.45;   
λz = 
      0.4;   
λiz = 
      0.04;    
αa = 
      15;
den = 24*3600;
topna = 100*den;

      
pEl = 0.1;    
pPl = 
      0.4;
pDr = 
        0.5;


dataOrsil = {{40, 51.17}, {50, 63.07}, {60, 76.16}, {80, 
              101.15}, {100, 127.33}, {120, 152.32}, {140, 177.31}, {160, 
              203.49}, {180, 228.48}, {200, 254.66}} /. {a_, b_} -> {a, 
              S*b};

 (*--------------Konec deklaracni casti-------------*) 


nahrada = Fit[dataOrsil, {1, diz}, diz];
Show[
        ListPlot[dataOrsil, PlotJoined -> True, 
          AxesLabel -> {"diz[mm]", "cena[Kc]"}, 
          DisplayFunction -> Identity], 
        Plot[nahrada, {diz, 40, 200}, PlotStyle -> Hue[0], 
          DisplayFunction -> Identity], 
        DisplayFunction -> $DisplayFunction];
Rthv = (1/α)v;  Rthz = (d/λ)z;  
    Rthiz  = (diz/(1000*λiz)); 
    Rtha  =  (1/α)a;
Piz = nahrada + Prace;
Q0 = ((Tv - Ta)/(Rthv + Rthz + Rtha));
Qiz = ((Tv - Ta)/(Rthv + Rthz + Rthiz + Rtha ));
SumaEl = (∑_(i = 0)^(T - 1))Qiz*cenael*10^-9*topna*S*
            ((Elup^i)/(inf^i))   ;
NakladyEl = 
        Piz + SumaEl;
  

doporuceniEl = 
        FindMinimum[NakladyEl, {diz, 50}];
SumaPl = (∑_(i = 0)^(T - 1))Qiz*cenapl*10^-9*topna*S*
            ((Plup^i)/(inf^i))  (*inkaso za plyn prepoctene na pocatek*) ;
NakladyPl = Piz + SumaPl;

    
doporuceniPl = 
        FindMinimum[NakladyPl, {diz, 50}];
SumaDr = (∑_(i = 0)^(T - 1))Qiz*cenadr*10^-9*topna*S*
            ((Drup^i)/(inf^i))   ;
NakladyDr = Piz + SumaDr;

    
doporuceniDr = 
        FindMinimum[NakladyDr, {diz, 50}];

      
SumaS = (∑_(i = 0)^(T - 1))(Qiz*pEl*cenael*10^-9*topna*
                S*((Elup^i)/(inf^i))  + 
              Qiz*pPl*cenapl*10^-9*topna*S*((Plup^i)/(inf^i)) + 
              Qiz*pDr*cenadr*10^-9*topna*S*
                ((Drup^i)/(inf^i)))  ;
NakladyS = Piz + SumaS;
Plot[{NakladyEl, NakladyPl, NakladyDr,  NakladyS},  {diz,  5,  
          500}];

    
doporuceniS = 
        FindMinimum[
          NakladyS, {diz, 
            50}];


UsporaEl = (∑_(i = 0)^(T - 1))(Q0 - Qiz)*
              cenael*10^-9*topna*S*((Elup^i)/(inf^i)) /. 
          doporuceniEl[[2]];
dizEl = 
        Round[diz /. doporuceniEl[[2]]];
dizPl = 
        Round[diz /. doporuceniPl[[2]]];
dizDr = 
        Round[diz /. doporuceniDr[[2]]];
dizS = 
        Round[diz /. doporuceniS[[2]]];
NaklEl = 
        Round[(1/1000)*
              doporuceniEl[[1]]]*1000;
NaklPl = 
        Round[(1/1000)*
              doporuceniPl[[1]]]*1000;
NaklDr = 
        Round[(1/1000)*
              doporuceniDr[[1]]]*1000;
NaklS = 
        Round[(1/1000)*
              doporuceniS[[1]]]*1000;
Print["Tlouš\:0165ka izolace p\:0159i topení elekt\
\:0159inou je ", 
      dizEl,  " mm, p\:0159i celkových nákladech \
p\:0159epočtených na dobu po\:0159ízení \
izolace ", NaklEl, " Kč."]
Print["Tlouš\:0165ka izolace p\:0159i topení plynem \
je ", dizPl,  " mm, p\:0159i celkových nákladech \
p\:0159epočtených na dobu po\:0159ízení \
izolace ", NaklPl, " Kč."]
Print["Tlouš\:0165ka izolace p\:0159i topení \
D\:0159evem je ", 
      dizDr,  " mm, p\:0159i celkových nákladech \
p\:0159epočtených na dobu po\:0159ízení \
izolace ", NaklDr, " Kč."]
Print["Tlouš\:0165ka izolace p\:0159i \
smíšeném topení (dle zadaných pom\
\:011br\:016f) je ", 
      dizS,  " mm, p\:0159i celkových nákladech p\:0159epo\
čtených na dobu po\:0159ízení izolace ", 
      NaklS, " Kč."]