In [2]:

```
#Question:
"""Finding the current drawn from the power mains by a balanced three-phase load."""
from math import sqrt
#Variable Declaration:
R=32 #Resistance of the load(in Ohms)
X_L=24 #Inductive reactance of the load(in Ohms)
V_L=400 #Line Voltage(in Volts)
#Calculations:
Z=R + X_L *1j
Z_mod=abs(Z)
V_ph_star=V_L/(sqrt(3))
I_ph_star=V_ph_star/Z_mod
I_L_star=I_ph_star
V_ph_delta=V_L
I_ph_delta=V_ph_delta/Z_mod
I_L_delta=I_ph_delta*(sqrt(3))
#Result:
print "(a)For star connection:"
print "The current drawn from the power mains is %.3f A." %(I_L_star)
print "(b)For delta connection:"
print "The current drawn from the power mains is %.3f A." %(I_L_delta)
```

In [4]:

```
#Question:
"""Finding the current in each line and the current in the nuetral conductor for a star-connected three-phase system."""
from math import sqrt,cos,sin,pi
#Variable Declaration:
V_L=415 #Line voltage(in Volts)
P_R=10e03 #Load in Red line(in kilo-Watts)
P_Y=8e03 #Load in Yellow line(in kilo-Watts)
P_B=5e03 #Load in Blue line(in kilo-Watts)
#Calculations:
Vph=V_L/sqrt(3)
I_R=P_R/Vph
I_Y=P_Y/Vph
I_B=P_B/Vph
I_H=(I_Y*cos(pi/6))-(I_B*cos(pi/6))
I_V=I_R-(I_Y*sin(pi/6))-(I_B*sin(pi/6))
I_N=sqrt((I_H*I_H)+(I_V*I_V))
#Result:
print "(a)The current taken by the 10-kW load is %.2f A." %(I_R)
print " The current taken by the 8-kW load is %.2f A." %(I_Y)
print " The current taken by the 5-kW load is %.2f A." %(I_B)
print "(b)The current in the nuetral conductor is %.2f A." %(I_N)
```

In [6]:

```
#Question:
"""Finding the phase currents and the line currents."""
from math import cos,pi,atan,radians,degrees,sqrt
#Variable Declaration:
f=50 #Frequency of the source(in Hertz)
V_L=415 #Line Voltage(in Volts)
R1=100 #Resistance of the first load(in Ohms)
R2=20.0 #Resistance of the second load(in Ohms)
L2=191e-03 #Self-inductance of the second load(in Henry)
R3=0.0 #Resistance of the third load(in Ohms)
C3=30e-06 #Capacitance of the third load(in Farads)
#Calculations:
Z1=R1
angle_1=0.0
X2=2*pi*f*L2
Z2=sqrt((R2*R2)+(X2*X2))
angle_2=atan(X2/R2)
Z3=1/(2*pi*f*C3)
angle_3=pi/2
Vph=V_L
I1=Vph/Z1
I2=Vph/Z2
I3=Vph/Z3
I_R=sqrt((I1*I1)+(I3*I3)+(2*I1*I3*cos(pi/6)))
angle_Y=radians(degrees(angle_2)-60)
I_Y=sqrt((I1*I1)+(I2*I2)+(2*I1*I2*cos(angle_Y)))
angle_B=pi-angle_Y-(pi/6)
I_B=sqrt((I2*I2)+(I3*I3)+(2*I2*I3*cos(angle_B)))
#Result:
print "(a)The phase current I1 in the load RY is %.2f A in phase with V_RY." %(I1)
print " The phase current I2 in load YB is %.2f A lagging V_YB by %.2f degrees." %(I2,degrees(angle_2))
print " The phase current I3 in load BR is %.2f A leading V_BR by %.2f degrees." %(I3,degrees(angle_3))
print "(b)The line current I_R is %.2f A." %(I_R)
print " The line current I_Y is %.2f A." %(I_Y)
print " The line current I_B is %.2f A." %(I_B)
```

In [9]:

```
#Question:
"""Finding the line current,the power factor and the total power for a balanced three-phase system."""
from math import sqrt
#Variable Declaration:
R_ph=20.0 #Resistance of each phase(in Ohms)
X_L_ph=15.0 #Inductive reactance of each phase(in Ohms)
V_L=400.0 #Line Voltage(in Volts)
#Calculations:
Z_ph=R_ph + X_L_ph *1j
Z_mod=abs(Z_ph)
V_ph_star=V_L/(sqrt(3))
I_ph_star=V_ph_star/Z_mod
I_L_star=I_ph_star
pf_star=R_ph/Z_mod
P_active_star=sqrt(3)*V_L*I_L_star*pf_star
V_ph_delta=V_L
I_ph_delta=V_ph_delta/Z_mod
I_L_delta=I_ph_delta*(sqrt(3))
pf_delta=R_ph/Z_mod
P_active_delta=sqrt(3)*V_L*I_L_delta*pf_delta
#Result:
print "(a)For star connected load:"
print "(i)The line current is %.2f A." %(I_L_star)
print "(ii)The power factor is %.2f lagging." %(pf_star)
print "(iii)The total active power is %.2f kW." %(P_active_star/1000)
print "\n(b)For delta connection:"
print "(i)The line current is %.2f A." %(I_L_delta)
print "(ii)The power factor is %.2f lagging." %(pf_delta)
print "(iii)The total active power is %.2f kW." %(P_active_delta/1000)
```

In [11]:

```
#Question:
"""Fidning the total power consumed and the power factor of a balanced three-phase circuit."""
from math import atan,cos,sqrt
#Variable Declaration:
W1=3e03 #Reading of wattmeter-1(in Watts)
W2=1.5e03 #Reading of wattmeter-2(in Watts)
#Calculations:
P=W1+W2
pf_angle=atan(sqrt(3)*((W1-W2)/(W1+W2)))
pf=cos(pf_angle)
#Result:
print "The total power consumed is %e W." %(P)
print "The power factor of the balanced three-phase circuit is %.3f." %(pf)
print "NOTE:From the given data it is impossible to state whether the power factor is leading or lagging."
```

In [13]:

```
#Question:
"""Finding the total power,the power factor and the line current for a balanced three-phase circuit."""
from math import atan,cos,sqrt
#Variable Declaration:
V_L=415 #Line voltage(in Volts)
W1=5.2e03 #Reading of wattmeter-1(in Watts)
W2=-1.7e03 #Reading of wattmeter-2(in Watts)
#Calculations:
P=W1+W2
pf_angle=atan(sqrt(3)*((W1-W2)/(W1+W2)))
pf=cos(pf_angle)
I_L=P/(sqrt(3)*V_L*pf)
#Result:
print "The total power consumed is %e W.\n" %(P)
print "The power factor of the balanced three-phase circuit is %.3f." %(pf)
print "NOTE:From the given data it is impossible to state whether the power factor is leading or lagging."
print "\nThe line current is %.2f A." %(I_L)
```

In [15]:

```
#Question:
"""Finding the total power consumed in a star-connected three-phase network."""
from math import sqrt,radians,degrees
from cmath import rect,phase
#Variable Declaration:
R=6.0 #Resistance per phase(in Ohms)
X_L=8.0 #Inductive reactance per phase(in Ohms)
V_L=220.0 #Line voltage(in Volts)
#Calculations:
Z=6+ (1j*8)
Vph=V_L/sqrt(3.0)
V_RN=rect(Vph,0)
V_YN=rect(Vph,radians(-120.0))
V_BN=rect(Vph,radians(120.0))
V_RY=V_RN-V_YN
V_YB=V_YN-V_BN
V_BR=V_BN-V_RN
I_R=V_RN/Z
I_Y=V_YN/Z
I_B=V_BN/Z
P=sqrt(3.0)*V_L*abs(I_R)*cos(phase(Z))
#Result:
print "(a)The phase voltages are:"
print " V_RN=%.2f V at an angle of %.3f degrees." %(abs(V_RN),degrees(phase(V_RN)))
print " V_YN=%.2f V at an angle of %.3f degrees." %(abs(V_YN),degrees(phase(V_YN)))
print " V_BN=%.2f V at an angle of %.3f degrees." %(abs(V_BN),degrees(phase(V_BN)))
print "(b)The line voltages are:"
print " V_RY=%.2f V at an angle of %.3f degrees." %(abs(V_RY),degrees(phase(V_RY)))
print " V_YB=%.2f V at an angle of %.3f degrees." %(abs(V_YB),degrees(phase(V_YB)))
print " V_BR=%.2f V at an angle of %.3f degrees." %(abs(V_BR),degrees(phase(V_BR)))
print "(c)The line currents(same as phase currents) are:"
print " I_R=%.2f A at an angle of %.3f degrees." %(abs(I_R),degrees(phase(I_R)))
print " I_Y=%.2f A at an angle of %.3f degrees." %(abs(I_Y),degrees(phase(I_Y)))
print " I_B=%.2f A at an angle of %.3f degrees." %(abs(I_B),degrees(phase(I_B)))
print "(d)The total power consumed is %.2f W." %(round(P,2))
```

In [10]:

```
#Question:
"""Finding the total power consumed in a delta-connected three-phase network."""
from math import sqrt,radians,degrees
from cmath import rect,phase
#Variable Declaration:
R=6.0 #Resistance per phase(in Ohms)
X_L=8.0 #Inductive reactance per phase(in Ohms)
V_L=220.0 #Line voltage(in Volts)
#Calculations:
Z=6+ (1j*8)
Vph=V_L
V_RY=rect(Vph,0)
V_YB=rect(Vph,radians(-120.0))
V_BR=rect(Vph,radians(120.0))
I_RY=V_RY/Z
I_YB=V_YB/Z
I_BR=V_BR/Z
I_R=I_RY-I_BR
I_Y=I_YB-I_RY
I_B=I_BR-I_YB
P=sqrt(3.0)*V_L*abs(I_R)*cos(phase(Z))
#Result:
print "(a)The phase voltages(same as line voltages) are:"
print " V_RY=%.2f V at an angle of %.3f degrees." %(abs(V_RY),degrees(phase(V_RY)))
print " V_YB=%.2f V at an angle of %.3f degrees." %(abs(V_YB),degrees(phase(V_YB)))
print " V_BR=%.2f V at an angle of %.3f degrees." %(abs(V_BR),degrees(phase(V_BR)))
print "(b)The phase currents in the three load impedances are:"
print " I_RY=%.2f A at an angle of %.3f degrees." %(abs(I_RY),degrees(phase(I_RY)))
print " I_YB=%.2f A at an angle of %.3f degrees." %(abs(I_YB),degrees(phase(I_YB)))
print " I_BR=%.2f A at an angle of %.3f degrees." %(abs(I_BR),degrees(phase(I_BR)))
print "(c)The line currents are:"
print " I_R=%.2f A at an angle of %.3f degrees." %(abs(I_R),degrees(phase(I_R)))
print " I_Y=%.2f A at an angle of %.3f degrees." %(abs(I_Y),degrees(phase(I_Y)))
print " I_B=%.2f A at an angle of %.3f degrees." %(abs(I_B),degrees(phase(I_B)))
print "(d)The total power consumed is %.2f W." %(round(P,2))
```

In [7]:

```
#Question:
"""Finding the line current and the total power supplied by a three-phase system."""
from cmath import rect,phase
from math import radians,degrees,sqrt,cos
#Variable Declaration:
Z_A_delta=rect(12.0,radians(30.0))
Z_star=rect(5.0,radians(45.0))
V_L=400.0
#Calculations:
Z_A_star=Z_A_delta/3.0
Zeq=(Z_A_star*Z_star)/(Z_A_star+Z_star)
Vph=V_L/sqrt(3.0)
I_L=Vph/Zeq
P=sqrt(3.0)*I_L*V_L*cos(phase(Zeq))
#Result:
print "(a)The line current is %.3f A." %(round((abs(I_L)),3))
print "(b)The power suppiled is %e W." %(abs(P))
```

In [9]:

```
#Question:
"""Finding the constants of the load per phase."""
from math import pi,sqrt
#Variable Declaration:
I_L=100.0 #Line current(in Amperes)
V_L=1100.0 #Line voltage(in Volts)
f=50.0 #Frequency of the supply(in Hertz)
P=150e03 #Power delivered by the three-phase system(in Watts)
#Calculations:
R=P/(3*I_L*I_L)
Vph=V_L/sqrt(3.0)
Iph=I_L
Z=Vph/Iph
X_C=sqrt((Z*Z)-(R*R))
C=1/(2*pi*f*X_C)
#Result:
print "The constants of the load per phase are:"
print "R=%.3f Ohms and C=%e F." %(R,C)
```

In [8]:

```
#Question:
"""Finding the impedance in each branch and the power factor in a balanced delta-connected three-phase circuit."""
from math import sqrt,cos
#Variable Declaration:
V_L=400.0 #Line voltage(in Volts)
I_L=20.0 #Line current(in Amperes)
P=10e03 #Total power absorbed by the load(in Watts)
#Calculations:
V_ph=V_L
I_ph=I_L/sqrt(3.0)
Z_ph=V_ph/I_ph
pf=P/(sqrt(3.0)*V_L*I_L)
V_ph_star=V_L/sqrt(3.0)
I_L_star=V_ph_star/Z_ph
I_ph_star=I_L_star
P=sqrt(3.0)*V_L*I_L_star*pf
#Result:
print "(a)The impedance in each branch is %.2f Ohms." %(round(Z_ph,2))
print "(b)The power factor is %.4f lagging." %(pf)
print "(c)The total power consumed if the same impedances are star-connected is %.2f kW." %(round((P/1000.0),2))
```

In [3]:

```
#Question:
"""Finding the total power in the three-phase system."""
from cmath import rect,phase
from math import pi,sin,radians,degrees
#Variable Declaration:
R1=100.0 #Resistance of the first phase(in Ohms)
R2=200.0 #Resistance of the second phase(in Ohms)
L3=0.3 #Inductance of the third phase(in Henry)
V_L=100.0 #Line voltage(in Volts)
f=50.0 #Frequency of the supply(in Hertz)
#Calculations:
Vab=rect(V_L,0)
Vbc=rect(V_L,radians(-120))
Vca=rect(V_L,radians(120))
Zab=R1
Zca=R2
Zbc=1j*(2*pi*f*L3)
Iab=Vab/Zab
Ibc=Vbc/Zbc
Ica=Vca/Zca
Pab=(abs(Vab)*abs(Vab))/R1
Pbc=0
Pca=(abs(Vca)*abs(Vca))/R2
act_P=Pab+Pbc+Pca
rea_P=abs(Vbc)*abs(Ibc)*sin(phase(Zbc))
#Result:
print "(a)The total active power in the system is %.2f W." %round(act_P,2)
print "(b)The total reactive power in the system is %.2f VAr." %round(rea_P,2)
```

In [12]:

```
#Question:
"""Finding the load circuit parameters per phase."""
from math import pi,sqrt,sin,acos
#Variable Declaration:
I_L=160.0 #Line current(in Amperes)
V_L=1.1e03 #Line voltage(in Volts)
P=210e03 #Total power load(in kilo-Watts)
f=50.0 #Frequency of the supply voltage(in Hertz)
#Calculations:
pf=P/(sqrt(3.0)*V_L*I_L)
V_ph=V_L/sqrt(3.0)
I_ph=I_L
Z_ph=V_ph/I_ph
R_ph=Z_ph*pf
X_C=Z_ph*sin(acos(pf))
C=1.0/(2*pi*f*X_C)
#Result:
print "The load circuit parameters per phase are:"
print "R=%.3f Ohms." %(round(R_ph,3))
print "C=%e F." %(C)
```

In [4]:

```
"""Finding the resistance and the inductance of the load per phase."""
from math import pi,sqrt,sin,acos
#Variable Declaration:
V_L=400.0 #Line voltage(in Volts)
f=50.0 #Frequency of the supply(in Hertz)
Iph=25.0 #Phase current(in Amperes)
P=13.856e03 #Total active power absorbed by the load(in Watts)
#Calculations:
I_L=Iph
pf=P/(sqrt(3.0)*V_L*I_L)
Vph=V_L/sqrt(3.0)
Zph=Vph/Iph
Rph=Zph*pf
Xph=Zph*sin(acos(pf))
L=Xph/(2*pi*f)
Q=3*Vph*Iph*sin(acos(pf))
S=3*Vph*Iph
#Result:
print "(a)The resistance of the load per phase is %.3f Ohms and the inductance of the load per phase is %e H." %(Rph,L)
print "(b)The total reactive power is %e VAR." %(Q)
print "(c)The total apparent power is %e VA." %(S)
```

In [5]:

```
#Question:
"""Finding the line current,the power factor and the total kVA."""
from math import sqrt,pi,cos
from cmath import phase
#Variable Declaration:
Z1=100+(1j*0) #First impedance(in Ohms)
C=32e-06 #Capacitance of the capacitor(in Farads)
V_L=415.0 #Line voltage(in Volts)
f=50.0 #Frequency of the supply(in Hertz)
#Calculations:
Z2=-(1j*(1/(2*pi*f*C)))
Zph=(Z1*Z2)/(Z1+Z2)
Vph=V_L/sqrt(3.0)
Iph=Vph/Zph
I_L=Iph
pf=cos(phase(Zph))
P=sqrt(3.0)*V_L*I_L*pf
kVA=sqrt(3.0)*V_L*I_L
#Result:
print "(a)The line current is %.3f A." %(abs(I_L))
print "(b)The power factor is %.4f leading." %(pf)
print "(c)The power absorbed is %e W." %(abs(P))
print "(d)The total kVA is %e kVA." %(abs(kVA))
```

In [17]:

```
#Question:
"""Finding the line current,input and output power in a three-phase motor."""
from math import sqrt,atan,cos
#Variable Declaration:
effi=0.86 #Efficiency of the motor
W1=255e03 #Reading of the first wattmeter(in Watts)
W2=85e03 #Reading of the second wattmeter(in Watts)
V_L=1.6e03 #Line voltage(in Volts)
#Calculations:
P=W1+W2
phi=atan(sqrt(3.0)*((W1-W2)/(W1+W2)))
pf=cos(phi)
I_L=P/(sqrt(3.0)*V_L*pf)
Po=P*effi
#Result:
print "(a)The input power is %.2f kW." %(round((P/1000.0),2))
print "(b)The power factor is %.3f lagging." %(round(pf,3))
print "(c)The line current is %.2f A." %(round(I_L,2))
print "(d)The output power is %.2f kW." %(round((Po/1000.0),2))
```

In [15]:

```
#Question:
"""Finding the readings of the two wattmeters."""
from math import sqrt,acos,tan
#Variable Declaration:
P=25e03 #Total input power(in Watts)
pf=0.8 #Power factor
V_L=400.0 #Line voltage(in Volts)
#Calculations:
"""W1-W2=(1.0/sqrt(3.0))*(W1+W2)*tan(phi);"""
eq_1=P
eq_2=(1.0/sqrt(3.0))*P*tan(acos(pf))
W1=(eq_1+eq_2)/2.0
W2=P-W1
#Result:
print "The readings of the wattmeters are:"
print "W1=%.4f kW." %(round((W1/1000.0),4))
print "W2=%.4f kW." %(round((W2/1000.0),4))
```

In [10]:

```
#Question:
"""Finding the total active power consumed by the load."""
from cmath import phase,rect
from math import radians
#Variable Declaration:
V_RY=rect(200,0) #Line Voltage V_RY(in Volts)
V_YB=rect(200,radians(-120)) #Line Voltage V_YB(in Volts)
V_BR=rect(200,radians(120)) #Line Voltage V_BR(in Volts)
Z1=rect(10,radians(60)) #Impedance of the first phase(in Ohms)
Z2=rect(10,radians(0)) #Impedance of the second phase(in Ohms)
Z3=rect(10,radians(60)) #Impedance of the third phase(in Ohms)
#Calculations:
I1=V_RY/Z1
I2=V_YB/Z2
I3=V_BR/Z3
IR=I1-I3
IB=I3-I2
W1=abs(V_RY)*abs(IR)*cos(phase(IR))
W2=-abs(V_YB)*abs(IB)*cos(phase(IB)-phase(V_YB))
P=W1+W2
#Result:
print "(a)The readings of the wattmeters are: W1=%.2f W and W2=%.2f W." %(W1,W2)
print "(b)The total active power consumed by the load is %.2f W." %(P)
```

In [12]:

```
#Question:
"""Finding the total active power consumed by the load."""
from cmath import phase,rect
from math import radians
#Variable Declaration:
V_RY=rect(200,0) #Line Voltage V_RY(in Volts)
V_YB=rect(200,radians(-120)) #Line Voltage V_YB(in Volts)
V_BR=rect(200,radians(120)) #Line Voltage V_BR(in Volts)
Z1=rect(10,radians(60)) #Impedance of the first phase(in Ohms)
Z2=rect(10,radians(0)) #Impedance of the second phase(in Ohms)
Z3=rect(10,radians(60)) #Impedance of the third phase(in Ohms)
#Calculations:
I1=V_RY/Z1
I2=V_YB/Z2
I3=V_BR/Z3
IR=I1-I3
IY=I2-I1
W1=-abs(V_BR)*abs(IR)*cos(phase(IR)-phase(V_BR))
W2=abs(V_YB)*abs(IY)*cos(phase(IY)-phase(V_YB))
P=W1+W2
#Result:
print "(a)The readings of the wattmeters are: W1=%.2f W and W2=%.2f W." %(W1,W2)
print "(b)The total active power consumed by the load is %.2f W." %(P)
```

In [1]:

```
#Question:
"""Finding the reading of the wattmeter."""
from cmath import rect,phase
from math import radians,cos
#Variable Declaration:
V_RY=rect(440.0,0) #Line voltage in RY line(in Volts)
V_YB=rect(440.0,radians(-120)) #Line voltage in YB line(in Volts)
V_BR=rect(440.0,radians(120)) #Line voltage in BR line(in Volts)
#Calculations:
V_RB=rect(440.0,radians(120-180))
I1=V_RY/(60.0+(1j*45.0))
I2=V_RB/(-(1j*56.0))
I_AB=I1+I2
V_CD=V_YB
P=abs(I_AB)*abs(V_CD)*cos(phase(V_CD))
#Result:
print "The reading of the wattmeter is %.4f W." %(round(P,4))
print "Note: There is a calculation error in the textbook."
print "I_AB=11.50 A at an angle of 2.035 degrees and not 11.05 A. Therefore P=-2531.1166 W."
```

In [19]:

```
#Question:
"""Finding the line and phase current in a motor."""
from cmath import phase,rect
from math import acos,sqrt,radians,cos
#Variable Declaration:
V_RY=rect(440,0) #Line voltage in RY line(in Volts)
Zph=3+1j*4 #Phase Impedance(in Ohms)
pf=0.8 #Lagging power factor
P=75e03 #Total active power(in Watts)
V_L=440.0 #Line voltage(in Volts)
#Calculations:
I_L_mod=P/(sqrt(3.0)*V_L*pf)
phi=acos(pf)
I_L_delta=rect(I_L_mod,(radians(-30-degrees(phi))))
Iph=rect((I_L_mod/sqrt(3.0)),-phi)
Vph=rect((V_L/sqrt(3.0)),radians(-30))
I_L_star=Vph/Zph
I_L=I_L_delta+I_L_star
P1=sqrt(3.0)*abs(V_L)*abs(I_L_delta)*pf
P2=sqrt(3.0)*abs(V_L)*abs(I_L_star)*cos(phase(Zph))
P_tot=P1+P2
#Result:
print "(a)The line current in the motor is %.2f A at a phase angle of %.2f degrees." %(abs(I_L_delta),degrees(phase(I_L_delta)))
print " The phase current in the motor is %.2f A at a phase angle of %.2f degrees." %(abs(Iph),degrees(phase(Iph)))
print "(b)The line current and phase current in the load is %.2f A at a phase angle of %.2f degrees." %(abs(I_L_star),degrees(phase(I_L_star)))
print "(c)The total line current is %.2f A at a phase angle of %.2f degrees." %(abs(I_L),degrees(phase(I_L)))
print "(d)The total power consumed is %.3f W." %(P_tot)
```