summaryrefslogtreecommitdiff
path: root/Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb
diff options
context:
space:
mode:
authorhardythe12015-07-03 12:23:43 +0530
committerhardythe12015-07-03 12:23:43 +0530
commit9d260e6fae7328d816a514130b691fbd0e9ef81d (patch)
tree9e6035702fca0f6f8c5d161de477985cacad7672 /Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb
parentafcd9e5397e3e1bde0392811d0482d76aac391dc (diff)
downloadPython-Textbook-Companions-9d260e6fae7328d816a514130b691fbd0e9ef81d.tar.gz
Python-Textbook-Companions-9d260e6fae7328d816a514130b691fbd0e9ef81d.tar.bz2
Python-Textbook-Companions-9d260e6fae7328d816a514130b691fbd0e9ef81d.zip
add/remove books
Diffstat (limited to 'Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb')
-rwxr-xr-xElectrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb2381
1 files changed, 2381 insertions, 0 deletions
diff --git a/Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb b/Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb
new file mode 100755
index 00000000..27e9fedf
--- /dev/null
+++ b/Electrical_Measurements_Measuring_Instruments_by_K._Shinghal/Chapter2.ipynb
@@ -0,0 +1,2381 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2 - Analog measurement of electrical quantities"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1 - pg 130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "for Ist method\n",
+ "wattmeter reading is (W)= 804.0\n",
+ "percentage error is high (%) = 0.5\n",
+ "for 2nd method\n",
+ "wattmeter reading (W)= 802.5\n",
+ "percentage error is high (%) = 0.3125\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 130\n",
+ "#Example 2.1:#wattmeter reading and error\n",
+ "#calculate the wattmeter reading\n",
+ "import math,cmath\n",
+ "#given\n",
+ "print \"for Ist method\"\n",
+ "v=50;#volts\n",
+ "i=20;#amperes\n",
+ "pf=0.8;#power factor\n",
+ "pl=v*i*pf;#true power\n",
+ "vc=(50*pf)+1j*v*math.sqrt(1-pf**2);#complex form \n",
+ "ic=i+1j*0;#\n",
+ "r1=0.01;#ohms\n",
+ "#calculations and results\n",
+ "vpl=vc+(i*r1);#voltage across pressure coil\n",
+ "wrlc1=(vpl.real)*(ic.real);#\n",
+ "er=(wrlc1-pl)/(pl);#\n",
+ "print \"wattmeter reading is (W)=\",wrlc1\n",
+ "print \"percentage error is high (%) = \",er*100\n",
+ "print \"for 2nd method\"\n",
+ "r2=1000;#ohms\n",
+ "ic1=ic+(vc/r2);#\n",
+ "wrlc2=(vc.real)*(ic1.real)+(vc.imag)*(ic1.imag);#\n",
+ "er1=(wrlc2-pl)/(pl);#\n",
+ "print \"wattmeter reading (W)=\",wrlc2\n",
+ "print \"percentage error is high (%) = \",er1*100\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2 - pg 131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "self inductance (mH) = 2.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 131\n",
+ "#Example 2.2:#self inductance\n",
+ "#calculate the self inductance\n",
+ "#given\n",
+ "c=20.;#pF\n",
+ "rs=10000.;#ohms\n",
+ "#calculations\n",
+ "l=(c*10**-12)*rs**2;#henry\n",
+ "#results\n",
+ "print \"self inductance (mH) = \",l*10**3\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3 - pg 131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "percentage error is (%) = 0.39\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 131\n",
+ "#Example 2.3:#percentage error\n",
+ "#calculate the percentage error\n",
+ "#given\n",
+ "import math\n",
+ "v=100;#volts\n",
+ "i=10;#amperes\n",
+ "pf=0.45;#power factor\n",
+ "f=50;#Hz\n",
+ "l=25;#mH\n",
+ "r=4000;#ohms\n",
+ "#calculations\n",
+ "tp=v*i*pf;#true power in watts\n",
+ "b=math.atan((2*math.pi*f*l*10**-3)/r);#phase angle in radians\n",
+ "e=v*i*math.tan(b)*math.sqrt(1-pf**2);#\n",
+ "per=(e*100)/(tp);#\n",
+ "#results\n",
+ "print \"percentage error is (%) = \",round(per,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4 - pg 131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "true power in (kW) = 851.3\n",
+ "answer is wrong in the textbook\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 131\n",
+ "#Example 2.4:#true power\n",
+ "#calculate the true power\n",
+ "#given\n",
+ "import math\n",
+ "from math import cos\n",
+ "ph=45.;#degree\n",
+ "th=90.;#radians\n",
+ "dela=-45.;#radians\n",
+ "f=50.;#Hz\n",
+ "l=15.;#mH\n",
+ "r=300.;#ohms\n",
+ "#calculations\n",
+ "b=math.atan((2*math.pi*f*l*10**-3)/r);#in radians\n",
+ "k=((cos(ph/57.3))/(cos(b)*cos(42/57.3)));#\n",
+ "nr=20;#nomianl ratio\n",
+ "e=-0.3;#\n",
+ "er=(e*nr)/100;#\n",
+ "ar1=nr-er;#actual ratio\n",
+ "nr1=100;#nomianl ratio\n",
+ "e1=0.9;#\n",
+ "er1=(e1*nr1)/100;#\n",
+ "ar2=nr1-er1;#actual ratio\n",
+ "p=450;#watts\n",
+ "tp=ar1*ar2*k*p;#\n",
+ "#results\n",
+ "print \"true power in (kW) = \",round(tp*10**-3,1)\n",
+ "print 'answer is wrong in the textbook'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5 - pg 132"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "torque in Nm when angle is 45 degree (Nm) = 6.68e-06\n",
+ "torque in Nm when angle is 90 degree (Nm) = 9.45e-06\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 132\n",
+ "#Example 2.5:#torque\n",
+ "#calculate the torque required\n",
+ "#given\n",
+ "import math\n",
+ "from math import sin\n",
+ "d=2.5;#diameter in cm\n",
+ "n=500;#turns\n",
+ "b=1.1;#mWb/m**2\n",
+ "v=100;#volts\n",
+ "pf=0.7;#power factor\n",
+ "rp=2000;#ohms\n",
+ "#calculations\n",
+ "x=((math.pi*(d*10**-2)**2*n*b*10**-3*v*pf)/(4*rp));#\n",
+ "ang1=45;#degree\n",
+ "ang2=90;#degree\n",
+ "td1=x*sin(ang1/57.3);#\n",
+ "td2=x*sin(ang2/57.3);#\n",
+ "#results\n",
+ "print \"torque in Nm when angle is 45 degree (Nm) = \",round(td1,8)\n",
+ "print \"torque in Nm when angle is 90 degree (Nm) = \",round(td2,8)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6 - pg 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "unknown resistance is (ohm)= 2784.0\n",
+ "answer is wrong in the textbook\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 133\n",
+ "#Example 2.6:#resistance\n",
+ "#calculate the resistance\n",
+ "#given\n",
+ "import math\n",
+ "la=4.78;#henry\n",
+ "ra=298.;#ohms\n",
+ "lb=3.;#henry\n",
+ "rb=190.;#ohms\n",
+ "v=200.;#volts\n",
+ "#calculations\n",
+ "r=((la*100*lb*100*math.pi**2)-(ra*rb))/(rb+ra);#ohm\n",
+ "#results\n",
+ "print \"unknown resistance is (ohm)=\",round(r,0)\n",
+ "print 'answer is wrong in the textbook'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7 - pg 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "addition resistance (ohm) = 2750.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 133\n",
+ "#Example 2.7:#resistance\n",
+ "#calculate the addition in resistance\n",
+ "#given\n",
+ "i=20.;#amperes\n",
+ "v=100.;#volts\n",
+ "pf=1;#power factor\n",
+ "rp=5500.;#ohms\n",
+ "th=150.;#angle\n",
+ "wd=20;#watts per degree\n",
+ "#calculations\n",
+ "p=v*i*pf;#watts\n",
+ "kd=((rp*th)/p);#constant\n",
+ "rp1=wd*kd;#in ohms\n",
+ "adr=rp1-rp;#\n",
+ "#results\n",
+ "print \"addition resistance (ohm) = \",adr\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8 - pg 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "resistance in (ohm) = 120.0\n",
+ "load impedance in (ohm) = 75.0\n",
+ "impedance of combination in (ohm) = 53.57\n",
+ "power absorbed by the load in (W) = 546.6\n",
+ "power factor of the load = 0.4555\n",
+ "total power supply is (W) = 1296.6\n",
+ "total power factor = 0.772\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 134\n",
+ "#Example 2.8:#resistance,impedance,power,power factor ,voltage and power factor\n",
+ "#calculate the total power factor,supply, impedance and resistance\n",
+ "#given\n",
+ "v=300.;#volts\n",
+ "i2=2.5;#amperes\n",
+ "#calculations and results\n",
+ "r=v/i2;#ohms\n",
+ "print \"resistance in (ohm) =\",r\n",
+ "i3=4;#amperes\n",
+ "zl=v/i3;#ohms\n",
+ "print \"load impedance in (ohm) = \",zl\n",
+ "v=300;#volts\n",
+ "i2=2.5;#amperes\n",
+ "r=v/i2;#ohms\n",
+ "i1=5.6;#amperes\n",
+ "z=v/i1;#ohms\n",
+ "print \"impedance of combination in (ohm) = \",round(z,2)\n",
+ "i3=4;#amperes\n",
+ "pl=((i1**2-i2**2-i3**2)*r)/2;#in watts\n",
+ "print \"power absorbed by the load in (W) = \",pl\n",
+ "pl=((i1**2-i2**2-i3**2)*r)/2;#in watts\n",
+ "pfl=((i1**2-i2**2-i3**2)/(2*i2*i3));#power factor\n",
+ "print \"power factor of the load = \",pfl\n",
+ "pr=i2**2*r;#in watts\n",
+ "tps=pl+pr;#in watts\n",
+ "print \"total power supply is (W) = \",tps\n",
+ "tps=pl+pr;#in watts\n",
+ "tpf=tps/(v*i1);#power factor\n",
+ "print \"total power factor = \",round(tpf,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9 - pg 135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "average power to be read by wattmeter is (W) = 127.32\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 135\n",
+ "#Example 2.9:#wattmeter reading\n",
+ "#calculate the average power\n",
+ "import math,scipy\n",
+ "from scipy import integrate\n",
+ "v=24.;#volts\n",
+ "r1=6.;#ohms\n",
+ "vm=100;#volts\n",
+ "t0=0.;#\n",
+ "t1=(1./100);#\n",
+ "f=50.;#Hz\n",
+ "#calculations\n",
+ "i=v/r1;#in amperes\n",
+ "z=2*math.pi*f;#\n",
+ "def fun(t):\n",
+ "\ty=math.sin(z*t)\n",
+ "\treturn y\n",
+ "x=scipy.integrate.quad(fun,t0,(t1/2.));#\n",
+ "p=vm*(1/t1)*i*x[0];#\n",
+ "#results\n",
+ "print \"average power to be read by wattmeter is (W) = \",round(p,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 10 - pg 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "load impedance in (ohm) = 20.0\n",
+ "impedance of combination in (ohm) = 35.0\n",
+ "power absorbed by the load is,(W) = 202.0\n",
+ "power absorbed by the non inductive resistor is,(W) = 300.0\n",
+ "power factor of load is 0.63\n",
+ "power factor of the whole circuit is 0.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 136\n",
+ "#Example 2.10:#load impedance and combination impedance\n",
+ "#calculate the power factor and power, load\n",
+ "#given\n",
+ "v3=80.;#volts\n",
+ "i=4.;#amperes\n",
+ "v1=140;#volts\n",
+ "#calculations and results\n",
+ "zl=v3/i;#ohms\n",
+ "z=v1/i;#ohms\n",
+ "print \"load impedance in (ohm) = \",zl\n",
+ "print \"impedance of combination in (ohm) = \",z\n",
+ "v2=75.;#volts (it is given 72 in the textbook)\n",
+ "r=v2/i;#\n",
+ "pl=((v1**2-v2**2-v3**2)/(2*r));#watts\n",
+ "pr=i**2*r;#watts\n",
+ "print \"power absorbed by the load is,(W) = \",pl\n",
+ "print \"power absorbed by the non inductive resistor is,(W) = \",pr\n",
+ "pfl=((v1**2-v2**2-v3**2)/(2*v2*v3));#power factor of the load\n",
+ "tp=pr+pl;#total power in watts\n",
+ "pfc=tp/(v1*i);#power factor\n",
+ "print \"power factor of load is\",round(pfl,2)\n",
+ "print \"power factor of the whole circuit is\",round(pfc,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 11 - pg 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "wattmeter (W1) reading in (kW) = 85.0\n",
+ "wattmeter (W2) reading in (kW) = 215.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 136\n",
+ "#Example 2.11:#wattmeters readings\n",
+ "#calculate the wattmeters readings\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "pf=0.8;#\n",
+ "#calculations\n",
+ "td=(sqrt(1-pf**2))/pf;#\n",
+ "sr=300;#kW\n",
+ "df=(sr/sqrt(3))*td;#\n",
+ "w2=(sr+df)/2;#\n",
+ "w1=sr-w2;#\n",
+ "#results\n",
+ "print \"wattmeter (W1) reading in (kW) = \",round(w1)\n",
+ "print \"wattmeter (W2) reading in (kW) = \",round(w2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12 - pg 137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "power factor of the system = 0.189\n",
+ "capacitance (micro-F) = 322.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 137\n",
+ "#Example 2.12:#power factor and capacitance\n",
+ "#calculate the capacitance and power factor\n",
+ "import math\n",
+ "from math import atan,sqrt,cos\n",
+ "#given\n",
+ "w1=-2000.;#watts\n",
+ "w2=4000.;#watts\n",
+ "v=400.;#volts\n",
+ "pfn=0.5;#power factor\n",
+ "f=50.;#Hz\n",
+ "#calculations\n",
+ "ph=math.atan((sqrt(3.)*(w2-w1))/(w2+w1)) *57.3;#in degree\n",
+ "pf=cos(ph/57.3);#\n",
+ "w=w1+w2;#total power\n",
+ "vp=(v/sqrt(3));#phase voltage\n",
+ "pp=w/3.;#power per phase\n",
+ "pi=(pp)/(vp*pf);#phase current\n",
+ "pim=vp/pi;#phase impedance\n",
+ "rip=pim*pf;#resistance each phase\n",
+ "rep=(sqrt(pim**2-rip**2));#reactance of each phase\n",
+ "pimb=rip/pfn;#impedance per phase\n",
+ "repn=(sqrt(pimb**2-rip**2));#reactance per phase\n",
+ "cp=rep-repn;#capacitive reactance\n",
+ "c=((1/(2*math.pi*f*cp)));#\n",
+ "#results\n",
+ "print \"power factor of the system = \",round(pf,3)\n",
+ "print \"capacitance (micro-F) = \",round(c*10**6)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 13 - pg 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "power factor = 0.866\n",
+ "line current is (A)= 83.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 138\n",
+ "#Example 2.13:#power factor and line current\n",
+ "#calculate the line current and power factor\n",
+ "#given\n",
+ "import math\n",
+ "x=1;#\n",
+ "w=50;#kW\n",
+ "v=400.;#volts\n",
+ "#calculations\n",
+ "w2=2*x;#\n",
+ "w1=x;#\n",
+ "ph=math.atan((math.sqrt(3)*(w2-w1))/(w2+w1))*57.3;#in degree\n",
+ "pf=math.cos(ph/57.3);#power factor\n",
+ "il=((w/(math.sqrt(3)*v*pf)))*10**3;#in amperes\n",
+ "#results\n",
+ "print \"power factor = \",round(pf,3)\n",
+ "print \"line current is (A)=\",round(il,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14 - pg 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "when both readings are positive\n",
+ "power is (W) = 6900.0\n",
+ "power factor (leading) = 0.866\n",
+ "when second readig is negative\n",
+ "power is (W) = 2300.0\n",
+ "power factor (leading) = 0.189\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 138\n",
+ "#Example 2.14:#total power and power factor\n",
+ "#calculate the total power and power factor\n",
+ "#given\n",
+ "import math\n",
+ "print \"when both readings are positive\"\n",
+ "w2=2300.;#watts\n",
+ "w1=4600.;#watts\n",
+ "#calculations and results\n",
+ "p1=w2+w1;#\n",
+ "ph=57.3*math.atan((math.sqrt(3)*(w2-w1))/(w2+w1));#in degree\n",
+ "pf=math.cos(ph/57.3);#power factor\n",
+ "print \"power is (W) = \",p1\n",
+ "print \"power factor (leading) = \",round(pf,3)\n",
+ "print \"when second readig is negative\"\n",
+ "w21=-2300.;#watts\n",
+ "w1=4600.;#watts\n",
+ "p2=w21+w1;#\n",
+ "ph2=57.3*math.atan((math.sqrt(3)*(w21-w1))/(w21+w1));#in degree\n",
+ "pf1=math.cos(ph2/57.3);#power factor\n",
+ "print \"power is (W) = \",p2\n",
+ "print \"power factor (leading) = \",round(pf1,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15 - pg 139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "load current in amperes = 5.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 139\n",
+ "#Example 2.15:#load current\n",
+ "#calculate the load current\n",
+ "#given\n",
+ "import math\n",
+ "from math import atan,cos,sqrt\n",
+ "rw=3550.;#reading of wattmeter\n",
+ "rp=806.;#watts\n",
+ "#calculations\n",
+ "ph=atan((sqrt(3)*rp)/rw);#in degree\n",
+ "pf=cos(ph/57.3);#power factor\n",
+ "v=440;#volts\n",
+ "i=((rw)/(sqrt(3)*v*pf));#amperes\n",
+ "#results\n",
+ "print \"load current in amperes = \",round(i)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16 - pg 139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "error (slow) in percentage = 9.1\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 139\n",
+ "#Example 2.16:#error\n",
+ "#calculate the error percentage\n",
+ "#given\n",
+ "import math\n",
+ "from math import sin\n",
+ "d=87./57.3;#radians\n",
+ "pf=0.5;#\n",
+ "#calculations\n",
+ "n=(1./4)*sin(d-60/57.3);#\n",
+ "nc=(1./4)*pf*sin(d);#\n",
+ "e=((n-nc)/nc)*100;#error\n",
+ "#results\n",
+ "print \"error (slow) in percentage = \",round(-e,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 17 - pg 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "error (%) = 1.82\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 140\n",
+ "#Example 2.17:#error\n",
+ "#calculate the error\n",
+ "#given\n",
+ "import math,scipy\n",
+ "from scipy import integrate \n",
+ "i=5;#amperes\n",
+ "t0=0;#\n",
+ "t1=30./60;#\n",
+ "e=0.56;#kWh\n",
+ "v1=220;#volts\n",
+ "#calculations\n",
+ "def function(t):\n",
+ "\ty=5\n",
+ "\treturn y\n",
+ "x=scipy.integrate.quad(function,t0,t1);#\n",
+ "v=(e*10**3)/x[0];#volts\n",
+ "ae=v1*i*t1*10**-3;#actual energy\n",
+ "e=((e-ae)/ae)*100;#error\n",
+ "#results\n",
+ "print \"error (%) = \",round(e,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18 - pg 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "time duration (seconds) = 367.0\n",
+ "limits of accuracy (%) = 0.73\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 140\n",
+ "#Example 2.18:#time and error\n",
+ "#calculate the time duration and limits of accuracy\n",
+ "#given\n",
+ "nd=500.;#dvisions\n",
+ "cr=0.1;#dvisions can read\n",
+ "ie=0.05;#inherent error\n",
+ "tea=0.1;#total error allowable\n",
+ "cr1=0.01;#seconds\n",
+ "cr2=0.1;#seconds\n",
+ "nd1=500/10.;#\n",
+ "#calculations\n",
+ "re=(cr/nd)*100;#reading error\n",
+ "te=re+ie;#total error\n",
+ "per=tea-te;#permissible error\n",
+ "ersw=cr1*100;#error in reading stop watch\n",
+ "erss=cr2*100;#error in stopping and starting\n",
+ "ter=ersw+erss;#total error\n",
+ "t=per/ter;#seconds\n",
+ "er1=(cr/nd1)*100;#new reading error\n",
+ "ie1=((ie*nd)/nd1);#new inherent error\n",
+ "ter1=er1+ie1;#\n",
+ "la=ter1+per;#\n",
+ "#results\n",
+ "print \"time duration (seconds) = \",round(1./t)\n",
+ "print \"limits of accuracy (%) = \",la\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 19 - pg 141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "error (slow) is (%) 1.66\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 141\n",
+ "#Example 2.19:#error\n",
+ "#calculate the error\n",
+ "#given\n",
+ "import math\n",
+ "n=40.;#revolutions\n",
+ "rc=0.12;#registration constant\n",
+ "e2=22000;#volts\n",
+ "e1=110;#volts\n",
+ "i2=500;#amperes\n",
+ "i1=5;#amperes\n",
+ "i=5.25;#amperes\n",
+ "lv=110;#volts\n",
+ "pf=1;#\n",
+ "t=61;#seconds\n",
+ "#calculations\n",
+ "err=n/rc;#energy recorded in kWh is\n",
+ "ae=((math.sqrt(3)*e2*lv*i*i2*pf*t)/(e1*i1*3600))*10**-3;#kWh\n",
+ "e=((err-ae)/ae)*100;#\n",
+ "#results\n",
+ "print \"error (slow) is (%)\",round(-e,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 20 - pg 142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "error (fast) in recording (%) = 0.2\n",
+ "limit of error in the meter is 0.07 % or 0.33 % \n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 142\n",
+ "#Example 2.20:#error and limit of error\n",
+ "#calculate the error and limit of error\n",
+ "#given\n",
+ "mc=1200.;#meter constant in rev/kWh\n",
+ "n=40.;#revolutions\n",
+ "tp=99.8;#seconds\n",
+ "v=240;#volts\n",
+ "i=5;#amperes\n",
+ "#calculations\n",
+ "err=n/mc;#energy recorded in kWh\n",
+ "ae=((v*i*tp*10**-3)/3600);#actual energy in kWh\n",
+ "e=((err-ae)/ae)*100;#error\n",
+ "n=500;#divisions\n",
+ "rn=0.1;#dvision reading accuracy\n",
+ "per=((rn/n)*100);#possible error\n",
+ "ie=0.05;#inherent error\n",
+ "per1=(((rn/10)/tp)*100);#possible error\n",
+ "her=((ie/tp)*100);#human error\n",
+ "tpr=per+per1+her+ie;#total possible error\n",
+ "li1=e-tpr;#\n",
+ "li2=e+tpr;#\n",
+ "#results\n",
+ "print \"error (fast) in recording (%) = \",round(e,2)\n",
+ "print \"limit of error in the meter is \",round(li1,2),\"% or \",round(li2,2),\"% \"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21 - pg 143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "total monthly bill in Rs 19295.0\n",
+ "power factor is 0.78\n",
+ "load factor is 0.96\n",
+ "average cost per unit (kWh) in paisa is 15.4\n",
+ "total monthly bill and load factor is calculated wrong in the book due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 143\n",
+ "#Example 2.21:#consumer monthly bill ,power factor and average cost per unit\n",
+ "#calculate the consumer monthly bill ,power factor and average cost per unit\n",
+ "#given\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "kwh=125000.;#\n",
+ "kvarh=100000.;#\n",
+ "kw=180;#\n",
+ "kvar=125;#\n",
+ "d=30.;#days\n",
+ "t=24.;#hours a day\n",
+ "#calculations\n",
+ "kvah=sqrt(kwh**2+kvarh**2);#kVAh\n",
+ "mkva=sqrt(kw**2+kvar**2);#kVA\n",
+ "pkva=15;#rupees\n",
+ "pkvah=0.1;#reupees\n",
+ "tmb=pkva*mkva+pkvah*kvah;#in Rs\n",
+ "pf=kwh/kvah;#power factor\n",
+ "lf=((kwh/(d*t))/kw);#load factor\n",
+ "avcp=tmb/kwh;#in paisa\n",
+ "#results\n",
+ "print \"total monthly bill in Rs\",round(tmb)\n",
+ "print \"power factor is\",round(pf,2)\n",
+ "print \"load factor is\",round(lf,2)\n",
+ "print \"average cost per unit (kWh) in paisa is\",round(avcp*100,1)\n",
+ "print 'total monthly bill and load factor is calculated wrong in the book due to rounding off error'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 22 - pg 143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of revolution per kWh is,(revolutions/kWh)= 3273.0\n",
+ "full load speed r.p.s = 1.0\n",
+ "error (fast) in percentage = 0.84\n",
+ "numberof revolutions is calcultaed wrong in the textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 143\n",
+ "#Example 2.22:#full load speed and error\n",
+ "#calculate the full load speed and error\n",
+ "#given\n",
+ "v=220.;#volts\n",
+ "n=30.;#revolutions\n",
+ "i=5.;#in amperes\n",
+ "t=59.5;#seconds\n",
+ "#calculations\n",
+ "wrv=((v*i*10**-3)/(3600.));#kWh\n",
+ "mc=((3600.*10**3)/(v*i));#rev/kWh\n",
+ "ec=((v*i*10**-3)/(3600.));#kWh\n",
+ "sfl=mc*ec;#rps\n",
+ "hler=n*ec;#kWh\n",
+ "hlf=(((i/2.)*v*10**-3*t)/(3600.));#kWh\n",
+ "e=(hler-hlf)/hlf;#\n",
+ "#results\n",
+ "print \"number of revolution per kWh is,(revolutions/kWh)=\",round(mc)\n",
+ "print \"full load speed r.p.s = \",sfl\n",
+ "print \"error (fast) in percentage = \",round(e*100,2)\n",
+ "print 'numberof revolutions is calcultaed wrong in the textbook due to rounding off error'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 23 - pg 144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "shunt resistance when current is 10mA (ohm) = 52.63\n",
+ "shunt resistance when current is 75mA (ohm) = 6.71\n",
+ "shunt resistance when current is 100mA (ohm) = 2.004\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 144\n",
+ "#Example 2.23:#shunt resistance \n",
+ "#calculate the shunt resistance \n",
+ "#given\n",
+ "ra=1000.;#armature resistance in ohms\n",
+ "i=10.;#mA\n",
+ "ia=500.;#micro amperes\n",
+ "i1=75;#mA\n",
+ "i3=100;#mA\n",
+ "#calculations\n",
+ "rsh1=((ra)/((i/(ia*10**-3))-1));#in ohms\n",
+ "rsh2=((ra)/((i1/(ia*10**-3))-1));#in ohms\n",
+ "ia3=0.4*ia;#micro amperes\n",
+ "rsh3=((ra)/((i3/(ia3*10**-3))-1));#in ohms\n",
+ "#results\n",
+ "print \"shunt resistance when current is 10mA (ohm) = \",round(rsh1,2)\n",
+ "print \"shunt resistance when current is 75mA (ohm) = \",round(rsh2,2)\n",
+ "print \"shunt resistance when current is 100mA (ohm) = \",round(rsh3,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 24 - pg 144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "shunt resistance in milli ohm is 0.60012\n",
+ "power consumption in shunt is,(W)= 9.37\n",
+ "series resistance in kilo ohm is 24.997\n",
+ "power consumption in the series resistance is,(W)= 15.623\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 144\n",
+ "#Example 2.24:#shunt resistance and series resistance\n",
+ "#calculate the shunt resistance and series resistance\n",
+ "#given\n",
+ "i=125.;#amperes\n",
+ "ia=25.;#armature current in mA\n",
+ "ra=3;#ohms\n",
+ "#calculations\n",
+ "ish=i-(ia*10**-3);#amperes\n",
+ "rsh=((ia*ra)/ish);#milli ohms\n",
+ "pcs=ish**2*rsh*10**-3;#watts\n",
+ "rv=625;#volts\n",
+ "rs=((rv-(ra*ia*10**-3))/(ia*10**-3))*10**-3;#killo ohms\n",
+ "pc=(ia*10**-3)**2*rs*10**3;#watts\n",
+ "#results\n",
+ "print \"shunt resistance in milli ohm is\",round(rsh,5)\n",
+ "print \"power consumption in shunt is,(W)=\",round(pcs,2)\n",
+ "print \"series resistance in kilo ohm is\",rs\n",
+ "print \"power consumption in the series resistance is,(W)=\",round(pc,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25 - pg 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "when micro meter resistance is 25 ohm\n",
+ "multiplying power for the shunt for a 1250 ohm is 4.02\n",
+ "multiplying power for the shunt for a 2500 ohm is 2.01\n",
+ "when micro meter resistance is 2500 ohm\n",
+ "multiplying power for the shunt for a 1250 ohm is 6.0\n",
+ "multiplying power for the shunt for a 2500 ohm is 3.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 145\n",
+ "#Example 2.25:#mulitplying power\n",
+ "#calculate the mulitplying power in all cases\n",
+ "print \"when micro meter resistance is 25 ohm\"\n",
+ "#given\n",
+ "ra=25.;#ohms\n",
+ "rsh=5000.;#ohms\n",
+ "r1=1250.;#ohms\n",
+ "r2=2500;#ohms\n",
+ "#calculations and results\n",
+ "n=((ra+rsh)/r1);#\n",
+ "n2=((ra+rsh)/r2);#\n",
+ "print \"multiplying power for the shunt for a 1250 ohm is\",n\n",
+ "print \"multiplying power for the shunt for a 2500 ohm is\",n2\n",
+ "print \"when micro meter resistance is 2500 ohm\"\n",
+ "ra1=2500.;#ohms\n",
+ "rsh=5000.;#ohms\n",
+ "r1=1250.;#ohms\n",
+ "n1=((ra1+rsh)/r1);#\n",
+ "r2=2500.;#ohms\n",
+ "n3=((ra1+rsh)/r2);#\n",
+ "print \"multiplying power for the shunt for a 1250 ohm is\",n1\n",
+ "print \"multiplying power for the shunt for a 2500 ohm is\",n3\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 26 - pg 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "voltage is,(V)= 487.0\n",
+ "resistance is ,(k-ohm)= 27.0\n",
+ "resistance is calculated wrong in the textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 145\n",
+ "#Example 2.26:#resistance\n",
+ "#calculate the resistance\n",
+ "r1=185.;#ohm\n",
+ "r2=205.;#ohm\n",
+ "r3=215.;#ohm\n",
+ "R31=195.;#OHM\n",
+ "r4=200.;#ohm\n",
+ "r5=1100.;#ohm\n",
+ "v1=85.;#V\n",
+ "#calculations\n",
+ "R=r1+r2+r3+r4+R31;#ohm\n",
+ "R1=(R-r4)+((r5*r4)/(r5+r4));#\n",
+ "V=(v1*R1)/round(R1-(R-r4));#V\n",
+ "I=round(V)/R;#A\n",
+ "vd4=I*r4;#V\n",
+ "x=0.5;#% allowable\n",
+ "vd41=(vd4)-(vd4*x)/100;#\n",
+ "rv=((vd41*(R-r4)*r4))/((V*r4)-((R*vd41)));#\n",
+ "#results\n",
+ "print \"voltage is,(V)=\",round(V)\n",
+ "print \"resistance is ,(k-ohm)=\",round(rv*10**-3)\n",
+ "print 'resistance is calculated wrong in the textbook due to rounding off error'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 27 - pg 146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a). The sensitivity of an instrument,S1 = 0.0099\n",
+ "(b). The resistance,R(ohm) = 200.0\n",
+ "The relative sensitivity,S = 0.012\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 146\n",
+ "#Example 2.27: Sensitivity\n",
+ "#calculate the sensitivity and resistance, relative sensitivity\n",
+ "#given data :\n",
+ "I1=0.1;# in mA\n",
+ "R1=50.;# in ohm\n",
+ "I2=10.;# in mA\n",
+ "I3=10.1;# in mA\n",
+ "I5=10;# in mA\n",
+ "V=2;# in Volt\n",
+ "#calculations\n",
+ "I4=I2-I1;\n",
+ "Rsh=I1*R1/(I3-I1);\n",
+ "Im1=Rsh*I4/(R1+Rsh);\n",
+ "S1=(I1-Im1)/(I3-I4);\n",
+ "R=V/(I5*10**-3);\n",
+ "# formula : Im=((I3-Im)*(R-V))/R1;\n",
+ "Im2=(0.8*I3)-8;\n",
+ "Im3=(0.8*I4)-8\n",
+ "S2=(Im2-Im3)/(I3-I4);\n",
+ "S=S1/S2;\n",
+ "#results\n",
+ "print \"(a). The sensitivity of an instrument,S1 = \",round(S1,4)\n",
+ "print \"(b). The resistance,R(ohm) = \",R\n",
+ "print \"The relative sensitivity,S = \",round(S,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 28 - pg 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Shunt resistance,Rs(ohm) = 0.01\n",
+ "Inductance,Ls(micro-H) = 10.0\n",
+ "Current,Ia1(A) = 4.81\n",
+ "Error,(%)(low) = 3.8\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 147\n",
+ "#Example 2.28: Error\n",
+ "#calculate the Error, shunt resistance and inductance\n",
+ "#given data :\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "La=90*10**-6;# in micro-H\n",
+ "Ra=0.09;# in ohm\n",
+ "I=50;# in A\n",
+ "Ia=5;# in A\n",
+ "f=50;# in Hz\n",
+ "#calculations\n",
+ "LsbyRs=La/Ra;\n",
+ "w=2*math.pi*f;\n",
+ "Rs=Ra/9;\n",
+ "Ls=LsbyRs*Rs*10**6;\n",
+ "Ls1=0;# shunt is non-inductive \n",
+ "Ia1=(Rs*I)/sqrt((Ra+Rs)**2+(w**2*La**2));\n",
+ "Error=((Ia-Ia1)/Ia)*100;\n",
+ "#results\n",
+ "print \"Shunt resistance,Rs(ohm) = \",Rs\n",
+ "print \"Inductance,Ls(micro-H) = \",Ls\n",
+ "print \"Current,Ia1(A) = \",round(Ia1,2)\n",
+ "print \"Error,(%)(low) = \",round(Error,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 29 - pg 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "area is (cm^2)= 188.0\n",
+ "error is (%)= 8.11\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 148\n",
+ "#Example 2.29 :area and percentage error\n",
+ "#calculate the area and error\n",
+ "#given data \n",
+ "import math\n",
+ "from math import sqrt\n",
+ "v1=18.;#kV\n",
+ "c1=60.;#pF\n",
+ "v2=2.;#\n",
+ "d=2.5;#cm\n",
+ "#calculations\n",
+ "q=v2*10**3*c1*10**-12;#\n",
+ "cs=q/(v1*10**3);#F\n",
+ "eo=8.854*10**-12;#\n",
+ "a=((cs*d*10**-2)/(eo));#\n",
+ "c2=50;#pf\n",
+ "x=c1-c2;#\n",
+ "stf=((v2*10**3)**2*x*10**-12);#\n",
+ "v=sqrt(stf/(x*10**-12*2))/1000;#kV\n",
+ "c3=c2+(x/2);#pf\n",
+ "x1=c3/(cs*10**12);#\n",
+ "V1=(x1+1)*v#\n",
+ "V=10*sqrt(2);#V\n",
+ "er=((V-V1)/V1)*100;#\n",
+ "#results\n",
+ "print \"area is (cm^2)=\",round(a*10**4)\n",
+ "print \"error is (%)=\",round(er,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 30 - pg 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The percentage error in case 1 (%) = -15.25\n",
+ "The percentage error in case 2 (%) = -0.688\n",
+ "The answers are a bit different due to rounding off error in textbook\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 150\n",
+ "#Example 2.30: % Error\n",
+ "#calculate the percentage error \n",
+ "#given data :\n",
+ "Ra=2.;# in ohm\n",
+ "Rsh=0.0004;# constant\n",
+ "alfa=0.004;\n",
+ "t1=288.;# in K\n",
+ "t2=333.;# in K\n",
+ "I=100.;# in A\n",
+ "Rs=50.;# in ohm\n",
+ "#calculations\n",
+ "theta=t2-t1;\n",
+ "Ra1=Ra+(alfa*Ra*theta);\n",
+ "N1=1+(Ra/Rsh);\n",
+ "Ia=I/N1;\n",
+ "N2=1+(Ra1/Rsh);\n",
+ "Ia1=I/N2;\n",
+ "epsilon1=(Ia1-Ia)*100/Ia;\n",
+ "N3=1+((Ra+Rs)/Rsh);\n",
+ "Ia2=I*10**3/N3;\n",
+ "N4=1+((Ra1+Rs)/Rsh);\n",
+ "Ia3=I*10**3/N4;\n",
+ "epsilon2=(Ia3-Ia2)*100/Ia2;\n",
+ "#results\n",
+ "print \"The percentage error in case 1 (%) = \",round(epsilon1,2)\n",
+ "print \"The percentage error in case 2 (%) = \",round(epsilon2,3)\n",
+ "print 'The answers are a bit different due to rounding off error in textbook'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 31 - pg 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "electromotive force is (mV)= 24.632\n",
+ "resistance is (ohm)= 105.263\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 151\n",
+ "#Example 2.31: Resistance and electromotive force\n",
+ "#calculate the electromotive force and resistance\n",
+ "#given data :\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "i1=20.;# in mA\n",
+ "i2=400.;# in mA\n",
+ "v1=19.5;# in mV\n",
+ "v2=23.4;# in mV\n",
+ "y=100;#mV\n",
+ "#calculations\n",
+ "i3=i1/i2;\n",
+ "K1=i1/i3;\n",
+ "x1=v1/K1;#\n",
+ "k2=y/i3;#\n",
+ "x2=v2/k2;#\n",
+ "A=numpy.matrix([[1, -x1],[1, -x2]]);\n",
+ "B=numpy.matrix([[v1],[v2]]);#\n",
+ "X=numpy.dot(numpy.linalg.inv(A),B);#\n",
+ "#results\n",
+ "print \"electromotive force is (mV)=\",round(X[0,0],3)\n",
+ "print \"resistance is (ohm)=\",round(X[1,0],3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 32 - pg 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Error (%) = 1.4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 151\n",
+ "#Example 2.32: error\n",
+ "#calculate the error\n",
+ "#given data :\n",
+ "import math\n",
+ "V=20*10**3;# in V\n",
+ "v1=2*10**3;# in V\n",
+ "R=10*10**3;# in ohm\n",
+ "f=50.;# in Hz\n",
+ "#calculations\n",
+ "r=R*v1/V;\n",
+ "w=2*math.pi*f;\n",
+ "C=0.60*10**-6;# in F\n",
+ "v=V/((R/r)*math.sqrt(1+((w**2*C**2*r**2*(R-r)**2)/R**2)));\n",
+ "Error=((v1-v)/v1)*100;\n",
+ "#results\n",
+ "print \"Error (%) = \",round(Error,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 33 - pg 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(i). Flux in the core (mWb) = 0.591\n",
+ "(ii). The actual ratio K = 161.04\n",
+ "(iii). The phase angle (degree) = 0.215\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 152\n",
+ "#Example 2.33: Flux, actual ratio and phase angle\n",
+ "#calculate the Flux, actual ratio and phase angle\n",
+ "#given data :\n",
+ "import math\n",
+ "from math import sin,cos\n",
+ "I=5.;# in A\n",
+ "r1=4.;# in ohm\n",
+ "r2=0.2;# in ohm\n",
+ "Ts=160;# in turns\n",
+ "F=50;# in Hz\n",
+ "I0=6;# in A\n",
+ "theta1=30/57.3;# in radians\n",
+ "#calculations\n",
+ "Es=I*(r1+r2);\n",
+ "fi=Es*10**3/(4.44*Ts*F);\n",
+ "Ie=I0*cos(theta1);# in A\n",
+ "Im=I0*sin(theta1);# in A\n",
+ "dela=0;\n",
+ "K=Ts+(((Ie*cos(dela))+(Im*sin(dela)))/I);\n",
+ "theta=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(Ts*I));\n",
+ "#results\n",
+ "print \"(i). Flux in the core (mWb) = \",round(fi,3)\n",
+ "print \"(ii). The actual ratio K = \",round(K,2)\n",
+ "print \"(iii). The phase angle (degree) = \",round(theta,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 34 - pg 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "(a). The ratio error (%) = -0.0436\n",
+ "(b). phase angle is 0.0 degree 3.438 minutes \n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 152\n",
+ "#Example 2.34: The ratio errror and phase angle error\n",
+ "#calculate the ratio error and phase angle\n",
+ "#given data :\n",
+ "import math\n",
+ "from math import sin,cos,sqrt\n",
+ "I=5.;# in A\n",
+ "n=1000./5;# normal ratio\n",
+ "sin_alfa=0.4;\n",
+ "Im=1;# in A\n",
+ "dela=0;\n",
+ "#calculations\n",
+ "cos_alfa=sqrt(1-sin_alfa**2);\n",
+ "I0=Im/cos_alfa;\n",
+ "Ie=I0*sin_alfa;\n",
+ "K=n+(((Ie*cos(dela))+(Im*sin(dela)))/I);\n",
+ "er=(n-K)*100/K;\n",
+ "eph=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(n*I));\n",
+ "x=round(eph);#\n",
+ "y=eph-x;#\n",
+ "#results\n",
+ "print \"(a). The ratio error (%) = \",round(er,4)\n",
+ "print \"(b). phase angle is \",x,\" degree \",round(y*60,3),\" minutes \"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 35 - pg 153"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The ratio error,(%) = -0.744\n",
+ "The phase angle,(degree) = -0.252\n",
+ "The answers are a bit different due to rounding off error in textbook\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 153\n",
+ "#Example 2.35: The ratio errror and phase angle error\n",
+ "#calculate the ratio error and phase angle\n",
+ "#given data :\n",
+ "import math\n",
+ "from math import sin,cos,asin\n",
+ "I=5.;# in A\n",
+ "n=198.;# in turns\n",
+ "L=12.5;#in VA\n",
+ "f=50.;# assume in Hz\n",
+ "Ie=10.;# in A\n",
+ "Im=15.;# in A\n",
+ "l=1.*10**-3;# in H\n",
+ "#calculations\n",
+ "Kn=1000./I;\n",
+ "Zs=L/I**2;\n",
+ "Re=2*math.pi*f*l;# in ohm\n",
+ "dela=asin(Re/Zs)*180/math.pi;\n",
+ "K=n+(((Ie*cos(dela))+(Im*sin(dela)))/I);\n",
+ "Rerror=(Kn-K)*100./K;\n",
+ "eph=(180/math.pi)*(((Im*cos(dela))-(Ie*sin(dela)))/(n*I));\n",
+ "#results\n",
+ "print \"The ratio error,(%) = \",round(Rerror,3)\n",
+ "print \"The phase angle,(degree) = \",round(eph,3)\n",
+ "print 'The answers are a bit different due to rounding off error in textbook'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 36 - pg 154"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "phase angle is -4.7 minutes\n",
+ "load is (VA)= 12.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 154\n",
+ "#Example 2.36: phase angle error load in VA\n",
+ "#calculate the phase angle error load\n",
+ "#given data \n",
+ "import math\n",
+ "from math import sqrt\n",
+ "v1=1000.;#V\n",
+ "v2=100.;#V\n",
+ "xp=65.4;#ohm\n",
+ "rp=97.5;#ohm\n",
+ "pf=0.4;#\n",
+ "im=0.02;#A\n",
+ "Xp=110;#ohm\n",
+ "#calculations\n",
+ "r=v1/v2;#\n",
+ "sd=pf;#\n",
+ "csd=sqrt(1-pf**2);#\n",
+ "ie=im*(pf/csd);#A\n",
+ "th=((ie*xp)-(im*rp))/(r*v2);#rad\n",
+ "thd=th*(180/math.pi);#\n",
+ "iss=(r*((im*rp)-(ie*xp)))/(Xp);\n",
+ "va=iss*v2;#VA\n",
+ "#results\n",
+ "print \"phase angle is \",round(thd*60,1),\"minutes\"\n",
+ "print \"load is (VA)=\",round(va,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 37 - pg 155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "flux is (m-Wb)= 0.18\n",
+ "ratio error is (%)= -3.61\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 155\n",
+ "#Example 2.37: flux and current ratio error\n",
+ "#calculate the flux and ratio error\n",
+ "#given\n",
+ "n1=1000.;#A\n",
+ "n2=5.;#A\n",
+ "r=1.6;#ohm\n",
+ "wt=1.5;#watt\n",
+ "f=50;#Hz\n",
+ "cd1=1;#\n",
+ "sd=0;#\n",
+ "#calculations\n",
+ "kn=n1/n2;#\n",
+ "ts=kn;#\n",
+ "es=n2*r;#v\n",
+ "ph=es/(4.44*f*kn);#m Wb\n",
+ "ep=es/kn;#\n",
+ "ie=wt/ep;#A\n",
+ "K=((kn+(ie/n2)));#\n",
+ "re=((kn-K)/K)*100;#\n",
+ "#results\n",
+ "print \"flux is (m-Wb)=\",round(ph*10**3,2)\n",
+ "print \"ratio error is (%)=\",round(re,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 38 - pg 155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "RCF for case (a) = 1.0165\n",
+ "phase error for case (a) (%)= -1.623\n",
+ "phase angle error for case (a) 10.3 minutes\n",
+ "RCF for case (b) = 1.0075\n",
+ "phase error for case (b) (%)= -0.744\n",
+ "phase angle error for case (b)is 51.6 minutes\n",
+ "RCF for case (c) = 0.9925\n",
+ "phase error for case (c) (%)= 0.756\n",
+ "phase angle error for case (c) is 51.6 minutes\n",
+ "RCF for case (d) = 1.00825\n",
+ "phase error for case (d) (%)= -0.82\n",
+ "phase angle error for case (d) is 5.157 minutes\n",
+ "RCF for case (e) = 1.00375\n",
+ "phase error for case (e) (%)= -0.374\n",
+ "phase angle error for case (e) is 25.8 minutes\n",
+ "RCF for case (f) = 0.99625\n",
+ "phase error for case (f) (%)= 0.376\n",
+ "phase angle error for case (f) is 25.8 minutes\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 155\n",
+ "#Example 2.38: RCF ,ratio error and phase angle error\n",
+ "#calculate the ratio error, phase angle error and RCF in all cases\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "vp=2000.;#V\n",
+ "n=20.;#\n",
+ "va1=50.;#\n",
+ "pfl1=0.6;#lagging\n",
+ "va2=25.;#V\n",
+ "ie=0;#\n",
+ "im=0;#\n",
+ "cd1=0.6;#\n",
+ "rs1=0.75;#ohm\n",
+ "rp1=300.;#ohm\n",
+ "xs1=1.5;#ohm\n",
+ "xp1=600.;#ohm\n",
+ "#calculations and results\n",
+ "vs=vp/n;#\n",
+ "iss=va1/vs;#A\n",
+ "iss2=va2/vs;#A\n",
+ "sd1=sqrt(1-cd1**2);#\n",
+ "Rp1=n**2*rs1+rp1;#ohm\n",
+ "Xp1=n**2*xs1+xp1;#ohm\n",
+ "vps1=n+((iss/n)*(Rp1*cd1+Xp1*sd1))/vs;#\n",
+ "RCF1=vps1/n;#\n",
+ "er1=((n-vps1)/vps1)*100;#%\n",
+ "per1=((iss*(Xp1*cd1-Rp1*sd1))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a=round(per1);#\n",
+ "x1=per1-per1a;#\n",
+ "print \"RCF for case (a) = \",RCF1\n",
+ "print \"phase error for case (a) (%)=\",round(er1,3)\n",
+ "print \"phase angle error for case (a) \",round(x1*60,1),\" minutes\"\n",
+ "cd11=1;#\n",
+ "sd11=sqrt(1-cd11**2);#\n",
+ "vps2=n+((iss/n)*(Rp1*cd11+Xp1*sd11))/vs;#\n",
+ "RCF2=vps2/n;#\n",
+ "er2=((n-vps2)/vps2)*100;#%\n",
+ "per2=((iss*(Xp1*cd11-Rp1*sd11))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a1=round(per2);#\n",
+ "x2=per1-per1a1;#\n",
+ "print \"RCF for case (b) =\",RCF2\n",
+ "print \"phase error for case (b) (%)=\",round(er2,3)\n",
+ "print \"phase angle error for case (b)is \",round(per2*60,1),\" minutes\"\n",
+ "cd12=0.6;#\n",
+ "sd12=-0.8;#\n",
+ "vps3=n+((iss/n)*(Rp1*cd12+Xp1*sd12))/vs;#\n",
+ "RCF3=vps3/n;#\n",
+ "er3=((n-vps3)/vps3)*100;#%\n",
+ "per3=((iss*(Xp1*cd12-Rp1*sd12))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a1=round(per2);#\n",
+ "x2=per1-per1a1;#\n",
+ "print \"RCF for case (c) =\",RCF3\n",
+ "print \"phase error for case (c) (%)=\",round(er3,3)\n",
+ "print \"phase angle error for case (c) is \",round(per3*60,1),\" minutes\"\n",
+ "cd13=0.6;#\n",
+ "sd13=0.8;#\n",
+ "vps4=n+((iss2/n)*(Rp1*cd13+Xp1*sd13))/vs;#\n",
+ "RCF4=vps4/n;#\n",
+ "er4=((n-vps4)/vps4)*100;#%\n",
+ "per4=((iss2*(Xp1*cd13-Rp1*sd13))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a1=round(per2);#\n",
+ "x2=per1-per1a1;#\n",
+ "print \"RCF for case (d) =\",RCF4\n",
+ "print \"phase error for case (d) (%)=\",round(er4,2)\n",
+ "print \"phase angle error for case (d) is \",round(per4*60,3),\" minutes\"\n",
+ "cd14=1;#\n",
+ "sd14=0;#\n",
+ "vps5=n+((iss2/n)*(Rp1*cd14+Xp1*sd14))/vs;#\n",
+ "RCF5=vps5/n;#\n",
+ "er5=((n-vps5)/vps5)*100;#%\n",
+ "per5=((iss2*(Xp1*cd14-Rp1*sd14))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a1=round(per2);#\n",
+ "x2=per1-per1a1;#\n",
+ "print \"RCF for case (e) =\",RCF5\n",
+ "print \"phase error for case (e) (%)=\",round(er5,3)\n",
+ "print \"phase angle error for case (e) is \",round(per5*60,1),\" minutes\"\n",
+ "cd15=0.6;#\n",
+ "sd16=-0.8;#\n",
+ "vps6=n+((iss2/n)*(Rp1*cd15+Xp1*sd16))/vs;#\n",
+ "RCF6=vps6/n;#\n",
+ "er6=((n-vps6)/vps6)*100;#%\n",
+ "per6=((iss2*(Xp1*cd15-Rp1*sd16))/(n**2*vs))*(180/math.pi);#degree\n",
+ "per1a1=round(per2);#\n",
+ "x2=per1-per1a1;#\n",
+ "print \"RCF for case (f) =\",RCF6\n",
+ "print \"phase error for case (f) (%)=\",round(er6,3)\n",
+ "print \"phase angle error for case (f) is \",round(per6*60,1),\" minutes\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 39 - pg 158"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "ratio error (%)= -1.26\n",
+ "RCF = 1.01275\n",
+ "phase angle error (degree)= 0.73\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 158\n",
+ "#Example 2.39: ,ratio error and phase angle error\n",
+ "#calculate the ratio error,RCF and phase angle error\n",
+ "#given\n",
+ "import math\n",
+ "from math import cos, sin\n",
+ "vp=1000.;#V\n",
+ "iss=5.;#A\n",
+ "VA=25.;#\n",
+ "wt=0.25;#W\n",
+ "im=15.;#A\n",
+ "xs=1.;#ohm\n",
+ "rs=5.;#ohm\n",
+ "#calculations\n",
+ "n=vp/iss;#\n",
+ "vs=VA/iss;#\n",
+ "vp=iss/n;#V\n",
+ "ie=wt/vp;#A\n",
+ "dl=math.atan(xs/rs)*57.3;#\n",
+ "dlr=dl*(math.pi/180);#\n",
+ "K=n+((ie*cos(dl/57.3)+im*sin(dl/57.3))/iss);#\n",
+ "re=((n-K)/K)*100;#per\n",
+ "RCF=K/n;#\n",
+ "eph=(180/math.pi)*(((im*cos(dl/57.3))-(ie*sin(dl/57.3)))/(n*iss));\n",
+ "#results\n",
+ "print \"ratio error (%)=\",round(re,2)\n",
+ "print \"RCF =\",round(RCF,5)\n",
+ "print \"phase angle error (degree)=\",round(eph,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 40 - pg 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "true value of voltage is,(V)= 2030.0\n",
+ "true value of current is,(A)= 80.4\n",
+ "true value of power is ,(kW)= 149.4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 159\n",
+ "#Example 2.40: true value of voltage ,current and power\n",
+ "#calculate the true value of voltage ,current and power\n",
+ "#given\n",
+ "import math\n",
+ "from math import acos,cos\n",
+ "vs=102.;#V\n",
+ "iss=4.;#A\n",
+ "ws=375.;#W\n",
+ "rcf=0.995;#\n",
+ "rcf1=1.005;#\n",
+ "a1=2000.;#\n",
+ "a2=100.;#\n",
+ "#calculations\n",
+ "ph=acos(ws/(iss*vs))*57.3;#degree\n",
+ "ph1=round(ph);#\n",
+ "x=ph-ph1;#\n",
+ "y=x*60;#\n",
+ "angd=y+22+10;#\n",
+ "ang=angd/60.;#\n",
+ "ta=ph1+ang;#\n",
+ "nr=a1/a2;#\n",
+ "avr=rcf*nr;#\n",
+ "pv=avr*vs;#\n",
+ "acr=rcf1*(a2/nr);#\n",
+ "pc=acr*iss*iss;#A\n",
+ "psd=pv*pc*cos(ta/57.3)*10**-3;#\n",
+ "#results\n",
+ "print \"true value of voltage is,(V)=\",round(pv)\n",
+ "print \"true value of current is,(A)=\",pc\n",
+ "print \"true value of power is ,(kW)=\",round(psd,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 41 - pg 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 46,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "primary current is,(A)= 498.415\n",
+ "phase error is (radian)= 0.0058\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 160\n",
+ "#Example 2.41:primary current ,phase error \n",
+ "#calculate the primary current ,phase error \n",
+ "#given\n",
+ "import math,cmath\n",
+ "from math import cos,sin\n",
+ "zs=0.433+1j*0.25;#ohm\n",
+ "zs1=0.15+1j*0.0;#ohm\n",
+ "nt=2.;#turns\n",
+ "l1=8.;#\n",
+ "l2=4.;#\n",
+ "tnt=198;#turns\n",
+ "iss=5;#A\n",
+ "#calculations\n",
+ "zs2=zs+zs1;#ohm\n",
+ "zsa=math.sqrt((zs2.real)**2+(zs2.imag)**2);#\n",
+ "zsng=math.atan(zs2.imag/zs2.real);#\n",
+ "ie=l2/nt;#\n",
+ "im=l1/nt;#\n",
+ "K=((tnt/2.)+((ie*cos(zsng))+(im*sin(zsng)))/iss);#\n",
+ "ip=K*iss;#A\n",
+ "th=((im*cos(zsng))-(ie*sin(zsng)))/((tnt/2)*iss);#\n",
+ "#results\n",
+ "print \"primary current is,(A)=\",round(ip,3)\n",
+ "print \"phase error is (radian)=\",round(th,4)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 42 - pg 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "ratio error (%)= -1.26\n",
+ "RCF = 1.01275\n",
+ "phase angle error (degree)= 0.73\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 158\n",
+ "#Example 2.39: ,ratio error and phase angle error\n",
+ "#calculate the ratio error,RCF and phase angle error\n",
+ "#given\n",
+ "import math\n",
+ "from math import cos, sin\n",
+ "vp=1000.;#V\n",
+ "iss=5.;#A\n",
+ "VA=25.;#\n",
+ "wt=0.25;#W\n",
+ "im=15.;#A\n",
+ "xs=1.;#ohm\n",
+ "rs=5.;#ohm\n",
+ "#calculations\n",
+ "n=vp/iss;#\n",
+ "vs=VA/iss;#\n",
+ "vp=iss/n;#V\n",
+ "ie=wt/vp;#A\n",
+ "dl=math.atan(xs/rs)*57.3;#\n",
+ "dlr=dl*(math.pi/180);#\n",
+ "K=n+((ie*cos(dl/57.3)+im*sin(dl/57.3))/iss);#\n",
+ "re=((n-K)/K)*100;#per\n",
+ "RCF=K/n;#\n",
+ "eph=(180/math.pi)*(((im*cos(dl/57.3))-(ie*sin(dl/57.3)))/(n*iss));\n",
+ "#results\n",
+ "print \"ratio error (%)=\",round(re,2)\n",
+ "print \"RCF =\",round(RCF,5)\n",
+ "print \"phase angle error (degree)=\",round(eph,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 43 - pg 161"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 48,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "current is (mA)= 1.1474\n",
+ "The answer is a bit different due to rounding off error in textbook\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 161\n",
+ "#Example 2.43 :percentage change in current\n",
+ "#calculate the current\n",
+ "#given data\n",
+ "import math,cmath\n",
+ "r=0.5;#kilo ohm\n",
+ "r1=1.;#kilo ohm\n",
+ "f=50.;#Hz\n",
+ "V=1.;#V\n",
+ "#calculations\n",
+ "z1=((1j*r1*r)/(r1+1j*r));#kilo-ohm\n",
+ "z1m=abs(z1);#kilo-ohm\n",
+ "z2=((1j*r1*r)/(r+1j*r1));#kilo-ohm\n",
+ "z2m=abs(z2);#kilo-ohm\n",
+ "tz=z1m+z2m;#kilo-ohm\n",
+ "i=V/tz;#A\n",
+ "v1=i*z1m*10**-3;#V\n",
+ "v2=i*10**-3*z2m;#V\n",
+ "df=f-((f*5)/100);#Hz\n",
+ "rc1=((r*df)/f);#k-ohm\n",
+ "rc2=((r1*df)/f);#k-ohm\n",
+ "z1n=((1j*rc1)/(r1+1j*rc1));#\n",
+ "z1nm=abs(z1n);#k-ohm\n",
+ "z2n=((1j*rc2*r)/(r+1j*rc2));#\n",
+ "z2nm=abs(z2n);#k-ohm\n",
+ "znw=z1nm+z2nm;#k-ohm\n",
+ "inn=V/znw;#\n",
+ "#results\n",
+ "print \"current is (mA)=\",round(inn,4)\n",
+ "print 'The answer is a bit different due to rounding off error in textbook'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 44 - pg 162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "inductance is (H)= 9.73\n",
+ "frequency is (Hz)= 41.7\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 162\n",
+ "#Example 2.44 :Inductance\n",
+ "#calculate the inductance and frequency\n",
+ "#given data\n",
+ "import math,cmath\n",
+ "c=1.;#micro-F\n",
+ "f1=60.;#Hz\n",
+ "f=50.;#Hz\n",
+ "#calculations\n",
+ "l1=((c*10**6)/(f1**2*(2*math.pi)**2));#\n",
+ "r1=100;#ohm\n",
+ "z1=r1+1j*((2*math.pi*f*l1)-(1/(2*math.pi*f*c*10**-6)));#ohm\n",
+ "c2=1.5;#micro-F\n",
+ "l2=((-z1.imag)+(1/(2*math.pi*c2)))/100;#H\n",
+ "f2=(1/(2*math.pi))*math.sqrt(1/(l2*c2*10**-6));#Hz\n",
+ "#results\n",
+ "print \"inductance is (H)=\",round(l2,2)\n",
+ "print \"frequency is (Hz)=\",round(f2,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 45 - pg 163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "true value of voltage is,(V)= 2030.0\n",
+ "true value of current is,(A)= 80.4\n",
+ "true value of power is ,(kW)= 149.4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 159\n",
+ "#Example 2.40: true value of voltage ,current and power\n",
+ "#calculate the true value of voltage ,current and power\n",
+ "#given\n",
+ "import math\n",
+ "from math import acos,cos\n",
+ "vs=102.;#V\n",
+ "iss=4.;#A\n",
+ "ws=375.;#W\n",
+ "rcf=0.995;#\n",
+ "rcf1=1.005;#\n",
+ "a1=2000.;#\n",
+ "a2=100.;#\n",
+ "#calculations\n",
+ "ph=acos(ws/(iss*vs))*57.3;#degree\n",
+ "ph1=round(ph);#\n",
+ "x=ph-ph1;#\n",
+ "y=x*60;#\n",
+ "angd=y+22+10;#\n",
+ "ang=angd/60.;#\n",
+ "ta=ph1+ang;#\n",
+ "nr=a1/a2;#\n",
+ "avr=rcf*nr;#\n",
+ "pv=avr*vs;#\n",
+ "acr=rcf1*(a2/nr);#\n",
+ "pc=acr*iss*iss;#A\n",
+ "psd=pv*pc*cos(ta/57.3)*10**-3;#\n",
+ "#results\n",
+ "print \"true value of voltage is,(V)=\",round(pv)\n",
+ "print \"true value of current is,(A)=\",pc\n",
+ "print \"true value of power is ,(kW)=\",round(psd,1)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 46 - pg 163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 51,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Series resistance,Rs(ohm) = 8000.0\n",
+ "answer is wrong in the textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 160\n",
+ "#Example 2.42: Resistance\n",
+ "#calculate the Series resistance\n",
+ "import math\n",
+ "#given data :\n",
+ "f=50.;#/ in Hz\n",
+ "r=2000.;# in ohm\n",
+ "L=0.5;# in H\n",
+ "V=100.;# in V\n",
+ "#calculations\n",
+ "Zm=math.sqrt(r**2+(2*math.pi*f*L));\n",
+ "im=V/Zm;\n",
+ "Rs=(500.-(im*Zm))/im;\n",
+ "#results\n",
+ "print \"Series resistance,Rs(ohm) = \",round(Rs)\n",
+ "print 'answer is wrong in the textbook due to rounding off error'\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}