name="Tedom Quanto D400";
abr="D400";
Pe=400;(*kW elektricky vykon*)
ηc=.901;(*- celkova ucinnost*)
Pt=456;(*kW tepelny vykon*)
investice=6400000+6000000;(*Kč*)
cServis=90;(*Kč/h cena za servis*)
cGO=2560000;
zivotnost=60000;
color=Red;

name="Motorgas MGM 400";
abr="M400";
Pe=404;(*kW elektricky vykon*)
ηc=.866;(*- celkova ucinnost*)
Pt=500;(*kW tepelny vykon*)
investice=5290000+6000000;(*Kč*)
cServis=80;(*Kč/h cena za servis*)
cGO=2116000;
zivotnost=60000;
color=Blue;

name="2x Capstone C200";
abr="2C200";
Pe=2*190;(*kW elektricky vykon*)
ηc=.765;(*- celkova ucinnost*)
Pt=2*279;(*kW tepelny vykon*)
investice=2*7140000+9000000;(*Kč*)
cServis=27;(*Kč/h cena za servis*)
cGO=5712000;
zivotnost=80000;
color=Orange;

r=.08; (*- diskont*)
gE=1.02;gPl=1.02;gZB=1.02;gSer=1.02;

Qspot={1070,980,990,720,580,420,400,390,540,780,950,940};(*GJ/měsíc*)


q=1+r;
dan=.15;(* dan*)
odpisy={.11,.2225,.2225,.2225,.2225};


cPlynFix=580000;(*Kc/rok*)
cPlynVar=840;(*Kc/MWh*)
ηkot=.9;(*- účinnost kotle*)
cE=1204.9929504179702` +295.09118854079475` ArcTan[4.2288929588740745` -0.00115048223412454` hodiny];

ZB=Piecewise[{{1640,Pe≤200&&hodiny≤3000},{1180,Pe≤200&&hodiny≤4400},{250,Pe≤200&&hodiny≤8400},{1180,Pe≤1000&&hodiny≤3000},{780,Pe≤1000&&hodiny≤4400},{170,Pe≤1000&&hodiny≤8400},{830,Pe≤5000&&hodiny≤3000},{500,Pe≤5000&&hodiny≤4400},{75,Pe≤5000&&hodiny≤8400}}];

maxHodinRok=Total[Qspot]/3.6*1000/Pt;
TZiv:=zivotnost/hodiny;

Evyr=Pe*hodiny/1000;
QKJ=Pt*hodiny/1000;
Qkot=Total[Qspot]/3.6-QKJ;

VE=Evyr*cE*(gE^(t-1));
VZB=ZB*Evyr*(gZB^(t-1));
NPl=(((QKJ+Evyr)/ηc+Qkot/ηkot)*cPlynVar+cPlynFix)*(gPl^(t-1));
NSer=cServis*hodiny*(gSer^(t-1));
NOdpisy=investice*odpisy;
NPVTaxOdp=Sum[NOdpisy[[t]]*dan*(q^(-t)),{t,1,5}];
CF=(VE+VZB-NPl-NSer)*(1-dan);

NPV=-investice+Sum[CF*(q^(-t)),{t,1,2*TZiv}]+NPVTaxOdp-cGO*(q^(-TZiv));
anuita=(((q^(2*TZiv))*r)/((q^(2*TZiv))-1));
NPV0=-Sum[(Total[Qspot]/3.6/ηkot*cPlynVar+cPlynFix)*(gPl^(t-1))*(1-dan)*(q^(-t)),{t,1,2*TZiv}];

(Subscript[RCF, name])=Plot[(NPV-NPV0)*anuita,{hodiny,0,maxHodinRok},AxesLabel->{"Doba provozu [hod/rok]","RCF [Kč]"},PlotStyle->color]