x1=0.4
L1=100
X_L1=x1*L1

x2=0.4
L2=80
X_L2=x2*L2

#T1 SF7-16000/110
Sn_T1=16 #MVA
Uk1=10.5 #%
Un_T1=121#KV
X_T1=Uk1*Un_T1**2/(100*Sn_T1)

#T2 S
Sn_T2=31.5 #MVA
Uk2=10.5 #%
Un_T2=121#KV
X_T2=Uk2*Un_T2**2/(100*Sn_T2)
X_T1

"""
Explanation: 9.试作下图所示电力系统的阻抗图，并将参数注载图上（不计线路和变压器的电阻和导纳）。
1.计算时取6KV电压为基本级。
2.计算时取10KV电压为基本级。
3.计算时取110KV电压为基本级。

<img src="./第9、10题图.png" />
1.解：
先计算各参数的实际值。
End of explanation
"""


k1=6.3/121
k2=110/11

"""
Explanation: 计算各变压器变比：
End of explanation
"""



imp_reduction=lambda z,k:z*(k**2)
X_L2x=imp_reduction(X_L2,k1*k2)
X_L1x=imp_reduction(X_L1,k1)
X_T1x=imp_reduction(X_T1,k1)
X_T2x=imp_reduction(X_T2,k1*k2)

print("X_L2=%.3f"%X_L2x)
print("X_L1=%.3f"%X_L1x)
print("X_T1=%.3f"%X_T1x)
print("X_T2=%.3f"%X_T2x)

"""
Explanation: 将实际值归算成6kv为基准的归算值：
End of explanation
"""


#10kv
k1=121/6.3
k2=11/110


X_L2x=imp_reduction(X_L2,1)
X_L1x=imp_reduction(X_L1,k2)
X_T1x=imp_reduction(X_T1,k2)
X_T2x=imp_reduction(X_T2,k2)

print("X_L2=%.3f"%X_L2x)
print("X_L1=%.3f"%X_L1x)
print("X_T1=%.3f"%X_T1x)
print("X_T2=%.3f"%X_T2x)

"""
Explanation: 2.10kv为基准，因为之前算出了实际值，因此只需要重算k:
End of explanation
"""


#110kv
k1=121/6.3
k2=110/11


X_L2x=imp_reduction(X_L2,k2)
X_L1x=imp_reduction(X_L1,1)
X_T1x=imp_reduction(X_T1,1)
X_T2x=imp_reduction(X_T2,1)

print("X_L2=%.3f"%X_L2x)
print("X_L1=%.3f"%X_L1x)
print("X_T1=%.3f"%X_T1x)
print("X_T2=%.3f"%X_T2x)

"""
Explanation: 3.以110kv为基值:
End of explanation
"""


#标幺值计算1
UB=110#kv
SB=100#MVA
XB=UB**2/SB
puv=lambda x,xb:x/xb
X_L2b=puv(X_L2x,XB)
X_L1b=puv(X_L1x,XB)
X_T1b=puv(X_T1x,XB)
X_T2b=puv(X_T2x,XB)

print("X_L2=%.3f"%X_L2b)
print("X_L1=%.3f"%X_L1b)
print("X_T1=%.3f"%X_T1b)
print("X_T2=%.3f"%X_T2b)

"""
Explanation: 10． 对上题所示电力系统，试作以标幺值表示的阻抗图。并将参数注在图上。取基准功率$S_{B}=100MVA$ ；$110KV$级的基准电压$U_{B}=110kV$ 。
有两种做法，一种将各实际值归算到110kv等级然后除以110kv的基值。另一种，将110kv基值归算到各电压等级，得到各电压等级的基值。
因为110的值已经算出很容易得出结论，因此在此我先采取第一种做法.
End of explanation
"""


#标幺值计算2
k1=6.3/121
k2=11/110

U_6B=UB*k1
U_11B=UB*k2
X_6B=U_6B**2/SB
X_11B=U_11B**2/SB

X_L2b=puv(X_L2,X_11B)


print("X_L2=%.3f"%X_L2b)
print("X_L1=%.3f"%X_L1b)
print("X_T1=%.3f"%X_T1b)
print("X_T2=%.3f"%X_T2b)

"""
Explanation: 第二种做法
End of explanation
"""


