<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Excercises Electric Machinery Fundamentals
Chapter 2
Problem 2-7
Step1:  Description
A 30-kVA 8000/230-V distribution transformer has an impedance referred to the primary of
$Z_{EQ} = 20\,\Omega + j100\,\Omega$.
The components of the excitation branch referred to the primary side are
$R_C = 100\,k\Omega$ and
$X_M = 20\,k\Omega$
(a)
If the primary voltage is 7967 V and the load impedance is $Z_L = (2.0 + j0.7)\Omega$, what is the secondary voltage of the transformer? What is the voltage regulation of the transformer?
(b)
If the load is disconnected and a capacitor of $X_L = -j3.0\,\Omega$ is connected in its place, what is the secondary voltage of the transformer? What is its voltage regulation under these conditions?
Step2:  SOLUTION
(a)
The easiest way to solve this problem is to refer all components to the primary side of the
transformer. The turns ratio is
Step3:  Thus the load impedance referred to the primary side is
Step4:  The referred secondary current is $I_s' = \frac{V_P}{Z_{EQ} Z_L'}$
Step5:  and the referred secondary voltage is $V_s' = I_s' Z_L'$
Step6:  The actual secondary voltage is thus
Step7:  And the voltage regulation with $VR = \frac{V_P-V_S'}{V_S'}$ is therefore
Step8:  (b)
The easiest way to solve this problem is to refer all components to the primary side of the
transformer. The turns ratio is
Step9:  Thus the load impedance referred to the primary side is
Step10:  The referred secondary current is $I_s' = \frac{V_P}{Z_{EQ} X_L'}$
Step11:  and the referred secondary voltage is $V_s' = I_s' X_L'$
Step12:  The actual secondary voltage is thus
Step13:  And the voltage regulation with $VR = \frac{V_P-V_S'}{V_S'}$ is therefore
<ASSISTANT_TASK:>
Python Code:
%pylab notebook
%precision 4
Explanation: Excercises Electric Machinery Fundamentals
Chapter 2
Problem 2-7
End of explanation
Zeq =  20.0 + 100.0j   # [Ohm]
Rc  = 100.0e3          # [Ohm]
Xm  =  20.0e3          # [Ohm]
Zload = 2.0 + 0.7j     # [Ohm]
Xload = -3.0j          # [Ohm] 
Vp = 7967.0            # [V]
Explanation: Description
A 30-kVA 8000/230-V distribution transformer has an impedance referred to the primary of
$Z_{EQ} = 20\,\Omega + j100\,\Omega$.
The components of the excitation branch referred to the primary side are
$R_C = 100\,k\Omega$ and
$X_M = 20\,k\Omega$
(a)
If the primary voltage is 7967 V and the load impedance is $Z_L = (2.0 + j0.7)\Omega$, what is the secondary voltage of the transformer? What is the voltage regulation of the transformer?
(b)
If the load is disconnected and a capacitor of $X_L = -j3.0\,\Omega$ is connected in its place, what is the secondary voltage of the transformer? What is its voltage regulation under these conditions?
End of explanation
a = 8000/230.0
a
Explanation: SOLUTION
(a)
The easiest way to solve this problem is to refer all components to the primary side of the
transformer. The turns ratio is:
End of explanation
Zloadp = a**2 * Zload  
Zloadp
Explanation: Thus the load impedance referred to the primary side is:
End of explanation
Isp =  Vp/ (Zeq + Zloadp)
print('Isp = {:.3f} A ∠{:.2f}°'.format(
            abs(Isp), angle(Isp, deg=True)))
Explanation: The referred secondary current is $I_s' = \frac{V_P}{Z_{EQ} Z_L'}$:
End of explanation
Vsp =  Isp * Zloadp
print('Vsp = {:.1f} V ∠{:.2f}°'.format(
            abs(Vsp), angle(Vsp, deg=True)))       
Explanation: and the referred secondary voltage is $V_s' = I_s' Z_L'$:
End of explanation
Vs = Vsp /a
print('Vs = {:.1f} V {:.2f}°'.format(
            abs(Vs), angle(Vs, deg=True)))
print('===================')
Explanation: The actual secondary voltage is thus
End of explanation
VR = (abs(Vp) - abs(Vsp)) / abs(Vsp) * 100
print('VR = {:.2f} %'.format(VR))
print('===========')
Explanation: And the voltage regulation with $VR = \frac{V_P-V_S'}{V_S'}$ is therefore:
End of explanation
a  # already defined earlier...
Explanation: (b)
The easiest way to solve this problem is to refer all components to the primary side of the
transformer. The turns ratio is:
End of explanation
Xloadp = a**2 * Xload  
Xloadp
Explanation: Thus the load impedance referred to the primary side is:
End of explanation
Isp =  Vp/ (Zeq + Xloadp)
print('Isp = {:.3f} A ∠{:.2f}°'.format(
            abs(Isp), angle(Isp, deg=True)))
Explanation: The referred secondary current is $I_s' = \frac{V_P}{Z_{EQ} X_L'}$:
End of explanation
Vsp =  Isp * Xloadp
print('Vsp = {:.2f} V ∠{:.2f}°'.format(
            abs(Vsp), angle(Vsp, deg=True)))       
Explanation: and the referred secondary voltage is $V_s' = I_s' X_L'$:
End of explanation
Vs = Vsp /a
print('Vs = {:.1f} V ∠{:.2f}°'.format(
            abs(Vs), angle(Vs, deg=True)))
print('====================')
Explanation: The actual secondary voltage is thus
End of explanation
VR = (abs(Vp) - abs(Vsp)) / abs(Vsp) * 100
print('VR = {:.2f} %'.format(VR))
print('============')
Explanation: And the voltage regulation with $VR = \frac{V_P-V_S'}{V_S'}$ is therefore:
End of explanation
<END_TASK>