Un1=25
Un2=400
Uv=Un1
frekv=50
omega=2*pi*frekv

% Transformator
Snt=500
Ukp=11
Xt=Ukp/100*Uv^2/Snt

% Vedeni
l=250
Lp1=0.001*l

Xv1=Lp1*omega/Un2^2*Uv^2
Xv=Xv1/2

% Nadrazena soustava
Sk=1000
Xs=1.1*Uv^2/Sk

% Alternator
CosFi=0.9
Png=500
Sng=Png/CosFi
Xd=250/100*Uv^2/Sng
Xdc=70/100*Uv^2/Sng

Pt=450
Fi=acos(CosFi)
Qg=Pt/CosFi*sin(Fi)
Qg=Pt*tan(Fi)
Ig=(Pt-i*Qg)/sqrt(3)/Uv
Unf=Uv/sqrt(3)
Xc=Xd+Xt+Xv+Xs
E=i*Ig*Xc+Unf
Xcc=Xdc+Xt+Xv+Xs
Ec=i*Ig*Xcc+Unf

Us=i*Ig*Xs+Unf
Ug=i*Ig*(Xs+Xt+Xv)+Unf

Theta0=angle(E)
Theta0c=angle(Ec)
Eabs=abs(E)
Ecabs=abs(Ec)

Pg=3*Eabs*Unf/Xc*sin(Theta0)
Pg=3*Ecabs*Unf/Xcc*sin(Theta0c)
Pmax=3*Eabs*Unf/Xc
Pmaxc=3*Ecabs*Unf/Xcc

Pmax1=Pmaxc
Pmax2=0
Xccc=Xdc+Xt+Xv1+Xs
Pmax3=3*Ecabs*Unf/Xccc

Tm=5
Jmot=Tm*(Png*1E6)/(omega*omega)
