(*Tabulka parametrů páry s veličinami:
teplota [°C], tlak [MPa], entropie [J/(kg*K)], entalpie [kJ/kg]*)

tab={{600,27.107,6308.8,3474.1},{597,26.326,6318.5,3472.3},{338.19,5.0491,6393.7,3036.1},{610,4.7967,7307.5,3691.7},{606.5,4.6528,7313.3,3684.7},{297.02,0.57427,7384.2,3056.5},{29.577,0.004181,7716,2330.1},{29.602,0.004145,431,123.99},{30.541,1.5,443.9,129.33},{54.3,1.45,758.6,228.59},{81.811,1.4,1096.3,343.74},{106.19,1.4,1375.6,446.27},{129.69,1.35,1630.7,545.88},{154.67,1.35,1888.6,652.97},{182.17,1.05,2160.7,772.77},{188.62,34,2179.7,818.43},{220.48,33,2472.2,957.05},{259.81,32,2813.2,1134.3},{285.03,31,3040.3,1253.4},{289.91,30,3086.6,1277}};

odbery={{389.13,7.2536,6383.4,3124.4},{509.87,2.5701,7339.9,3483.8},{391.82,1.1707,7364.9,3244.2},{311.8,0.57427,7437.4,3087.2},{223.32,0.29926,7412.8,2913.7},{145.87,0.13126,7465.2,2766},{82.401,0.052216,7503.1,2620.3},{57.47,0.017723,7604.5,2490.5}};

h=Flatten[Take[tab,All,-1]];(*vyjádření pouze entalpií*)

ho=Flatten[Take[odbery,All,-1]];(*vyjádření pouze entalpií odběrů*)

hk={1184.6(*269.9°C*),992.6(*230.5*),846.1(*198.6*),566.5(*134.7*),466.4(*111.2*),248.2(*59.3*)};(*entalpie kondenzátu při daných teplotách*)

(*rovnice pro jednotlivá zařízení:*)

rceVTO4=oVTO4*(ho[[2]]-hx)==h[[20]]-h[[19]];
rceVTO3=oVTO3*(ho[[1]]-hk[[1]])==h[[19]]-h[[18]];
rceVTO2=oVTO2*(h[[3]]-hk[[2]])+oVTO3*(hk[[1]]-hk[[2]])==h[[18]]-h[[17]];
rceVTO1=oVTO4*(hx-hk[[3]])+(oVTO3+oVTO2)*(hk[[2]]-hk[[3]])==h[[17]]-h[[16]];
rceTO=oTO*(ho[[3]]-h[[15]])+(oVTO4+oVTO3+oVTO2)*(hk[[3]]-h[[15]])==(1-oVTO4-oVTO3-oVTO2-oTO)*(h[[15]]-h[[14]]);
rceNTO5=oNTO5*(ho[[4]]-hk[[4]])==(1-oVTO4-oVTO3-oVTO2-oTO)*(h[[14]]-h[[13]]);
rceNTO4=oNTO4*(ho[[5]]-hk[[5]])+oNTO5*(hk[[4]]-hk[[5]])==(1-oVTO4-oVTO3-oVTO2-oTO)*(h[[13]]-h[[12]]);
rceNTO3=oNTO3*(ho[[6]]-h[[12]])+(oNTO4+oNTO5)*(hk[[5]]-h[[12]])==(1-oVTO4-oVTO3-oVTO2-oTO-oNTO5-oNTO4-oNTO3-oEKOGAVO)*(h[[12]]-h[[11]]);
rceNTO2=oNTO2*(ho[[7]]-hk[[6]])==(1-oVTO4-oVTO3-oVTO2-oTO-oNTO5-oNTO4-oNTO3-oEKOGAVO)*(h[[11]]-h[[10]]);
rceNTO1=oNTO1*(ho[[8]]-h[[10]])+oNTO2*(hk[[6]]-h[[10]])==(1-oVTO4-oVTO3-oVTO2-oTO-oNTO5-oNTO4-oNTO3-oNTO2-oNTO1)*(h[[10]]-h[[9]]);
rceEKOGAVO=oEKOGAVO==165.09/464.48;
(*bezEKOGAVO: rceEKOGAVO=oEKOGAVO==0;*)
(*bezNTO4: rceNTO5=oNTO5*(ho[[4]]-hk[[5]])==(1-oVTO4-oVTO3-oVTO2-oTO)*(h[[14]]-h[[12]]);
rceNTO4=oNTO4==0;*)

rce={rceVTO4,rceVTO3,rceVTO2,rceVTO1,rceTO,rceNTO5,rceNTO4,rceNTO3,rceNTO2,rceNTO1,rceEKOGAVO};

promenne={oVTO4,oVTO3,oVTO2,oTO,oNTO5,oNTO4,oNTO3,oNTO2,oNTO1,oEKOGAVO,hx};

res=NSolve[rce,promenne][[1]](*řešení soustavy rovnic*)

doNTO=oVTO4+oVTO3+oVTO2+oTO+oNTO5

aVT=h[[2]]-ho[[1]]+(1-oVTO3)*(ho[[1]]-h[[3]]);aST=(1-oVTO3-oVTO2)*(h[[4]]-ho[[2]])+(1-oVTO4-oVTO3-oVTO2)*(ho[[2]]-ho[[3]])+(1-oVTO4-oVTO3-oVTO2-oTO)*(ho[[3]]-ho[[4]])+(1-doNTO)*(ho[[4]]-h[[6]]);aNT=(1-doNTO)*(h[[6]]-ho[[5]])+(1-doNTO-oNTO4)*(ho[[5]]-ho[[6]])+(1-doNTO-oNTO4-oNTO3)*(ho[[6]]-ho[[7]])+(1-doNTO-oNTO4-oNTO3-oNTO2)*(ho[[7]]-ho[[8]])+(1-doNTO-oNTO4-oNTO3-oNTO2-oNTO1)*(ho[[8]]-h[[7]]);
aELN=(1/0.8)*(tab[[16]][[2]]-tab[[15]][[2]])*1.13;
a=aVT+aST+aNT-aELN/.res;(*určení vykonané práce*)

q=h[[1]]-h[[20]]+(1-oVTO3-oVTO2)*(h[[4]]-h[[3]])+(oEKOGAVO)*(h[[12]]-h[[10]])/.res;(*určení dodaného tepla*)

η=100*(a/q)(*výpočet účinnosti*)

ηmax=100*((tab[[4]][[1]]-tab[[8]][[1]])/(tab[[4]][[1]]+273.15))(*výpočet maximální možné účinnosti*)

(η/(ηmax))*100(*výpočet poměru dosažené a maximální účinnosti*)

qbezEKO=h[[1]]-h[[20]]+(1-(oVTO3)-(oVTO2))*(h[[4]]-h[[3]])/.res;(*určení dodaného tepla bez EKOGAVO*)

P1=1286000;

P1/qbezEKO(*výpočet celkového hmotnostního toku*)

(Take[promenne,10]/.res)*P1/qbezEKO(*výpočet jmenovitých odběrů*)

(aVT+aST+aNT/.res)*P1/qbezEKO/1000(*výpočet vyráběného výkonu*)