import math
from numpy import exp
# Variables
#Base Value
S3phib = 15; #in MVA
Vllst = 69; #in kV
Vllp = 13.2; #in kV
Vrrb = 120.;
Ztpu = 1j*0.08; #Transformer impedance per unit length
VSTpuop = 1.05*exp(1j*0); #Per Unit Maximum Subtransmission Voltage Off Peak
VSTpup = 1.00*exp(1j*0); #Per Unit Maximum Subtransmission Voltage Peak
pftop = 0.95; #Off Peak kilovoltageamperage power factor
Sop = 0.25; #Off Peak kilovoltageamperage
pftp = 0.85; #Off Peak kilovoltageamperage power factor
Sp = 1.0; #Off Peak kilovoltageamperage
Regpu = 5./(8*100); #Regulated percent volts for 32 steps
K = 3.88*(10**-6); #Drop Consmath.tant
S = 4000.; # Peak Load in kVA
l = 10.; #Length of the feeder
#Case A
Rset = 0.;
Xset = 0.;
Vpmax = 1.0417;
BW = 0.0083;
VRRpu = (Vpmax-BW); #Setting of VRR
VRR = (Vpmax-BW)*Vrrb;
# Calculations
#Case B
IPpuop = (Sop/VSTpuop)*exp(1j*math.acos(pftop)*math.pi/180); #No Load Primary Current at substation Off Peak
VPpuop = VSTpuop-(IPpuop*Ztpu); #Highest Allowable Primary Voltage Off Peak
IPpup = (Sp/VSTpup)*exp(-1*1j*math.acos(pftp)*math.pi/180); #No Load Primary Current at substation Peak
VPpup = VSTpup-(IPpup*Ztpu); #Highest Allowable Primary Voltage Peak
Step1 = (abs(VPpuop)-VRRpu)/Regpu; #Off Peak Number Steps
#To find the positive step value
Step2 = -1*(abs(VPpup)-VRRpu)/Regpu; # Peak Number Steps
#Case C
#At Peak Load Primary Voltages
MaxVpp = 1.075; #Max
MinVpp = 1.000; #Min
TVDpu = K*S*l/2; #Total Voltage Drop
MinVPpu = VRRpu-TVDpu;
#At Annual Peak Load Primary Voltages
APMaxVPpu = MaxVpp-BW; #Max
APMinVPpu = MinVpp+BW; #Min
#At no load Load Primary Voltages
NLMaxVPpu = Vpmax-BW; #Max
NLMinVPpu = APMinVPpu; #Min
# Results
print 'a)The Setting of the VRR for the highest allowable primary voltage is %g V'%(VRR)
print 'b The Maximum Number of Steps of buck and boost for:'
print 'Off Peak : %g steps'%(math.ceil(Step1))
print 'Peak : %g steps'%(math.ceil(Step2))
print 'c) At Annual Load%( Significant Values on Voltage Curve'
print 'The Total Voltage Drop is %g pu V'%(TVDpu)
print 'The Minimum Feeder Voltage at the end of the feeder is %g'%(MinVPpu)
print 'The Minimum and Maximum Primary Voltages at Peak Load is %g pu V and %g pu V'%(APMaxVPpu,APMinVPpu)
print 'The Minimum and Maximum Primary Voltages at Peak Load is %g pu V and %g pu V'%(NLMaxVPpu,NLMinVPpu)
import math
from sympy import Symbol,solve
# Variables
#Terms from previous example
TVDpu = 0.0776; #Total Voltage Drop
VRRpu = 1.035; #Setting Voltage of Regulator
l = 10.; #Length of the Feeder
#Primary voltages for various cases
VPpua = 1.01;
VPpub = 1.00;
s1 = Symbol('s1'); #Variable Value of Regulator length
#Function to find the equation for the regulator dismath.tance
def dist(y):
return (s1*(2-(s1/l))/l)-((VRRpu-y)/TVDpu)
# Calculations
#Different Cases
Xa = dist(VPpua);
Xb = dist(VPpub);
s1a = solve(Xa);
if((abs(l-s1a[0])+(l-s1a[0])) == 0):
s1a = s1a[1];
else:
s1a = s1a[0];
s1b = solve(Xb);
if((abs(l-s1b[0])+(l-s1b[0])) == 0):
s1b = s1b[1];
else:
s1b = s1b[0];
# Results
print 'a) The Regulator must be placed at %g miles from the start of the feeder'%(s1a)
print 'b) The Regulator must be placed at %g miles from the start of the feeder'%(s1b)
print 'c The Advantage of a over b is that it can compensate for future growth'
import math
# Variables
l = 10.; #Length of the feeder
S3phi = 4000.; #Annual Peak Load in kVA
VPpu = 1.01; #Primary Feeder Voltage
s1 = 1.75; # Dismath.tance of the Regulator
Rmax = 10./100; #Regulation Percent
# Calculations
S = S3phi*(1-(s1/l)); #Uniformly Distributed three phase load
Sph = S/3; #Single Phase Load
Sreg = Rmax*Sph; #Regulated Size
# Results
print 'The Calculated Circuit Kilovoltampere Size is %g kVA, And The corresponding Minimum kilovoltampere size \
of the regulator size can be found as 114.3 kVA'%(Sreg)
import math
#To specify the best settings for regulation
#Page 474
# Variables
s1 = 1.75; #As Found in Example 2
VRRpu = 1.035; #As R and X are zero, the Settings turn out to produce this
#Parameters of Distribution
K = 3.88*(10**-6);
S = 3300.;
l = 10.; #length of the line
# Calculations
VDpu = K*S*(l-s1)/2; #Per unit voltage drop
VP = VRRpu-VDpu; #Primary Feeder Voltage
#We Obtain VDs = K*(S3-((S3*s)/l))s+K(S*s/l)s/2;
#We take various values of s and carry out the computation and hence form the table 9-4 given given in the result file
#We Obtain from the voltage drop value for any give point s between the substation and the regulator station as
#VDs = I(r.math.cos(theta)+ del math.sin(theta))s*(1-(s/(2*l)))
#We finally Get VDs = 3.88 * (10**-6) * (3300-(3300s/8.25))s+3.88*(10**-6)*(3300s/8.25)*s/2
# Results
#Again for different values of s we get the table 9-5
print 'a)The Best Settings for LDCs R and X, and for the VRR'
print 'The best settings for LDC of the regulator are when settings for both R and X are zero and VRRpu = %g pu V'%(VRRpu)
print 'b)The Voltage Drop occuring in the feeder portion between the regulating point and the end of the feeder is %g pu V'%(VDpu)
print 'The Result Files give the Profiles and relevant information about the solution'
import math
#To determine the setting of the regulator so that the voltage criteria is met
#Page 478
# Variables
l = 10.; #Length of the feeder
s1 = 1.75;
ra = 0.386;
xa = 0.4809;
xd = 0.1802;
xL = xa+xd;
Vb = 120;
pf = 0.85; #Power Factor
S = 1100.; #Load in kVA
Vln = 7.62; #line to neutral voltage in kV
Reff = ra*(l-s1)/2;
Xeff = xL*(l-s1)/2;
#Primary Ratings
CTp = 150; #Current Tranformer
PTn = 63.5; #POtential Transformer
# Calculations
#R Value of the dial
Rset = (CTp/PTn)*Reff;
Rsetpu = Rset/Vb;
#X value of the dial
Xset = (CTp/PTn)*Xeff;
Xsetpu = Xset/Vb;
VRP = 1.0138; #Assumption Made on the Regulating Point
#Output Voltage of the Regulator
Vreg = VRP+((S/Vln)*((Rset*pf)+(Xset*math.sin(math.radians(math.acos(pf)))))/(CTp*Vb));
# Results
print 'a) The Regulating Voltage is %g pu V'%(Vreg)
print 'As per Table 9-6; the primary voltage criteria are met by using the R and X settings'
print 'b The Voltage Profiles are given in the result file attached'
import math
# Variables
#From Problems 4 and 5 the co-effcients are obtained
VRRpu = 1.035;
Vreg4 = 1.0337;
Vreg5 = 1.0666;
VRP4 = 1.0337;
VRP5 = 1.0138;
Vmin = 1.010; #For s = 1.75
# Calculations
#Steps
Buck4 = (VRRpu-VRP4)/(0.00625);
Buck5 = (VRRpu-VRP5)/(0.00625);
Boost4 = (Vreg4-Vmin)/(0.00625);
Boost5 = (Vreg5-Vmin)/(0.00625);
# Results
print 'a) The Number of steps of buck and number is steps of boost in example 9-4 is %g and %g respectively'%(Buck4,Boost4)
print 'b) The Number of steps of buck and number is steps of boost in example 9-5 is %g and %g respectively'%(Buck5,Boost5)
import math
# Variables
l = 3.; #Length of the line
Vlc = 2450.; #Regulated Voltage
Vcp = 12800.; #Primary of customer transformer
#Base Values
Vlbp = 2400.; #Primary Bus Voltage of Customer's Bus(Low Voltage)
Vlbs = 4160.; #Secondary Bus Voltage of Customer's Bus
Sb = 5000.; #Power in kVA
r = 0.3; #Line Resismath.tance per mile
x = 0.8; #Line Reacmath.tance per mile
Vhbp = 7390.; #Primary Bus Voltage of High Voltage Bus
Vhbs = 12800.; #Secondary Bus Voltage of High Voltage Bus
PTn = 63.5; #Potential Transformer Turns Ratio
CTp = 250.; #Current Transformer Turns Ratio
VRP = Vlc/Vlbp; #Voltage at RP
Vll = Vhbs/1000; #Line Voltage
VBsec = Vcp/(math.sqrt(3)*PTn); #Secondary Reading of the Customer Transformer
# Calculations
VRRset = VRP*VBsec; #Setting of the voltage-setting dial of VRR
Zb = (Vll**2)*1000/Sb; #Applicable Impedance Base
Ztpu = 0.05*1j; #Transformer Impedance per unit
Zt = Ztpu*Zb; #Transformer Impedance
#Effective Resismath.tances and Reacmath.tances
Reff = (r*l)+Zt.real;
Xeff = (x*l)+Zt.imag;
Rset = CTp*Reff/PTn; #X Dial Setting of LDCs
Xset = CTp*Xeff/PTn; #X Dial Setting of LDCs
# Results
print 'a) The Necessary Setting of the voltage-setting dial of the VRR of each single phase regulator in use is %g V'%(VRRset)
print 'b) R and X dial settings of LDS is %g ohm and %g ohm respectively'%(Rset,Xset)
import math
#To Determine the Design Parameters of a Distributed System
#Page 484
# Variables
VPpu = 1.035; #Primary Feeder Voltage per unit
TVDpu = 0.0776; #Total Voltage Drop of Feeder
Vll = 13.2; #Line Voltage in kV
Vlpuqsw = 1; #New Voltage at the End of the Feeder due to Qsw at annual peak load
XL = 0.661; #Inductive Reacmath.tance per mile
Pl = 3400; #Real Power
Ql = 2100; #Reactive Power
l = 10.; #Length of the Feeder in Miles
Lf = 0.4; #Load Factor
CR = 0.27; #Total Capacitor Compensation Ratio For the Above Load Factor
QNSW = CR*Ql; #Required Size of the Nonswitched capacitor bank
s = 2*l/3; #Loacation of Nonswitched capacitor bank for Optimum Result
VRpu = QNSW*(2*XL*l/3)/(1000*(Vll**2)); #Per Unit Voltage Rise
VDspu = TVDpu*s*(2-(s/l))/l; #Voltage drop for the uniformaly distributed load
VSpu = VPpu-VDspu; #Feeder Voltage at 2l/3 dismath.tance
nVSpu = VSpu+VRpu; #New Voltage Rise when there is a fixed capacitor bank
Vlpu = VPpu-TVDpu; #When No Capcacitor bank is there, the voltage at the end of the feeder
nVlpu = Vlpu+VRpu; #When Capcacitor bank is there, the voltage at the end of the feeder
VRpuqsw = Vlpuqsw-nVlpu; #Required Voltage Rise
Q3phisw = 1000*(Vll**2)*VRpuqsw/(XL*l); #Required Size of the Capacitor Bank
# Calculations
#Let us assume the 15 single phase standard 50 kVAr Capacitor Units = 750 kVAr
SQ3phisw = 750; #Selected Capacitor Bank
RVRlpu = VRpuqsw*SQ3phisw/Q3phisw; #Resulmath.tant Voltage Rises at dismath.tance l
RVRspu = RVRlpu*s/l; #Resulmath.tant Voltage Rises at dismath.tance s
#At Peak Load when both the Non-Switched and Switched Capacitor Banks are on
PVspu = nVSpu+RVRspu; #Voltage at s
PVlpu = nVlpu+RVRlpu; #Voltage at l
# Results
print 'a) The NSW Capacitor Rating is %g kVAr, Which means 2 100kVAr Capacitor Banks per phase'%(QNSW)
print 'b) Voltage Rise per unit is %g pu V'%(VRpu)
print 'i When the No Capacitor Bank is Installed '
print 'Voltage at %g miles is %g pu V'%(s,VSpu)
print 'Voltage at %g miles is %g pu V'%(l,Vlpu)
print 'ii When the Fixed Capacitor Bank is Installed '
print 'Voltage at %g miles is %g pu V'%(s,nVSpu)
print 'Voltage at %g miles is %g pu V'%(l,nVlpu)
print 'c) At Annual Peak Load, The Size of Capacitor Bank Required is %g'%(Q3phisw)
print 'The Voltage Rise at the Annual Load for the Required Capacitor Bank is %g pu V'%(VRpuqsw)
#Note That The Calculations are highly accurate, Rounding of Terms hasn't be emplyed
import math
from numpy import exp
#To Determine the proper 3 phase capacitor bank
#Page 488
# Variables
V = 12.8; #Voltage in kV
xl = 0.8; #Reacmath.tance per unit length
l = 3; #Dismath.tance of the line
Xl = xl*l; #Effective Reacmath.tance of the the Line
pf = 0.8; #Initial Power Factor
pfn = 0.88; #New Improved Power Factor
Qcu = 150; #Capacity of each unit available
XT = 1.6384; #Reacmath.tance of the transformer
# Calculations
S3phi = 5000*exp(1j*math.pi*math.acos(pf)/180); #Presently existing Load
#For New Load Real part of the Load doesn't Change
QLnew = (S3phi.real)*math.degrees(math.atan(math.acos(pfn))); #The Required VAr
S3phinew = math.sqrt(((S3phi.real)**2)+(QLnew**2)); #New Apparent Power
Qc = (S3phi.imag)-QLnew; #Minimum Size of capacitor bank;
N = math.ceil(Qc/Qcu); #Number of Units Required
Qcn = N*Qcu; #Required VAr
XL = Xl+XT; #Total Reacmath.tance
VRpu = Qcn*XL/(1000*(V**2)); #Voltage Rise Per unit
# Results
print 'The The Voltage Rise found out is %g pu V, which is greater than the voltage rise criterion.Hence %g Capacitor units\
of %g kVAr must be installed'%(VRpu,N,Qcu)
# Variables
Skva = 6.3*(10**3); #Starting kVA per HP of the Motor
HPmotor = 10.; #Power Rating
Vll = 7.2*(10**3); #Line Voltage
I3phi = 1438.; #Fault Current
# Calculations
Sstart = Skva*HPmotor; #Starting kVA
VDIP = 120*Sstart/(I3phi*Vll); #Voltage Dip
# Results
print 'a) The Voltage dip due to the motor start is %g V'%(VDIP)
print 'b) From the Permissible voltage flicker limit curve%( The Voltage dip of 0.73 Vwith a frequency of\
15 times per hour is in the satisfactory flicker zone and therefore is not objectionable to the immediate customers'
# Variables
Skva = 5.6*(10**3); #Starting kVA per HP of the Motor
HPmotor = 100.; #Power Rating
Vll = 12.47*(10**3); #Line Voltage
I3phi = 1765.; #Fault Current
# Calculations
Sstart = Skva*HPmotor; #Starting kVA
VDIP = 69.36*Sstart/(I3phi*Vll); #Voltage Dip
# Results
print 'a) The Voltage dip due to the motor start is %g V'%(VDIP)
print 'b) From the Permissible voltage flicker limit curve, The Voltage dip of 1.72 Vwith a frequency of three\
times per hour is in the satisfactory flicker zone and therefore is not objectionable to the immediate customers'