Chapter 4: Analysis of Single Phase AC Circuit

Example 1: pg 167

In [1]:
# Exa 4.1
#pg 167
#calculate the current and power consumed
# Given data
from math import sqrt,pi
R = 10.;# inohm
V = 230.;# in V
f = 50.;# in Hz
#calculations
I = V/R;# in A
print "The currrent in A is",I
P =V*I;# in W
print "The power consumed in W is",P
Vm = sqrt(2)*V;# in V
Im =sqrt(2)*I;# in A
omega = 2*pi*f;# in rad/sec
#Equation for voltage: V = Vm*sind(omega*t) 
#Equation for current: i = Im*sind(omega*t)
print "Voltage equation : v = ",round(Vm,2)," sin (",round(omega)," t)"
print "Current equation : i = ",round(Im,2)," sin (",round(omega)," t)"
The currrent in A is 23.0
The power consumed in W is 5290.0
Voltage equation : v =  325.27  sin ( 314.0  t)
Current equation : i =  32.53  sin ( 314.0  t)

Example 2: pg 167

In [2]:
# Exa 4.2
#pg 167
#calculate the instantaneous and average power
# Given data
from math import pi,cos
R = 100.;# in ohm
i= '3*cos(omega*t)';# in A
#calculations
A= R*3**2;# assumed
P= R*3**2/2.*(1+cos(pi/2));# in watts
#results
print "Instantaneous power taken by resistor in watts is : "
print round(A/2.)," (1+cos(2*omega*t))"
print "The average power in watts is : ",P
Instantaneous power taken by resistor in watts is : 
450.0  (1+cos(2*omega*t))
The average power in watts is :  450.0

Example 3: pg 168

In [3]:
# Exa 4.38
#pg 168
from math import pi,sqrt,sin
# Given data
I = 10.;# in A
V = 230.;# in V
f = 50.;# in Hz
#calculations
X_L = V/I;# in ohm
# X_L = 2*%pi*f*L;
Vrms = V;# in V
Irms = I;# in A
Vm = Vrms*sqrt(2);# in V
Im = Irms*sqrt(2);# in A
omega = 2*pi*f;# in rad/sec
L = X_L/(2*pi*f);# in H
#results
#Equation for voltage: V = Vm*sind(omega*t) 
#Equation for current: i = Im*sind(omega*t)
print "Inductive reactance in ohm is",X_L
print "Inductance of the coil in H is",round(L,4)
print "Voltage equation : v = ",round(Vm,2)," sin (",round(omega)," t)"
print "Current equation : i = ",round(Im,2)," sin (",round(omega)," t - pi/2)"
Inductive reactance in ohm is 23.0
Inductance of the coil in H is 0.0732
Voltage equation : v =  325.27  sin ( 314.0  t)
Current equation : i =  14.14  sin ( 314.0  t - pi/2)

Example 4: pg 168

In [4]:
# Exa 4.4
#pg 168
#calculate the voltage and current equations
# GIven data
from math import pi,sqrt
C = 318.;# in muF
C = C * 10**-6;# in F
V = 230.;# in V
f = 50.;# in Hz
#calculations
X_C = 1/(2*pi*f*C);# in ohm
print "The capacitive reactance in ohm is",round(X_C)
I = V/X_C;# in A
print "The R.M.S value of current in A is",round(I)
Vrms = V;# in V
Irms = I;# in A
Vm = Vrms*sqrt(2);# in V
Im = Irms*sqrt(2);# in A
omega = 2*pi*f;# in rad/sec
# V = Vm*sind(omega*t);
# i = Im*sind((omega*t)+(%pi/2));
#Equation for voltage: V = Vm*sind(omega*t) 
#Equation for current: i = Im*sind(omega*t)
print "Voltage equation : v = ",round(Vm,2)," sin (",round(omega)," t)"
print "Current equation : i = ",round(Im,2)," sin (",round(omega)," t + pi/2)"
The capacitive reactance in ohm is 10.0
The R.M.S value of current in A is 23.0
Voltage equation : v =  325.27  sin ( 314.0  t)
Current equation : i =  32.5  sin ( 314.0  t + pi/2)

Example 5: pg 169

In [5]:
# Exa 4.5
#pg 169
#calculate the power consumed, phase angle and circuit current
# Given data
from math import pi,sqrt,cos,atan
R = 7;# in ohm
L = 31.8;# in mH
L = L * 10**-3;# in H
V = 230.;# in V
f = 50.;# in Hz
#calculations
X_L = 2*pi*f*L;# in ohm
Z = sqrt( (R**2)+(X_L**2) );# in ohm
I = V/Z;# in A
print "The circuit current in A is",round(I,2)
# tand(phi) = X_L/R;
phi = atan(X_L/R);# in radians lag
print "The phase angle in degree is",round(phi*180/pi,0)
# Power factor
powerfactor = cos(phi);# in lag
print "The power factor is",round(powerfactor,3)
P = V*I*cos(phi);# in W
print "The power consumed in W is",round(P,2)
The circuit current in A is 18.85
The phase angle in degree is 55.0
The power factor is 0.574
The power consumed in W is 2488.49

Example 6: pg 169

In [6]:
# Exa 4.6
#pg 169
#calculate the value of resistance and inductance
# Given data
from math import acos,cos,pi
from cmath import exp
P = 400.;# in W
f = 50.;# in Hz
V = 120.;# in V
phi= acos(0.8);# in radians
# P =V*I*cos(phi);
#calculations
I = P/(V*cos(phi));# in A
Z= V/I;# in ohm
Z= Z*exp(1j*phi);# ohm
R= Z.real;# in ohm
XL= Z.imag;# in ohm
# Formula XL= 2*%pi*f*L
L= XL/(2*pi*f);# in H
#results
print "The value of R in ohm is : ",round(R,2)
print "The value of L in H is : ",round(L,3)
The value of R in ohm is :  23.04
The value of L in H is :  0.055

Example 7: pg 170

In [7]:
# Exa 4.7
#pg 170
#calculate the active and reactive components of power and current
from math import sin,cos,acos,sqrt,pi
# Given data
R = 17.32;# in ohm
L = 31.8;# in mH
L = L * 10**-3;# in H
V = 200.;# in V
f = 50.;# in Hz
#calculations
X_L = 2*pi*f*L;# in ohm
Z = sqrt( (R**2) + (X_L**2) );# in ohm
I = V/Z;# in A
phi =acos( R/Z);# in radians
ActiveCom= I*cos(phi);# in A
ReactiveCom= I*sin(phi);# in A
print "The active component of current in A is : ",round(ActiveCom,2)
print "The reactive component of current in A is : ",round(ReactiveCom)
P= V*I*cos(phi);# in W
print "The active power in W is : ",round(P,1)
Q= V*I*sin(phi);# in VAR
print "The reactive power in VAR is : ",round(Q)

print 'Note: There is calculation error to evaluate the value of P, so the answer in the book is wrong.'
The active component of current in A is :  8.66
The reactive component of current in A is :  5.0
The active power in W is :  1732.9
The reactive power in VAR is :  1000.0
Note: There is calculation error to evaluate the value of P, so the answer in the book is wrong.

Example 8: pg 170

In [8]:
#pg 170
#calculate the voltage in all cases
from math import sin,sqrt,pi
# Given data
R = 20.;# in ohm
C = 200.;# in muF
C=C*10**-6
f =50.;# in Hz
#I = 10.8 sin(314*t)
Im = 10.8;# in A
#calculations
I = Im/sqrt(2);# in A
V_R = I*R;# in V
print "The voltage across 20 ohm resistor in V is : ",round(V_R,1)
#Vc = I*X_C and  X_C = 1/omega*C;
omega = 2*pi*f;# in rad/sec
Vc = I * 1/(omega*C);# in V
print "The voltage across 200 muF capacitor in V is",round(Vc,2)
V = sqrt( (V_R**2) + (Vc**2) );# in V
print "The voltage across the circuit in V is",round(V,1)
The voltage across 20 ohm resistor in V is :  152.7
The voltage across 200 muF capacitor in V is 121.54
The voltage across the circuit in V is 195.2

Example 9: pg 171

In [9]:
#pg 171
#calculate the resistance and inductance in all cases
from math import pi,sqrt
import cmath
# Given data
f= 60.;# in Hz
print "Part (a)"
Z= 12.+30*1j;
R= Z.real # in ohm
XL= Z.imag;# in ohm
# Formula XL= 2*%pi*f*L
#calculations
L= XL/(2*pi*f);# in H
L= L*10**3;# in mH
print "The value of resistance in ohm is : ",R
print "The value of inductance in mH is : ",round(L,2)
L= L*10**-3;# in H
print "Part (b)"
Z= 0-60*1j;
R= Z.real;# in ohm
XC= (abs(Z.imag));# in ohm
# Formula XC= 1/(2*%pi*f*C)
C= 1/(2*pi*XC*f);# in H
C= C*10**6;# in muF
print "The value of resistance in ohm is : ",R
print "The value of inductance in muF is : ",round(C,3)
C= C*10**-6;# in F
print "Part (c)"
Z= 20*cmath.exp(60*1j*pi/180.)
R= Z.real;# in ohm
XL= Z.imag;# in ohm
# Formula XL= 2*%pi*f*L
L= XL/(2*pi*f);# in H
L= L*10**3;# in mH
print "The value of resistance in ohm is : ",R
print "The value of inductance in mH is : ",round(L,2)
Part (a)
The value of resistance in ohm is :  12.0
The value of inductance in mH is :  79.58
Part (b)
The value of resistance in ohm is :  0.0
The value of inductance in muF is :  44.21
Part (c)
The value of resistance in ohm is :  10.0
The value of inductance in mH is :  45.94

Example 10: pg 171

In [10]:
#pg 171
#calculate the power factor and voltage in all cases
import math,cmath
# Given data
R = 120.;# in ohm
XC = 250.;# in ohm
I = 0.9;# in A
#calculations
Z= R-1j*XC;# in ohm
phi= cmath.phase(Z)
V=I*Z;# in V
VR = I*R;# in V
VC= I*XC;# in V
P= abs(V)*I*math.cos(phi);# in W
Q= abs(V)*I*math.sin(phi);# in VAR
print "The power factor is : ",round(math.cos(phi),4)
print "Supply voltage : "
print "Magnitude is : ",round(abs(V),4)," V and angle is : ",round(cmath.phase(V)*180/math.pi,3)," degree"
print "The voltage across resistance in V is : ",VR
print "The voltage across capacitance in V is : ",VC
print "The active power in W is : ",P
print "The reactive power in VAR is : ",Q
The power factor is :  0.4327
Supply voltage : 
Magnitude is :  249.5776  V and angle is :  -64.359  degree
The voltage across resistance in V is :  108.0
The voltage across capacitance in V is :  225.0
The active power in W is :  97.2
The reactive power in VAR is :  -202.5

Example 11: pg 172

In [11]:
#pg 172
#calculate the power, impedance, current and phase angle
import math,cmath
from math import pi,sqrt,cos,acos,atan
# Given data
V = 230.;# in V
f = 50.;# in Hz
L = 0.06;# in H
R = 2.5;# in ohm
C = 6.8;# in microF
#calculations
C = C * 10**-6;# in F
X_L = 2*pi*f*L;# in ohm
X_C = 1/(2*pi*f*C);# in ohm
Z = sqrt( (R**2) + ((X_L-X_C)**2) );# in ohm
print "The impedance in ohm is",round(Z,1)
I = V/Z;# in A
print "The current in A is",round(I,3)
# tan(phi) = (X_L-X_C)/R;
phi = atan( (X_L-X_C)/R );# in lead
print "The phase angle between current and voltage is : ",round(abs(phi)*180/pi,1)," lead"
phi = acos(R/Z);
print "The power factor is : ",round(math.cos(phi),5)," lead"
P = V*I*cos(phi);# in W
print "The power consumed in W is",round(P,3)
The impedance in ohm is 449.3
The current in A is 0.512
The phase angle between current and voltage is :  89.7  lead
The power factor is :  0.00556  lead
The power consumed in W is 0.655

Example 12: pg 173

In [12]:
#pg 173
#calculate the voltage, current, frequency
from math import pi,sqrt
# GIven data
R = 100.;# in ohm
L = 100.;# in muH
L = L * 10**-6;# in H
C = 100.;# in  pF
C = C * 10**-12;# in F
V = 10;# in V
#calculations
# The resonant frequency 
f_r = 1/(2*pi*sqrt(L*C));# in Hz 
print "The resonant frequency in Hz is",round(f_r,2)
# current at resonance 
Ir = V/R;# in A
print "The current at resonance in A is",Ir
X_L = 2*pi*f_r*L;# in ohm 
# voltage across L at resonance 
V_L = Ir*X_L;# in V
print "The voltage across L at resonance in V is",V_L
X_C = X_L;# in ohm
# voltage across C at resonance 
V_C = Ir*X_C;# in V
print "The voltage across C at resonance in V is",V_C
Q= 1/R*sqrt(L/C);
print "The Q-factor is : ",Q
The resonant frequency in Hz is 1591549.43
The current at resonance in A is 0.1
The voltage across L at resonance in V is 100.0
The voltage across C at resonance in V is 100.0
The Q-factor is :  10.0

Example 13: pg 174

In [14]:
#pg 174
#calculate the quality,frequency,current,power 
from math import pi,sqrt
# Given data
R = 10.;# in ohm
L = 0.2;# in H
C = 40.;# in muF
C = C * 10**-6;# in F
V = 100;# in V
#calculations
f_r = 1/(2*pi*sqrt(L*C));# in Hz
print "The frequency at resonace in Hz is",round(f_r,4)
Im = V/R;# in A
print "The current in A is",Im
Pm = (Im**2)*R;# in W
print "The power in W is",Pm
# voltage across R 
V_R = Im*R;# in V
print "The voltage across R in V is",V_R
X_L = 2*pi*f_r*L;# in ohm
# voltage across L 
V_L = Im*X_L;# in V
print "The voltage across L in V is",round(V_L,3)
X_C = 1/(2*pi*f_r*C);# in ohm
# voltage across  C 
V_C = Im*X_C;# in V
print "The voltage across  C in V is",round(V_C,3)
omega = 2*pi*f_r;# in rad/sec
Q = (omega*L)/R;
print "The quality factor is",round(Q,3)
del_F = R/(4*pi*L);
f1 = f_r-del_F;# in Hz
f2 = f_r+del_F;# in Hz
print "The half power frequencies are : ",round(f1,4)," Hz and ",round(f2,4)," Hz"
BW = f2-f1;# in Hz
print "The bandwidth in Hz is : ",round(BW,4)
The frequency at resonace in Hz is 56.2698
The current in A is 10.0
The power in W is 1000.0
The voltage across R in V is 100.0
The voltage across L in V is 707.107
The voltage across  C in V is 707.107
The quality factor is 7.071
The half power frequencies are :  52.2909  Hz and  60.2486  Hz
The bandwidth in Hz is :  7.9577

Example 14: pg 175

In [15]:
#pg 175
#calculate the bandwidth
from math import sqrt,pi
# Given data
R = 10.;# in ohm
L = 15.;# in muH
L = L * 10**-6;# in H
C = 100;# in pF
C = C * 10**-12;# in F
#calculations
f_r = 1/(2*pi*sqrt(L*C));# in Hz
X_L = 2*pi*f_r*L;# in ohm
Q = X_L/R;# in ohm
BW = f_r/Q;# in Hz
BW = BW * 10**-3;# in kHz
#results
print "The bandwidth in kHz is",round(BW,2)
The bandwidth in kHz is 106.1

Example 15: pg 175

In [16]:
#pg 175
#calculate the quality, frequencies
# Given data
from math import pi,sqrt
R = 1000.;# in ohm
L = 100.;# in mH
L = L * 10**-3;# in H
C = 10;# in muF
C = C * 10**-12;# in F
#calculations
f_r = 1/(2*pi*sqrt(L*C));# in Hz
print "The resonant frequency in kHz is",round(f_r*10**-3)
Q = (1/R)*(sqrt(L/C));
print "The quality factor is",Q
f1 = f_r - R/(4*pi*L);# in Hz
f1 = f1 * 10**-3;# in kHz
f2 = f_r + R/(4*pi*L);# in Hz
f2 = f2 * 10**-3;# in kHz
print "The half point frequencies are : ",round(f1,1)," Hz and ",round(f2,1)," Hz"
The resonant frequency in kHz is 159.0
The quality factor is 100.0
The half point frequencies are :  158.4  Hz and  160.0  Hz

Example 16: pg 176

In [17]:
#pg 176
#calculate the line current, power factor and power consumed
# Given data
from math import sqrt,cos,acos,pi
R = 20.;# in ohm
L = 31.8;# in mH
L = L * 10**-3;# in H
V = 230.;# in V
f = 50.;# in Hz
#calculations
I_R = V/R;# in A
X_L = 2*pi*f*L;# in ohm
I_L = V/X_L;# in A
I = sqrt( (I_R**2) + (I_L**2) );# in A
phi= acos( I_R/I);
P = V*I*cos(phi);# in W
#results
print "The line current in A is",round(I,2)
print "The power factor is : ",round(cos(phi),3)," lag"
print "The power consumed in W is",P
The line current in A is 25.73
The power factor is :  0.447  lag
The power consumed in W is 2645.0

Example 17: pg 177

In [18]:
#pg 177
#calculate the line current, power
# Given data
from math import pi,sqrt,atan,sin,cos
import math
C = 50.;# in muF
C = C * 10**-6;# in F
R = 20.;# in ohm
L = 0.05;# in H
V = 200.;# in V
f = 50.;# in Hz
#calculations
X_C = 1/(2*pi*f*C);# in ohm
Z1 = X_C;# in ohm
I1 = V/X_C;# in A
X_L = 2*pi*f*L;# in ohm
Z2 = sqrt( (R**2) + (X_L**2) );# in ohm
I2 = V/Z2;# in A
# tan(phi2) = X_L/R;
phi2 = atan(X_L/R);# in degree
phi1 = 90*math.pi/180.;# in degree
I_cos_phi = I1*cos(phi1) + I2*cos(phi2);# in A 
I_sin_phi = I1*sin(phi1) - I2*sin(phi2);# in A 
phi= atan(I_sin_phi/I_cos_phi);# in radians
I= sqrt(I_cos_phi**2+I_sin_phi**2);# in A
P= V*I*cos(phi);# in W
#results
print "The line current in A is",round(I,2)
print "The power factor is : ",round(cos(phi),3)," lag"
print "The power consumed in W is",round(P,2)
The line current in A is 6.42
The power factor is :  0.964  lag
The power consumed in W is 1236.97

Example 18: pg 178

In [19]:
#pg 178
#calculate the phase angle and power factor
# Given data
import cmath,math
V= 68+154*1j;# in V
I1= 10+14*1j;# in A
I2= 2+8*1j;# in A
#calculations
I= I1+I2;# in A
phi= cmath.phase(V) - cmath.phase(I);# in radians
#results
print "The phase angle in degrees is : ",round(phi*180./math.pi,3)
print "The power factor is : ",round(math.cos(phi),3)," lag"
The phase angle in degrees is :  4.786
The power factor is :  0.997  lag

Example 19: pg 178

In [20]:
#pg 178
#calculate the supply current, power factor
# Given data
from math import pi,cos
import cmath
R1 = 50.;# in ohm
L = 318.;# in mH
L = L * 10**-3;# in H
R2 = 75.;# in ohm
C = 159.;# in muF
C =C * 10**-6;# in F
V = 230.;# in V
f = 50.;# in Hz
#calculations
XL= 2*pi*f*L;# in ohm
Z1= R1+XL*1j;# in ohm
I1= V/Z1;# in A
XC= 1/(2*pi*f*C);# in ohm
Z2= R2-1j*XC;# in ohm
I2= V/Z2;# in A
I= I1+I2;# in A
phi= cmath.phase(I)# in radians
#results
print "Supply current : "
print "Magnitude is : ",round(abs(I),2)," A"
print "Angle : ",round(phi*180/pi,1)," degrees"
print "Power factor is : ",round(cos(phi),3)," lag"
Supply current : 
Magnitude is :  3.93  A
Angle :  -15.9  degrees
Power factor is :  0.962  lag

Example 20: pg 179

In [21]:
#pg 179
#calculate the admittance and supply current
# Given data
import cmath
from math import pi,cos
V=250;# in V
Z1= 70.7+70.7*1j;# in ohm
Z2= 120+160*1j;# in ohm
Z3= 120+90*1j;# in ohm
Y1= 1/Z1;# in S
Y2= 1/Z2;# in S
Y3= 1/Z3;# in S
Y_T= Y1+Y2+Y3;# in S
#calculations
phi= cmath.phase(Y_T)*180./pi;# in degrees
I= V*Y_T;# in A
#results
print "Total admittance of the circuit : "
print "Magnitude is : ",round(abs(Y_T),5)," mho"
print "Angle is : ",round(phi,1)," degrees"
print "The supply current : "
print "Magnitude is : ",round(abs(I),2)," A"
print "Angle is : ",round(phi,1)," degrees"
print "Power factor is : ",round(cos(phi*pi/180.),2)," degrees lag"
Total admittance of the circuit : 
Magnitude is :  0.02155  mho
Angle is :  -44.4  degrees
The supply current : 
Magnitude is :  5.39  A
Angle is :  -44.4  degrees
Power factor is :  0.71  degrees lag

Example 21: pg 180

In [22]:
#pg 180
#calculate the impedance, resistance, reactance, power and power factor
# Given data
from math import sqrt,atan,cos,pi
from cmath import exp
import cmath
Vm = 100.;# in V
phi1= 30.;# in degrees
Im = 15.;# in A
phi2= 60.;# in degrees
V= Vm/sqrt(2)*exp(phi1*1j*pi/180);# in V
I= Im/sqrt(2)*exp(phi2*1j*pi/180);# in A
Z= V/I;# in ohm
R= Z.real;# in ohm
XC= abs(Z.imag);# in ohm
phi= cmath.phase(Z)*180/pi;# in degrees
P= abs(V)*abs(I)*cos(phi*pi/180);# in W
#results
print "The impedance is : ",Z," ohm"
print "The resistance is : ",round(R,4)," ohm"
print "The reactance is : ",round(XC,4)," ohm"
print "The power is : ",round(P,2)," W"
print "The power factor is : ",round(cos(phi*pi/180),3)," leading"
The impedance is :  (5.7735026919-3.33333333333j)  ohm
The resistance is :  5.7735  ohm
The reactance is :  3.3333  ohm
The power is :  649.52  W
The power factor is :  0.866  leading

Example 22: pg 180

In [23]:
#pg 180
#calculate the pure inductance
# Given data
from math import sqrt,pi
P = 100.;# in W
V = 120.;# in V
f= 50.;# in Hz
V = 200;# in V
V_R = 120;# in V
#calculations
I = P/V;# in A
V_L = sqrt( (V**2) - (V_R**2) );# in V
# V_L = I*X_L;
X_L = V_L/I;# in ohm
# X_L = 2*%pi*f*L;
L = X_L/(2*pi*f);# in H
#results
print "The value of pure inductance in H is",round(L,4)

print 'Note: There is calculation error to find the value of V_L, So the answer in the book is wrong  and coding is correct.'
The value of pure inductance in H is 1.0186
Note: There is calculation error to find the value of V_L, So the answer in the book is wrong  and coding is correct.

Example 23: pg 181

In [24]:
#pg 181
#calculate the circuit admittance, impedance, power 
# Given data
import cmath,math
from cmath import exp,phase
from math import pi,cos
V=230.;# in V
f= 50.;# in Hz
Z1= 10.*exp(-30*1j*pi/180);# in ohm
Z2= 20.*exp(60*1j*pi/180);# in ohm
Z3= 40.*exp(0*1j*pi/180);# in ohm
#calculations
Y1= 1/Z1;# in S
Y2= 1/Z2;# in S
Y3= 1/Z3;# in S
Y= Y1+Y2+Y3;# in S
phi= phase(Y)*180./pi;# in degrees
Z=1/Y;# in ohm
P= V**2*abs(Y);# in W
#results
print "The circuit admittance is : ",round(abs(Y),3)," mho"
print "The circuit impedance is : ",round(abs(Z),1)," ohm"
print "The power consumed in W is : ",round(P)
print "The power factor is : ",round(cos(phi*pi/180.),3)," lead"
print 'The answer is a bit different due to rounding off error from textbook'
The circuit admittance is :  0.137  mho
The circuit impedance is :  7.3  ohm
The power consumed in W is :  7235.0
The power factor is :  0.999  lead
The answer is a bit different due to rounding off error from textbook

Example 24: pg 181

In [25]:
#pg 181
#calculate the value of P1,P2
import cmath
#  Given data
Z1= 10+15*1j;#  in ohm
Z2= 6-8*1j;#  in ohm
R1= 10.;#  in ohm
R2= 6.;#  in ohm
I_T= 15.;#  in A
#calculations
I1= I_T*Z2/(Z1+Z2);#  in A
I2= I_T*Z1/(Z1+Z2);#  in A
P1= (abs(I1))**2*R1;#  in W
P2= (abs(I2))**2*R2;#  in W
#results
print "The value of P1 in W is : ",round(P1,3)
print "The value of P2 in W is : ",round(P2,3)
The value of P1 in W is :  737.705
The value of P2 in W is :  1438.525

Example 25: pg 182

In [26]:
#pg 182
#calculate the impedance, current and voltage
#  Given data
from math import pi,cos
from cmath import phase
R = 8.;#  in ohm
L = 0.12;#  in H
C = 140.;#  in muF
C = C * 10**-6;#  in F
V = 230.;#  in V
f = 50.;#  in Hz
#calculations
XL = 2*pi*f*L;#  in ohm
XC= 1/(2*pi*f*C);#  in ohm
Z= R+1j*XL-1j*XC;#  in ohm
I= V/Z;#  in A
phi= phase(I)#  in radians
PowerFactor= cos(phi);
VC= abs(I)*XC;#  in V
#results
print "Impedence of the entire circuit : "
print "Magnitude is : ",round(abs(Z),4)," ohm"
print "Angle is : ",round(phase(Z)*180/pi,3)," degrees"
print "Current flowing through the condensor : "
print "Magnitude is : ",round(abs(I),3)," ohm"
print "Angle is : ",round(phase(I)*180/pi,3)," degree"
print "Power factor of the circuit is : ",round(cos(phi),4)," lag"
print "The voltage across the condensor in V is : ",round(VC,4)
Impedence of the entire circuit : 
Magnitude is :  16.9671  ohm
Angle is :  61.868  degrees
Current flowing through the condensor : 
Magnitude is :  13.556  ohm
Angle is :  -61.868  degree
Power factor of the circuit is :  0.4715  lag
The voltage across the condensor in V is :  308.2071

Example 26: pg 183

In [27]:
#pg 183
#calculate the half power frequencies
#  Given data
from math import sqrt,pi
R = 10;#  in ohm
L = 0.1;#  in H
C = 8;#  in muF
C = C * 10**-6;#  in F
#calculations
f_r = 1/(2*pi*sqrt(L*C));#  in Hz
Q = (1/R) * (sqrt(L/C));
del_F = R/(4*pi*L);
#  The half power frequencies 
f1 = f_r - del_F;#  in Hz
f2 = f_r+del_F;#  in Hz
#results
print "The half power frequencies are : ",round(f1,4)," Hz and ",round(f2,4)," Hz"
The half power frequencies are :  169.9829  Hz and  185.8984  Hz

Example 27: pg 183

In [28]:
#pg 183
#calculate the capacitance
#  Given data
from math import pi
R = 15.;#  in ohm
X_L = 10.;#  in ohm
f_r = 50.;#  in Hz
#calculations
#  X_L = 2*%pi*f_r*L;
L = X_L/(2*pi*f_r);#  in H
#  value of capacitance 
C = 1/( L*( ((f_r*2*pi)**2)+((R**2)/(L**2)) ));#  in F
C = C*10**6;#  in muF
#results
print "The value of capacitance in muF is",round(C,2)
The value of capacitance in muF is 97.94

Example 28: pg 183

In [29]:
#pg 183
#calculate the current, phase angle and power
#  Given data
import cmath,math
Z1= 3+4*1j;#  in ohm
Z2= 6+8*1j;#  in ohm
V= 230.;#  in V
#calculations
I1= V/Z1;#  in A
I2= V/Z2;#  in A
I_T= I1+I2;#  in A
phi= cmath.phase(I_T);#  in degrees
P= V*abs(I_T)*math.cos(phi);# in V
#results
print "The value of current : "
print "The magnitude in A is : ",abs(I_T)
print "The phase angle in degree is : ",round(phi*180/math.pi,2)
print "The power drawn from the source in W is : ",P
The value of current : 
The magnitude in A is :  69.0
The phase angle in degree is :  -53.13
The power drawn from the source in W is :  9522.0

Example 29: pg 184

In [30]:
#pg 184
#calculate the admittance and impedance
#  Given data
import cmath
from math import cos,pi
Z1= 1.6+1j*7.2;#  in ohm
Z2= 4+1j*3;#  in ohm
Z3= 6-1j*8;#  in ohm
V= 100.;#  in V
Y2= 1/Z2;#  in mho
#calculations
Y3= 1/Z3;#  in mho
print "The admittance in mho is : ",Y2
print "The admittance in mho is : ",Y3
ZT= Z1+1/(Y2+Y3);
phi = cmath.phase(ZT)
print "Total circuit impedance : "
print "Magnitude : ",abs(ZT)," ohm"
print "Angle : ",round(phi*180/pi,2)," degrees"
IT= V/ZT;#  in A
PT= V*abs(IT)*cos(phi);#  in W
print "The total power supplied in W is : ",PT
The admittance in mho is :  (0.16-0.12j)
The admittance in mho is :  (0.06+0.08j)
Total circuit impedance : 
Magnitude :  10.0  ohm
Angle :  53.13  degrees
The total power supplied in W is :  600.0

Example 30: pg 185

In [31]:
#pg 185
#calculate the capacitance, voltage and Q factor
#  Given data
from math import pi
R = 4;#  in ohm
L = 0.5;#  in H
V = 100.;#  in V
f = 50.;#  in Hz
#calculations
X_L = 2*pi*f*L;#  in ohm
X_C = X_L;#  in ohm
#  X_C = 1/(2*%pi*f*C);
C = 1/(X_C*2*pi*f);#  in F
C = C * 10**6;#  in F
I = V/R;#  in A]
V_C = I*X_C;#  in V
omega = 2*pi*f;#  in rad/sec
Q = (omega*L)/R;
#results
print "The value of capacitance in muF is",round(C,4)
print "The voltage across the capacitance in V",round(V_C)
print "The Q factor of the circuit is",round(Q,2)
The value of capacitance in muF is 20.2642
The voltage across the capacitance in V 3927.0
The Q factor of the circuit is 39.27