Příloha 1 - Kód v programu Wolfram Mathematica použitý k výpočtu

(*definice komplexního otočení o 120°*)
a=(E^(I*((2π)/3)));

(*funkce na vykreslení fázorů*)
presnost=0.01;
zobrazvektory[list_]:=Module[{list2,Uvekt,Uvekt2,Uarrow,Ubararrow,delka,range,barvy,popis},
list2=Flatten[list];
Uvekt=Transpose[{-Im[list2],Re[list2]}];
delka=Uvekt//Length;
Uvekt2=Transpose[{Table[{0,0},{i,delka}],Uvekt}];
Uarrow=Arrow/@Uvekt2;
barvy=Darker/@Hue/@(Range[delka]/delka);
Ubararrow=Transpose[{barvy,Uarrow}];
range=1.1*Max[Abs/@Flatten[Uvekt]];
popis=StringJoin/@Transpose[{TextString/@Range[delka],ConstantArray[")  ",delka],ToString/@(Re/@Round[list2,presnost]+(Im/@Round[list2,presnost])*j)}];
Show[Graphics/@Ubararrow,Axes->True,AxesLabel->{"-Im(U) [kV]","Re(U) [kV]"},PlotRange->{{-range,range},{-range,range}},Epilog->Inset[SwatchLegend[barvy,popis],{1.1range,0.6range}]]]

zobrazvektory2[list_]:=Module[{list2,Uvekt,Uvekt2,Uarrow,Ubararrow,delka,range,barvy},
list2=Flatten[list];
Uvekt=Transpose[{-Im[list2],Re[list2]}];
delka=Uvekt//Length;
Uvekt2=Transpose[{Table[{0,0},{i,delka}],Uvekt}];
Uarrow=Arrow/@Uvekt2;
barvy=Darker/@Hue/@(Range[delka]/delka);
Ubararrow=Transpose[{barvy,Uarrow}];
range=1.1*Max[Abs/@Flatten[Uvekt]];
Show[Graphics/@Ubararrow,Axes->True,AxesLabel->{"-Im","Re"},PlotRange->{{-range,range},{-range,range}}]]

(*funkce pro paralelní kombinaci impedancí*)
par[list_]:=(1/(Total[(1/(#))&/@list]))

(*vztažné hodnoty*)
Sv=2*63;
Uv=6.3;
Zv=((Uv^2)/Sv);
Iv=(Sv/(Uv*(Sqrt[3])));

(*blokový transformátor*)
(*zapojení vinutí YNd1*)
Sbt=3*400;
U1bt=420;
U2bt=24;
I1bt=1.650;
I2bt=16.666;
ukbt=0.14;
Pkbt=0.75;
xbt=ukbt*(Sv/Sbt);
rbt=(Pkbt/Sbt)*(Sv/Sbt);
zbt=rbt+(Sqrt[(xbt^2)-(rbt^2)])*I;

(*odbočkový transformátor*)
(*zapojení vinutí Dd0d0*)
S1ot=63;
S2ot=31.5;
U1ot=24;
U2ot=6.3;
I1ot=1.516;
I2ot=2.887;
uk12ot=0.0857;
uk13ot=0.0875;
uk23ot=0.166;
Pk12ot=0.1237;
Pk13ot=0.1282;
Pk23ot=0.2772;
r12ot=Pk12ot*(Sv/(S2ot^2));
r13ot=Pk13ot*(Sv/(S2ot^2));
r23ot=Pk23ot*(Sv/(S2ot^2));
z12ot=r12ot+I*(Sqrt[(((uk12ot*(Sv/S2ot)))^2)-(r12ot^2)]);
z13ot=r13ot+I*(Sqrt[(((uk13ot*(Sv/S2ot)))^2)-(r13ot^2)]);
z23ot=r23ot+I*(Sqrt[(((uk23ot*(Sv/S2ot)))^2)-(r23ot^2)]);
z1ot=((z12ot+z13ot-z23ot)/2);
z2ot=((z12ot+z23ot-z13ot)/2);
z3ot=((z13ot+z23ot-z12ot)/2);
(*impedance OT při dvou aktivních sekcích*)
zot2=par[{z1ot+z2ot,z1ot+z2ot}];
(*impedance OT při čtyřech aktivních sekcích*)
zot4=par[{z1ot+par[{z2ot,z3ot}],z1ot+par[{z2ot,z3ot}]}];

(*rezervní transformátor*)
(*zapojení vinutí YNd1d1*)
S1rt=63;
S2rt=31.5;
U1rt=110;
U2rt=6.3;
I1rt=0.331;
I2rt=2.887;
uk12rt=0.0934;
uk13rt=0.0925;
uk23rt=0.1844;
Pk12rt=0.1221;
Pk13rt=0.1173;
Pk23rt=0.2711;
r12rt=Pk12rt*(Sv/(S2rt^2));
r13rt=Pk13rt*(Sv/(S2rt^2));
r23rt=Pk23rt*(Sv/(S2rt^2));
z12rt=r12rt+I*(Sqrt[(((uk12rt*(Sv/S2rt)))^2)-(r12rt^2)]);
z13rt=r13rt+I*(Sqrt[(((uk13rt*(Sv/S2rt)))^2)-(r13rt^2)]);
z23rt=r23rt+I*(Sqrt[(((uk23rt*(Sv/S2rt)))^2)-(r23rt^2)]);
z1rt=((z12rt+z13rt-z23rt)/2);
z2rt=((z12rt+z23rt-z13rt)/2);
z3rt=((z13rt+z23rt-z12rt)/2);
(*impedance RT při dvou aktivních sekcích*)
zrt2=par[{z1rt+z2rt,z1rt+z2rt}];
(*impedance RT při čtyřech aktivních sekcích*)
zrt4=par[{z1rt+par[{z2rt,z3rt}],z1rt+par[{z2rt,z3rt}]}];

(*400 kV vedeni*)
X1v400=0.2974;
R1v400=0.02153;
Z1v400=R1v400+X1v400*I;
R0v400=0.1301;
X0v400=0.6293;
Z0v400=R0v400+X0v400*I;
x1v400=X1v400*(Sv/(400^2))*3;
z1v400=Z1v400*(Sv/(400^2))*3;
x0v400=X0v400*(Sv/(400^2))*3;
z0v400=Z0v400*(Sv/(400^2))*3;

(*110 kV vedeni*)
X1v110=0.3661;
R1v110=0.0425;
Z1v110=R1v110+X1v110*I;
R0v110=0.1812;
X0v110=0.9794;
Z0v110=R0v110+X0v110*I;
x1v110=X1v110*(Sv/(110^2))*3;
z1v110=Z1v110*(Sv/(110^2))*3;
x0v110=X0v110*(Sv/(110^2))*3;
z0v110=Z0v110*(Sv/(110^2))*3;

(*modelova vlastni spotreba*)
SBA=2.6+1.5I;
SBB=0;
SBC=2.9+1.9I;
SBD=0;
SBAmax=11.2+6.4I;
SBBmax=11.8+9.1I;
SBCmax=9.9+6.3I;
SBDmax=12.2+9.4I;
ZvsBA=((6.3^2)/(Conjugate[SBA]));
ZvsBC=((6.3^2)/(Conjugate[SBC]));
z1vsBA=(ZvsBA/Zv);
z1vsBC=(ZvsBC/Zv);
ZvsBAmax=((6.3^2)/(Conjugate[SBAmax]));
ZvsBBmax=((6.3^2)/(Conjugate[SBBmax]));
ZvsBCmax=((6.3^2)/(Conjugate[SBCmax]));
ZvsBDmax=((6.3^2)/(Conjugate[SBDmax]));
z1vsBAmax=(ZvsBAmax/Zv);
z1vsBBmax=(ZvsBBmax/Zv);
z1vsBCmax=(ZvsBCmax/Zv);
z1vsBDmax=(ZvsBDmax/Zv);

(*maximální a minimální impedance vlastní spotřeby*)
z1vs400min=par[{z1vsBA,z1vsBC}]+zot2;
z1vs400max=par[{z1vsBAmax,z1vsBBmax,z1vsBCmax,z1vsBDmax}]+zot4;
z1vs400={z1vs400min,z1vs400max};
z1vs110min=par[{z1vsBA,z1vsBC}]+zrt2;
z1vs110max=par[{z1vsBAmax,z1vsBBmax,z1vsBCmax,z1vsBDmax}]+zrt4;
z1vs110={z1vs110min,z1vs110max};
z1vs4={z1vs400,z1vs400,z1vs110,z1vs110};

(*funkce pro transformaci do složkové soustavy a z ní*)
naslozky[list_]:=Module[{a},a=(E^(I*((2π)/3)));
(1/3)*list.{{1,1,1},{a,(a^2),1},{(a^2),a,1}}]
zeslozek[list_]:=Module[{a},a=(E^(I*((2π)/3)));
list.{{1,(a^2),a},{1,a,(a^2)},{1,1,1}}]

(*výpočet v bezporuchovém stavu*)
bezpreruseni[{u_,z1_,z2_,z0_}]:={{(u/z1),0,0},{0,0,0}}

(*výpočet při přerušení jedné fáze*)
preruseni1f[{u_,z1_,z2_,z0_}]:=Module[{i1,i2,i0,u1,u2,u0},
i1=(u/(z1+((z2*z0)/(z2+z0))));
u1=u2=u0=u-i1*z1;
i2=((-u2)/z2);
i0=((-u0)/z0);
{{i1,i2,i0},{u1,u2,u0}}]
preruseni1fbez0[{u_,z1_,z2_,z0_}]:=Module[{i1,i2,i0,u1,u2,u0},
i1=(u/(z1+z2));
u1=u2=u0=u-i1*z1;
i2=((-u2)/z2);
i0=0;
{{i1,i2,i0},{u1,u2,u0}}]

(*výpočet při přerušení dvou fází*)
preruseni2f[{u_,z1_,z2_,z0_}]:=Module[{i1,i2,i0,u1,u2,u0},
i1=i2=i0=u/(z1+z2+z0);
u1=u-i1*z1;
u2=-i2*z2;
u0=-i0*z0;
{{i1,i2,i0},{u1,u2,u0}}]
preruseni2fbez0[{u_,z1_,z2_,z0_}]:=Module[{i1,i2,i0,u1,u2,u0},
i1=i2=i0=0;
u1=u-i1*z1;
u2=-i2*z2;
u0=-i0*z0;
{{i1,i2,i0},{u1,u2,u0}}]

(*funkce pro výpočet úbytku napětí*)
ubytek[{{i1_,i2_,i0_},{u1_,u2_,u0_}},{z1_,z2_,z0_}]:={{i1,i2,i0},{u1+z1*i1,u2+z2*i2,u0+z0*i0}}

(*funkce pro vynulování uzlu napětí*)
vynulujuzel[list_]:={list[[1]],list[[2]]-ConstantArray[list[[2]]//Mean,3]}

(*funkce pro zaokrouhlení kvůli správnému zobrazení nulových hodnot, korekce numerických nepřesností okolo nulové hodnoty*)
zaokrouh[{a_,b_,c_}]:={Round[a,0.001],Round[b,0.001],Round[c,0.001]}

(*vykreslení vyšetřované oblasti impedance*)
pl1a=RegionPlot[2.35≤z1&&z1≤19.6&&(1/7)*z1≤z2&&z2≤(1/2)*z1,{z1,0,20},{z2,0,10},Axes->True,Frame->None,AxesLabel->{"| (Subscript[z, 1]) |","| (Subscript[z, 2]) |"},PerformanceGoal->"Quality",GridLines->Automatic,PlotTheme->"Monochrome",PlotRangePadding->{0.2,0},ImageSize->240];
pl1b=RegionPlot[2.35≤z1&&z1≤19.6&&2≤z2&&z2≤7,{z1,0,20},{z2,0,8},Axes->True,Frame->None,AxesLabel->{"| (Subscript[z, 1]) |","(Subscript[z, 1/2])"},PerformanceGoal->"Quality",PlotTheme->"Monochrome",GridLines->Automatic,PlotRangePadding->{0.2,0},ImageSize->240];
pl2=GraphicsGrid[{{pl1b,pl1a}}]

(*vypocet 400 kV, provoz, preruseni za bt*)
z1celk=z1vs;
z2celk=z2vs;
z0celk=Null;
(*vypocet s obecnymi hodnotami impedancí vlastní spotřeby, pred ot*)
bezprslozky1=bezpreruseni[{1,z1celk,z2celk,z0celk}];
pr1fslozky1=preruseni1fbez0[{1,z1celk,z2celk,z0celk}];
pr2fslozky1=preruseni2fbez0[{1,z1celk,z2celk,z0celk}];
bezprfaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky1;
pr1ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky1;
pr2ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky1;
bezpr1=bezprfaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f1=pr1ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f1=pr2ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, ctyri sekce v provozu*)
bezprslozky2=ubytek[bezprslozky1,{zot4,zot4,0}];
pr1fslozky2=ubytek[pr1fslozky1,{zot4,zot4,0}];
pr2fslozky2=ubytek[pr2fslozky1,{zot4,zot4,0}];
bezprfaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky2;
pr1ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky2;
pr2ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky2;
bezpr2=bezprfaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f2=pr1ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f2=pr2ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
bezpr2nul=bezpr2//vynulujuzel;
pr1f2nul=pr1f2//vynulujuzel;
pr2f2nul=pr2f2//vynulujuzel;
(*vykreslení grafů*)
pl3=Plot[{Abs[pr1f2[[1]][[1]]]/Abs[bezpr2[[1]][[1]]],Abs[pr1f2[[1]][[2]]]/Abs[bezpr2[[1]][[2]]],Abs[pr1f2[[1]][[3]]]/Abs[bezpr2[[1]][[3]]]},{z12,2,7},PlotRange->{{2,7},{-0.1,1.7}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl4=GraphicsGrid[{{zobrazvektory2[bezpr2[[1]]/.{z1->1,z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr1f2[[1]]]/.z1->1],{z12,7,2,-0.5}]]}},ImageSize->550];
pl5=GraphicsGrid[{{zobrazvektory2[bezpr2[[2]]/.z1->Abs[z1vs400max]],Show[Table[zobrazvektory2[pr1f2[[2]]/.z1->Abs[z1vs400max]],{z12,2,7,0.5}]]}},ImageSize->550];
pl6=GraphicsGrid[{{zobrazvektory2[bezpr2nul[[2]]/.z1->Abs[z1vs400max]],Show[Table[zobrazvektory2[pr1f2nul[[2]]/.z1->Abs[z1vs400max]],{z12,2,7,0.5}]]}},ImageSize->550];
pl7=Plot[Evaluate[Abs[pr1f2nul][[2]]/.z1->Abs[z1vs400min]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, a])","(Subscript[u, b])","(Subscript[u, c])"},PlotRange->{0,1.21}];
pl8=Plot[Evaluate[Abs[(pr1f2nul[[2]]-RotateLeft[pr1f2nul[[2]]])/.z1->Abs[z1vs400max]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, ab])","(Subscript[u, bc])","(Subscript[u, ca])"},PlotRange->{0,1.21}];

(*vypocet 400 kV, odstavka, porucha před BT*)
z1celk=z1v400+zbt+z1vs;
z2celk=z1v400+zbt+z2vs;
z0celk=z0v400+zbt;
(*vypocet s obecnymi hodnotami impedancí vlastní spotřeby, v rozvodne*)
bezprslozky1=bezpreruseni[{1,z1celk,z2celk,z0celk}];
pr1fslozky1=preruseni1f[{1,z1celk,z2celk,z0celk}];
pr2fslozky1=preruseni2f[{1,z1celk,z2celk,z0celk}];
bezprfaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky1;
pr1ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky1;
pr2ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky1;
bezpr1=bezprfaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f1=pr1ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f1=pr2ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za vedenim*)
bezprslozky2=ubytek[bezprslozky1,{z1v400,z1v400,z0v400}];
pr1fslozky2=ubytek[pr1fslozky1,{z1v400,z1v400,z0v400}];
pr2fslozky2=ubytek[pr2fslozky1,{z1v400,z1v400,z0v400}];
bezprfaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky2;
pr1ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky2;
pr2ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky2;
bezpr2=bezprfaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f2=pr1ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f2=pr2ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za blokovym trafem*)
netoc0={{1,1,0},{1,1,0}};
bezprslozky3=ubytek[bezprslozky2,{zbt,zbt,zbt}]*netoc0;
pr1fslozky3=ubytek[pr1fslozky2,{zbt,zbt,zbt}]*netoc0;
pr2fslozky3=ubytek[pr2fslozky2,{zbt,zbt,zbt}]*netoc0;
bezprfaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(bezprslozky3);
pr1ffaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr1fslozky3);
pr2ffaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr2fslozky3);
bezpr3=bezprfaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f3=pr1ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f3=pr2ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, dve sekce v provozu*)
bezprslozky4=ubytek[bezprslozky3,{zot2,zot2,0}];
pr1fslozky4=ubytek[pr1fslozky3,{zot2,zot2,0}];
pr2fslozky4=ubytek[pr2fslozky3,{zot2,zot2,0}];
bezprfaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky4];
pr1ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky4];
pr2ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky4];
bezpr4=bezprfaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f4=pr1ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f4=pr2ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, ctyri sekce v provozu*)
bezprslozky5=ubytek[bezprslozky3,{zot4,zot4,0}];
pr1fslozky5=ubytek[pr1fslozky3,{zot4,zot4,0}];
pr2fslozky5=ubytek[pr2fslozky3,{zot4,zot4,0}];
bezprfaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky5];
pr1ffaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky5];
pr2ffaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky5];
bezpr5=bezprfaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f5=pr1ffaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f5=pr2ffaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
bezprslozky={bezprslozky1,bezprslozky2,bezprslozky3,bezprslozky4,bezprslozky5};
pr1fslozky={pr1fslozky1,pr1fslozky2,pr1fslozky3,pr1fslozky4,pr1fslozky5};
pr2fslozky={pr2fslozky1,pr2fslozky2,pr2fslozky3,pr2fslozky4,pr2fslozky5};
bezprfaze={bezprfaze1,bezprfaze2,bezprfaze3,bezprfaze4,bezprfaze5};
pr1ffaze={pr1ffaze1,pr1ffaze2,pr1ffaze3,pr1ffaze4,pr1ffaze5};
pr2ffaze={pr2ffaze1,pr2ffaze2,pr2ffaze3,pr2ffaze4,pr2ffaze5};
bezpr={bezpr1,bezpr2,bezpr3,bezpr4,bezpr5};
pr1f={pr1f1,pr1f2,pr1f3,pr1f4,pr1f5};
pr2f={pr2f1,pr2f2,pr2f3,pr2f4,pr2f5};
(*vykreslení grafů*)
pl9=Plot[{Abs[pr1f1[[1]][[1]]]/Abs[bezpr1[[1]][[1]]]/.z1->Abs[z1vs400min],Abs[pr1f1[[1]][[2]]]/Abs[bezpr1[[1]][[2]]]/.z1->Abs[z1vs400min],Abs[pr1f1[[1]][[3]]]/Abs[bezpr1[[1]][[3]]]/.z1->Abs[z1vs400min]},{z12,2,7},PlotRange->{{2,7},{-0.1,2}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl10=GraphicsGrid[{{zobrazvektory2[bezpr1[[1]]/.{z1->Abs[z1vs400min],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr1f1[[1]]]/.z1->Abs[z1vs400min]],{z12,7,2,-1}]]}},ImageSize->550];
pl11=GraphicsGrid[{{zobrazvektory2[bezpr2[[2]]/.z1->Abs[z1vs400min]],Show[Table[zobrazvektory2[pr1f2[[2]]/.z1->z],{z12,2,7,2.5},{z,Abs[z1vs400max],Abs[z1vs400min],3}]]}},ImageSize->550];
pl12=GraphicsGrid[{{zobrazvektory2[bezpr5[[1]]/.{z1->Abs[z1vs400min],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr1f5[[1]]]/.z1->Abs[z1vs400min]],{z12,7,2,-1}]]}},ImageSize->550];
pl13=Plot[{Abs[pr2f1[[1]][[1]]]/Abs[bezpr1[[1]][[1]]]/.z1->Abs[z1vs400min],Abs[pr2f1[[1]][[2]]]/Abs[bezpr1[[1]][[2]]]/.z1->Abs[z1vs400min],Abs[pr2f1[[1]][[3]]]/Abs[bezpr1[[1]][[3]]]/.z1->Abs[z1vs400min]},{z12,2,7},PlotRange->{{2,7},{-0.1,3.01}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl14=GraphicsGrid[{{zobrazvektory2[bezpr1[[1]]/.{z1->Abs[z1vs400min],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr2f2[[1]]]/.z1->Abs[z1vs400min]],{z12,7,2,-1}]]}},ImageSize->550];
pl15=GraphicsGrid[{{zobrazvektory2[bezpr2[[2]]/.z1->Abs[z1vs400min]],Show[Table[zobrazvektory2[pr2f2[[2]]/.z1->Abs[z1vs400min]],{z12,2,7,0.5}]]}},ImageSize->550];
pl16=Plot[Evaluate[Abs[pr2f2][[2]]/.z1->Abs[z1vs400min]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, a])","(Subscript[u, b])","(Subscript[u, c])"},PlotRange->{0,1.21}];
pl17=Plot[Evaluate[Abs[(pr2f2[[2]]-RotateLeft[pr2f5[[2]]])/.z1->Abs[z1vs400min]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, ab])","(Subscript[u, bc])","(Subscript[u, ca])"},PlotRange->{0,1.21}];
pl18=Plot[{Abs[pr2f5[[1]][[1]]]/Abs[bezpr5[[1]][[1]]]/.z1->Abs[z1vs400min],Abs[pr2f5[[1]][[2]]]/Abs[bezpr5[[1]][[2]]]/.z1->Abs[z1vs400min],Abs[pr2f5[[1]][[3]]]/Abs[bezpr5[[1]][[3]]]/.z1->Abs[z1vs400min]},{z12,2,7},PlotRange->{{2,7},{-0.1,3.01}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl19=GraphicsGrid[{{zobrazvektory2[bezpr5[[1]]/.{z1->Abs[z1vs400min],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr2f5[[1]]]/.z1->Abs[z1vs400min]],{z12,7,2,-1}]]}},ImageSize->550];
pl20=GraphicsGrid[{{zobrazvektory2[bezpr5[[2]]/.z1->Abs[z1vs400min]],Show[Table[zobrazvektory2[pr2f5[[2]]/.z1->Abs[z1vs400min]],{z12,2,7,0.5}]]}},ImageSize->550];
pl21=Plot[Evaluate[Abs[pr2f5][[2]]/.z1->Abs[z1vs400min]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, a])","(Subscript[u, b])","(Subscript[u, c])"},PlotRange->{0,1.21}];
pl22=Plot[Evaluate[Abs[(pr2f5[[2]]-RotateLeft[pr2f5[[2]]])/.z1->Abs[z1vs400min]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, ab])","(Subscript[u, bc])","(Subscript[u, ca])"},PlotRange->{0,1.21}];

(*vypocet 110 kV, preruseni pred rt*)
z1celk=z1v110+z1vs;
z2celk=z1v110+z2vs;
z0celk=z0v110+zrt4;
(*vypocet s obecnymi hodnotami impedancí vlastní spotřeby, v rozvodne*)
bezprslozky1=bezpreruseni[{1,z1celk,z2celk,z0celk}];
pr1fslozky1=preruseni1f[{1,z1celk,z2celk,z0celk}];
pr2fslozky1=preruseni2f[{1,z1celk,z2celk,z0celk}];
bezprfaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky1;
pr1ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky1;
pr2ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky1;
bezpr1=bezprfaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f1=pr1ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f1=pr2ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za vedenim*)
bezprslozky2=ubytek[bezprslozky1,{z1v110,z1v110,z0v110}];
pr1fslozky2=ubytek[pr1fslozky1,{z1v110,z1v110,z0v110}];
pr2fslozky2=ubytek[pr2fslozky1,{z1v110,z1v110,z0v110}];
bezprfaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky2;
pr1ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky2;
pr2ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky2;
bezpr2=bezprfaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f2=pr1ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f2=pr2ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za rezervnim trafem 2 sekce v provozu*)
netoc0={{1,1,0},{1,1,0}};
bezprslozky3=ubytek[bezprslozky2,{zrt2,zrt2,zrt4}]*netoc0;
pr1fslozky3=ubytek[pr1fslozky2,{zrt2,zrt2,zrt4}]*netoc0;
pr2fslozky3=ubytek[pr2fslozky2,{zrt2,zrt2,zrt4}]*netoc0;
bezprfaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(bezprslozky3)];
pr1ffaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr1fslozky3)];
pr2ffaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr2fslozky3)];
bezpr3=bezprfaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f3=pr1ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f3=pr2ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za rezervnim trafem 4 sekce v provozu*)
netoc0={{1,1,0},{1,1,0}};
bezprslozky4=ubytek[bezprslozky2,{zrt4,zrt4,zrt4}]*netoc0;
pr1fslozky4=ubytek[pr1fslozky2,{zrt4,zrt4,zrt4}]*netoc0;
pr2fslozky4=ubytek[pr2fslozky2,{zrt4,zrt4,zrt4}]*netoc0;
bezprfaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(bezprslozky4)];
pr1ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr1fslozky4)];
pr2ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr2fslozky4)];
bezpr4=bezprfaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f4=pr1ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f4=pr2ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*výsledky do tabulky*)
bezprslozkyr={bezprslozky1,bezprslozky2,bezprslozky3,bezprslozky4,bezprslozky4};
pr1fslozkyr={pr1fslozky1,pr1fslozky2,pr1fslozky3,pr1fslozky4,pr1fslozky4};
pr2fslozkyr={pr2fslozky1,pr2fslozky2,pr2fslozky3,pr2fslozky4,pr2fslozky4};
bezprfazer={bezprfaze1,bezprfaze2,bezprfaze3,bezprfaze4,bezprfaze4};
pr1ffazer={pr1ffaze1,pr1ffaze2,pr1ffaze3,pr1ffaze4,pr1ffaze4};
pr2ffazer={pr2ffaze1,pr2ffaze2,pr2ffaze3,pr2ffaze4,pr2ffaze4};
bezprr={bezpr1,bezpr2,bezpr3,bezpr4,bezpr4};
pr1fr={pr1f1,pr1f2,pr1f3,pr1f4,pr1f4};
pr2fr={pr2f1,pr2f2,pr2f3,pr2f4,pr2f4};
(*vykreslení grafů*)
pl29=Plot[{Abs[pr1f1[[1]][[1]]]/Abs[bezpr1[[1]][[1]]]/.z1->Abs[z1vs110max],Abs[pr1f1[[1]][[2]]]/Abs[bezpr1[[1]][[2]]]/.z1->Abs[z1vs110max],Abs[pr1f1[[1]][[3]]]/Abs[bezpr1[[1]][[3]]]/.z1->Abs[z1vs110max]},{z12,2,7},PlotRange->{{2,7},{-0.1,2}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl30=GraphicsGrid[{{zobrazvektory2[bezpr2[[1]]/.{z1->Abs[z1vs110max],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr1f2[[1]]]/.z1->Abs[z1vs110max]],{z12,7,2,-1}]]}},ImageSize->550];
pl31=GraphicsGrid[{{zobrazvektory2[bezpr2[[2]]/.z1->Abs[z1vs110max]],Show[{Table[zobrazvektory2[pr1f4[[2]]/.z1->Abs[z1vs110max]],{z12,2,7,2.5}],Table[zobrazvektory2[pr1f2[[2]]/.z1->Abs[z1vs110max]],{z12,2,7,2.5}]}]}},ImageSize->550];
pl32=GraphicsGrid[{{zobrazvektory2[bezpr4[[1]]/.{z1->Abs[z1vs110max],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr1f4[[1]]]/.z1->Abs[z1vs110max]],{z12,7,2,-1}]]}},ImageSize->550];
pl32b=Plot[{Abs[pr1f4[[1]][[1]]]/Abs[bezpr4[[1]][[1]]]/.z1->Abs[z1vs110max],Abs[pr1f4[[1]][[2]]]/Abs[bezpr4[[1]][[2]]]/.z1->Abs[z1vs110max],Abs[pr1f4[[1]][[3]]]/Abs[bezpr4[[1]][[3]]]/.z1->Abs[z1vs110max]},{z12,2,7},PlotRange->{{2,7},{-0.1,3.01}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl33=Plot[{Abs[pr2f1[[1]][[1]]]/Abs[bezpr1[[1]][[1]]]/.z1->Abs[z1vs110max],Abs[pr2f1[[1]][[2]]]/Abs[bezpr1[[1]][[2]]]/.z1->Abs[z1vs110max],Abs[pr2f1[[1]][[3]]]/Abs[bezpr1[[1]][[3]]]/.z1->Abs[z1vs110max]},{z12,2,7},PlotRange->{{2,7},{-0.1,3.01}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl34=GraphicsGrid[{{zobrazvektory2[bezpr2[[1]]/.{z1->Abs[z1vs110max],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr2f2[[1]]]/.z1->Abs[z1vs110max]],{z12,7,2,-1}]]}},ImageSize->550];
pl35=GraphicsGrid[{{zobrazvektory2[bezpr2[[2]]/.z1->Abs[z1vs110max]],Show[Table[zobrazvektory2[pr2f2[[2]]/.z1->Abs[z1vs110max]],{z12,2,7,0.5}]]}},ImageSize->550];
pl36=GraphicsGrid[{{Plot[Evaluate[Abs[pr2f2][[2]]/.z1->Abs[z1vs110max]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2])","u [-]"},AxesStyle->Black,GridLines->Automatic,PlotRange->{0,1.21},AspectRatio->1],Plot[Evaluate[Abs[pr2f4][[2]]/.z1->Abs[z1vs110max]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2])","u [-]"},AxesStyle->Black,GridLines->Automatic,PlotRange->{0,1.21},AspectRatio->1],LineLegend[Darker/@Hue/@(Range[3]/3),{"(Subscript[u, a])","(Subscript[u, b])","(Subscript[u, c])"}]}},ImageSize->600,Alignment->Left,Spacings->0];

pl37=GraphicsGrid[{{Plot[Evaluate[Abs[(pr2f2[[2]]-RotateLeft[pr2f2[[2]]])/.z1->Abs[z1vs110max]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2])","u [-]"},AxesStyle->Black,GridLines->Automatic,PlotRange->{0,1.21},AspectRatio->1],Plot[Evaluate[Abs[(pr2f4[[2]]-RotateLeft[pr2f4[[2]]])/.z1->Abs[z1vs110max]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2])","u [-]"},AxesStyle->Black,GridLines->Automatic,PlotRange->{0,1.21},AspectRatio->1],LineLegend[Darker/@Hue/@(Range[3]/3),{"(Subscript[u, ab])","(Subscript[u, bc])","(Subscript[u, ca])"}]}},ImageSize->600,Alignment->Left,Spacings->0];
pl38=Plot[{Abs[pr2f4[[1]][[1]]]/Abs[bezpr4[[1]][[1]]]/.z1->Abs[z1vs110max],Abs[pr2f4[[1]][[2]]]/Abs[bezpr4[[1]][[2]]]/.z1->Abs[z1vs110max],Abs[pr2f4[[1]][[3]]]/Abs[bezpr4[[1]][[3]]]/.z1->Abs[z1vs110max]},{z12,2,7},PlotRange->{{2,7},{-0.1,3.01}},GridLines->Automatic,AxesOrigin->{2,0},PlotLegends->{"(Subscript[i, %  a])","(Subscript[i, %  b])","(Subscript[i, %  c])"},AxesLabel->{"(Subscript[z, 1/2]) [-]","(Subscript[i, %]) [-]"},PlotStyle->Darker/@Hue/@(Range[3]/3),ImageSize->400,AxesStyle->Black];
pl39=GraphicsGrid[{{zobrazvektory2[bezpr4[[1]]/.{z1->Abs[z1vs110max],z12->1}],Show[Table[zobrazvektory2[zaokrouh[pr2f4[[1]]]/.z1->Abs[z1vs110max]],{z12,7,2,-1}]]}},ImageSize->550];
pl40=GraphicsGrid[{{zobrazvektory2[bezpr4[[2]]/.z1->Abs[z1vs110max]],Show[Table[zobrazvektory2[pr2f4[[2]]/.z1->Abs[z1vs110max]],{z12,2,7,0.5}]]}},ImageSize->550];
pl41=Plot[Evaluate[Abs[pr2f4][[2]]/.z1->Abs[z1vs110max]],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, a])","(Subscript[u, b])","(Subscript[u, c])"},PlotRange->{0,1.21}];
pl42=Plot[Evaluate[Abs[(pr2f4[[2]]-RotateLeft[pr2f4[[2]]])/.z1->Abs[z1vs110max]]/(Sqrt[3])],{z12,2,7},PlotStyle->Darker/@Hue/@(Range[3]/3),AxesLabel->{"(Subscript[z, 1/2]) [-]","u [-]"},AxesStyle->Black,GridLines->Automatic,ImageSize->400,PlotLegends->{"(Subscript[u, ab])","(Subscript[u, bc])","(Subscript[u, ca])"},PlotRange->{0,1.21}];
pl51=GraphicsGrid[{{zobrazvektory2[bezprfaze4[[2]]/.{z1vs->1000I,z2vs->1000I}],zobrazvektory2[pr1ffaze4[[2]]/.{z1vs->1000I,z2vs->1000I}]}},ImageSize->550];
pl52=GraphicsGrid[{{zobrazvektory2[bezprfaze4[[2]]/.{z1vs->1000I,z2vs->1000I}],zobrazvektory2[pr2ffaze4[[2]]/.{z1vs->1000I,z2vs->1000I}]}},ImageSize->550];

(*vypocet 400 kV, preruseni za bt*)
z1celk=z1v400+zbt+z1vs;
z2celk=z1v400+zbt+z2vs;
z0celk=z0v400+zbt;
(*vypocet s obecnymi hodnotami impedancí vlastní spotřeby, v rozvodne*)
bezprslozky1=bezpreruseni[{1,z1celk,z2celk,z0celk}];
pr1fslozky1a=preruseni1fbez0[{1,z1celk,z2celk,z0celk}];
pr2fslozky1a=preruseni2fbez0[{1,z1celk,z2celk,z0celk}];
pr1fslozky1={pr1fslozky1a[[1]],bezprslozky1[[2]]};
pr2fslozky1={pr2fslozky1a[[1]],bezprslozky1[[2]]};
bezprfaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky1;
pr1ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky1;
pr2ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky1;
bezpr1=bezprfaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f1=pr1ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f1=pr2ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za vedenim*)
bezprslozky2=ubytek[bezprslozky1,{z1v400,z1v400,z0v400}];
pr1fslozky2=ubytek[pr1fslozky1,{z1v400,z1v400,z0v400}];
pr2fslozky2=ubytek[pr2fslozky1,{z1v400,z1v400,z0v400}];
bezprfaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky2;
pr1ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky2;
pr2ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky2;
bezpr2=bezprfaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f2=pr1ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f2=pr2ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za blokovym trafem*)
bezprslozky3=ubytek[bezprslozky2,{zbt,zbt,zbt}];
pr1fslozky3=ubytek[pr1fslozky2,{zbt,zbt,zbt}];
pr2fslozky3=ubytek[pr2fslozky2,{zbt,zbt,zbt}];
pr1fslozky3a=ubytek[pr1fslozky1a,{z1v400+zbt,z1v400+zbt,z0v400+zbt}];
pr2fslozky3a=ubytek[pr2fslozky1a,{z1v400+zbt,z1v400+zbt,z0v400+zbt}];
bezprfaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(bezprslozky3);
pr1ffaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr1fslozky3);
pr2ffaze3={#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr2fslozky3);
bezpr3=bezprfaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f3=pr1ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f3=pr2ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, dve sekce v provozu*)
bezprslozky4=ubytek[bezprslozky3,{zot2,zot2,0}];
pr1fslozky4=ubytek[pr1fslozky3a,{zot2,zot2,0}];
pr2fslozky4=ubytek[pr2fslozky3a,{zot2,zot2,0}];
bezprfaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky4];
pr1ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky4];
pr2ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky4];
bezpr4=bezprfaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f4=pr1ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f4=pr2ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, ctyri sekce v provozu*)
bezprslozky5=ubytek[bezprslozky3,{zot4,zot4,0}];
pr1fslozky5=ubytek[pr1fslozky3a,{zot4,zot4,0}];
pr2fslozky5=ubytek[pr2fslozky3a,{zot4,zot4,0}];
bezprfaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky5];
pr1ffaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky5];
pr2ffaze5=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky5];
bezpr5=bezprfaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f5=pr1ffaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f5=pr2ffaze5/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
bezprslozky0={bezprslozky1,bezprslozky2,bezprslozky3,bezprslozky4,bezprslozky5};
pr1fslozky0={pr1fslozky1,pr1fslozky2,pr1fslozky3,pr1fslozky4,pr1fslozky5};
pr2fslozky0={pr2fslozky1,pr2fslozky2,pr2fslozky3,pr2fslozky4,pr2fslozky5};
bezprfaze0={bezprfaze1,bezprfaze2,bezprfaze3,bezprfaze4,bezprfaze5};
pr1ffaze0={pr1ffaze1,pr1ffaze2,pr1ffaze3,pr1ffaze4,pr1ffaze5};
pr2ffaze0={pr2ffaze1,pr2ffaze2,pr2ffaze3,pr2ffaze4,pr2ffaze5};
bezpr0={bezpr1,bezpr2,bezpr3,bezpr4,bezpr5};
pr1f0={pr1f1,pr1f2,pr1f3,pr1f4,pr1f5};
pr2f0={pr2f1,pr2f2,pr2f3,pr2f4,pr2f5};

(*vypocet 110 kV, preruseni za rt*)
z1celk=z1v110+z1vs;
z2celk=z1v110+z2vs;
z0celk=z0v110+zrt4;
(*vypocet s obecnymi hodnotami impedancí vlastní spotřeby, v rozvodne*)
bezprslozky1=bezpreruseni[{1,z1celk,z2celk,z0celk}];
pr1fslozky1a=preruseni1fbez0[{1,z1celk,z2celk,z0celk}];
pr2fslozky1a=preruseni2fbez0[{1,z1celk,z2celk,z0celk}];
pr1fslozky1={pr1fslozky1a[[1]],bezprslozky1[[2]]};
pr2fslozky1={pr2fslozky1a[[1]],bezprslozky1[[2]]};
bezprfaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky1;
pr1ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky1;
pr2ffaze1={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky1;
bezpr1=bezprfaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f1=pr1ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f1=pr2ffaze1/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za vedenim*)
bezprslozky2=ubytek[bezprslozky1,{z1v110,z1v110,z0v110}];
pr1fslozky2=ubytek[pr1fslozky1,{z1v110,z1v110,z0v110}];
pr2fslozky2=ubytek[pr2fslozky1,{z1v110,z1v110,z0v110}];
pr1fslozky2a=ubytek[pr1fslozky1a,{z1v110,z1v110,z0v110}];
pr2fslozky2a=ubytek[pr2fslozky1a,{z1v110,z1v110,z0v110}];
bezprfaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky2;
pr1ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky2;
pr2ffaze2={#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky2;
bezpr2=bezprfaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f2=pr1ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f2=pr2ffaze2/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za rezervnim trafem, dve sekce v provozu*)
bezprslozky3=ubytek[bezprslozky2,{zrt2,zrt2,0}];
pr1fslozky3=ubytek[pr1fslozky2a,{zrt2,zrt2,0}];
pr2fslozky3=ubytek[pr2fslozky2a,{zrt2,zrt2,0}];
bezprfaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(bezprslozky3)];
pr1ffaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr1fslozky3)];
pr2ffaze3=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@(pr2fslozky3)];
bezpr3=bezprfaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f3=pr1ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f3=pr2ffaze3/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
(*vypocet za odbockovym trafem, ctyri sekce v provozu*)
bezprslozky4=ubytek[bezprslozky2,{zrt4,zrt4,0}];
pr1fslozky4=ubytek[pr1fslozky2a,{zrt4,zrt4,0}];
pr2fslozky4=ubytek[pr2fslozky2a,{zrt4,zrt4,0}];
bezprfaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@bezprslozky4];
pr1ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr1fslozky4];
pr2ffaze4=vynulujuzel[{#1,{1,(a^2),a}-#2}&@@zeslozek/@pr2fslozky4];
bezpr4=bezprfaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f4=pr1ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f4=pr2ffaze4/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
bezprslozkyr0={bezprslozky1,bezprslozky2,bezprslozky3,bezprslozky4,bezprslozky4};
pr1fslozkyr0={pr1fslozky1,pr1fslozky2,pr1fslozky3,pr1fslozky4,pr1fslozky4};
pr2fslozkyr0={pr2fslozky1,pr2fslozky2,pr2fslozky3,pr2fslozky4,pr2fslozky4};
bezprfazer0={bezprfaze1,bezprfaze2,bezprfaze3,bezprfaze4,bezprfaze4};
pr1ffazer0={pr1ffaze1,pr1ffaze2,pr1ffaze3,pr1ffaze4,pr1ffaze4};
pr2ffazer0={pr2ffaze1,pr2ffaze2,pr2ffaze3,pr2ffaze4,pr2ffaze4};
bezprr0={bezpr1,bezpr2,bezpr3,bezpr4,bezpr4};
pr1fr0={pr1f1,pr1f2,pr1f3,pr1f4,pr1f4};
pr2fr0={pr2f1,pr2f2,pr2f3,pr2f4,pr2f4};
(*vykreslení grafu*)
pl50=GraphicsGrid[{{zobrazvektory2[bezprfaze4[[2]]/.{z1vs->1000I,z2vs->1000I}],zobrazvektory2[pr1ffaze4[[2]]/.{z1vs->1000I,z2vs->1000I}]}},ImageSize->550];

bezprfazecelk={bezprfaze,bezprfaze0,bezprfazer,bezprfazer0};
pr1ffazecelk={pr1ffaze,pr1ffaze0,pr1ffazer,pr1ffazer0};
pr2ffazecelk={pr2ffaze,pr2ffaze0,pr2ffazer,pr2ffaze0};
celk={bezprfazecelk,pr1ffazecelk,pr2ffazecelk};

celk2=Table[{celk[[i,j,k,1,m]],celk[[i,j,k,2,m]],(1/(Sqrt[3]))(celk[[i,j,k,2,m]]-RotateLeft[celk,{0,0,0,0,1}][[i,j,k,2,m]])},{i,3},{j,4},{k,5},{m,3}];

celk3=Table[celk2[[i,j,k,m,l]],{i,3},{j,4},{k,5},{l,3},{m,3}];
celk4=Table[If[l==1,celk3[[i,j,k,l,m]]/celk3[[1,j,k,l,m]],celk3[[i,j,k,l,m]]],{i,3},{j,4},{k,5},{l,3},{m,3}];

(*Syntax: celk4[[typ(bez,1f,2f),mistoporuchy(predot,zaot,predrt,zart),hodnotyzamistem(rozv,ved,bt/rt2,ot2/rt4,ot4/rt4),velicina(i/ufaz/usdruz),faze(a,b,c)]] *)

(*hromadné vykreslení grafů pro analýzu chování poruchy*)
Manipulate[Module[{pom},
TableForm[Table[pom=Abs[celk4[[i,k,j,velicina,All]]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
Plot[pom,{z12,1,10},PlotRange->{{2,7},{-0.1,2.8}},GridLines->{{1,1}},AxesOrigin->{2,0},PlotLegends->{"a","b","c"},AxesLabel->{"z12",""},ImageSize->210],{j,2,5,3},{i,3}],TableHeadings->{{"pred trf","na vs"},{"bez poruchy"," preruseni 1 faze","preruseni 2 fazi"}}]],Row[{Control[{{k,1,"misto poruchy"},{1->"pred bt",2->"za bt",3->"pred rt",4->"za rt"}}],Control[{{velicina,1},{1->"zmena proudu",2->"napeti faz",3->"napeti sdruz"}}],Control[{z1,Abs[z1vs4[[k]][[2]]],Abs[z1vs4[[k]][[1]]],(1/19)(Abs[z1vs4[[k]][[1]]]-Abs[z1vs4[[k]][[2]]])}]},Spacer[20]]]

(*funkce na vytváření 3d grafů s proměným z1 a z2/z1*)
Plot3Dz1z12[x_,{y1_,y2_}]:=Plot3D[x,{z1,Abs[y2],Abs[y1]},{z12,2,7},PlotLegends->Automatic,PlotRange->All,ColorFunction->"Rainbow",AxesLabel->{"z1","z1/z2","i"},ImageSize->500]

(*400 kV, porucha před BT, 3D graf a fázory*)
Manipulate[
{FindMinimum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs400max]≤z1≤Abs[z1vs400min],2≤z12≤7},{z1,z12}],
FindMaximum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs400max]≤z1≤Abs[z1vs400min],2≤z12≤7},{z1,z12}],
Plot3Dz1z12[Abs[f[[misto]][[velicina]][[faze]]],z1vs400]},Row[{Control[{{f,bezpr,"porucha"},{bezpr->"bez",pr1f->"1f",pr2f->"2f"}}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",5->"ot 4sekce",4->"ot 2 sekce"}}],Control[{{faze,1},{1->"a",2->"b",3->"c"}}],Control[{{velicina,1},{1->"proud",2->"napeti"}}]},Spacer[10]]]
Manipulate[Module[{bezpr,pr1f,pr2f},
bezpr=bezprfaze[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f=pr1ffaze[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f=pr2ffaze[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
GraphicsGrid[{{zobrazvektory[(bezpr)[[1]]],zobrazvektory[(pr1f)[[1]]],
zobrazvektory[(pr2f)[[1]]]},{zobrazvektory[(bezpr)[[2]]],zobrazvektory[(pr1f)[[2]]],
zobrazvektory[(pr2f)[[2]]]}},ImageSize->750]],Row[{Control[{z1,Abs[z1vs400max],Abs[z1vs400min],((Abs[z1vs400min]-Abs[z1vs400max])/9)}],Control[{z12,2,7,1}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",4->"ot 2sekce",5->"ot 4 sekce"}}]},Spacer[10]]]

(*400 kV, porucha za BT, 3D graf a fázory*)
Manipulate[
{FindMinimum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs400max]≤z1≤Abs[z1vs400min],2≤z12≤7},{z1,z12}],
FindMaximum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs400max]≤z1≤Abs[z1vs400min],2≤z12≤7},{z1,z12}],
Plot3Dz1z12[Abs[f[[misto]][[velicina]][[faze]]],z1vs400]},Row[{Control[{{f,bezpr0,"porucha"},{bezpr0->"bez",pr1f0->"1f",pr2f0->"2f"}}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",5->"ot 4sekce",4->"ot 2 sekce"}}],Control[{{faze,1},{1->"a",2->"b",3->"c"}}],Control[{{velicina,1},{1->"proud",2->"napeti"}}]},Spacer[10]]]
Manipulate[Module[{bezpr,pr1f,pr2f},
bezpr=bezprfaze0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f=pr1ffaze0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f=pr2ffaze0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
GraphicsGrid[{{zobrazvektory[(bezpr)[[1]]],zobrazvektory[(pr1f)[[1]]],
zobrazvektory[(pr2f)[[1]]]},{zobrazvektory[(bezpr)[[2]]],zobrazvektory[(pr1f)[[2]]],
zobrazvektory[(pr2f)[[2]]]}},ImageSize->750]],Row[{Control[{z1,Abs[z1vs400max],Abs[z1vs400min],((Abs[z1vs400min]-Abs[z1vs400max])/9)}],Control[{z12,2,7,1}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",4->"ot 2sekce",5->"ot 4 sekce"}}]},Spacer[10]]]

(*110 kV, porucha před RT, 3D graf a fázory*)
Manipulate[
{FindMinimum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs110max]≤z1≤Abs[z1vs110min],1≤z12≤10},{z1,z12}],
FindMaximum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs110max]≤z1≤Abs[z1vs110min],1≤z12≤10},{z1,z12}],
Plot3Dz1z12[Abs[f[[misto]][[velicina]][[faze]]],z1vs110]},Row[{Control[{{f,bezprr,"porucha"},{bezprr->"bez",pr1fr->"1f",pr2fr->"2f"}}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",4->"rt 4 sekce",3->"rt 2sekce"}}],Control[{{faze,1},{1->"a",2->"b",3->"c"}}],Control[{{velicina,1},{1->"proud",2->"napeti"}}]},Spacer[10]]]
Manipulate[Module[{bezpr,pr1f,pr2f},
bezpr=bezprfazer[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f=pr1ffazer[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f=pr2ffazer[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
GraphicsGrid[{{zobrazvektory[(bezpr)[[1]]],zobrazvektory[(pr1f)[[1]]],
zobrazvektory[(pr2f)[[1]]]},{zobrazvektory[(bezpr)[[2]]],zobrazvektory[(pr1f)[[2]]],
zobrazvektory[(pr2f)[[2]]]}},ImageSize->750]],Row[{Control[{z1,Abs[z1vs110max],Abs[z1vs110min],((Abs[z1vs110min]-Abs[z1vs110max])/9)}],Control[{z12,1,10,1}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",4->"rt 4 sekce",3->"rt 2sekce"}}]},Spacer[10]]]

(*110 kV, porucha za RT, 3D graf a fázory*)
Manipulate[
{FindMinimum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs110max]≤z1≤Abs[z1vs110min],1≤z12≤10},{z1,z12}],
FindMaximum[{Abs[f[[misto]][[velicina]][[faze]]],Abs[z1vs110max]≤z1≤Abs[z1vs110min],1≤z12≤10},{z1,z12}],
Plot3Dz1z12[Abs[f[[misto]][[velicina]][[faze]]],z1vs110]},Row[{Control[{{f,bezprr0,"porucha"},{bezprr0->"bez",pr1fr0->"1f",pr2fr0->"2f"}}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",5->"ot 4sekce",4->"ot 2 sekce"}}],Control[{{faze,1},{1->"a",2->"b",3->"c"}}],Control[{{velicina,1},{1->"proud",2->"napeti"}}]},Spacer[10]]]
Manipulate[Module[{bezpr,pr1f,pr2f},
bezpr=bezprfazer0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
pr1f=pr1ffazer0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};pr2f=pr2ffazer0[[misto]]/.{z1vs->(z1*(E^(I*0.6))),z2vs->(I*z1/z12)};
GraphicsGrid[{{zobrazvektory[(bezpr)[[1]]],zobrazvektory[(pr1f)[[1]]],
zobrazvektory[(pr2f)[[1]]]},{zobrazvektory[(bezpr)[[2]]],zobrazvektory[(pr1f)[[2]]],
zobrazvektory[(pr2f)[[2]]]}},ImageSize->750]],Row[{Control[{z1,Abs[z1vs110max],Abs[z1vs110min],((Abs[z1vs110min]-Abs[z1vs110max])/9)}],Control[{z12,2,7,1}],Control[{{misto,1,"za zařízením"},{1->"rozv",2->"ved",3->"bt",4->"ot 2sekce",5->"ot 4 sekce"}}]},Spacer[10]]]