# Chapter 1: Review of Electric Circuit Theory¶

## Example 1.1, Page 5¶

In [1]:
#Calculations&Results
#on applying KVL we get
i=75./50;#in Amperes
v_th=(30*i)+25;#Equivalent Thevenin voltage (in Volts)
r_th=(20*30)/(20+30);#Equivalent thevenin resistance (in Ohms)
print 'max power (in watts)= %.2f'%p_max#maximum power dissipiated

load resistance (in ohms)= 12
max power (in watts)= 102.08


## Example 1.2, Page 13¶

In [2]:
import math
import cmath
import matplotlib.pyplot as plt
import numpy as np

#Variable declaration
#Refer to figure 1.5a
L=1*10**-3;#henery
R=3.;#ohms
print "v(t)=14.142cos1000t"
V_m=14.142;#Peak value of applied voltage (in Volts)

#Calculations&Results
V=V_m/math.sqrt(2);#RMS value of applied voltage (in Volts)
#On comparing with standard equation v(t)=acoswt
#Inductive impedance=jwL
Z_L=complex(0,w*L);#in ohms
#capacitive impedance=-j/wC
Z_c=complex(0,-1/(w*C));#in ohms
#Impedance of the circuit is given by
Z=Z_L+Z_c+R;#in ohms
I=V/Z#Current in the circuit#in Amperes
r=I.real;
i=I.imag;
magn_I=math.sqrt((r**2)+(i**2));#magnitude of current (in Amperes)
phase_I=math.degrees(math.atan(i/r));#phase of current (in degree)
print 'magnitude of current (in Amperes)= %.f'%magn_I
print 'phase of current (in Degrees) = %.2f'%phase_I

Vr = I*R
Vl = I*Z_L
Vc = I*Z_c
print "\nCurrent in time domain is:\ni(t)=2.828cos(1000t+53.13)A"
S = V*I   #complex power supplied by source(VA)
magn_S = math.sqrt((S.real**2)+(S.imag**2))
print "\nApparent power S = %.f VA"%magn_S
print "Reactive power P = %.f W"%S.real
print "Reactive power Q = %.f VAR"%(-S.imag)

v(t)=14.142cos1000t
magnitude of current (in Amperes)= 2
phase of current (in Degrees) = 53.13

Current in time domain is:
i(t)=2.828cos(1000t+53.13)A

Apparent power S = 20 VA
Reactive power P = 12 W
Reactive power Q = -16 VAR


## Example 1.3, Page 17¶

In [3]:
import math
import cmath

#Variable declaration
I=10;#Current drawn by the load (in Amperes)
pf1=0.5;#lagging power factor
pf2=0.8;
V=120;#source voltage (in Volts)
f=60;#frequency of source (in Hertz)

#Calculations
Vl = complex(120,0)
Il = complex(5,8.66)   #10/_60  in polar
S = Vl*Il
i = 600/(V*pf2)   #Since power at source is 600W

#Refer to fig 1.6(b)
#I_Lc=I_L+I_c
I = complex(5,-3.75)    #Writing I from polar to cartesian form
Il = complex(5,-8.66)   #Writing Il from polar to cartesian forms
Ic = I - Il
Zc = V/Ic
Xc = Zc/complex(0,1)
C = 1/(2*math.pi*f*Xc)

#Result
print "The required value of capacitor is %.2f"%(C.real*10**6)

The required value of capacitor is -108.53


## Example 1.4, Page 26¶

In [4]:
import math
import cmath

#Variable declaration
#Make delta -star conversion of load
Z_L=complex(1,2);#Impedance of each wire (in Ohms)
Z_p=complex(177,-246);#per-phase impedance (in Ohms)
Z_pY=Z_p/3;#per-phase impedance in Y-connection (in Ohms)
Z=Z_L+Z_pY;#Total per phase impedance (in Ohms)
V=866/math.sqrt(3);#Per-phase voltage (in Volts)
V_phase=0;
I=V/Z;#Current in the circuit (in Ampere)

#Calculations&Results
I_mag=math.sqrt((I.real**2)+(I.imag**2));#magnitude of current (in Amperes)
I_phase=math.degrees(math.atan(I.imag/I.real));#phase of current (in Degrees)
pf=math.cos(math.atan(I.imag/I.real));#power factor
#Refer to fig:1.13(b)
#Source are connected in star,so phase currents = line currents
I_na_mag=I_mag;#Magnitude of Source current through n-a (in Amperes)
I_nb_mag=I_mag;#Magnitude of Source current through n-b (in Amperes)
I_nc_mag=I_mag;#Magnitude of Source current through n-c (in Amperes)
I_na_phase=I_phase+(0);#phase angle of current through n-a (in Degree)
I_nb_phase=I_phase+(-120);#phase angle of current through n-b (in Degree)
I_nc_phase=I_phase+(120);#phase angle of current through n-c (in Degree)
print 'Source currents are:'
print 'I_na_mag (in Amperes)= %.f'%I_na_mag
print 'I_na_phase (in Degrees)=%.2f'%I_na_phase
print 'I_nb_mag (in Amperes)=%.f'%I_nb_mag
print 'I_nb_phase (in Degrees)=%.2f'%I_nb_phase
print 'I_nc_mag (in Amperes)=%.f'%I_nc_mag
print 'I_nc_phase (in Degrees)=%.2f'%I_nc_phase

#Load is connected in delta network
I_AB_mag=I_mag/math.sqrt(3);#magnitude of current through AB (in Amperes)
I_BC_mag=I_mag/math.sqrt(3);#magnitude of current through BC (in Amperes)
I_CA_mag=I_mag/math.sqrt(3);#magnitude of current through CA (in Amperes)
I_AB_phase=I_na_phase+30;#phase angle of current through AB (in Degrees)
I_BC_phase=I_nb_phase+30;#phase angle of current through BC (in Degrees)
I_CA_phase=I_nb_phase-90;#phase angle of current through CA (in Degrees)
print '\nPhase currents through the load are:'
print 'I_AB_mag (in Amperes)= %.3f'%I_AB_mag
print 'I_AB_phase (in Degrees)= %.2f'%I_AB_phase
print 'I_BC_mag (in Amperes)= %.3f'%I_BC_mag
print 'I_BC_phase (in Degrees)= %.2f'%I_BC_phase
print 'I_CA_mag (in Amperes)= %.3f'%I_CA_mag
print 'I_CA_phase (in Degrees)= %.2f'%I_CA_phase

I_AB=complex((I_AB_mag*math.cos(I_AB_phase*math.pi/180)),(I_AB_mag*math.sin(I_AB_phase*math.pi/180)));#(in Amperes)
V_AB = I_AB*Z_p
V_AB_mag = math.sqrt(V_AB.real**2+V_AB.imag**2)
V_AB_phase = math.degrees(math.atan(V_AB.imag/V_AB.real))
print '\nLine or phase voltages at the load are:'
print 'V_AB = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase)
print 'V_BC = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase-120)
print 'V_CA = %.2f,angle = %.2f V'%(V_AB_mag,V_AB_phase+120)

P_AB=I_AB_mag**2*(Z_p.real);#in watts

P_line=3*I_mag**2*(Z_L.real);#in watts
print 'Power dissipated by transmission line (in Watts)= %.f'%P_line
print 'Total power supplied by three-phase source is %.2f W'%P_source

Source currents are:
I_na_mag (in Amperes)= 5
I_na_phase (in Degrees)=53.13
I_nb_mag (in Amperes)=5
I_nb_phase (in Degrees)=-66.87
I_nc_mag (in Amperes)=5
I_nc_phase (in Degrees)=173.13

Phase currents through the load are:
I_AB_mag (in Amperes)= 2.887
I_AB_phase (in Degrees)= 83.13
I_BC_mag (in Amperes)= 2.887
I_BC_phase (in Degrees)= -36.87
I_CA_mag (in Amperes)= 2.887
I_CA_phase (in Degrees)= -156.87

Line or phase voltages at the load are:
V_AB = 874.83,angle = 28.87 V
V_BC = 874.83,angle = -91.13 V
V_CA = 874.83,angle = 148.87 V

Power dissipated (in Watts)=4424.74
Power dissipated by transmission line (in Watts)= 75
Total power supplied by three-phase source is 4499.74 W


## Example 1.5, Page 29¶

In [5]:
#Variable declaration
R1 = 25  #in ohms
R2 = 100 #in ohms
Rt = 100 #in ohms
V = 100.  #in volts

#Calculations
Rp = (R1*R2)/(R1+R2)
It = V/Rt   #total current in circuit in Amps
V_25 = It*Rp  #voltage across 25 ohm resistor, in volts
I_25 = V_25/R1 #current through 25 ohm resistor, in Amps
P_25 = V_25*I_25

#Result
print "Power dissipated by the 25ohm resistor is %.f W"%P_25

Power dissipated by the 25ohm resistor is 16 W


## Example 1.6, Page 33¶

In [6]:
import math

#Variable declaration
#Refer to the fig:1.16
R=40;#in ohms
L=complex(0,30);#in ohms

#Calculations&Results
V=117*(complex(math.cos(0),math.sin(0)));#in Volts
#Equivalent load impedance is obtained by parallel combination of Resistance R and Inductance L
Z1=complex(0.6,16.8);# in Ohms
Z=Z_L+Z1;#Equivalent impedance of circuit (in Ohms)
I_mag=math.sqrt(I.real**2+I.imag**2);#magnitude of current flowing through load (in Amperes)
I_phase=math.degrees(math.atan(I.imag/I.real))
print 'Reading of ammeter (in Amperes)=%.f,angle = %.2f'%(I_mag,I_phase)

V_L_mag=math.sqrt(V_L.real**2+V_L.imag**2);#magnitude of voltage across load (in Volts)
V_L_phase = math.degrees(math.atan(V_L.imag/V_L.real))
print '\nReading of voltmeter (in Volts)= %.f,angle = %.2f'%(V_L_mag,V_L_phase)

P=(V_L*I.conjugate());#Power developed (in Watts)
print 'Reading of wattmeter (in Watts)=%.1f'%P.real

pf=P.real/(V_L_mag*I_mag);#Power factor
print 'power factor=%.2f(lagging)'%pf

Reading of ammeter (in Amperes)=3,angle = -67.38

Reading of voltmeter (in Volts)= 72,angle = -14.25
power factor=0.60(lagging)


## Example 1.7, Page 38¶

In [7]:
import math

#Variable declaration
#transforming delta connected source into an equivalent Star-connected source
V_s=1351;#source voltage (in Volts)
V=1351/math.sqrt(3);#in volts
V_phase=0;

#Calculations&Results
Z=complex(360,150);#per-phase impedance(in ohms)
I=V/Z;#current in the circuit (in Amperes)
I_mag=math.sqrt(I.real**2+I.imag**2);#in ampere
I_phase=math.degrees(math.atan(I.imag/I.real));#degree

#Refer to fig 1.19(a)
V_ab=1351*complex(math.cos(-30*math.pi/180),math.sin(-30*math.pi/180));#in Volts
I_aA=2*complex(math.cos(I_phase*math.pi/180),math.sin(I_phase*math.pi/180));#in Amperes
V_cb=1351*complex(math.cos(-90*math.pi/180),math.sin(-90*math.pi/180));#in Volts
I_cC=2*complex(math.cos((I_phase-120)*math.pi/180),math.sin((I_phase-120)*math.pi/180));#in Amperes
P1=V_ab*I_aA.conjugate();#reading of wattmeter 1 (in Watts)
print 'Reading of wattmeter W1 (in Watts) =%.2f'%P1.real
P2=V_cb*I_cC.conjugate();#reading of wattmeter 2 (in Watts)
print 'Reading of wattmeter W2 (in Watts)=%.2f'%P2.real
P=P1.real+P2.real;#total power developed (in Watts)
print 'Total power developed (in Watts)= %.f' %P

pf=math.cos(math.atan(I.imag/I.real));#power factor
print 'power factor= %.3f(lagging)'%pf

Reading of wattmeter W1 (in Watts) =2679.62
Reading of wattmeter W2 (in Watts)=1640.39
Total power developed (in Watts)= 4320
power factor= 0.923(lagging)


## Example 1.8, Page 44¶

In [8]:
import math

#Variable declaration
V = 120  #Voltage(V)
I = 5    #current(A)
P = 480.  #power(W)
f = 60    #Hz

#Calculations&Results
S = V*I  #apparent power(W)
theta = math.degrees(math.acos(P/S))   #power factor angle
#In phasor form,
Vp = V*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))
Ip = I*complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180))

#For series circuit
Zs = Vp/Ip
print "Equivalent Impedance of series circuit = ",Zs
Xc = -Zs.imag
C = 1./(2*math.pi*f*Xc)
print "Equivalent capacitance of series circuit = %.2f uF"%(C*10**6)

#For parallel circuit
I_mag = I*math.cos(theta*math.pi/180)
I_imag = I*math.sin(theta*math.pi/180)
Rp = V/I_mag
print "\nEquivalent resistance of parallel circuit = %d ohms"%Rp
Xp = V/I_imag
Cp = 1./(2*math.pi*f*Xp)
print "Equivalent capacitance of parallel circuit = %.1f uF"%(Cp*10**6)

Equivalent Impedance of series circuit =  (19.2-14.4j)
Equivalent capacitance of series circuit = 184.21 uF

Equivalent resistance of parallel circuit = 29 ohms
Equivalent capacitance of parallel circuit = 66.3 uF


## Example 1.9, Page 46¶

In [9]:
import math

#Variable declaration
P = 3246   #power consumed(W)
Vl = 208.   #line voltage(V)
Il = 10.6   #line current(A)

#Calculations&Results

#Y-Connection
V_phi = Vl/math.sqrt(3)  #pre-phase voltage(V)
I_phi = Il               #pre-phase current(A)
P_phi = P/3   #pre-phase power(W)
S_phi = V_phi*I_phi      #pre-phase apparent power(VA)
theta = math.degrees(math.acos((P_phi/S_phi)))   #lag
#In phasor form,
V_AN = V_phi*complex(math.cos(0*math.pi/180),math.sin(0*math.pi/180))
I_AN = I_phi*complex(math.cos(-theta*math.pi/180),math.sin(-theta*math.pi/180))
Zy = V_AN/I_AN
Zy_phase = math.degrees(math.atan(Zy.imag/Zy.real))
I_mag = I_phi*math.cos(Zy_phase*math.pi/180)
I_imag = I_phi*math.sin(Zy_phase*math.pi/180)
Rp = V_phi/I_mag  #ohms
Xp = V_phi/I_imag #ohms
print "For Y-connection:"
print "Impedance = ",Zy
print "Resistance = %.2f ohms, Reactance = %.2f ohms"%(Rp,Xp)

For Y-connection:
Impedance =  (9.62976148095+5.96800193442j)
Resistance = 13.33 ohms, Reactance = 21.51 ohms