In [1]:

```
import math
# Variables
Vll = 416.; #Voltage Line to Line
Vph = Vll/(math.sqrt(3)); #Phase Voltage and Base Voltage
#Load Currents
Ia = 30.;
Ib = 20.;
Ic = 50.;
#Power Factors of the load
pfa = 1.;
pfb = 0.5;
pfc = 0.9;
#Impedances of the Sections
ZA = 0.05+(1j*0.01);
ZAB = 0.1+(1j*0.02);
ZBC = 0.05+(1j*0.05);
#Impedance upto the point of load
ZB = ZA+ZAB;
ZC = ZB+ZBC;
# Calculations
#Function to Calculate Voltage Drop
def VD(a,b,c):
return a*((b.real*c)+(b.imag*math.sin(math.acos(c))))
#Voltage Drops at A,B and C
VDA = VD(Ia,ZA,pfa);
VDB = VD(Ib,ZB,pfb);
VDC = VD(Ic,ZC,pfc);
TVD = VDA+VDB+VDC; #Total Voltage Drop
TVDpu = TVD/Vph; # In Per Unit
def Real(y,z):
return Vph*y*z #Function to Calculate Real Power
def Reactive(y,z):
return Vph*y*math.sin(math.acos(z)) #Funtion to Calculate the Reactive power
#Real Powers
Pa = Real(Ia,pfa);
Pb = Real(Ib,pfb);
Pc = Real(Ic,pfc);
P = Pa+Pb+Pc; #Total Real Power
#Reactive Powers
Qa = Reactive(Ia,pfa);
Qb = Reactive(Ib,pfb);
Qc = Reactive(Ic,pfc);
Q = Qa+Qb+Qc; #Total Reactive Power
S = math.sqrt((P**2)+(Q**2)); #Total output from the Transformer
PF = P/S; #Load Power Factor
# Results
print 'a) The Total Voltage drop is %g pu'%(TVDpu)
print 'b) The Real Power per Phase is %g kW'%(P/1000)
print 'c) The Reactive Power per Phase is %g kVAr'%(Q/1000)
print 'd) The Kilovoltampere output and load factor is %g kVA and %g lagging'%(S/1000,PF)
```

In [3]:

```
import math
# Variables
pf = 0.9; #Power Factor
Vb = 120.; #Base Voltage
#From The Tables
r = 0.334; #Resismath.tance per thousand feet
x = 0.0299; #Reacmath.tance per thousand feet
K1 = 0.02613; #Voltage Drop
#Assumed Cable
I = 100.; #Secodary line Current
Ls = 100.; #Length of Secondary line in feet
# Calculations
R = r*Ls/1000; # Resismath.tance Value for a 100 feet Line
X = x*Ls/1000; # Reacmath.tance Value for a 100 feet Line
VD = I*((R*pf)+(X*math.sin(math.radians(math.acos(pf))))); #Voltage Drop
VDpu = VD/Vb; #Per unit value
# Results
print 'The Cable Selected is of 100 feet, carrying 100A and cable size #2 AWG'
print 'The Voltage drop for the above cable is %g pu V'%(VDpu)
print 'The Above Value is Close to the Value%g pu V) in the table given.'%(K1)
```

In [6]:

```
import math
# Variables
Sts = (10+(11*4.4)); #Load Selected on the transformer
V = 240.; #Voltage
Sta = 50.; #Available Unit
pf = 0.9; #Load Power Factor
I = (Sts/V)/(Sta/V);
VDT = I*((0.0107*pf)+(0.0139*math.sin(math.radians(math.acos(pf)))));
SLload = 10.+(3*6);
# Calculations
def VD(a,b,c):
return a*b*c/(10**4) #Function to find Voltage Drop Per unit
VDSL = VD(0.0088,116.7,150);
VDSD = VD(0.01683,41.76,70);
TVD = VDT+VDSL+VDSD;
Is = 80.;
Smotor = Is*V/1000;
pf1 = 0.5;
VDIPT = ((0.0107*pf1)+(0.0139*math.sin(math.radians(math.acos(pf1)))))*(Smotor/Sta);
VDIPSL = VD(0.00636,80,150);
VDIPSD = VD(0.01089,80,70);
TVDIP = VDIPT+VDIPSL+VDIPSD;
VDSL1 = VD(0.00769,116.7,150);
VDSD1 = VD(0.0136,41.6,70);
TVD1 = VDT+VDSL1+VDSD1;
# Results
print 'a The Voltage drops are:'
print 'Transformer is %g pu V'%(VDT)
print 'Secondary Lines is %g pu V'%(VDSL)
print 'Service Drops is %g pu V'%(VDSD)
print 'Total is %g pu V'%(TVD)
print 'The Above Value doesn''t meet the required criterion'
print 'b The Voltage dip for motor starting are:'
print 'Transformer is %g pu V'%(VDIPT)
print 'Secondary Lines is %g pu V'%(VDIPSL)
print 'Service Drops is %g pu V'%(VDIPSD)
print 'Total is %g pu V'%(TVDIP)
print 'The Above Value does meet the required criterion'
print 'C The Voltage drops after changing the conductors are:'
print 'Transformer is %g pu V'%(VDT)
print 'Secondary Lines is %g pu V'%(VDSL1)
print 'Service Drops is %g pu V'%(VDSD1)
print 'Total is %g pu V'%(TVD1)
print 'The Above Value doesn''t meet the required criterion'
print 'Thus 350 kcmilcable size for the secondary lines and \
#2/0 AWG cable size for service drops to meet the criteria'
```

In [8]:

```
import math
# Variables
#Length in feet
Lsd = 100.; #Service Drop Line
Lsl = 200.; #Secondary Line
SB = 75.; #Transformer Capacity in kVA
pf = 0.9; #Load Power Factor
#From the Tables
ISL = 129.17; #Secondary Line Current
ISD = 41.67; #Service Drop Current
KSD = 0.01683; #Service Drop Cable Consmath.tant
KSL = 0.0136; #Secondary Cable Consmath.tant
#for Transformer
R = 0.0101; #Resismath.tance in per unit
X = 0.0143; #Reamath.tance in per unit
# Calculations
#From the Diagram
ST = (3.+2+8+6)+(5+6+7+4)+(6+7+8+10); #Total Load on transformer
STpu = ST/SB; #In Per unit;
#The Above value also corresponds to the Current as Well
I = STpu; #Current in Per Unit
VDT = I*((R*pf)+(X*math.sin(math.radians(math.acos(pf))))); #Voltage Drop in the Transformer
VDSL = KSL*(Lsl*ISL/(10**4)); #Secondary Line
VDSD = KSD*(Lsd*ISD/(10**4)); #Service Drop Line
VD = VDT+VDSD+VDSL; #Total Voltage Drop
# Results
print 'a)The Load in transformer is %g kVA or %g pu'%(ST,STpu)
print 'b) The Total Voltage Drop is %g pu V'%(VD)
```

In [10]:

```
import math
from numpy import exp
# Variables
An = 4.; #Service Area
l = 1.; #Length of 0a
#Voltages in kV
Vll = 13.2; #Line to line
Vln = 7.62; #Line to neutral
#Peak Loading
Dp = 1000.; #Peak Loading Intensity per sq.miles
Sl = 2000.; #Lumped Load in kVA
#Off Peak Loading
Dop = 333.; #Loading intensity
VB = 7620.; #Base Voltage
Vs = 1.025; #Substation Voltages
Sn = Dp*An; #Load Connected to the square shaped service area
Sm = Sn+Sl; #Total Load
K = 0.0003; #Cable Consmath.tant
# Calculations
VD0a = K*Sm*l; #Voltage Drop between substation and a
lab = 2; #Dismath.tance from a to b
VDab = (K*Sn*lab/2)+(K*Sl*lab); #Voltage drop from b to c
lbc = 2; #Dismath.tance from b to c
VDbc = 3*K*Sl*lbc; #Voltage drop from b to c #Change in Consmath.tant
I = Sl/(math.sqrt(3)*(0.947*Vll));
Ib = Sl/(math.sqrt(3)*(Vll)); #BAse Current
MIpu = I/Ib; #Per Unit Current
Ztpu = complex(0,0.05);
pf = 0.9; #Load Power Factor
Ipu = MIpu*exp(1j*math.pi*math.acos(pf)/180);
#The Voltage has been tapped up 5 percent
puVDcd = (abs(Ipu)*((Ztpu.real*pf)+(Ztpu.imag*math.sin(math.radians(math.acos(pf))))))-0.05;
VDcd = puVDcd*100;
def volt(a,b):
return (a-(b/100.)) #funtion to find out voltages
#per unit Voltages
puVa = volt(Vs,VD0a);
puVb = volt(puVa,VDab);
puVc = volt(puVb,VDbc);
puVd = volt(puVc,VDcd);
#Voltages in V
Va = puVa*VB;
Vb = puVb*VB;
Vc = puVc*VB;
Vd = puVd*VB;
# Results
print 'a The Percentage drops are'
print ' Substation to a is %g percent'%(VD0a);
print ' a to b is %g percent'%(VDab);
print ' b to c is %g percent'%(VDbc);
print ' c to d is %g percent'%(VDcd);
print 'b The Per unit voltages are:'
print ' Point a is %g pu V'%(puVa)
print ' Point b is %g pu V'%(puVb)
print ' Point c is %g pu V'%(puVc)
print ' Point d is %g pu V'%(puVd)
print 'c The Line to Neutral voltages are:'
print ' Point a is %g V'%(Va)
print ' Point b is %g V'%(Vb)
print ' Point c is %g V'%(Vc)
print ' Point d is %g V'%(Vd)
```

In [12]:

```
import math
#To determine the percent drop from the substation to various points
#Page 340
# Variables
V0op = 1.; #At off Peak
An = 4.; #Service Area
l = 1.; #Length of 0a
#Voltages in kV
Vll = 13.2; #Line to line
Vln = 7.62; #Line to neutral
#Peak Loading
Dp = 1000.; #Peak Loading Intensity per sq.miles
Sl = 2000.; #Lumped Load in kVA
#Off Peak Loading
Dop = 333.; #Loading intensity
VB = 7620.; #Base Voltage
Vs = 1.025; #Substation Voltages
Sn = Dop*An; #Load Connected to the square shaped service area
Sm = Sn+Sl; #Total Load
K = 0.0003; #Cable Consmath.tant
# Calculations
VD0a = K*Sm*l; #Voltage Drop between substation and a
lab = 2.; #Dismath.tance from a to b
VDab = (K*Sn*lab/2)+(K*Sl*lab); #Voltage drop from b to c
lbc = 2.; #Dismath.tance from b to c
VDbc = 3*K*Sl*lbc; #Voltage drop from b to c #Change in Consmath.tant
I = Sl/(math.sqrt(3)*(0.947*Vll));
Ib = Sl/(math.sqrt(3)*(Vll)); #BAse Current
MIpu = I/Ib; #Per Unit Current
Ztpu = complex(0,0.05);
pf = 0.9; #Load Power Factor
Ipu = MIpu*exp(1j*math.pi*math.acos(pf)/180);
#The Voltage has been tapped up 5 percent
puVDcd = (abs(Ipu)*((Ztpu.real*pf)+(Ztpu.imag*math.sin(math.radians(math.acos(pf))))))-0.05;
VDcd = puVDcd*100;
def volt(a,b):
return (a-(b/100)) #funtion to find out voltages
#per unit Voltages
puVa = volt(V0op,VD0a);
puVb = volt(puVa,VDab);
puVc = volt(puVb,VDbc);
puVd = volt(puVc,VDcd);
#Voltages in V
Va = puVa*VB;
Vb = puVb*VB;
Vc = puVc*VB;
Vd = puVd*VB;
# Results
print 'a The Percentage drops are'
print ' Substation to a is %g percent'%(VD0a);
print ' a to b is %g percent'%(VDab);
print ' b to c is %g percent'%(VDbc);
print ' c to d is %g percent'%(VDcd);
print 'b The Per unit voltages are:'
print ' Point a is %g pu V'%(puVa)
print ' Point b is %g pu V'%(puVb)
print ' Point c is %g pu V'%(puVc)
print ' Point d is %g pu V'%(puVd)
print 'c The Line to Neutral voltages are:'
print ' Point a is %g V'%(Va)
print ' Point b is %g V'%(Vb)
print ' Point c is %g V'%(Vc)
print ' Point d is %g V'%(Vd)
```

In [13]:

```
import math
# Variables
Vll = 13.2; #Voltage in kV (Line voltage)
TCDi = 0.45; #Load Density in kVA per feet
FD = 1.08; #Diversity Factor for all loads
FLS = 0.2; #Annual Loss Factor
DFi = 0.6; #30 min Annual Demand Factor
Dg = TCDi*DFi/FD; #Divesified Maximum Demand of the Group
L = 30000; #Length of the Whole Feeder in Feet
#To Achieve Minimum Voltage Drop, The Substation must be located at the centre of the line
Ln = 15000.; #NEW Length of the Feeder
# Calculations
SPK = Dg*Ln; #Peak Load on each main of the substation trnasformer
I = (SPK/(math.sqrt(3)*Vll)); #Current in the Line
K = 0.0009; #For the Assumed Conductor
VD = K*SPK*Ln/(2*5280); #Voltage Drop, Is divided by 5280, to convert the length in miles
# Results
print 'a) To Achieve Minimum Voltage Drop, The Substation is Placed at the Centre of the Line,\
and For a Current of %g A following in it, #4 AWG or #2 AWG ACSR conductors are used'%(I)
print 'b) For a #4 AWG Copper Conductor, The Percentage Voltage drop at annual peak load is %g pecent'%(VD)
#Calculation Mistake in the TextBook
```

In [14]:

```
# Variables
Vll = 13.2; #Voltage in kV (Line voltage)
TCDi = 0.45; #Load Density in kVA per feet
FD = 1.08; #Diversity Factor for all loads
FLS = 0.2; #Annual Loss Factor
DFi = 0.6; #30 min Annual Demand Factor
# Calculations
Dg = TCDi*DFi/FD; #Divesified Maximum Demand of the Group
L = 30000; #Length of the Whole Feeder in Feet
I = 164.2; #Current
r = 0.592; #Resismath.tance Per Mile
R = r*L/(3.*5280); #Total Resismath.tance
CL = 3*(I**2)*R; #Total Power Loss in entire length
TAEL = CL*FLS*8760/(10**3); #Total Annual Energy Loss
# Results
print 'The Total Annual Eddy Current Loss is %g kWhr'%(TAEL)
```

In [15]:

```
import math
# Variables
#Loads in kVA
Sbc = 3000.; #Load Along bc
Sd = 2000.; #Load At Point d
S0a = Sbc+Sd; #Total Load
Sab = Sbc/2; #Load along ab
#Cable Consmath.tants
K0a = 0.0005; #For 0 to a
Kab = 0.0010; #For a to b
Kac = 0.0010; #For a to c
Kad = 0.0010; #For a to d
#Length
l0a = 1.0; #From 0 to a
lab = 2.; #From a to b
lad = 2.; #From a to d
# Calculations
#Voltage Drops At Specific Points
VDa = K0a*S0a*l0a;
VDb = (Kab*Sab*lab/2)+VDa;
VDc = VDb;
VDd = (Kad*Sd*lad)+VDa;
#To determine the Voltages at Point a
Vll = 12650.; #Line to Line Voltage
Vln = 7300.; #Line to Neutral Voltage
Valn = Vln-(VDa*Vln/100);
Vall = Vll-(VDa*Vll/100);
# Results
print 'a The Voltage Drops at:'
print 'Point a is %g percent'%(VDa)
print 'Point b is %g percent'%(VDb)
print 'Point c is %g percent'%(VDc)
print 'Point d is %g percent'%(VDd)
print 'b) The Voltages VaL-N is %g V and VaL-L is %g V'%(Valn,Vall)
```