Chapter 2 - Analog measurement of electrical quantities

Example 1 - pg 130

In [1]:
#pg 130
#Example 2.1:#wattmeter reading and error
#calculate the wattmeter reading
import math,cmath
#given
print "for Ist method"
v=50;#volts
i=20;#amperes
pf=0.8;#power factor
pl=v*i*pf;#true power
vc=(50*pf)+1j*v*math.sqrt(1-pf**2);#complex form 
ic=i+1j*0;#
r1=0.01;#ohms
#calculations and results
vpl=vc+(i*r1);#voltage across pressure coil
wrlc1=(vpl.real)*(ic.real);#
er=(wrlc1-pl)/(pl);#
print "wattmeter reading is (W)=",wrlc1
print "percentage error is high (%) = ",er*100
print "for 2nd method"
r2=1000;#ohms
ic1=ic+(vc/r2);#
wrlc2=(vc.real)*(ic1.real)+(vc.imag)*(ic1.imag);#
er1=(wrlc2-pl)/(pl);#
print "wattmeter reading (W)=",wrlc2
print "percentage error is high (%) = ",er1*100
for Ist method
wattmeter reading is (W)= 804.0
percentage error is high (%) =  0.5
for 2nd method
wattmeter reading (W)= 802.5
percentage error is high (%) =  0.3125

Example 2 - pg 131

In [2]:
#pg 131
#Example 2.2:#self inductance
#calculate the self inductance
#given
c=20.;#pF
rs=10000.;#ohms
#calculations
l=(c*10**-12)*rs**2;#henry
#results
print "self inductance (mH) = ",l*10**3
self inductance (mH) =  2.0

Example 3 - pg 131

In [3]:
#pg 131
#Example 2.3:#percentage error
#calculate the percentage error
#given
import math
v=100;#volts
i=10;#amperes
pf=0.45;#power factor
f=50;#Hz
l=25;#mH
r=4000;#ohms
#calculations
tp=v*i*pf;#true power in watts
b=math.atan((2*math.pi*f*l*10**-3)/r);#phase angle in radians
e=v*i*math.tan(b)*math.sqrt(1-pf**2);#
per=(e*100)/(tp);#
#results
print "percentage error is (%) = ",round(per,3)
percentage error is (%) =  0.39

Example 4 - pg 131

In [4]:
#pg 131
#Example 2.4:#true power
#calculate the true power
#given
import math
from math import cos
ph=45.;#degree
th=90.;#radians
dela=-45.;#radians
f=50.;#Hz
l=15.;#mH
r=300.;#ohms
#calculations
b=math.atan((2*math.pi*f*l*10**-3)/r);#in radians
k=((cos(ph/57.3))/(cos(b)*cos(42/57.3)));#
nr=20;#nomianl ratio
e=-0.3;#
er=(e*nr)/100;#
ar1=nr-er;#actual ratio
nr1=100;#nomianl ratio
e1=0.9;#
er1=(e1*nr1)/100;#
ar2=nr1-er1;#actual ratio
p=450;#watts
tp=ar1*ar2*k*p;#
#results
print "true power in (kW) = ",round(tp*10**-3,1)
print 'answer is wrong in the textbook'
true power in (kW) =  851.3
answer is wrong in the textbook

Example 5 - pg 132

In [5]:
#pg 132
#Example 2.5:#torque
#calculate the torque required
#given
import math
from math import sin
d=2.5;#diameter in cm
n=500;#turns
b=1.1;#mWb/m**2
v=100;#volts
pf=0.7;#power factor
rp=2000;#ohms
#calculations
x=((math.pi*(d*10**-2)**2*n*b*10**-3*v*pf)/(4*rp));#
ang1=45;#degree
ang2=90;#degree
td1=x*sin(ang1/57.3);#
td2=x*sin(ang2/57.3);#
#results
print "torque in Nm when angle is 45 degree (Nm) = ",round(td1,8)
print "torque in Nm when angle is 90 degree (Nm) = ",round(td2,8)
torque in Nm when angle is 45 degree (Nm) =  6.68e-06
torque in Nm when angle is 90 degree (Nm) =  9.45e-06

Example 6 - pg 133

In [6]:
#pg 133
#Example 2.6:#resistance
#calculate the resistance
#given
import math
la=4.78;#henry
ra=298.;#ohms
lb=3.;#henry
rb=190.;#ohms
v=200.;#volts
#calculations
r=((la*100*lb*100*math.pi**2)-(ra*rb))/(rb+ra);#ohm
#results
print "unknown resistance is (ohm)=",round(r,0)
print 'answer is wrong in the textbook'
unknown resistance is (ohm)= 2784.0
answer is wrong in the textbook

Example 7 - pg 133

In [7]:
#pg 133
#Example 2.7:#resistance
#calculate the addition in resistance
#given
i=20.;#amperes
v=100.;#volts
pf=1;#power factor
rp=5500.;#ohms
th=150.;#angle
wd=20;#watts per degree
#calculations
p=v*i*pf;#watts
kd=((rp*th)/p);#constant
rp1=wd*kd;#in ohms
adr=rp1-rp;#
#results
print "addition resistance (ohm) = ",adr
addition resistance (ohm) =  2750.0

Example 8 - pg 134

In [9]:
#pg 134
#Example 2.8:#resistance,impedance,power,power factor ,voltage and power factor
#calculate the total power factor,supply, impedance and resistance
#given
v=300.;#volts
i2=2.5;#amperes
#calculations and results
r=v/i2;#ohms
print "resistance in (ohm) =",r
i3=4;#amperes
zl=v/i3;#ohms
print "load impedance in (ohm) = ",zl
v=300;#volts
i2=2.5;#amperes
r=v/i2;#ohms
i1=5.6;#amperes
z=v/i1;#ohms
print "impedance of combination in (ohm) = ",round(z,2)
i3=4;#amperes
pl=((i1**2-i2**2-i3**2)*r)/2;#in watts
print "power absorbed by the load in (W) = ",pl
pl=((i1**2-i2**2-i3**2)*r)/2;#in watts
pfl=((i1**2-i2**2-i3**2)/(2*i2*i3));#power factor
print "power factor of the load = ",pfl
pr=i2**2*r;#in watts
tps=pl+pr;#in watts
print "total power supply  is (W) = ",tps
tps=pl+pr;#in watts
tpf=tps/(v*i1);#power factor
print "total power factor = ",round(tpf,3)
resistance in (ohm) = 120.0
load impedance in (ohm) =  75.0
impedance of combination in (ohm) =  53.57
power absorbed by the load in (W) =  546.6
power factor of the load =  0.4555
total power supply  is (W) =  1296.6
total power factor =  0.772

Example 9 - pg 135

In [10]:
#pg 135
#Example 2.9:#wattmeter reading
#calculate the average power
import math,scipy
from scipy import integrate
v=24.;#volts
r1=6.;#ohms
vm=100;#volts
t0=0.;#
t1=(1./100);#
f=50.;#Hz
#calculations
i=v/r1;#in amperes
z=2*math.pi*f;#
def fun(t):
	y=math.sin(z*t)
	return y
x=scipy.integrate.quad(fun,t0,(t1/2.));#
p=vm*(1/t1)*i*x[0];#
#results
print "average power to be read by wattmeter is (W) = ",round(p,2)
average power to be read by wattmeter is (W) =  127.32

Example 10 - pg 136

In [11]:
#pg 136
#Example 2.10:#load impedance and combination impedance
#calculate the power factor and power, load
#given
v3=80.;#volts
i=4.;#amperes
v1=140;#volts
#calculations and results
zl=v3/i;#ohms
z=v1/i;#ohms
print "load impedance in (ohm) = ",zl
print "impedance of combination in (ohm) = ",z
v2=75.;#volts (it is given 72 in the textbook)
r=v2/i;#
pl=((v1**2-v2**2-v3**2)/(2*r));#watts
pr=i**2*r;#watts
print "power absorbed by the load is,(W) = ",pl
print "power absorbed by the non inductive resistor is,(W) = ",pr
pfl=((v1**2-v2**2-v3**2)/(2*v2*v3));#power factor of the load
tp=pr+pl;#total power in watts
pfc=tp/(v1*i);#power factor
print "power factor of load is",round(pfl,2)
print "power factor of the whole circuit is",round(pfc,1)
load impedance in (ohm) =  20.0
impedance of combination in (ohm) =  35.0
power absorbed by the load is,(W) =  202.0
power absorbed by the non inductive resistor is,(W) =  300.0
power factor of load is 0.63
power factor of the whole circuit is 0.9

Example 11 - pg 136

In [12]:
#pg 136
#Example 2.11:#wattmeters readings
#calculate the wattmeters readings
import math
from math import sqrt
#given
pf=0.8;#
#calculations
td=(sqrt(1-pf**2))/pf;#
sr=300;#kW
df=(sr/sqrt(3))*td;#
w2=(sr+df)/2;#
w1=sr-w2;#
#results
print "wattmeter (W1) reading in (kW) = ",round(w1)
print "wattmeter (W2) reading in (kW) = ",round(w2)
wattmeter (W1) reading in (kW) =  85.0
wattmeter (W2) reading in (kW) =  215.0

Example 12 - pg 137

In [14]:
#pg 137
#Example 2.12:#power factor and capacitance
#calculate the capacitance and power factor
import math
from math import atan,sqrt,cos
#given
w1=-2000.;#watts
w2=4000.;#watts
v=400.;#volts
pfn=0.5;#power factor
f=50.;#Hz
#calculations
ph=math.atan((sqrt(3.)*(w2-w1))/(w2+w1)) *57.3;#in degree
pf=cos(ph/57.3);#
w=w1+w2;#total power
vp=(v/sqrt(3));#phase voltage
pp=w/3.;#power per phase
pi=(pp)/(vp*pf);#phase current
pim=vp/pi;#phase impedance
rip=pim*pf;#resistance each phase
rep=(sqrt(pim**2-rip**2));#reactance of each phase
pimb=rip/pfn;#impedance per phase
repn=(sqrt(pimb**2-rip**2));#reactance per phase
cp=rep-repn;#capacitive reactance
c=((1/(2*math.pi*f*cp)));#
#results
print "power factor of the system = ",round(pf,3)
print "capacitance (micro-F) = ",round(c*10**6)
power factor of the system =  0.189
capacitance (micro-F) =  322.0

Example 13 - pg 138

In [15]:
#pg 138
#Example 2.13:#power factor and line current
#calculate the line current and power factor
#given
import math
x=1;#
w=50;#kW
v=400.;#volts
#calculations
w2=2*x;#
w1=x;#
ph=math.atan((math.sqrt(3)*(w2-w1))/(w2+w1))*57.3;#in degree
pf=math.cos(ph/57.3);#power factor
il=((w/(math.sqrt(3)*v*pf)))*10**3;#in amperes
#results
print "power factor = ",round(pf,3)
print "line current is (A)=",round(il,1)
power factor =  0.866
line current is (A)= 83.3

Example 14 - pg 138

In [16]:
#pg 138
#Example 2.14:#total power and power factor
#calculate the total power and power factor
#given
import math
print "when both readings are positive"
w2=2300.;#watts
w1=4600.;#watts
#calculations and results
p1=w2+w1;#
ph=57.3*math.atan((math.sqrt(3)*(w2-w1))/(w2+w1));#in degree
pf=math.cos(ph/57.3);#power factor
print "power is (W) = ",p1
print "power factor (leading) = ",round(pf,3)
print "when second readig is negative"
w21=-2300.;#watts
w1=4600.;#watts
p2=w21+w1;#
ph2=57.3*math.atan((math.sqrt(3)*(w21-w1))/(w21+w1));#in degree
pf1=math.cos(ph2/57.3);#power factor
print "power is (W) = ",p2
print "power factor (leading) = ",round(pf1,3)
when both readings are positive
power is (W) =  6900.0
power factor (leading) =  0.866
when second readig is negative
power is (W) =  2300.0
power factor (leading) =  0.189

Example 15 - pg 139

In [17]:
#pg 139
#Example 2.15:#load current
#calculate the load current
#given
import math
from math import atan,cos,sqrt
rw=3550.;#reading of wattmeter
rp=806.;#watts
#calculations
ph=atan((sqrt(3)*rp)/rw);#in degree
pf=cos(ph/57.3);#power factor
v=440;#volts
i=((rw)/(sqrt(3)*v*pf));#amperes
#results
print "load current in amperes = ",round(i)
load current in amperes =  5.0

Example 16 - pg 139

In [18]:
#pg 139
#Example 2.16:#error
#calculate the error percentage
#given
import math
from math import sin
d=87./57.3;#radians
pf=0.5;#
#calculations
n=(1./4)*sin(d-60/57.3);#
nc=(1./4)*pf*sin(d);#
e=((n-nc)/nc)*100;#error
#results
print "error (slow) in percentage = ",round(-e,1)
error (slow) in percentage =  9.1

Example 17 - pg 140

In [19]:
#pg 140
#Example 2.17:#error
#calculate the error
#given
import math,scipy
from scipy import integrate 
i=5;#amperes
t0=0;#
t1=30./60;#
e=0.56;#kWh
v1=220;#volts
#calculations
def function(t):
	y=5
	return y
x=scipy.integrate.quad(function,t0,t1);#
v=(e*10**3)/x[0];#volts
ae=v1*i*t1*10**-3;#actual energy
e=((e-ae)/ae)*100;#error
#results
print "error (%)  = ",round(e,2)
error (%)  =  1.82

Example 18 - pg 140

In [20]:
#pg 140
#Example 2.18:#time and error
#calculate the time duration and limits of accuracy
#given
nd=500.;#dvisions
cr=0.1;#dvisions can read
ie=0.05;#inherent error
tea=0.1;#total error allowable
cr1=0.01;#seconds
cr2=0.1;#seconds
nd1=500/10.;#
#calculations
re=(cr/nd)*100;#reading error
te=re+ie;#total error
per=tea-te;#permissible error
ersw=cr1*100;#error in reading stop watch
erss=cr2*100;#error in stopping and starting
ter=ersw+erss;#total error
t=per/ter;#seconds
er1=(cr/nd1)*100;#new reading error
ie1=((ie*nd)/nd1);#new inherent error
ter1=er1+ie1;#
la=ter1+per;#
#results
print "time duration (seconds) = ",round(1./t)
print "limits of accuracy (%) = ",la
time duration (seconds) =  367.0
limits of accuracy (%) =  0.73

Example 19 - pg 141

In [21]:
#pg 141
#Example 2.19:#error
#calculate the error
#given
import math
n=40.;#revolutions
rc=0.12;#registration constant
e2=22000;#volts
e1=110;#volts
i2=500;#amperes
i1=5;#amperes
i=5.25;#amperes
lv=110;#volts
pf=1;#
t=61;#seconds
#calculations
err=n/rc;#energy recorded in kWh is
ae=((math.sqrt(3)*e2*lv*i*i2*pf*t)/(e1*i1*3600))*10**-3;#kWh
e=((err-ae)/ae)*100;#
#results
print "error (slow) is (%)",round(-e,2)
error (slow) is (%) 1.66

Example 20 - pg 142

In [24]:
#pg 142
#Example 2.20:#error and limit of error
#calculate the error and limit of error
#given
mc=1200.;#meter constant in rev/kWh
n=40.;#revolutions
tp=99.8;#seconds
v=240;#volts
i=5;#amperes
#calculations
err=n/mc;#energy recorded in kWh
ae=((v*i*tp*10**-3)/3600);#actual energy in kWh
e=((err-ae)/ae)*100;#error
n=500;#divisions
rn=0.1;#dvision reading accuracy
per=((rn/n)*100);#possible error
ie=0.05;#inherent error
per1=(((rn/10)/tp)*100);#possible error
her=((ie/tp)*100);#human error
tpr=per+per1+her+ie;#total possible error
li1=e-tpr;#
li2=e+tpr;#
#results
print "error (fast) in recording (%) = ",round(e,2)
print "limit of error in the meter is ",round(li1,2),"% or ",round(li2,2),"% "
error (fast) in recording (%) =  0.2
limit of error in the meter is  0.07 % or  0.33 % 

Example 21 - pg 143

In [23]:
#pg 143
#Example 2.21:#consumer monthly bill ,power factor and average cost per unit
#calculate the consumer monthly bill ,power factor and average cost per unit
#given
import math
from math import sqrt
kwh=125000.;#
kvarh=100000.;#
kw=180;#
kvar=125;#
d=30.;#days
t=24.;#hours a day
#calculations
kvah=sqrt(kwh**2+kvarh**2);#kVAh
mkva=sqrt(kw**2+kvar**2);#kVA
pkva=15;#rupees
pkvah=0.1;#reupees
tmb=pkva*mkva+pkvah*kvah;#in Rs
pf=kwh/kvah;#power factor
lf=((kwh/(d*t))/kw);#load factor
avcp=tmb/kwh;#in paisa
#results
print "total monthly bill in Rs",round(tmb)
print "power factor is",round(pf,2)
print "load factor is",round(lf,2)
print "average cost per unit (kWh) in paisa is",round(avcp*100,1)
print 'total monthly bill and load factor is calculated wrong in the book due to rounding off error'
total monthly bill in Rs 19295.0
power factor is 0.78
load factor is 0.96
average cost per unit (kWh) in paisa is 15.4
total monthly bill and load factor is calculated wrong in the book due to rounding off error

Example 22 - pg 143

In [25]:
#pg 143
#Example 2.22:#full load speed and error
#calculate the full load speed and error
#given
v=220.;#volts
n=30.;#revolutions
i=5.;#in amperes
t=59.5;#seconds
#calculations
wrv=((v*i*10**-3)/(3600.));#kWh
mc=((3600.*10**3)/(v*i));#rev/kWh
ec=((v*i*10**-3)/(3600.));#kWh
sfl=mc*ec;#rps
hler=n*ec;#kWh
hlf=(((i/2.)*v*10**-3*t)/(3600.));#kWh
e=(hler-hlf)/hlf;#
#results
print "number of revolution per kWh is,(revolutions/kWh)=",round(mc)
print "full load speed r.p.s = ",sfl
print "error (fast) in percentage  = ",round(e*100,2)
print 'numberof revolutions is calcultaed wrong in the textbook due to rounding off error'
number of revolution per kWh is,(revolutions/kWh)= 3273.0
full load speed r.p.s =  1.0
error (fast) in percentage  =  0.84
numberof revolutions is calcultaed wrong in the textbook due to rounding off error

Example 23 - pg 144

In [26]:
#pg 144
#Example 2.23:#shunt resistance 
#calculate the shunt resistance 
#given
ra=1000.;#armature resistance in ohms
i=10.;#mA
ia=500.;#micro amperes
i1=75;#mA
i3=100;#mA
#calculations
rsh1=((ra)/((i/(ia*10**-3))-1));#in ohms
rsh2=((ra)/((i1/(ia*10**-3))-1));#in ohms
ia3=0.4*ia;#micro amperes
rsh3=((ra)/((i3/(ia3*10**-3))-1));#in ohms
#results
print "shunt resistance when current is 10mA (ohm) = ",round(rsh1,2)
print "shunt resistance when current is 75mA (ohm) = ",round(rsh2,2)
print "shunt resistance when current is 100mA (ohm) = ",round(rsh3,3)
shunt resistance when current is 10mA (ohm) =  52.63
shunt resistance when current is 75mA (ohm) =  6.71
shunt resistance when current is 100mA (ohm) =  2.004

Example 24 - pg 144

In [28]:
#pg 144
#Example 2.24:#shunt resistance and series resistance
#calculate the shunt resistance and series resistance
#given
i=125.;#amperes
ia=25.;#armature current in mA
ra=3;#ohms
#calculations
ish=i-(ia*10**-3);#amperes
rsh=((ia*ra)/ish);#milli ohms
pcs=ish**2*rsh*10**-3;#watts
rv=625;#volts
rs=((rv-(ra*ia*10**-3))/(ia*10**-3))*10**-3;#killo ohms
pc=(ia*10**-3)**2*rs*10**3;#watts
#results
print "shunt resistance in milli ohm is",round(rsh,5)
print "power consumption in shunt is,(W)=",round(pcs,2)
print "series resistance in kilo ohm is",rs
print "power consumption in the series resistance is,(W)=",round(pc,3)
shunt resistance in milli ohm is 0.60012
power consumption in shunt is,(W)= 9.37
series resistance in kilo ohm is 24.997
power consumption in the series resistance is,(W)= 15.623

Example 25 - pg 145

In [29]:
#pg 145
#Example 2.25:#mulitplying power
#calculate the mulitplying power in all cases
print "when micro meter resistance is 25 ohm"
#given
ra=25.;#ohms
rsh=5000.;#ohms
r1=1250.;#ohms
r2=2500;#ohms
#calculations and results
n=((ra+rsh)/r1);#
n2=((ra+rsh)/r2);#
print "multiplying power for the shunt for a 1250 ohm is",n
print "multiplying power for the shunt for a 2500 ohm is",n2
print "when micro meter resistance is 2500 ohm"
ra1=2500.;#ohms
rsh=5000.;#ohms
r1=1250.;#ohms
n1=((ra1+rsh)/r1);#
r2=2500.;#ohms
n3=((ra1+rsh)/r2);#
print "multiplying power for the shunt for a 1250 ohm is",n1
print "multiplying power for the shunt for a 2500 ohm is",n3
when micro meter resistance is 25 ohm
multiplying power for the shunt for a 1250 ohm is 4.02
multiplying power for the shunt for a 2500 ohm is 2.01
when micro meter resistance is 2500 ohm
multiplying power for the shunt for a 1250 ohm is 6.0
multiplying power for the shunt for a 2500 ohm is 3.0

Example 26 - pg 145

In [30]:
#pg 145
#Example 2.26:#resistance
#calculate the resistance
r1=185.;#ohm
r2=205.;#ohm
r3=215.;#ohm
R31=195.;#OHM
r4=200.;#ohm
r5=1100.;#ohm
v1=85.;#V
#calculations
R=r1+r2+r3+r4+R31;#ohm
R1=(R-r4)+((r5*r4)/(r5+r4));#
V=(v1*R1)/round(R1-(R-r4));#V
I=round(V)/R;#A
vd4=I*r4;#V
x=0.5;#% allowable
vd41=(vd4)-(vd4*x)/100;#
rv=((vd41*(R-r4)*r4))/((V*r4)-((R*vd41)));#
#results
print "voltage is,(V)=",round(V)
print "resistance is ,(k-ohm)=",round(rv*10**-3)
print 'resistance is calculated wrong in the textbook due to rounding off error'
voltage is,(V)= 487.0
resistance is ,(k-ohm)= 27.0
resistance is calculated wrong in the textbook due to rounding off error

Example 27 - pg 146

In [31]:
#pg 146
#Example 2.27: Sensitivity
#calculate the sensitivity and resistance, relative sensitivity
#given data :
I1=0.1;# in mA
R1=50.;# in ohm
I2=10.;# in mA
I3=10.1;# in mA
I5=10;# in mA
V=2;# in Volt
#calculations
I4=I2-I1;
Rsh=I1*R1/(I3-I1);
Im1=Rsh*I4/(R1+Rsh);
S1=(I1-Im1)/(I3-I4);
R=V/(I5*10**-3);
# formula : Im=((I3-Im)*(R-V))/R1;
Im2=(0.8*I3)-8;
Im3=(0.8*I4)-8
S2=(Im2-Im3)/(I3-I4);
S=S1/S2;
#results
print "(a). The sensitivity of an instrument,S1 = ",round(S1,4)
print "(b). The resistance,R(ohm) = ",R
print "The relative sensitivity,S = ",round(S,3)
(a). The sensitivity of an instrument,S1 =  0.0099
(b). The resistance,R(ohm) =  200.0
The relative sensitivity,S =  0.012

Example 28 - pg 147

In [32]:
#pg 147
#Example 2.28: Error
#calculate the Error, shunt resistance  and inductance
#given data :
import math
from math import sqrt
La=90*10**-6;# in micro-H
Ra=0.09;# in ohm
I=50;# in A
Ia=5;# in A
f=50;# in Hz
#calculations
LsbyRs=La/Ra;
w=2*math.pi*f;
Rs=Ra/9;
Ls=LsbyRs*Rs*10**6;
Ls1=0;# shunt is non-inductive 
Ia1=(Rs*I)/sqrt((Ra+Rs)**2+(w**2*La**2));
Error=((Ia-Ia1)/Ia)*100;
#results
print "Shunt resistance,Rs(ohm) = ",Rs
print "Inductance,Ls(micro-H) = ",Ls
print "Current,Ia1(A) = ",round(Ia1,2)
print "Error,(%)(low) = ",round(Error,1)
Shunt resistance,Rs(ohm) =  0.01
Inductance,Ls(micro-H) =  10.0
Current,Ia1(A) =  4.81
Error,(%)(low) =  3.8

Example 29 - pg 148

In [33]:
#pg 148
#Example 2.29 :area and percentage error
#calculate the area and error
#given data 
import math
from math import sqrt
v1=18.;#kV
c1=60.;#pF
v2=2.;#
d=2.5;#cm
#calculations
q=v2*10**3*c1*10**-12;#
cs=q/(v1*10**3);#F
eo=8.854*10**-12;#
a=((cs*d*10**-2)/(eo));#
c2=50;#pf
x=c1-c2;#
stf=((v2*10**3)**2*x*10**-12);#
v=sqrt(stf/(x*10**-12*2))/1000;#kV
c3=c2+(x/2);#pf
x1=c3/(cs*10**12);#
V1=(x1+1)*v#
V=10*sqrt(2);#V
er=((V-V1)/V1)*100;#
#results
print "area is (cm^2)=",round(a*10**4)
print "error is (%)=",round(er,2)
area is (cm^2)= 188.0
error is (%)= 8.11

Example 30 - pg 150

In [34]:
#pg 150
#Example 2.30: % Error
#calculate the percentage error 
#given data :
Ra=2.;# in ohm
Rsh=0.0004;# constant
alfa=0.004;
t1=288.;# in K
t2=333.;# in K
I=100.;# in A
Rs=50.;# in ohm
#calculations
theta=t2-t1;
Ra1=Ra+(alfa*Ra*theta);
N1=1+(Ra/Rsh);
Ia=I/N1;
N2=1+(Ra1/Rsh);
Ia1=I/N2;
epsilon1=(Ia1-Ia)*100/Ia;
N3=1+((Ra+Rs)/Rsh);
Ia2=I*10**3/N3;
N4=1+((Ra1+Rs)/Rsh);
Ia3=I*10**3/N4;
epsilon2=(Ia3-Ia2)*100/Ia2;
#results
print "The percentage error in case 1 (%) = ",round(epsilon1,2)
print "The percentage error in case 2 (%) = ",round(epsilon2,3)
print 'The answers are a bit different due to rounding off error in textbook'
The percentage error in case 1 (%) =  -15.25
The percentage error in case 2 (%) =  -0.688
The answers are a bit different due to rounding off error in textbook

Example 31 - pg 151

In [35]:
#pg 151
#Example 2.31: Resistance and electromotive force
#calculate the electromotive force and resistance
#given data :
import numpy
from numpy import linalg
i1=20.;# in mA
i2=400.;# in mA
v1=19.5;# in mV
v2=23.4;# in mV
y=100;#mV
#calculations
i3=i1/i2;
K1=i1/i3;
x1=v1/K1;#
k2=y/i3;#
x2=v2/k2;#
A=numpy.matrix([[1, -x1],[1, -x2]]);
B=numpy.matrix([[v1],[v2]]);#
X=numpy.dot(numpy.linalg.inv(A),B);#
#results
print "electromotive force is (mV)=",round(X[0,0],3)
print "resistance is (ohm)=",round(X[1,0],3)
electromotive force is (mV)= 24.632
resistance is (ohm)= 105.263

Example 32 - pg 151

In [36]:
#pg 151
#Example 2.32: error
#calculate the error
#given data :
import math
V=20*10**3;# in V
v1=2*10**3;# in V
R=10*10**3;# in ohm
f=50.;# in Hz
#calculations
r=R*v1/V;
w=2*math.pi*f;
C=0.60*10**-6;# in F
v=V/((R/r)*math.sqrt(1+((w**2*C**2*r**2*(R-r)**2)/R**2)));
Error=((v1-v)/v1)*100;
#results
print "Error (%) = ",round(Error,1)
Error (%) =  1.4

Example 33 - pg 152

In [37]:
#pg 152
#Example 2.33: Flux, actual ratio and phase angle
#calculate the Flux, actual ratio and phase angle
#given data :
import math
from math import sin,cos
I=5.;# in A
r1=4.;# in ohm
r2=0.2;# in ohm
Ts=160;# in turns
F=50;# in Hz
I0=6;# in A
theta1=30/57.3;# in radians
#calculations
Es=I*(r1+r2);
fi=Es*10**3/(4.44*Ts*F);
Ie=I0*cos(theta1);# in A
Im=I0*sin(theta1);# in A
dela=0;
K=Ts+(((Ie*cos(dela))+(Im*sin(dela)))/I);
theta=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(Ts*I));
#results
print "(i). Flux in the core (mWb) = ",round(fi,3)
print "(ii). The actual ratio K = ",round(K,2)
print "(iii). The phase angle (degree)  = ",round(theta,3)
(i). Flux in the core (mWb) =  0.591
(ii). The actual ratio K =  161.04
(iii). The phase angle (degree)  =  0.215

Example 34 - pg 152

In [38]:
#pg 152
#Example 2.34: The ratio errror and phase angle error
#calculate the ratio error and phase angle
#given data :
import math
from math import sin,cos,sqrt
I=5.;# in A
n=1000./5;# normal ratio
sin_alfa=0.4;
Im=1;# in A
dela=0;
#calculations
cos_alfa=sqrt(1-sin_alfa**2);
I0=Im/cos_alfa;
Ie=I0*sin_alfa;
K=n+(((Ie*cos(dela))+(Im*sin(dela)))/I);
er=(n-K)*100/K;
eph=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(n*I));
x=round(eph);#
y=eph-x;#
#results
print "(a). The ratio error (%) = ",round(er,4)
print "(b). phase angle is ",x," degree ",round(y*60,3)," minutes "
(a). The ratio error (%) =  -0.0436
(b). phase angle is  0.0  degree  3.438  minutes 

Example 35 - pg 153

In [39]:
#pg 153
#Example 2.35: The ratio errror and phase angle error
#calculate the ratio error and phase angle
#given data :
import math
from math import sin,cos,asin
I=5.;# in A
n=198.;# in turns
L=12.5;#in VA
f=50.;# assume in Hz
Ie=10.;# in A
Im=15.;# in A
l=1.*10**-3;# in H
#calculations
Kn=1000./I;
Zs=L/I**2;
Re=2*math.pi*f*l;# in ohm
dela=asin(Re/Zs)*180/math.pi;
K=n+(((Ie*cos(dela))+(Im*sin(dela)))/I);
Rerror=(Kn-K)*100./K;
eph=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(n*I));
#results
print "The ratio error,(%) = ",round(Rerror,3)
print "The phase angle,(degree) = ",round(eph,3)
print 'The answers are a bit different due to rounding off error in textbook'
The ratio error,(%) =  -0.744
The phase angle,(degree) =  -0.252
The answers are a bit different due to rounding off error in textbook

Example 36 - pg 154

In [40]:
#pg 154
#Example 2.36: phase angle error load in VA
#calculate the phase angle error load
#given data 
import math
from math import sqrt
v1=1000.;#V
v2=100.;#V
xp=65.4;#ohm
rp=97.5;#ohm
pf=0.4;#
im=0.02;#A
Xp=110;#ohm
#calculations
r=v1/v2;#
sd=pf;#
csd=sqrt(1-pf**2);#
ie=im*(pf/csd);#A
th=((ie*xp)-(im*rp))/(r*v2);#rad
thd=th*(180/math.pi);#
iss=(r*((im*rp)-(ie*xp)))/(Xp);
va=iss*v2;#VA
#results
print "phase angle is ",round(thd*60,1),"minutes"
print "load is (VA)=",round(va,1)
phase angle is  -4.7 minutes
load is (VA)= 12.5

Example 37 - pg 155

In [41]:
#pg 155
#Example 2.37: flux and current ratio error
#calculate the flux and ratio error
#given
n1=1000.;#A
n2=5.;#A
r=1.6;#ohm
wt=1.5;#watt
f=50;#Hz
cd1=1;#
sd=0;#
#calculations
kn=n1/n2;#
ts=kn;#
es=n2*r;#v
ph=es/(4.44*f*kn);#m Wb
ep=es/kn;#
ie=wt/ep;#A
K=((kn+(ie/n2)));#
re=((kn-K)/K)*100;#
#results
print "flux is (m-Wb)=",round(ph*10**3,2)
print "ratio error is (%)=",round(re,2)
flux is (m-Wb)= 0.18
ratio error is (%)= -3.61

Example 38 - pg 155

In [42]:
#pg 155
#Example 2.38: RCF ,ratio error and phase angle error
#calculate the ratio error, phase angle error and RCF in all cases
import math
from math import sqrt
#given
vp=2000.;#V
n=20.;#
va1=50.;#
pfl1=0.6;#lagging
va2=25.;#V
ie=0;#
im=0;#
cd1=0.6;#
rs1=0.75;#ohm
rp1=300.;#ohm
xs1=1.5;#ohm
xp1=600.;#ohm
#calculations and results
vs=vp/n;#
iss=va1/vs;#A
iss2=va2/vs;#A
sd1=sqrt(1-cd1**2);#
Rp1=n**2*rs1+rp1;#ohm
Xp1=n**2*xs1+xp1;#ohm
vps1=n+((iss/n)*(Rp1*cd1+Xp1*sd1))/vs;#
RCF1=vps1/n;#
er1=((n-vps1)/vps1)*100;#%
per1=((iss*(Xp1*cd1-Rp1*sd1))/(n**2*vs))*(180/math.pi);#degree
per1a=round(per1);#
x1=per1-per1a;#
print "RCF for case (a) = ",RCF1
print "phase error for case (a) (%)=",round(er1,3)
print "phase angle error for case (a) ",round(x1*60,1)," minutes"
cd11=1;#
sd11=sqrt(1-cd11**2);#
vps2=n+((iss/n)*(Rp1*cd11+Xp1*sd11))/vs;#
RCF2=vps2/n;#
er2=((n-vps2)/vps2)*100;#%
per2=((iss*(Xp1*cd11-Rp1*sd11))/(n**2*vs))*(180/math.pi);#degree
per1a1=round(per2);#
x2=per1-per1a1;#
print "RCF for case (b) =",RCF2
print "phase error for case (b) (%)=",round(er2,3)
print "phase angle error for case (b)is ",round(per2*60,1)," minutes"
cd12=0.6;#
sd12=-0.8;#
vps3=n+((iss/n)*(Rp1*cd12+Xp1*sd12))/vs;#
RCF3=vps3/n;#
er3=((n-vps3)/vps3)*100;#%
per3=((iss*(Xp1*cd12-Rp1*sd12))/(n**2*vs))*(180/math.pi);#degree
per1a1=round(per2);#
x2=per1-per1a1;#
print "RCF for case (c) =",RCF3
print "phase error for case (c) (%)=",round(er3,3)
print "phase angle error for case (c) is ",round(per3*60,1)," minutes"
cd13=0.6;#
sd13=0.8;#
vps4=n+((iss2/n)*(Rp1*cd13+Xp1*sd13))/vs;#
RCF4=vps4/n;#
er4=((n-vps4)/vps4)*100;#%
per4=((iss2*(Xp1*cd13-Rp1*sd13))/(n**2*vs))*(180/math.pi);#degree
per1a1=round(per2);#
x2=per1-per1a1;#
print "RCF for case (d) =",RCF4
print "phase error for case (d) (%)=",round(er4,2)
print "phase angle error for case (d) is ",round(per4*60,3)," minutes"
cd14=1;#
sd14=0;#
vps5=n+((iss2/n)*(Rp1*cd14+Xp1*sd14))/vs;#
RCF5=vps5/n;#
er5=((n-vps5)/vps5)*100;#%
per5=((iss2*(Xp1*cd14-Rp1*sd14))/(n**2*vs))*(180/math.pi);#degree
per1a1=round(per2);#
x2=per1-per1a1;#
print "RCF for case (e) =",RCF5
print "phase error for case (e) (%)=",round(er5,3)
print "phase angle error for case (e) is ",round(per5*60,1)," minutes"
cd15=0.6;#
sd16=-0.8;#
vps6=n+((iss2/n)*(Rp1*cd15+Xp1*sd16))/vs;#
RCF6=vps6/n;#
er6=((n-vps6)/vps6)*100;#%
per6=((iss2*(Xp1*cd15-Rp1*sd16))/(n**2*vs))*(180/math.pi);#degree
per1a1=round(per2);#
x2=per1-per1a1;#
print "RCF for case (f) =",RCF6
print "phase error for case (f) (%)=",round(er6,3)
print "phase angle error for case (f) is ",round(per6*60,1)," minutes"
RCF for case (a) =  1.0165
phase error for case (a) (%)= -1.623
phase angle error for case (a)  10.3  minutes
RCF for case (b) = 1.0075
phase error for case (b) (%)= -0.744
phase angle error for case (b)is  51.6  minutes
RCF for case (c) = 0.9925
phase error for case (c) (%)= 0.756
phase angle error for case (c) is  51.6  minutes
RCF for case (d) = 1.00825
phase error for case (d) (%)= -0.82
phase angle error for case (d) is  5.157  minutes
RCF for case (e) = 1.00375
phase error for case (e) (%)= -0.374
phase angle error for case (e) is  25.8  minutes
RCF for case (f) = 0.99625
phase error for case (f) (%)= 0.376
phase angle error for case (f) is  25.8  minutes

Example 39 - pg 158

In [43]:
#pg 158
#Example 2.39:  ,ratio error and phase angle error
#calculate the ratio error,RCF and phase angle error
#given
import math
from math import cos, sin
vp=1000.;#V
iss=5.;#A
VA=25.;#
wt=0.25;#W
im=15.;#A
xs=1.;#ohm
rs=5.;#ohm
#calculations
n=vp/iss;#
vs=VA/iss;#
vp=iss/n;#V
ie=wt/vp;#A
dl=math.atan(xs/rs)*57.3;#
dlr=dl*(math.pi/180);#
K=n+((ie*cos(dl/57.3)+im*sin(dl/57.3))/iss);#
re=((n-K)/K)*100;#per
RCF=K/n;#
eph=(180/math.pi)*(((im*cos(dl/57.3))-(ie*sin(dl/57.3)))/(n*iss));
#results
print "ratio error (%)=",round(re,2)
print "RCF =",round(RCF,5)
print "phase angle error (degree)=",round(eph,3)
ratio error (%)= -1.26
RCF = 1.01275
phase angle error (degree)= 0.73

Example 40 - pg 159

In [44]:
#pg 159
#Example 2.40: true value of voltage ,current and power
#calculate the true value of voltage ,current and power
#given
import math
from math import acos,cos
vs=102.;#V
iss=4.;#A
ws=375.;#W
rcf=0.995;#
rcf1=1.005;#
a1=2000.;#
a2=100.;#
#calculations
ph=acos(ws/(iss*vs))*57.3;#degree
ph1=round(ph);#
x=ph-ph1;#
y=x*60;#
angd=y+22+10;#
ang=angd/60.;#
ta=ph1+ang;#
nr=a1/a2;#
avr=rcf*nr;#
pv=avr*vs;#
acr=rcf1*(a2/nr);#
pc=acr*iss*iss;#A
psd=pv*pc*cos(ta/57.3)*10**-3;#
#results
print "true value of voltage is,(V)=",round(pv)
print "true value of current is,(A)=",pc
print "true value of power is ,(kW)=",round(psd,1)
true value of voltage is,(V)= 2030.0
true value of current is,(A)= 80.4
true value of power is ,(kW)= 149.4

Example 41 - pg 160

In [46]:
#pg 160
#Example 2.41:primary current ,phase error 
#calculate the primary current ,phase error 
#given
import math,cmath
from math import cos,sin
zs=0.433+1j*0.25;#ohm
zs1=0.15+1j*0.0;#ohm
nt=2.;#turns
l1=8.;#
l2=4.;#
tnt=198;#turns
iss=5;#A
#calculations
zs2=zs+zs1;#ohm
zsa=math.sqrt((zs2.real)**2+(zs2.imag)**2);#
zsng=math.atan(zs2.imag/zs2.real);#
ie=l2/nt;#
im=l1/nt;#
K=((tnt/2.)+((ie*cos(zsng))+(im*sin(zsng)))/iss);#
ip=K*iss;#A
th=((im*cos(zsng))-(ie*sin(zsng)))/((tnt/2)*iss);#
#results
print "primary current is,(A)=",round(ip,3)
print "phase error is (radian)=",round(th,4)
primary current is,(A)= 498.415
phase error is (radian)= 0.0058

Example 42 - pg 160

In [47]:
#pg 158
#Example 2.39:  ,ratio error and phase angle error
#calculate the ratio error,RCF and phase angle error
#given
import math
from math import cos, sin
vp=1000.;#V
iss=5.;#A
VA=25.;#
wt=0.25;#W
im=15.;#A
xs=1.;#ohm
rs=5.;#ohm
#calculations
n=vp/iss;#
vs=VA/iss;#
vp=iss/n;#V
ie=wt/vp;#A
dl=math.atan(xs/rs)*57.3;#
dlr=dl*(math.pi/180);#
K=n+((ie*cos(dl/57.3)+im*sin(dl/57.3))/iss);#
re=((n-K)/K)*100;#per
RCF=K/n;#
eph=(180/math.pi)*(((im*cos(dl/57.3))-(ie*sin(dl/57.3)))/(n*iss));
#results
print "ratio error (%)=",round(re,2)
print "RCF =",round(RCF,5)
print "phase angle error (degree)=",round(eph,3)
ratio error (%)= -1.26
RCF = 1.01275
phase angle error (degree)= 0.73

Example 43 - pg 161

In [48]:
#pg 161
#Example 2.43 :percentage change in current
#calculate the current
#given data
import math,cmath
r=0.5;#kilo ohm
r1=1.;#kilo ohm
f=50.;#Hz
V=1.;#V
#calculations
z1=((1j*r1*r)/(r1+1j*r));#kilo-ohm
z1m=abs(z1);#kilo-ohm
z2=((1j*r1*r)/(r+1j*r1));#kilo-ohm
z2m=abs(z2);#kilo-ohm
tz=z1m+z2m;#kilo-ohm
i=V/tz;#A
v1=i*z1m*10**-3;#V
v2=i*10**-3*z2m;#V
df=f-((f*5)/100);#Hz
rc1=((r*df)/f);#k-ohm
rc2=((r1*df)/f);#k-ohm
z1n=((1j*rc1)/(r1+1j*rc1));#
z1nm=abs(z1n);#k-ohm
z2n=((1j*rc2*r)/(r+1j*rc2));#
z2nm=abs(z2n);#k-ohm
znw=z1nm+z2nm;#k-ohm
inn=V/znw;#
#results
print "current is (mA)=",round(inn,4)
print 'The answer is a bit different due to rounding off error in textbook'
current is (mA)= 1.1474
The answer is a bit different due to rounding off error in textbook

Example 44 - pg 162

In [49]:
#pg 162
#Example 2.44 :Inductance
#calculate the inductance and frequency
#given data
import math,cmath
c=1.;#micro-F
f1=60.;#Hz
f=50.;#Hz
#calculations
l1=((c*10**6)/(f1**2*(2*math.pi)**2));#
r1=100;#ohm
z1=r1+1j*((2*math.pi*f*l1)-(1/(2*math.pi*f*c*10**-6)));#ohm
c2=1.5;#micro-F
l2=((-z1.imag)+(1/(2*math.pi*c2)))/100;#H
f2=(1/(2*math.pi))*math.sqrt(1/(l2*c2*10**-6));#Hz
#results
print "inductance is (H)=",round(l2,2)
print "frequency is (Hz)=",round(f2,1)
inductance is (H)= 9.73
frequency is (Hz)= 41.7

Example 45 - pg 163

In [50]:
#pg 159
#Example 2.40: true value of voltage ,current and power
#calculate the true value of voltage ,current and power
#given
import math
from math import acos,cos
vs=102.;#V
iss=4.;#A
ws=375.;#W
rcf=0.995;#
rcf1=1.005;#
a1=2000.;#
a2=100.;#
#calculations
ph=acos(ws/(iss*vs))*57.3;#degree
ph1=round(ph);#
x=ph-ph1;#
y=x*60;#
angd=y+22+10;#
ang=angd/60.;#
ta=ph1+ang;#
nr=a1/a2;#
avr=rcf*nr;#
pv=avr*vs;#
acr=rcf1*(a2/nr);#
pc=acr*iss*iss;#A
psd=pv*pc*cos(ta/57.3)*10**-3;#
#results
print "true value of voltage is,(V)=",round(pv)
print "true value of current is,(A)=",pc
print "true value of power is ,(kW)=",round(psd,1)
true value of voltage is,(V)= 2030.0
true value of current is,(A)= 80.4
true value of power is ,(kW)= 149.4

Example 46 - pg 163

In [51]:
#pg 160
#Example 2.42: Resistance
#calculate the Series resistance
import math
#given data :
f=50.;#/ in Hz
r=2000.;# in ohm
L=0.5;# in H
V=100.;# in V
#calculations
Zm=math.sqrt(r**2+(2*math.pi*f*L));
im=V/Zm;
Rs=(500.-(im*Zm))/im;
#results
print "Series resistance,Rs(ohm) = ",round(Rs)
print 'answer is wrong in the textbook due to rounding off error'
Series resistance,Rs(ohm) =  8000.0
answer is wrong in the textbook due to rounding off error