import math
# Variables
S = 25.*(10**3); #Rating of the transformer in VA
#Values in per unit
Rt = 0.014; #Resismath.tance of Transformer
Xt = 0.012; #Reacmath.tance of transformer
Vh = 7200; #High Voltage End in V
Vx = 120; # Low Voltage End in V
Rb = (Vh**2)/S; #Base Value of Resismath.tance
#Accroding to Lloyd's Formula
# Calculations
Zhx12 = (1.5*Rt)+(1j*1.2*Xt); #Impedance referred to HV side when the winding x2x3 is shorted
n = Vh/Vx; #Turns Ratio
Zhx13 = Rt+(1j*Xt); #Use of Entire low voltage winding
#Impedances of the required terms in pu
A = (2*Zhx13)-Zhx12;
B = ((2*Zhx12)-(2*Zhx13))/(n**2);
C = B;
#Angle of Impedances
ta = math.degrees(math.atan(A.imag/A.real));
tb = math.degrees(math.atan(B.imag/B.real));
# Results
print 'The Circuit impedances on the high voltage side is %g/_%g ohm'%(abs(A*Rb),ta)
print 'Each of the Circuit impedances on the low voltage side is %g/_%g ohm'%(abs(B*Rb),tb)
import math
from numpy import exp
# Variables
#Impedances from the previous example
Zh = 24.6437*exp(1j*53.9*math.pi/180);
Zl = 8.525*(10**-3)*exp(1j*18.9*math.pi/180);
#Voltages
Vh = 7200.; #High End
Vx = 120.; # Low End
S = 25.*1000; #Transformer Rating in VA
N = Vh/Vx; #Turns Ratio
# Calculations
#R of service drop is zero #Line to Neutral Currents
IfLVn = Vx/(Zl+((1/(N**2))*Zh)); #Secondary Fault Current
IfHVn = IfLVn/N; #Primary Fault Current
#R of service drop is zero #Line to Line Currents
Nl = Vh/(2*Vx); #New Truns Ratio
IfLVl = 2*Vx/((2*Zl)+((1/(Nl**2))*Zh)); #Secondary Fault Current
IfHVl = IfLVl/Nl; #Primary Fault Current
# Results
print 'a) The Magnitude of Line to Neutral Fault Currentson HV and LV when R of service drop\
is zero are %g A and %g A respectively'%(abs(IfHVn),abs(IfLVn))
print 'b) The Magnitude of Line to Line Fault Currentson HV and LV when R of service drop is zero are\
%g A and %g A respectively'%(abs(IfHVl),abs(IfLVl))
print 'c) The Minimum Allowable interrupting capacity for circuit breaker isconnected to the LV is %g A'%(abs(IfLVn))
import math
from sympy import solve,Symbol
from numpy import exp
# Variables
Vx = 120.; #Low End Voltage
#When Service drop is Zero
IfLVn = 8181.7*exp(-1*1j*34.3*math.pi/180); #Line to Neutral Vault Current
IfLVl = 5649*exp(-1*1j*40.6*math.pi/180); #Line to Line Fault Current
Ral4 = 2.58; # #4 AWG Aluminium Conductor Resismath.tance per mile
Ralinf = 1.03; # #1/0 AWG Aluminium Conductor Resismath.tance per mile
# Calculations
#Impedances when Service drop is zero, suffix l denotes line to line
#Suffix n denotes line to neutral
Zl0 = (2*Vx)/IfLVl;
Zn0 = (Vx)/IfLVn;
#When there is R service drop
#Magnitudes of Line to Line and Line to Earth fault currents are equal
R = Symbol('R'); #Variable Value
#Effective Impedances
Zl = Zl0+(2*R);
Zn = Zn0+(2*R);
#Fault Currents
Ifl = 2*Vx/Zl;
Ifn = Vx/Zn;
#print Ifl[1]
#Magnitudes of Currents
MIfl = abs(240.)/abs(Ifl.subs(R,3));
MIfn = abs(Ifn.subs(R,2))/abs(Ifn.subs(R,3));
DI = MIfl-MIfn;
X = - 1.5781966 + 240*R #DI.subs(R,2); #Polynomial Equation to find 'R'
R = solve(X)[0]; #Numerical Value
#The Magnitude of R found is Wrong in the Textbook
#Length of service drop cable
SDL4 = R/Ral4;
SDLinf = R/Ralinf;
# Results
print 'a) The Value of Service drop in the Cable is %g ohm'%(R)
print 'b The Length of service drop cable for:'
print 'i) #4 AWG Conductor is %g miles'%(SDL4)
print 'ii) #1/0 AWG Conductor is %g miles'%(SDLinf)
#Length is printed in Miles
# Variables
#Transformer Ratings in kVA
Sr1 = 250.;
Sr2 = 500.;
#percentage impedances
Zr1 = 2.4;
Zr2 = 3.1;
# Calculations
#Ratio of Maximum Loads
R = Sr1*Zr2/(Sr2*Zr1);
#If 500 kVA is chosen as the full load transformer, Transformer 1 becomes overloaded
SL1 = Sr1; #To Avoid OverLoading of transformer 1
SL2 = SL1/R; #Maximum Load on transformer 2
Tl = SL1+SL2; #Total Load without overloading
# Results
print 'The Maximum Load Carried without overloading any of the transformer is %g kVA'%(Tl)
import math
# Variables
#Considering Van as reference voltage
SL3phi = 200*(10**3); #Load to be powered
pf3 = 0.8; #Power Factor of three phase load
t3 = math.acos(pf3); #Power FActor Angle for three phase load
pf1 = 0.9; #Power Factor of math.single phase load
t1 = math.acos(pf1); #Power Factor angle of math.single phase load
SL1 = 80.*(10**3); #Single Phase Light Load
Vll = 240.; #Secondary Voltage
#Rating of Single Phase Transformers between individual lines
Sbc = 100.*(10**3);
Sab = 75.*(10**3);
Sca = Sab;
#Angles of Three phase voltages
ta = 0.;
tb = -120.;
tc = 120.;
#Angles of three line currents
tai = ta-t3;
tbi = tb-t3;
tci = tc-t3;
# Calculations
I = SL3phi/(math.sqrt(3)*Vll); #Magnitude of Current
#3 Phase Line Currents
Ia3 = I*exp(1j*math.pi*tai/180);
Ib3 = I*exp(1j*math.pi*tbi/180);
Ic3 = I*exp(1j*math.pi*tci/180);
MIbc = SL1/Vll; #Magnitude Single Phase Current
tbc = -90; #Lagging Van #Angle of Vbc
tbci = tbc-t1; #Angle of Current Ibc
Ibc = MIbc*exp(1j*math.pi*tbci/180);
#Load Currents
Ia = Ia3;
Ta = math.degrees(math.atan(Ia.imag/Ia.real));
Ib = Ib3+Ibc;
Tb = math.degrees(math.atan(Ib.imag/Ib.real));
Ic = Ic3-Ibc; #Current is wrong in the textbook
Tc = math.degrees(math.atan(Ic.imag/Ic.real));
#Current Flowing in the secondary winding of the transformers 1,2 and 3
Iac = ((Ic/Sbc)-(Ia/Sab))/((1/Sab)+(1/Sbc)+(1/Sca));
T1 = math.degrees(math.atan(Iac.imag/Iac.real)); #Angle of the above current
Iba = ((Ia/Sca)-(Ib/Sbc))/((1/Sab)+(1/Sbc)+(1/Sca));
T2 = math.degrees(math.atan(Iba.imag/Iba.real)); #Angle of the above current
Icb = ((Ib/Sab)-(Ic/Sca))/((1/Sab)+(1/Sbc)+(1/Sca));
T3 = math.degrees(math.atan(Icb.imag/Icb.real)); #Angle of the above current
#Kilovoltampere Load on each transformer
SLab = Vll*abs(Iba)/1000;
SLbc = Vll*abs(Icb)/1000;
SLca = Vll*abs(Iac)/1000;
Vlls = Vll; #Secondary Voltage
Vllp = 7620; #Primary Voltage
n = Vllp/Vlls; #Turns Ratio
#Primary Currents of the transformer
IAC = Iac/n;
IBA = Iba/n;
ICB = Icb/n;
#Primary Current in each each phase wire
IA = IAC-IBA;
TA = math.degrees(math.atan(IA.imag/IA.real)); #Angle of the above current
IB = IBA-ICB;
TB = math.degrees(math.atan(IB.imag/IB.real)); #Angle of the above current
IC = ICB-IAC;
TC = math.degrees(math.atan(IC.imag/IC.real)); #Angle of the above current
# Results
print 'a The Line Currents flowing in secondary phase wire :'
print 'A phase is %g/_%g A'%(abs(Ia),Ta)
print 'B phase is %g/_%g A'%(abs(Ib),Tb)
print 'C phase is %g/_%g A'%(abs(Ic),Tc)
print 'b The Current flowing in secondary winding of each transformer:'
print 'AC is %g/_%g A'%(abs(Iac),T1)
print 'AB is %g/_%g A'%(abs(Iba),T2)
print 'BC is %g/_%g A'%(abs(Icb),T3)
print 'c The Load on Each Transformer is:'
print '1 : %g kVA'%(SLca)
print '2 : %g kVA'%(SLab)
print '3 : %g kVA'%(SLbc)
print 'd The Current flowing in primary winding of each transformer:'
print 'AC is %g/_%g A'%(abs(IAC),T1)
print 'AB is %g/_%g A'%(abs(IBA),T2)
print 'BC is %g/_%g A'%(abs(ICB),T3)
print 'e The Line Currents flowing in primary phase wire :'
print 'A phase is %g/_%g A'%(abs(IA),TA)
print 'B phase is %g/_%g A'%(abs(IB),TB)
print 'C phase is %g/_%g A'%(abs(IC),TC)
#Ic is calculation is wrong, the author has added Ibc instead of subtracting, so if you change - into + in line 45, you get the answer as in the textbook
import math
# Variables
#Considering Van as reference voltage
SL3phi = 100.*(10**3); #Load to be powered
pf3 = 0.8; #Power Factor of three phase load
t3 = math.acos(pf3); #Power FActor Angle for three phase load
pf1 = 0.9; #Power Factor of math.single phase load
t1 = math.acos(pf1); #Power Factor angle of math.single phase load
SL1 = 50.*(10**3); #Single Phase Light Load
Vll = 240.; #Secondary Voltage
#Angles of Three phase voltages
ta = 0.;
tb = -120.;
tc = 120.;
#Angles of three line currents
tai = ta-t3;
tbi = tb-t3;
tci = tc-t3;
# Calculations
I = SL3phi/(math.sqrt(3)*Vll); #Magnitude of Current
#3 Phase Line Currents
Ia3 = I*exp(1j*math.pi*tai/180);
Ib3 = I*exp(1j*math.pi*tbi/180);
Ic3 = I*exp(1j*math.pi*tci/180);
MI1 = SL1/Vll; #Magnitude Single Phase Current
t1v = 30; #Leading Van #Angle of Vbc
t1i = t1v-t1; #Angle of Current Ibc
I1 = MI1*exp(1j*math.pi*t1i/180);
#Load Currents
Ia = Ia3+I1;
Ta = math.degrees(math.atan(Ia.imag/Ia.real));
Ib = Ib3-I1;
Tb = -180+(math.degrees(math.atan(Ib.imag/Ib.real)));
Ic = Ic3; #Current is wrong in the textbook
Tc = math.degrees(math.atan(Ic.imag/Ic.real));
#Current flowing in the secondary of the transformer
Iba = Ia;
T2 = math.degrees(math.atan(Iba.imag/Iba.real)); #Angle of the above current
Icb = Ic;
T3 = 180+(math.degrees(math.atan(Icb.imag/Icb.real))); #Angle of the above current
#Load on Each Transformer
SLba = Vll*abs(Iba)/1000;
SLcb = Vll*abs(Icb)/1000;
Vlls = Vll; #Secondary Voltage
Vllp = 7620; #Primary Voltage
n = Vllp/Vlls; #Turns Ratio
#Primary Currents of the transformer
IA = Iba/n;
TA = math.degrees(math.atan(IA.imag/IA.real)); #Angle of the above current
IB = Icb/n;
TB = T3; #Angle of the above current
IN = IA+IB; #Neutral Current
TN = math.degrees(math.atan(IN.imag/IN.real)); #Angle of the above current
# Results
print 'a The Line Currents flowing in secondary phase wire :'
print 'A phase is %g/_%g A'%(abs(Ia),Ta)
print 'B phase is %g/_%g A'%(abs(Ib),Tb)
print 'C phase is %g/_%g A'%(abs(Ic),Tc)
print 'b The Current flowing in secondary winding of each transformer:'
print 'AB is %g/_%g A'%(abs(Iba),T2)
print 'BC is %g/_%g A'%(abs(Icb),T3)
print 'c The Load on Each Transformer is:'
print '1 : %g kVA'%(SLba)
print '2 : %g kVA'%(SLcb)
print 'd The Line Currents flowing in primary phase wire :'
print 'AB is %g/_%g A'%(abs(IA),TA)
print 'CB is %g/_%g A'%(abs(IB),TB)
print 'The Neutral Current is %g/_%g'%(abs(IN),TN)
#Note the mistake in the Textbook for the calulation for Neutral Current
import math
from numpy import exp
# Variables
Vll = 480.; #Line to Line Voltage
Vln = 277.; #Line to neutral Voltage
# Calculations
#From the Phasor Diagram from the result file
Vab = Vll*exp(1j*0); #Vab is taken as reference
Vabh = 50*Vab/100;
VAB = 4160.;
VABh = 50*VAB/100;
VH1H2o = math.sqrt((VAB**2)-(VABh**2));
VH1H2t = (VABh);
Vx1x2o = 1*math.sqrt((Vab**2)-(Vabh**2))/3;
Vx2x3o = 2*math.sqrt((Vab**2)-(Vabh**2))/3;
VH2H3t = (VABh);
Vx1x2t = Vabh;
Vx2x3t = Vabh;
# Results
print 'a The Phasor diagram is shown in the result file attached to the code'
print 'b) Vab is %g/_%g V'%(abs(Vab),Vab.imag/Vab.real)
print 'c The Magnitudes of the following rated winding voltages'
print 'i) The Voltage VH1H2 on transformer 1 : %g V'%(VH1H2o.real)
print 'ii) The Voltage Vx1x2 on transformer 1 : %g V'%(Vx1x2o.real)
print 'iii) The Voltage Vx2x3 on transformer 1 : %g V'%(Vx2x3o.real)
print 'iv) The Voltage VH1H2 on transformer 2 : %g V'%(VH1H2t.real)
print 'v) The Voltage VH2H3 on transformer 2 : %g V'%(VH2H3t.real)
print 'vi) The Voltage Vx1x2 on transformer 2 : %g V'%(Vx1x2t.real)
print 'vii) The Voltage Vx1x2 on transformer 2 : %g V'%(Vx2x3t.real)
print 'd i NO ii NO iii YES'
import math
from numpy import exp
# Variables
R = 2.77; #Resismath.tance of the balanced load
#From Phasor Diagram in Result file
Vab = 480*exp(1j*0); #Reference Voltage
MVn = abs(Vab)/math.sqrt(3); #Magnitude of line to neutral voltages
#Angles of Three phase voltages
ta = -30.;
tb = -150.;
tc = 90.;
# Calculations
#Angles of Winding according to the Line Currents
tx3x2 = 30; #Leading
tx1x2 = -30; #Lagging
I = MVn/R; #Magnitude of current
#Low Voltage Current Phasors
Ia = I*exp(1j*math.pi*ta/180);
Ib = I*exp(1j*math.pi*tb/180);
Ic = I*exp(1j*math.pi*tc/180);
pfT = math.cos(math.radians(ta-ta)); #Angle of Ia is same as phase voltage #Resismath.tance load
# Results
print 'a The Low voltage current phasors are:'
print 'A is %g/_%g A'%(abs(Ia),ta)
print 'B is %g/_%g A'%(abs(Ib),tb)
print 'C is %g/_%g A'%(abs(Ic),tc)
print 'b The Phasor Diagram is the ''b'' diagram of in the result file'
print 'c) The Power Factor of the Transformer is %g'%(pfT)
print 'd) Power Factor as seen by winding x3x2 of transformer 2 is %g leading'%(math.cos(math.radians(tx3x2)))
print 'e) Power Factor as seen by winding x1x2 of transformer 2 is %g lagging'%(math.cos(math.radians(tx1x2)))
import math
from numpy import exp
#'o' and 't' represent transformer one and two respectively
# Variables
#Objective is to find the Factor which has to be multiplied to get VA rating
Vll = 1.; #Assumption Made
#From the Phasor Diagram from the result file
Vab = Vll*exp(1j*0); #Vab is taken as reference
Vabh = 50.*Vab/100;
Vx1x2o = 1*math.sqrt((Vab**2)-(Vabh**2))/3;
Vx2x3o = 2*math.sqrt((Vab**2)-(Vabh**2))/3;
Vx1x2t = Vabh;
Vx2x3t = Vabh;
#Let I be unity
I = 1;
# Calculations
#VA Ratings of the respective windings
Sx1x2o = Vx1x2o*I;
Sx2x3o = Vx2x3o*I;
Sx1x2t = Vx1x2t*I;
Sx2x3t = Vx2x3t*I;
#Total VA rating of transformer
S1 = Sx1x2o+Sx2x3o;
S2 = Sx1x2t+Sx2x3t;
#Ratio of total rating to maximum rating
Rt = (S1+S2)/(math.sqrt(3)*Vll*I);
# Results
print 'a) The voltampere raing of x1x2 of transformer 1 is %g*VI VA'%(Sx1x2o.real)
print 'b) The voltampere raing of x1x2 of transformer 1 is %g*VI VA'%(Sx2x3o.real)
print 'c) The Total Output from transformer 1 is %g*VI VA'%(S1.real)
print 'd) The voltampere raing of x1x2 of transformer 2 is %g*VI VA'%(Sx1x2t.real)
print 'e) The voltampere raing of x1x2 of transformer 2 is %g*VI VA'%(Sx2x3t.real)
print 'f) The Total Output from transformer 2 is %g*VI VA'%(S2.real)
print 'g) The Total Rating to the Maximum Continous Output is %g'%(Rt.real)
import math
from numpy import exp
# Variables
#Per unit value
Zt = 0.01+(1j*0.03); #Transformer impedance
Vll = 240.; #Secondary Voltage
Sl = 90.; #Lighting Load
pfl = 0.9;
tl = math.acos(pfl);
S = 25.; #Balanced Load
pf = 0.8;
t = math.acos(pf);
# Calculations
def angle(y):
return math.degrees(math.atan(y.imag/y.real))
tab = 30; #Phase angle of Vab
Il = Sl*1000/Vll; #Magnitude of Light Load
#Umath.sing the symmetrical - components theory
Ia1 = Il*exp(1j*math.pi*(tab-tl)/180);
Ta1 = angle(Ia1); #Angle for the above current
Ib1 = -1*Ia1;
Ic1 = 0; #Neutral Wire
#Angles of three line to line voltages
ta = 0;
tb = -120;
tc = 120;
Ib = S*1000/(math.sqrt(3)*Vll); #Magnitude of balanced load
#Currents in Three phase load
Ta2 = ta-t;
Ia2 = Ib*exp(1j*math.pi*Ta2/180);
Tb2 = tb-t;
Ib2 = Ib*exp(1j*math.pi*Tb2/180);
Tc2 = tc-t;
Ic2 = Ib*exp(1j*math.pi*Tc2/180);
#Currents in phase wire
Ia = Ia1+Ia2;
Ta = angle(Ia); #Angle corresponding to the above angle
Ib = Ib1+Ib2;
Tb = angle(Ib); #Angle corresponding to the above angle
Ic = Ic1+Ic2;
Tc = angle(Ic); #Angle corresponding to the above angle
#Transformer Loads
ST1 = Vll*abs(Ia)/1000;
T1 = 100; #From the above value of Load, this transformer is chosen to meet the specific characteristic
ST1pu = ST1/T1; #Per unit Load
ST2 = Vll*abs(Ic)/1000;
T2 = 15; #From the above value of Load, this transformer is chosen to meet the specific characteristic
ST2pu = ST2/T2; #Per unit Load
#Transformer Power Factors
pfT1 = math.cos(math.radians(tab-Ta));
pfT2 = math.cos(math.radians(90-Tc)); #Vcb makes angle of 90
Vh = 7200; #High End Voltage
n = Vh/Vll; #Turns Ratio
# The Primary Line Currents
IA = Ia/n;
IB = -1*Ic/n;
IN = -1*(IA+IB);
Ibase = T1*1000/Vll; #Base Current
Iapu = Ia/Ibase;
Icpu = Ic/Ibase;
#Phase Voltages
Vab = Vll*exp(1j*math.pi*tab/180);
Vbc = Vll*exp(-1*1j*math.pi*90/180);
#Per Unit Voltages
VANpu = (Vab/Vll)+(Iapu*Zt);
VBNpu = (Vbc/Vll)-(Icpu*Zt);
#Actual Voltages
VAN = VANpu*Vh;
VBN = VBNpu*Vh;
# Results
print 'a The Phasor Currents:'
print 'Ia is %g/_%g A'%(abs(Ia),Ta)
print 'Ib is %g/_%g A'%(abs(Ib),180+Tb)
print 'Ic is %g/_%g A'%(abs(Ic),Tc)
print 'b) Suitable ratings of the transformers are %g kVA and %g kVA'%(T1,T2)
print 'c) The Per Unit kVA load on each transformer is %g pu and %g pu'%(ST1pu,ST2pu)
print 'd) The power factor of output of each transformer is %g and %g both lagging'%(pfT1,pfT2)
print 'e The phasor currents at the high voltage leads:'
print 'IA is %g/_%g A'%(abs(IA),Ta)
print 'IB is %g/_%g A'%(abs(IB),180+angle(IB))
print 'IN is %g/_%g A'%(abs(IN),angle(IN))
print 'f) VAN is %g/_%g V and VBN is %g/_%g V'%(abs(VAN),angle(VAN),abs(VBN),angle(VBN))
#Highly Accuracy of Answers; Upto 5 decimal Places