In [1]:

```
from __future__ import division
import math
#Variable declaration:
l = 300 #line length(m)
magI1 = 100 #current at load 1(A)
pf1 = 0.707 #power factor at load 1
l1 = 200 #line length till load 1(m)
magI2 = 200 #current drawn at load 2(A)
pf2 = 0.8 #power factor at laod 2
l2 = 300 #line length till load 2(m)
R = 0.2 #total resistance of line(ohm/km)
X = 0.1 #total reactance of the line(ohm/km)
#Calculation:
phy1 = math.acos(pf1)
phy2 = math.acos(pf2)
Zac = (R+X*1j)*200/1000 #Impedance of section AC(ohm)
Zcb = (R+X*1j)*100/1000 #Impedance of section CB(ohm)
#Taking voltage at the far end B as the reference vector, we have
I2 = magI2*(pf2-1j*math.sin(phy2)) #Load current at point B(A)
I1 = magI1*(pf1-1j*math.sin(phy1)) #Load current at point C(A)
Icb = I2 #A
Iac = I1+I2 #A
Vcb = Icb*Zcb #V
Vac = Iac*Zac #V
V = Vac+Vcb #Voltage drop in the distributor(V)
#Result:
print "Voltage drop in the distributor is",round(abs(V),2),"V"
```

In [2]:

```
from __future__ import division
import math
#Variable declaration:
l = 2000 #line length(m)
magI1 = 80 #current at load 1(A)
pf1 = 0.9 #power factor at load 1
l1 = 1000 #line length till load 1(m)
magI2 = 120 #current drawn at load 2(A)
pf2 = 0.8 #power factor at laod 2
l2 = 2000 #line length till load 2(m)
R = 0.05 #total resistance of line(ohm/km)
X = 0.1 #total reactance of the line(ohm/km)
magVb = 230 #voltage maintained at point B(V)
#Calculation:
phy1 = math.acos(pf1)
phy2 = math.acos(pf2)
Zac = (R+X*1j)*1000/1000 #Impedance of section AC(ohm)
Zcb = (R+X*1j)*1000/1000 #Impedance of section CB(ohm)
#Taking voltage at the far end B as the reference vector, we have
I2 = magI2*(pf2-1j*math.sin(phy2)) #Load current at point B(A)
I1 = magI1*(pf1-1j*math.sin(phy1)) #Load current at point C(A)
Icb = I2 #A
Iac = I1+I2 #A
Vcb = Icb*Zcb #V
Vac = Iac*Zac #V
V = Vac+Vcb+magVb*(1+0j) #Voltage drop in the distributor(V)
theta = math.atan(V.imag/V.real)
#Result:
print "(i) Voltage drop in the distributor is",round(abs(V),2),"V"
print "(ii)The phase difference between Va and Vb is ",round(math.degrees(theta),2),"degrees"
```

In [3]:

```
from __future__ import division
import math
#Variable declaration:
magI1 = 100 #current at load 1(A)
pf1 = 0.6 #power factor at load 1
magI2 = 100 #current drawn at load 2(A)
pf2 = 0.8 #power factor at laod 2
R = 0.1 #total resistance of line(ohm/km)
X = 0.15 #total reactance of the line(ohm/km)
magVb = 200 #voltage maintained at point B(V)
#Calculation:
phy1 = math.acos(pf1)
phy2 = math.acos(pf2)
Zam = (R+X*1j) #Impedance of section AM(ohm)
Zmb = (R+X*1j) #Impedance of section MB(ohm)
#Taking voltage at the far end B as the reference vector, we have
I2 = magI2*(pf2-1j*math.sin(phy2)) #Load current at point B(A)
Imb = I2
Vb = magVb*(1+0j) #V
Vmb = Imb*Zmb #V
Vm = Vb+Vmb #V
alpha = math.atan(Vm.imag/Vm.real) #V
#The load current I1 has a lagging p.f. of 0Â·6 w.r.t. VM. It lags
#behind Vm by an angle phy1.
#Phase angle between I1 and Vb
phy11 = phy1-alpha
I1 = magI1*(math.cos(phy11)-math.sin(phy11)*1j) #A
Iam = I1+I2 #A
Vam = Iam*Zam #V
Va = Vm+Vam #V
theta = math.atan(Va.imag/Va.real)
#Result:
print "(i)Voltage at mid-point is",round(abs(Vm),1),"V"
print "(ii) Sending end voltage Va is",round(abs(Va),2),"V"
print "(iii)The phase difference between Va and Vb is ",round(math.degrees(theta),2),"degrees"
```

In [4]:

```
from __future__ import division
import math
#Variable declaration:
Zab = 1+1j #ohm
Zbc = 1+2j #ohm
Zac = 1+3j #ohm
Ib = 20 #load current at B(A)
pfb = 0.8 #power factor at A
Ic = 15 #load current at C(A)
pfc = 0.6 #power factor at B
#Calculation:
Iab = Ib*(pfb-1j*math.sin(math.acos(pfb))) #Current in section AB(A)
Iac = Ic*(pfc-1j*math.sin(math.acos(pfc))) #Current in section AB(A)
Vab = Iab*Zab #Voltage drop in section AB(V)
Vac = Iac*Zac #Voltage drop in section AC(V)
#point B is at higher potential than point C. The p.d. between B and C
#is Theveninâ€™s equivalent circuit e.m.f. Eo i.e.
Eo = Vac-Vab #volt
Zo = Zab+Zac #Theveninâ€™s equivalent impedance(ohm)
Ibc = Eo/(Zo+Zbc) #A
Iab1 = Iab+Ibc #A
Iac1 = Iac-Ibc #A
Ia = Iab+Iac #Current fed at A(A)
#Result:
print "The total current fed at A is",Ia,"A"
print "\nCurrent in AB is",Iab1.real+round(Iab1.imag,2)*1j,"A"
print "\nCurrent in BC is",Ibc.real+round(Ibc.imag,2)*1j,"A"
print "\nCurrent in AC is",Iac1.real+round(Iac1.imag,2)*1j,"A"
```

In [5]:

```
from __future__ import division
import math
#Variable declaration:
l = 1000 #line length(m)
magI1 = 5 #current at load 1(A)
pf1 = 0.8 #power factor at load 1
l1 = 600 #line length till load 1(m)
pf2 = 0.85 #power factor at motor load B
Po = 10 #power output at B(H.P)
n = 0.9 #efficiency
l2 = 400 #line length till load 2(m)
R = 1 #total resistance of line(ohm/km)
X = 0.5 #total reactance of the line(ohm/km)
magVb = 400 #voltage maintained at point B(V)
#Calculation:
Zac = (R+X*1j)*l1/l #ohm
Zcb = (R+X*1j)*l2/l #ohm
magVbp = magVb/3**0.5 #volt per phase
Vbp = magVbp*(1+0j) #V
magIb = Po*746/(3**0.5*magVb*pf2*n) #Line current at B(A)
magI2p = magIb
I2p = magI2p*(pf2-1j*math.sin(math.atan(pf2))) #A
I1p = magI1*(pf1-1j*math.sin(math.atan(pf1))) #A
Iac = I1p+I2p #Current in section AC(A)
Icb = I2p #Current in section CB(A)
Vcb = Icb*Zcb #V
Vac = Iac*Zac #V
Va = Vbp+Vcb+Vac #V
#Result:
print "Line voltage at A is",round(abs(Va)*3**0.5),"V"
```

In [6]:

```
from __future__ import division
import math
from sympy import *
#Variable declaration:
magVa = 11000 #volt
magIb = 50 #load current at B(A)
pf2 = 0.8 #power factor(lagging)
magIc = 120 #load current at C(A)
pf3 = 1.0 #power factor(lagging)
magId = 70 #load current at D(A)
pf4 = 0.866 #power factor(lagging)
Zab = 1+0.6j #ohm
Zbc = 1.2+0.9j #ohm
Zcd = 0.8+0.5j #ohm
Zda = 3+2j #ohm
#Calculation:
#Let current in section AB be (x + j*y).
x,y = symbols('x,y')
Iab = x+1j*y
x,y = symbols('x,y')
Ibc = Iab-magIb*(pf2-math.sin(math.atan(pf2))) #A
Icd = (x-40+1j*(y+30))-(120+0j) #A
Ida = ((x-160)+1j*(y+30))-(70*(0.866-0.5j)) #A
Vab = Iab*Zab #Drop in section AB(V)
Vbc = Ibc*Zbc #Drop in section BC(V)
Vcd = Icd*Zcd #Drop in section CD(V)
Vda = Ida*Zda #Drop in section DA(V)
# Vab+Vbc+Vcd+Vda = 0
# As the real and imaginary parts have to be separately zero,
# 6*x-4*y-1009.8 = 0
# 4*x+6*y-302.2 = 0
x1 = solve(6*x-4*y-1009.8,x)[0]
y1 = round(solve(4*x1+6*y-302.2,y)[0],1)
x11 = round(solve(6*x-4*y1-1009.8,x)[0],1)
#now putting the values of x11 and y1 in above equationa,
Iab1 = x11+1j*y1 #A
Ibc1 = (x11-40)+1j*(y1+30) #A
Icd1 = (x11-40+1j*(y1+30))-(120+0j) #A
Ida1 = ((x11-160)+1j*(y1+30))-(70*(0.866-0.5j)) #A
magVap = round(magVa/3**0.5) #Voltage at supply end A(V)
Vb = magVap*(1+0j)-Iab1*Zab #Voltage at station B(V/phase)
Vc = Vb-Ibc1*Zbc #Voltage at station C(V/phase)
Vd = Vc-Icd1*Zcd #Voltage at station D(V/phase)
#Result:
print "Current in section AB is",Iab1,"A"
print "Current in section BC is",Ibc1,"A"
print "Current in section CD is",Icd1,"A"
print "Current in section DA is",Ida1,"A"
print "Voltage at A is",magVap*(1+0j),"V/phase"
print "Voltage at B is",Vb,"V/phase"
print "Voltage at C is",Vc,"V/phase"
print "Voltage at D is",Vd,"V/phase"
```

In [1]:

```
from __future__ import division
import math
#Variable declaration:
Pr = 10 #load connected to line R(kW)
Py = 8 #load connected to line Y(kW)
Pb = 5 #load connected to line B(kW)
Vl = 400 #line voltage(V)
#the loads are non-reactive.
#Calculation:
Vp = round(Vl/3**0.5) #phase voltage(V)
Ir = Pr*1000/Vp #A
Iy = Py*1000/Vp #A
Ib = Pb*1000/Vp #A
#Resolving the three currents along x-axis and y-axis, we have,
Ih = Iy*math.cos(math.pi/6)-Ib*math.cos(math.pi/6) #Resultant horizontal component(A)
Iv = Ir-Iy*math.cos(math.pi/3)-Ib*math.cos(math.pi/3) #Resultant vertical component(A)
In = (Ih**2+Iv**2)**0.5 #current in neutral wire(A)
#Result:
print "(i) Ir =",round(Ir,1),"A"
print " Iy =",round(Iy,1),"A"
print " Ib =",round(Ib,2),"A"
print "(ii) Current in neutral wire is",round(In,1),"A"
```

In [1]:

```
from __future__ import division
import math
#Variable declaration:
Vl = 400 #line voltage(V)
Vp = 230 #voltage across lamp(V)
I1 = 70 #current in load RN(A)
I2 = 84 #current in load YN(A)
I3 = 33 #current in load BN(A)
Im = 200 #current taken by the motor(A)
pf = 0.2 #power factor(lagging)
#Calculation:
#Lamp load alone:
Ih = I2*math.cos(math.pi/6)-I3*math.cos(math.pi/6) #Resultant H-component(A)
Iv = I1-I3*math.cos(math.pi/3)-84*math.cos(math.pi/3) #Resultant V-component(A)
In = math.sqrt(Ih**2+Iv**2) #Neutral current(A)
#Both lamp load and motor load:
Ir = Im*pf #Active component of motor current(A)
Ix = Im*math.sin(math.acos(pf)) #Reactive component of motor current(A)
IR = ((Ir+I1)**2+Ix**2)**0.5 #A
IY = ((Ir+I2)**2+Ix**2)**0.5 #A
IB = ((Ir+I3)**2+Ix**2)**0.5 #A
P = Vp*(I1+I2+I3)*1 #Watt #( cos phy_L = 1)
Pm = 3**0.5*Vl*Im*pf #Power supplied to motor(W)
#Result:
print "Lamp load alone: neutral curent is",round(In,2),"A"
print "\nWhen Both lamp load and motor load is present:"
print "The current components are:"
print "Neutral current is",round(In,2),"A"
print "IR =",round(IR,1),"A;\tIY =",round(IY,0),"A;\tIB =",round(IB,2),"A"
print "Power supplied to the lamp is",P,"W"
print "Power supplied to the motor is",round(Pm),"W"
```

In [3]:

```
from __future__ import division
import math
#Variable declaration:
Prn = 20 #kW
pf1 = 1 #power factor of loaf RN
kVAyn = 28.75 #kVA of load YN
kVAbn = 28.75 #kVA of load BN
pf2 = 0.866 #power factor of laod YN & BN each.(lagging)
Vl = 400 #line voltage(V)
Vp = 230 #phase voltage(V)
#Calculation:
phy1 = math.acos(pf1)
phy2 = math.acos(pf2)
phy3 = phy2
Ir = Prn*1000/Vp #A
Iy = kVAyn*1000/Vp #A
Ib = kVAbn*1000/Vp #A
Ih = Ir-Iy*math.cos(phy2)-Ib*math.cos(phy2) #A
Iv = 0+Iy*math.sin(phy2)-Iy*math.sin(phy3) #A
In = math.sqrt(Ih**2+Iv**2) #A
#When load from B to N removed.:
#When the load from B to N is removed, the various line currents are:
#Ir in phase with Vrn; Iy lagging by 30 deg.; Ib = 0.
Ir1 = Ir
Iy1 = Iy; Ib1 = 0 #A
Ih1 = Ir1-Iy1*math.cos(math.pi/6) #A
Iv1 = 0-Iy1*math.sin(math.pi/6) #A
In1 = math.sqrt(Ih1**2+Iv1**2) #A
#Result:
print "When no changes were made, the various currents are:"
print "Ir =",round(Ir,2),"A;\tIy =",Iy,"A;\tIb =",Ib,"A;\tIn =",round(In,2),"A"
print "\nWhen load from B to N removed, the various currents are:"
print "Ir =",round(Ir1,2),"A;\tIy =",Iy1,"A;\tIb =",Ib1,"A;\tIn =",round(In1,2),"A"
```

In [3]:

```
from __future__ import division
import cmath
import math
#Variable declaration:
Vl = 400 #line voltage(V)
Vp = 230 #phase voltage(V)
Ir = 30 #load current at R-phase(A)
pf1 = 0.866 #power factor for R-phase(lagging)
Iy = 30 ##load current at Y-phase(A)
pf2 = 0.866 #power factor for R-phase(lagging)
Ib = 30 ##load current at R-phase(A)
pf3 = 1.0 #power factor for R-phase(lagging)
R = 0.2 #resistance of each line conductor(ohm)
#Calculation:
phy1 = math.acos(pf1)
phy2 = math.acos(pf2)
phy3 = math.acos(pf3)
VR = Vp*(1+0j) #V
VY = Vp*(math.cos(-2*math.pi/3)+math.sin(-2*math.pi/3)) #V
VB = Vp*(math.cos(2*math.pi/3)+math.sin(-2*math.pi/3)) #V
#the line currents can be expressed as :
IR = cmath.rect(30,-math.pi/6) #A
IY = cmath.rect(30,-math.pi/2) #A
IB = cmath.rect(30,2*math.pi/3) #A
IN = IR+IY+IB #A
#Since, the area of X-section of neutral is half of any line conductor.
Rn = 2*R #resistance of neutral(ohm)
#ER = VR + Drop in R phase + Drop in neutral
ER = VR+R*IR+IN*2*R #V
#Result:
print "The supply end voltage for R phase is",round(ER.real,3)+1j*round(ER.imag,3),"V"
```

In [5]:

```
from __future__ import division
#Variable declaration:
Vl = 400 #line voltage(V)
Vp = 230 #phase voltage(A)
Pln = 100 #load connected b/n LN(W)
Pyn = 150 #load connected b/n YN(W)
#Calculation:
#before disconnecting the neutral wire,
R1 = Vp**2/Pln #Resistance of lamp L1(ohm)
R2 = Vp**2/Pyn #Resistance of lamp L2(ohm)
#When the neutral wire is disconnected,
EL = 400 #V
I = EL/(R1+R2) #A
V1 = I*R1 #Voltage across lamp L1(V)
V2 = I*R2 #Voltage across lamp L2(V)
#Result:
print "The voltage across the lamps are:"
print "Lamp 1, Voltage =",V1,"V ;\tLamp 2, voltage =",V2,"V"
```