% Program pro vypocet cinnych a jalovych ztrat 

% Un [kV]
Un=110;
% Pmax [MW]
Pmax=40;
% cos Fi [-]
CosFi=0.95;
% Sn [MVA]
Sn=40;
% Td [hod]
Td=12;
% T [hod]
T=Td*365;
% Tp [hod]
Tp=8760;
% Tz [hod]
% Tz=T*sqrt(T/Tp)
Tz=T*sqrt(T/Tp);
% dP0 [%]
dP0p=0.3;
% dPk [%]
dPkp=1;
% Uk [%]
Ukp=10;
% I0 [%]
I0p=1;

fprintf('Un = %.1f [kV]\n',Un)
fprintf('Pmax = %.1f [MW]\n',Pmax)
fprintf('CosFi = %.5f [-]\n',CosFi)
fprintf('Sn = %.1f [MVA]\n',Sn)
fprintf('Td = %.3f [hod]\n',Td)
fprintf('T = %.1f [hod]\n',T)
fprintf('Tp = %.1f [hod]\n',Tp)
fprintf('Tz = %.1f [hod]\n',Tz)
fprintf('dP0 = %.3f [proc.]\n',dP0p)
fprintf('dPk = %.3f [proc.]\n',dPkp)
fprintf('Uk = %.3f [proc.]\n',Ukp)
fprintf('I0 = %.3f [proc.]\n',I0p)
fprintf('\n')

dP0=dP0p/100*Sn*1000;
fprintf('dP0 = %.1f [kW]\n',dP0)
dPk=dPkp/100*Sn*1000;
fprintf('dPk = %.1f [kW]\n',dPk)
dP0r=dP0*Tp/1000;
fprintf('dP0r = %.1f [MWh]\n',dP0r)
dPkr=dPk*Tz/1000*((Pmax/CosFi)/Sn)^2;
fprintf('dPkr = %.1f [MWh]\n',dPkr)
dPr=dP0r+dPkr;
fprintf('dPr = %.1f [MWh]\n',dPr)
Ap=T*Pmax;
fprintf('Ap = %.1f [MWh]\n',Ap)
dPp=dPr/Ap*100;
fprintf('dPp = %.5f [proc.]\n',dPp)
fprintf('\n')

Odm3=sqrt(3);
Inorm=Sn/(Odm3*Un);
fprintf('In = %.5f [kA]\n',Inorm)
I0=I0p/100*Inorm*1000;
fprintf('I0 = %.3f [A]\n',I0)
Q0=Odm3*Un*I0;
fprintf('Q0 = %.1f [kVAr]\n',Q0)
dQ0r=Q0*Tp/1000;
fprintf('dQ0r = %.1f [MVArh]\n',dQ0r)
Urp=dPkp;
fprintf('Ur = %.3f [proc.]\n',Urp)
Uxp=sqrt(Ukp*Ukp-Urp*Urp);
fprintf('Ux = %.3f [proc.]\n',Uxp)
Qk=Uxp/100*Sn*1000;
fprintf('Qk = %.3f [kVAr]\n',Qk)
dQkr=Qk*Tz*((Pmax/CosFi)/Sn)^2/1000;
fprintf('Qkr = %.1f [MVArh]\n',dQkr)
dQr=dQ0r+dQkr;
fprintf('Qr = %.1f [MVArh]\n',dQr)
