function [cp_metan,cp_toluen,cp_etanol,cp_aceton,cp_CO2,cp_O2,cp_H2O,cp_N2,dHr_metan,dHr_toluen,dHr_etanol,dHr_aceton] = reakcne_teplo(temp)
% vypocet reakcnich tepel
    % * slucovaci entalpie ZDROJ: http://atct.anl.gov/Thermochemical%20Data/version%201.110/index.html
    % ** slucovaci entalpie ZDROJ: http://webbook.nist.gov/cgi/cbook.cgi?ID=C109660&Units=SI&Mask=1#Thermo-Gas
    
T = temp; % [K]
Tst = 298.15; % [K]

% tabelovane hodnoty 

% Stechiometrie reakci

% Metan - CH4 + 2O2 => CO2 + 2 H2O
stech_rmetan_CH4 = 1; stech_rmetan_O2 = 2; stech_rmetan_CO2 = 1; stech_rmetan_H2O = 2;
% Toluen - C7H8 + 9O2 => 7 CO2 + 4 H2O
stech_rtoluen_C7H8 = 1; stech_rtoluen_O2 = 9; stech_rtoluen_CO2 = 7; stech_rtoluen_H2O = 4;
% Etanol - C2H6O + 3O2 => 2 CO2 + 3 H2O
stech_retanol_C2H6O = 1; stech_retanol_O2 = 3; stech_retanol_CO2 = 2; stech_retanol_H2O = 3;
% Aceton - C3H6O + 4O2 => 3 CO2 + 3 H2O
stech_raceton_C3H6O = 1; stech_raceton_O2 = 4; stech_raceton_CO2 = 3; stech_raceton_H2O = 3;

% dHsl(298.15 K) - slucovaci entalpie
dHsl_metan = -74532; % [J/mol] *
dHsl_toluen = 50000; % [J/mol] **
dHsl_etanol = -234000; % [J/mol] **
dHsl_aceton = -217100; % [J/mol] **
dHsl_CO = -110530; % [J/mol] **
dHsl_CO2 = -393474; % [J/mol]
dHsl_O2 = 0; % [J/mol]
dHsl_H2O = -241822; % [J/mol]

% teplotni rozvoje cp - tvar cp = A + B*t + C*t^2 + D*t^3
% ZDROJ: http://webbook.nist.gov/chemistry/ - úprava VB

% metan - cp = A + B*t + C*t^2 + D*t^3 (pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_metan_koefA = 32.2;
cp_metan_koefB = -0.00956;
cp_metan_koefC = 0.0000978;	
cp_metan_koefD = -0.0000000459;
cp_metan = cp_metan_koefA+cp_metan_koefB*T+cp_metan_koefC*T^2+cp_metan_koefD*T^3; % [J.mol^-1.K^-1]

% toluen - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_toluen_koefA = -288;
cp_toluen_koefB = 9.97;
cp_toluen_koefC = -0.0551;
cp_toluen_koefD = 0.000138;
cp_toluen = cp_toluen_koefA+cp_toluen_koefB*T+cp_toluen_koefC*T^2+cp_toluen_koefD*T^3; % [J.mol^-1.K^-1]

% etanol - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_etanol_koefA = 28.2;
cp_etanol_koefB = 0.125;
cp_etanol_koefC = 0.0000305;
cp_etanol_koefD = -0.0000000388;
cp_etanol = cp_etanol_koefA+cp_etanol_koefB*T+cp_etanol_koefC*T^2+cp_etanol_koefD*T^3; % [J.mol^-1.K^-1]

% aceton - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_aceton_koefA = 31.5;
cp_aceton_koefB = 0.16;
cp_aceton_koefC = -0.0000117;
cp_aceton_koefD = -0.0000000176; 
cp_aceton = cp_aceton_koefA+cp_aceton_koefB*T+cp_aceton_koefC*T^2+cp_aceton_koefD*T^3; % [J.mol^-1.K^-1]

% CO2 - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_CO2_koefA = 20.8;
cp_CO2_koefB = 0.0677;
cp_CO2_koefC = -0.0000465;
cp_CO2_koefD = 0.0000000123;
cp_CO2 = cp_CO2_koefA+cp_CO2_koefB*T+cp_CO2_koefC*T^2+cp_CO2_koefD*T^3; % [J.mol^-1.K^-1]

% O2 - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_O2_koefA = 28.9;
cp_O2_koefB = -0.00144;
cp_O2_koefC = 0.0000155;
cp_O2_koefD = -0.00000000792; 
cp_O2 = cp_O2_koefA+cp_O2_koefB*T+cp_O2_koefC*T^2+cp_O2_koefD*T^3; % [J.mol^-1.K^-1]

% H2O - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 500 - 1300 K) [J.mol^-1.K^-1]
cp_H2O_koefA = 31.4;
cp_H2O_koefB = 0.00368;
cp_H2O_koefC = 0.0000095;
cp_H2O_koefD = -0.00000000333; 
cp_H2O = cp_H2O_koefA+cp_H2O_koefB*T+cp_H2O_koefC*T^2+cp_H2O_koefD*T^3; % [J.mol^-1.K^-1]

% N2 - cp = A + B*t + C*t^2 + D*t^3(pro rozsah 298 - 1300 K) [J.mol^-1.K^-1]
cp_N2_koefA = 29.6;
cp_N2_koefB = -0.00574;
cp_N2_koefC = 0.0000145;
cp_N2_koefD = -0.00000000572; 
cp_N2 = cp_N2_koefA+cp_N2_koefB*T+cp_N2_koefC*T^2+cp_N2_koefD*T^3; % [J.mol^-1.K^-1]

% dHr(298.15 K) - vypocet standardnich reakcnich entalpii pri 298.15 K [J/mol]
dHr_298_metan = stech_rmetan_CO2*dHsl_CO2+stech_rmetan_H2O*dHsl_H2O-stech_rmetan_CH4*dHsl_metan-stech_rmetan_O2*dHsl_O2;% [J/mol]
dHr_298_toluen = stech_rtoluen_CO2*dHsl_CO2+stech_rtoluen_H2O*dHsl_H2O-stech_rtoluen_C7H8*dHsl_toluen-stech_rtoluen_O2*dHsl_O2;% [J/mol] 
dHr_298_etanol = stech_retanol_CO2*dHsl_CO2+ stech_retanol_H2O*dHsl_H2O-stech_retanol_C2H6O*dHsl_etanol-stech_retanol_O2*dHsl_O2;% [J/mol]
dHr_298_aceton = stech_raceton_CO2*dHsl_CO2+stech_raceton_H2O*dHsl_H2O-stech_raceton_C3H6O*dHsl_aceton-stech_raceton_O2*dHsl_O2;% [J/mol]

% Vypočet delta koeficientov
% dHr teplotni zavislost s vyuzitim Kirchhoffova zakona [J/mol]
% dHr = dHr_298 + ( A*(T-Tst) + B/2*(T-Tst)^2 + C/3*(T-Tst)^3 + D/4*(T-Tst)^4 [J/mol]

% Metan - CH4 + 2O2 => CO2 + 2 H2O

metan_koef_deltaA = (stech_rmetan_CO2*cp_CO2_koefA+stech_rmetan_H2O*cp_H2O_koefA)-(stech_rmetan_CH4*cp_metan_koefA+stech_rmetan_O2*cp_O2_koefA);
metan_koef_deltaB = (stech_rmetan_CO2*cp_CO2_koefB+stech_rmetan_H2O*cp_H2O_koefB)-(stech_rmetan_CH4*cp_metan_koefB+stech_rmetan_O2*cp_O2_koefB);
metan_koef_deltaC = (stech_rmetan_CO2*cp_CO2_koefC+stech_rmetan_H2O*cp_H2O_koefC)-(stech_rmetan_CH4*cp_metan_koefC+stech_rmetan_O2*cp_O2_koefC);
metan_koef_deltaD = (stech_rmetan_CO2*cp_CO2_koefD+stech_rmetan_H2O*cp_H2O_koefD)-(stech_rmetan_CH4*cp_metan_koefD+stech_rmetan_O2*cp_O2_koefD);

dHr_metan = dHr_298_metan+metan_koef_deltaA*(T-Tst)+metan_koef_deltaB/2*(T-Tst)^2+metan_koef_deltaC/3*(T-Tst)^3+metan_koef_deltaD/4*(T-Tst)^4; %[J/mol]

% Toluen - C7H8 + 9O2 => 7 CO2 + 4 H2O

toluen_koef_deltaA = (stech_rtoluen_CO2*cp_CO2_koefA+stech_rtoluen_H2O*cp_H2O_koefA)-(stech_rtoluen_C7H8*cp_toluen_koefA+stech_rtoluen_O2*cp_O2_koefA);
toluen_koef_deltaB = (stech_rtoluen_CO2*cp_CO2_koefB+stech_rtoluen_H2O*cp_H2O_koefB)-(stech_rtoluen_C7H8*cp_toluen_koefB+stech_rtoluen_O2*cp_O2_koefB);
toluen_koef_deltaC = (stech_rtoluen_CO2*cp_CO2_koefC+stech_rtoluen_H2O*cp_H2O_koefC)-(stech_rtoluen_C7H8*cp_toluen_koefC+stech_rtoluen_O2*cp_O2_koefC);
toluen_koef_deltaD = (stech_rtoluen_CO2*cp_CO2_koefD+stech_rtoluen_H2O*cp_H2O_koefD)-(stech_rtoluen_C7H8*cp_toluen_koefD+stech_rtoluen_O2*cp_O2_koefD);

dHr_toluen = dHr_298_toluen+toluen_koef_deltaA*(T-Tst)+toluen_koef_deltaB/2*(T-Tst)^2+toluen_koef_deltaC/3*(T-Tst)^3+toluen_koef_deltaD/4*(T-Tst)^4; %[J/mol]


% Etanol - C2H6O + 3O2 => 2 CO2 + 3 H2O

etanol_koef_deltaA = (stech_retanol_CO2*cp_CO2_koefA+stech_retanol_H2O*cp_H2O_koefA)-(stech_retanol_C2H6O*cp_etanol_koefA+stech_retanol_O2*cp_O2_koefA);
etanol_koef_deltaB = (stech_retanol_CO2*cp_CO2_koefB+stech_retanol_H2O*cp_H2O_koefB)-(stech_retanol_C2H6O*cp_etanol_koefB+stech_retanol_O2*cp_O2_koefB);
etanol_koef_deltaC = (stech_retanol_CO2*cp_CO2_koefC+stech_retanol_H2O*cp_H2O_koefC)-(stech_retanol_C2H6O*cp_etanol_koefC+stech_retanol_O2*cp_O2_koefC);
etanol_koef_deltaD = (stech_retanol_CO2*cp_CO2_koefD+stech_retanol_H2O*cp_H2O_koefD)-(stech_retanol_C2H6O*cp_etanol_koefD+stech_retanol_O2*cp_O2_koefD);

dHr_etanol = dHr_298_etanol+etanol_koef_deltaA*(T-Tst)+etanol_koef_deltaB/2*(T-Tst)^2+etanol_koef_deltaC/3*(T-Tst)^3+etanol_koef_deltaD/4*(T-Tst)^4; %[J/mol]

% Aceton - C3H6O + 4O2 => 3 CO2 + 3 H2O

aceton_koef_deltaA = (stech_raceton_CO2*cp_CO2_koefA+stech_raceton_H2O*cp_H2O_koefA)-(stech_raceton_C3H6O*cp_aceton_koefA+stech_raceton_O2*cp_O2_koefA);
aceton_koef_deltaB = (stech_raceton_CO2*cp_CO2_koefB+stech_raceton_H2O*cp_H2O_koefB)-(stech_raceton_C3H6O*cp_aceton_koefB+stech_raceton_O2*cp_O2_koefB);
aceton_koef_deltaC = (stech_raceton_CO2*cp_CO2_koefC+stech_raceton_H2O*cp_H2O_koefC)-(stech_raceton_C3H6O*cp_aceton_koefC+stech_raceton_O2*cp_O2_koefC);
aceton_koef_deltaD = (stech_raceton_CO2*cp_CO2_koefD+stech_raceton_H2O*cp_H2O_koefD)-(stech_raceton_C3H6O*cp_aceton_koefD+stech_raceton_O2*cp_O2_koefD);

dHr_aceton = dHr_298_aceton+aceton_koef_deltaA*(T-Tst)+aceton_koef_deltaB/2*(T-Tst)^2+aceton_koef_deltaC/3*(T-Tst)^3+aceton_koef_deltaD/4*(T-Tst)^4; %[J/mol]


end

