Chapter 11 : AC Power

Example 11.1 Page No : 199

In [10]:
%matplotlib inline

import math 
from numpy import arange,ones
from matplotlib.pyplot import plot,xlabel,ylabel,suptitle, subplot

#Problem 11.1")

# Given
#resistance  = 1000ohm")
t = arange(0,1+0.5,0.5)
i = ones(len(t))
i1 = -i;

subplot(2,1,1)
plot(t,i)
plot(t+1,i1)
plot(t+2,i)
plot(t+3,i1)
suptitle("i vs t")
xlabel('t in ms')
ylabel('i in mA')

i = 1.*10**-3*i
R = 1000;
#p = i**2*R
p = i**2*R;
subplot(2,1,2)
plot(t,p)
suptitle("p vs t")
xlabel('t in ms')
ylabel('p in mW')
[ 0.   0.5  1. ]
Out[10]:
<matplotlib.text.Text at 0x10f37cf50>

Example 11.2 Page No : 204

In [12]:
%matplotlib inline

import math 
from numpy import arange,ones
from matplotlib.pyplot import plot,xlabel,ylabel,suptitle, subplot#Problem 11.2")

t = arange(0,1.5,0.5)
i = ones(len(t))
i1 = -i;

subplot(2,2,1)
plot(t,i)
plot(t+1,i1)
suptitle("i vs t")
xlabel('t in ms')
ylabel('i in mA')
#Voltage across capacitor vC = (1/C)*integrate(i*dt)
#On integration
t = arange(0,0.001+0.0005,0.0005)
v = 2000*t
v1 = 2-v;
subplot(2,2,2)
plot(t,v)
plot(t+0.001,v1)
plot(t+0.002,v)
plot(t+0.003,v1)
suptitle("v vs t")
xlabel('t in ms')
ylabel('v in V')

#Power is p = v*i
t = arange(0,.001+.0005,.0005)
p = 2000*t
p1 = p-2;
subplot(2,2,3)
plot(t,p)
plot(t+0.001,p1)
plot(t+0.002,p)
plot(t+0.003,p1)
suptitle("p vs t")
xlabel('t in ms')
ylabel('p in W')

#Work is (C*v**2)/2
t = arange(0,.001+.0005,.0005)
w = t**2
w1 = t**2+1*10**-6-(2*10**-3*t);
subplot(2,2,4)
plot(t,w)
plot(t+0.001,w1)
plot(t+0.002,w)
plot(t+0.003,w1)
suptitle("w vs t")
xlabel('t in ms')
ylabel('w in J')
Out[12]:
<matplotlib.text.Text at 0x10f7ca150>

Example 11.4 Page No : 206

In [16]:
import math 
#Problem 11.4")

# Given
#Veff = 110V Z = 10+i8 ohm")
Veff = 110;
Z = 10+1j*8
Zmag = math.sqrt(10**2+8**2)
Zph = (math.tan(8./10)*180)/math.pi
P = (Veff**2*R)/(Zmag**2)
pf = math.cos((Zph*math.pi)/180)

print "Power factor is : %.4f"%pf
Power factor is : 0.5151

Example 11.5 Page No : 211

In [17]:
import math 
#Problem 11.5")

# Given
#Veff = 110V Ieff = 20(-50 deg)")
Imagn = 20;Iph  = -50;
Veff = 110;

P = Veff*Imagn*math.cos((abs(Iph)*math.pi)/180)
Q = Veff*Imagn*math.sin((abs(Iph)*math.pi)/180)
print "Average power is %3.1fW"%(P)
print "Reactive power is %3.1fvar"%(Q)
Average power is 1414.1W
Reactive power is 1685.3var

Example 11.10 Page No : 213

In [27]:
import math 
from scipy.linalg import polar
#Problem 11.10")

# Given
#Veff = 10V v = 10*math.sqrt(2)*math.cos(w*t)");
Veff = 10;vmag = 10*1.414

#a)")
Z1 = 1+1j
R,Theta = polar([[Z1]])
R = R[0][0].real
Theta = Theta[0][0].real
print "i1 = %d*math.cosw*t-%d)"%(vmag/R,Theta)
I1eff = (vmag/R)/1.414
#p1(t) = 100*math.sqrt(2)*math.cos(wt)*math.cos(wt-45)
#On solving
#p1(t) = 50+50*math.sqrt(2)*math.cos(2*w*t-45) W")
P1 = Veff*I1eff*math.cos(Theta)
Q1 = Veff*I1eff*math.sin(Theta)
S1 = P1+1j*Q1
S1mag = math.sqrt(P1**2+Q1**2)
pf1 = P1/S1mag
print "P1 = %dWQ1 = %dvarpf1 = %0.4flag)"%(P1,Q1,pf1)


#b)")
Z2 = 1-1j
R,Theta = polar([[Z2]])
R = R[0][0].real
Theta = Theta[0][0].real

print "i2 = %d*math.cosw*t%d)"%((vmag/R),Theta)
I2eff = (vmag/R)/1.414
#p2(t) = 100*math.sqrt(2)*math.cos(wt)*math.cos(wt+45)
#On solving
#p2(t) = 50+50*math.sqrt(2)*math.cos(2*w*t+45) W")
P2 = Veff*I2eff*math.cos(Theta)
Q2 = Veff*I2eff*math.sin(Theta)
S2 = P2+1j*Q2
S2mag = math.sqrt(P2**2+Q2**2)
pf2 = P2/S2mag
print "P2 = %dWQ2 = %dvarpf2 = %0.4flag)"%(P2,Q2,pf2)

#c)")
Zmag = (Z1*Z2)/(Z1+Z2)
print "i = %d*math.cosw*t)"%(vmag/Zmag).real
Ieff = (vmag/Zmag)/1.414
#p(t) = 100*math.sqrt(2)*math.sqrt(2)*math.cos(wt)*math.cos(wt)
#On solving
#p2(t) = 200*math.cos(w*t)**2 W")
P = (Veff*Ieff).real
Q = 0
S = P*Q
Smag = math.sqrt(P**2+Q**2)
pf = P/Smag
print "P = %dWQ = %dvarpf = %0.4f"%(P,Q,pf)
i1 = 19*math.cosw*t-1)
P1 = 22WQ1 = 139varpf1 = 0.1559lag)
i2 = 19*math.cosw*t1)
P2 = 22WQ2 = 139varpf2 = 0.1559lag)
i = 14*math.cosw*t)
P = 100WQ = 0varpf = 1.0000

Example 11.11 Page No : 218

In [29]:
import math 
#Problem 11.11")

# Given
#v = 42.5*math.cos(1000*t+30 deg)V Z = 3+i4 ohm")
Vmag = 42.5;
Z = 3+1j*4;
R = math.sqrt(3**2+4**2)
Theta = math.tan(4./3)*(180/math.pi)
Veffm = Vmag/math.sqrt(2)
Veffph = 30
Ieffm = Veffm/R
Ieffph = 30-Theta

Smag = Veffm*Ieffm
Sph = Veffph-Ieffph
x = Smag*math.cos((Sph*math.pi)/180)
y = Smag*math.sin((Sph*math.pi)/180)
z = complex(x,y)
pf = math.cos((Theta*math.pi)/180);

print "Real Power is %fW"%(x)
print "Reactive Power is %fvarinductive)"%(y)
print "Complex Power is %fVA"%(Smag)
print "Power factor is %3.1flag)"%(pf)
Real Power is -99.086517W
Reactive Power is -151.020703varinductive)
Complex Power is 180.625000VA
Power factor is -0.5lag)

Example 11.12 Page No : 220

In [30]:
import math 
#Problem 11.12")

# Given
#pf1 = 1 ; pf2 = 0.5 ; pf3 = 0.5")
#P1 = 10kW;P2 = 20kW;P3 = 15kW")
#Power supply is 6kV")
P1 = 10000;
P2 = 20000;
P3 = 15000;
Veff = 6000;
pf1 = 1   #implifies that theta1 = 0
t1 = 0
Q1 = P1*t1

pf2 = 0.5   #implifies that theta1 = 60
t2 = 1.73;
Q2 = P2*t2

pf3 = 1   #implifies that theta1 = 53.13
t3 = 1.33;
Q3 = P3*t3

PT = P1+P2+P3
QT = Q1+Q2+Q3
ST = math.sqrt(PT**2+QT**2)
pfT = PT/ST
Ieff = ST/Veff
Ieffph = math.cos(pfT)*(180/math.pi)
print "PT = %dWQT = %dvarST = %dVApf = %0.2flag)Ieff = %3.1f%3.2f deg)"%(PT,QT,ST,pfT,Ieff,Ieffph)
PT = 45000WQT = 54550varST = 70715VApf = 0.64lag)Ieff = 11.846.08 deg)

Example 11.13 Page No : 221

In [32]:
import math 
#Problem 11.13")

# Given
#Power factor is 0.95(lag)")
vmag = 240;Zmag = 3.5;Zph = 25;
I1mag = vmag/Zmag;iph = 0-Zph;
#Smag = Veff*Ieff
Smag = (vmag/math.sqrt(2))*(I1mag/math.sqrt(2))
Sph = 0+abs(iph)
x = Smag*math.cos((Sph*math.pi)/180)
y = Smag*math.sin((Sph*math.pi)/180)
z = complex(x,y)
pf = 0.95
theta = math.cos(0.95)*(180/math.pi)
#From fig 11.11
#Solving for Qc
Qc = y-(math.tan((theta*math.pi)/180)*x)
print " Qc = %dvarCapacitive )"%(Qc)
 Qc = -1426varCapacitive )

Example 11.14 Page No : 223

In [33]:
import math 
#Problem 11.14")

# Given
#Power  = 1000kW ; pf = 0.5(lag)")
#Voltage source is 5kV")
#Improved power factor is 0.8")

#Before improvement
P = 1000*10**3;
pf = 0.5;V = 5*10**3;
S = (P/pf)*10**-3
I = S/V

#After improvement
P = 1000*10**3;
pf = 0.8;V = 5*10**3;
S = (P/pf)*10**-3
I1 = S/V

#Current is reduced by ")
red = ((I-I1)/I)*100
print "Percentage reduction in current is %3.1fpercent"%(red)
Percentage reduction in current is 37.5percent

Example 11.16 Page No : 228

In [37]:
import math 
from numpy import real,imag
#Problem 11.16")

# Given
#Vg = 100V(rms)")
#Zg = 1+i Z1 = 2")
Vg = 100;

#a)")
Zg = 1+1j;
Z1 = 2
Z = Z1+Zg
Zmag = math.sqrt(Z.real**2+Z.imag**2)
I = Vg/Zmag
PZ1 = real(Z1)*(I**2)
Pg = real(Zg)*(I**2)
PT = PZ1+Pg
print "PZ = %dW Pg = %dW PT = %dW"%(PZ1,Pg,PT);

#b)")
#If Z2 = a+i*b
#Zg* = 1-i
#Given that
#(Z1*Z2)/(Z1+Z2) = 1-i
#As Z1 = 2 and solving for Z2
print (-1j,"Z2 = ") 
  
#c)")
#If Z2 is taken the value as calculated in b) then Z = 1-i
Zg = 1+1j;
Z1 = 2;
Z = 1-1j;
Zt = Z+Zg
Zmag = math.sqrt(real(Zt)**2+imag(Zt)**2)
I = Vg/Zmag
PZ = real(Z)*(I**2)
Pg = real(Zg)*(I**2)
#To calculate PZ1 and PZ2 we need to first calculate IZ1 nad IZ2
VZ = I*(1-1j)
IZ1 = VZ/Z1
IZ1mag = math.sqrt(real(IZ1)**2+imag(IZ1)**2)
PZ1 = real(Z1)*(IZ1mag**2)
PZ2 = PZ-PZ1
PT = PZ1+PZ2+Pg
print "PZ = %dW Pg = %dW PT = %dW"%(PZ,Pg,PT);
PZ = 2000W Pg = 1000W PT = 3000W
(-1j, 'Z2 = ')
PZ = 2500W Pg = 2500W PT = 5000W

Example 11.17 Page No : 233

In [39]:
import math 
#Problem 11.17")

# Given
#v1 = 5*math.cos(w1*t)  v2 = 10*math.cos(w2*t+60)")
#The circuit is modeled as
#resistance is 10ohm and inducmath.tance is 5mH")
R = 10;L = 5*10**-3;
#Let V be phasor voltage between the terminals
Vmag = 10;
Vph = 60; 
x = Vmag*math.cos((Vph*math.pi)/180);
y = Vmag*math.sin((Vph*math.pi)/180);
z = complex(x,y)

#a)")
w1 = 2000;w2 = 4000;
#Let Z be the impedance of the coil
Z1 = R+1j*L*w1
Z2 = R+1j*L*w2
V1 = 5;
#By applying superposition i = i1-i2
I1 = V1/Z1
R1,Theta = polar([[I1]])
R1 = R1[0][0].real
Theta = Theta[0][0].real

print "i1 = %0.2f*math.cos%dt%d deg)"%(R1,w1,Theta*180/math.pi);
i1 = 0.71*math.cos2000t20 deg)