"2xAlFe 670/8 max 209 MVA, 2x AlFe 450/6 max 158 MVA, 2x AlFe 240/6 max 102 MVA"
Uf2:=110000/Sqrt[3]
lv:={10,20}
rv:={0.042,0.065,0.125}
xv:={0.36610,0.3854,0.4070}
gv:=0
bv:={3.142*10^-6,2.982*10^-6,2.817*10^-6}
Z1[i_,j_]:=(rv[[i]]+I*xv[[i]])*lv[[j]]
Yq[i_,j_]:=(gv+I*bv[[i]])*lv[[j]]
(*P2:=10^6*{0,25,50,75,100,125,150,175}*)
P2:=0
P2max:={209,158,102}
A1[i_,j_]:=1+((Z1[i,j]*Yq[i,j])/2)
B1[i_,j_]:=Z1[i,j]
C1[i_,j_]:=Yq[i,j]+((Z1[i,j]*Yq[i,j]^2)/4)
D1[i_,j_]:=1+((Z1[i,j]*Yq[i,j])/2)

I2:=Conjugate[(P2/(3*Uf2))]
(*"I2"
N[I2,3]*)
Uf1[i_,j_]:=(A1[i,j]*Uf2+B1[i,j]*I2)/1000
I1[i_,j_]:=C1[i,j]*Uf2+D1[i,j]*I2
(*"U1"
Abs[Uf1]
Arg[Uf1]/Degree
"I1"
Abs[I1]
Arg[I1]/Degree*)

(*S1:=3*Uf1*1000*Conjugate[I1]
P1:=Abs[S1]*Cos[Arg[S1]]*)
Q1compl[i_,j_]:=Abs[3*(A1[i,j]*Uf2+B1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i,j]*Uf2+D1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))]]]*Sin[Arg[3*(A1[i,j]*Uf2+B1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i,j]*Uf2+D1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))]]]]/10^6
(*Q1=Abs[S1]*Sin[Arg[S1]]
"P1"
P1/10^6
"Q1"
Q1/10^6
Q1compl/10^6
"cos φ1"
Arg[S1]/Degree
Cos[Arg[S1]]
Smax:=3*Imax*Uf2
"Smax"
N[Smax/10^6,6]*)

(*P21:=P2/10^6
Q11:=Q1/10^6*)
(*Plot[Q1compl[3,2],{P2,0,P2max[[3]]},AxesLabel->{"P [MW]","dQ [MVAr]"}]*)
v1:=Plot[{Q1compl[1,1],Q1compl[1,2]},{P2,0,P2max[[1]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Red,Orange},PlotLegends->{"2x AlFe 670/8 10 km","2x AlFe 670/8 20 km"}]
v2:=Plot[{Q1compl[2,1],Q1compl[2,2]},{P2,0,P2max[[2]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Blue,Cyan},PlotLegends->{"2x AlFe 450/6 10 km","2x AlFe 450/6 20 km"}]
v3:=Plot[{Q1compl[3,1],Q1compl[3,2]},{P2,0,P2max[[3]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotLegends->{"2x AlFe 240/6 10 km","2x AlFe 240/6 20 km"}]
Show[v1,v2,v3]
(*ListPlot[{{P21[[1]],Q11[[1]]},{P21[[2]],Q11[[2]]},{P21[[3]],Q11[[3]]},{P21[[4]],Q11[[4]]},{P21[[5]],Q11[[5]]},{P21[[6]],Q11[[6]]},{P21[[7]],Q11[[7]]},{P21[[8]],Q11[[8]]}},AxesLabel->{"P [MW]","dQ [MVAr]"}]*)

(********************************** Kabely ************************************)

(*K101 3x1200mm AL max 1000A, K104 3x1000 Al max 1000A, K105 3x1000 Cu max 750A, K113 3x1600 Al max 1000A*)
lk:={5,10}
rk:={0.236/7.73,0.212/3.92,0.198/7.6,0.089/4.22}
xk:={0.804/7.73,0.428/3.92,0.814/7.6,0.527/4.22}
gk:=0
bk:={669.4/7.73*10^-6,322/3.92*10^-6,672.4/7.6*10^-6,448.87*10^-6/4.22}
Z1[i_,j_]:=(rk[[i]]+I*xk[[i]])*lk[[j]]
Yq[i_,j_]:=(gk+I*bk[[i]])*lk[[j]]
(*P2:=10^6*{0,25,50,75,100,125,150,175}*)
P2:=0
P2max:={190,190,143,190}
A1[i_,j_]:=1+((Z1[i,j]*Yq[i,j])/2)
B1[i_,j_]:=Z1[i,j]
C1[i_,j_]:=Yq[i,j]+((Z1[i,j]*Yq[i,j]^2)/4)
D1[i_,j_]:=1+((Z1[i,j]*Yq[i,j])/2)

I2:=Conjugate[(P2/(3*Uf2))]
Uf1[i_,j_]:=(A1[i,j]*Uf2+B1[i,j]*I2)/1000
I1[i_,j_]:=C1[i,j]*Uf2+D1[i,j]*I2
Q1kcompl[i_,j_]:=Abs[3*(A1[i,j]*Uf2+B1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i,j]*Uf2+D1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))]]]*Sin[Arg[3*(A1[i,j]*Uf2+B1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i,j]*Uf2+D1[i,j]*Conjugate[((P2*10^6)/(3*Uf2))]]]]/10^6

k1:=Plot[Q1kcompl[1,2],{P2,0,P2max[[1]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Red},PlotLegends->{"Al 1200 mm2 10 km"},PlotRange->Full]
k2:=Plot[Q1kcompl[2,2],{P2,0,P2max[[2]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Blue},PlotLegends->{"Al 1000 mm2 10 km"},PlotRange->Full]
k3:=Plot[Q1kcompl[3,2],{P2,0,P2max[[3]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Orange},PlotLegends->{"Cu 1000 mm2 10 km"},PlotRange->Full]
k4:=Plot[Q1kcompl[4,2],{P2,0,P2max[[4]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Pink},PlotLegends->{"Al 1600 mm2 10 km"},PlotRange->Full]
Show[k1,k2,k3,k4, AxesOrigin->{0,0},PlotRange->All]

(*************************** TRF 40, 50, 63 MVA *********************************)
Uf2:=110000/Sqrt[3]
rk:={2.5,1.9}
xk:={34.7,32.6}
gk:={4.83*10^-6,5.95*10^-6}
bk:={1.1*10^-6,5.06*10^-6}
Z1[i_]:=(rk[[i]]+I*xk[[i]])
Yq[i_]:=(gk[[i]]-I*bk[[i]])
(*P2:=10^6*{0,25,50,75,100,125,150,175}*)
P2:=0
P2max:={40,63}
A1[i_]:=1+((Z1[i]*Yq[i])/2)
B1[i_]:=Z1[i]
C1[i_]:=Yq[i]+((Z1[i]*Yq[i]^2)/4)
D1[i_]:=1+((Z1[i]*Yq[i])/2)

I2:=Conjugate[(P2/(3*Uf2))]
Uf1[i_]:=(A1[i]*Uf2+B1[i]*I2)/1000
I1[i_]:=C1[i]*Uf2+D1[i]*I2
Q1kcompl[i_]:=Abs[3*(A1[i]*Uf2+B1[i]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i]*Uf2+D1[i]*Conjugate[((P2*10^6)/(3*Uf2))]]]*Sin[Arg[3*(A1[i]*Uf2+B1[i]*Conjugate[((P2*10^6)/(3*Uf2))])*Conjugate[C1[i]*Uf2+D1[i]*Conjugate[((P2*10^6)/(3*Uf2))]]]]/10^6

k1:=Plot[Q1kcompl[1],{P2,0,P2max[[1]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotStyle->{Red},PlotLegends->{"40 MVA
((Subscript[u, k])=11,5%)"},PlotRange->Full]
k3:=Plot[Q1kcompl[2],{P2,0,P2max[[2]]},AxesLabel->{"P [MW]","dQ [MVAr]"},PlotLegends->{"63 MVA
((Subscript[u, k])=17%)"},PlotRange->Full]
Show[k1,k3,AxesOrigin->{0,0},PlotRange->All]

(************************ HDO ******************)
Xc216:=(112.67^2/(5*10^6))
Xc183:=(117.9^2/(7*10^6))
Hz216:=Plot[-(U^2/Xc216)/10^6,{U,0.9*110,1.1*110},AxesLabel->{"U [kV]","dQ [MVAr]"},PlotStyle->{Red},PlotLegends->{"f=216,66 Hz"},PlotRange->{All,{0,-6}},AxesOrigin->{99,0}]
Hz183:=Plot[-(U^2/Xc183)/10^6,{U,0.9*110,1.1*110},AxesLabel->{"U [kV]","dQ [MVAr]"},PlotStyle->{Blue},PlotLegends->{"f=183,33 Hz"},PlotRange->{All,{0,-8}},AxesOrigin->{99,0}]
Show[Hz216,Hz183,PlotRange->All]