summaryrefslogtreecommitdiff
path: root/Elements_of_Electromagnetics/chapter_8.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Elements_of_Electromagnetics/chapter_8.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Elements_of_Electromagnetics/chapter_8.ipynb')
-rw-r--r--Elements_of_Electromagnetics/chapter_8.ipynb454
1 files changed, 454 insertions, 0 deletions
diff --git a/Elements_of_Electromagnetics/chapter_8.ipynb b/Elements_of_Electromagnetics/chapter_8.ipynb
new file mode 100644
index 00000000..e9adf8d2
--- /dev/null
+++ b/Elements_of_Electromagnetics/chapter_8.ipynb
@@ -0,0 +1,454 @@
+{
+ "metadata": {
+ "name": "chapter_8.ipynb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 8: Magnetic Forces, Materials and Devices<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.1, Page number: 308<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "A charged particle of mass 2 kg and charge 3 C starts at point (1,-2,0)\n",
+ "with velocity 4a_x+3a_z m/s in an electric field 12a_x+10a_y V/m.\n",
+ "At time t=1s, determine \n",
+ "(a) The acceleration of the particle \n",
+ "(b) Its velocity \n",
+ "(c) Its kinetic energy \n",
+ "(d) Its position '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "m=2 #mass in kg\n",
+ "q=3 #charge in C\n",
+ "v=array([4,0,3]) #initial velocity in m/s\n",
+ "E=array([12,10,0]) #electric field in V/m\n",
+ "t=1 #time in sec\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "a=q*E/m #acceleration in m/s^2 after 1 sec\n",
+ "u=array([18*t+4,15*t,3]) #velocity in m/s after 1 sec\n",
+ "modofu=scipy.sqrt(dot(u,u))\n",
+ "KE=0.5*m*(modofu)**2 #kinetic energy in J at t=1 sec\n",
+ "s=array([9*t**2+4*t+1,7.5*t**2-2,3*t]) #position after 1 sec in m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'At time t=1 sec,'\n",
+ "print' The acceleration of the particle =',a,'m/s^2'\n",
+ "print 'Its velocity =',u,'m/s' \n",
+ "print 'Its kinetic energy =',KE,'J'\n",
+ "print 'Its position =',s,'m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At time t=1 sec,\n",
+ " The acceleration of the particle = [18 15 0] m/s^2\n",
+ "Its velocity = [22 15 3] m/s\n",
+ "Its kinetic energy = 718.0 J\n",
+ "Its position = [ 14. 5.5 3. ] m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.6, Page number: 322"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "A small current loop L1 with magnetic moment 5a_z A/m^2 is located at the origin while \n",
+ "another small loop current I2 with magnetic moment 3a_y A/m^2 is located at (4, - 3, 10). \n",
+ "Determine the torque on L2 . '''\n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ar=array([1,0,0]) #Unit vector along radial direction\n",
+ "ath=array([0,1,0]) #Unit vector along theta direction\n",
+ "aph=array([0,0,1]) #Unit vector along phi direction \n",
+ "x=4\n",
+ "y=-3\n",
+ "z=10\n",
+ "muo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "m1=5 #magnetic moment in A/m^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "r=scipy.sqrt(x**2+y**2+z**2)\n",
+ "p=scipy.sqrt(x**2+y**2)\n",
+ "sinphi=y/p\n",
+ "cosphi=x/p\n",
+ "sintheta=1/scipy.sqrt(5)\n",
+ "costheta=2/scipy.sqrt(5)\n",
+ "B1=muo*m1*(2*costheta*ar+sintheta*ath)/(4*scipy.pi*r**3)\n",
+ "m2=3*(sintheta*sinphi*ar+costheta*sinphi*ath+cosphi*aph)\n",
+ "T2=cross(m2,B1)*10**9\n",
+ "T2x=round(dot(T2,ar),3)\n",
+ "T2y=round(dot(T2,ath),3)\n",
+ "T2z=round(dot(T2,aph),3)\n",
+ "T2r=array([T2x,T2y,T2z]) #torque in nNm\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Torque T2 =',T2r,'nNm'\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Torque T2 = [-0.384 1.536 0.902]\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.7, Page number: 330"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "Region 0 < Z < 2 m is occupied by an infinite slab of permeable material (mur = 2.5). If \n",
+ "B = IOy ax - 5x ay mWb/m^2 within the slab, determine: (a) J, (b) Jb, (c) M, (d) Kb on \n",
+ "z=0 '''\n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "muo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "mur=2 #relative permeability\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "J=(-5-10)*10**-6/(4*scipy.pi*10**-7*2.5) #in kA/m^2\n",
+ "Jb=1.5*J #in kA/m^2\n",
+ "MbyB=(1.5)*10**4/(4*scipy.pi*2.5) \n",
+ "Mv=MbyB*10*10**-3*ax+MbyB*5*10**-3*ay\n",
+ "Kb=cross(az,Mv)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'J =',round(J,3),'kA/m^2'\n",
+ "print 'Jb =',round(Jb,3),'kA/m^2'\n",
+ "print 'M =(',round(dot(Mv,ax),3),'y,',round(dot(Mv,ay),3),'x, 0) kA/m'\n",
+ "print 'Kb =(',round(dot(Kb,ax),3),'x,',round(dot(Kb,ay),3),'y, 0) kA/m' \n",
+ " \n",
+ "\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "J = -4.775 kA/m^2\n",
+ "Jb = -7.162 kA/m^2\n",
+ "M =( 4.775 y, 2.387 x, 0) kA/m\n",
+ "Kb =( -2.387 x, 4.775 y, 0) kA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.8, Page number: 332<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "Given that H=-2a_x + 6a_y + 4 a_z A/m in region y - x - 2 <= 0 where \n",
+ "mu_1=5mu_0 , calculate \n",
+ "(a) M_1 and B_1 \n",
+ "(b) H_2 and B_2 in region y - x - 2 >= 0 where mu_2=2mu_0 '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction \n",
+ "H1=array([-2,6,4]) #in A/m\n",
+ "mu0=4*scipy.pi*10**-7 #permeability of free space\n",
+ "mur1=5 #relative permeabililty in region 1\n",
+ "mur2=2 #relative permeabililty in region 2\n",
+ "an=array([-1,1,0])/scipy.sqrt(2)\n",
+ "\n",
+ "#Calculatios\n",
+ "\n",
+ "mu1=mu0*mur1\n",
+ "mu2=mu0*mur2\n",
+ "M1=(mur1-1)*H1 # magnetisation in region 1 in A/m\n",
+ "B1=mu1*H1*10**6 # field in micro Wb/m^2\n",
+ "B1x=round(dot(B1,ax),2) # x component of B1\n",
+ "B1y=round(dot(B1,ay),1) # y component of B1\n",
+ "B1z=round(dot(B1,az),2) # z component of B1\n",
+ "B1r=array([B1x,B1y,B1z]) # B1 rounded to 2 decimal places\n",
+ "H1n=dot(H1,an)*an \n",
+ "H1t=H1-H1n\n",
+ "H2t=H1t # using transverse boundary condition\n",
+ "H2n=(mu1/mu2)*H1n # using normal boundary condition\n",
+ "H2=H2t+H2n # in A/m\n",
+ "B2=mu2*H2*10**6 # field in micro Wb/m^2\n",
+ "B2x=round(dot(B2,ax),2) # x component of B2\n",
+ "B2y=round(dot(B2,ay),2) # y component of B2\n",
+ "B2z=round(dot(B2,az),2) # z component of B2\n",
+ "B2r=array([B2x,B2y,B2z]) # B2 rounded to 2 decimal places\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'M1= ',M1,'A/m'\n",
+ "print 'B1= ',B1r,'micro Wb/m^2'\n",
+ "print 'H2= ',H2,'A/m'\n",
+ "print 'B2= ',B2r,'micro Wb/m^2'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M1= [-8 24 16] A/m\n",
+ "B1= [-12.57 37.7 25.13] micro Wb/m^2\n",
+ "H2= [ -8. 12. 4.] A/m\n",
+ "B2= [-20.11 30.16 10.05] micro Wb/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.14, Page number: 350<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "The toroidal core of Figure 8.26(a) has p_o = 10 cm and a circular cross \n",
+ "section with a = 1 cm. If the core is made of steel (mu = 1000mu_o) and \n",
+ "has a coil with 200 turns. calculate the amount of current that will\n",
+ "produce a flux of 0.5 mWb in the core. '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "p=10*10**-2 #in m\n",
+ "a=1*10**-2 #in m\n",
+ "Ur=1000 #relative permeability\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "n=200 #number of turns\n",
+ "phi=0.5*10**-3 #flux in the core in Wb\n",
+ "U=Uo*Ur #permeability of steel core\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "I=phi*2*scipy.pi*p/(U*n*scipy.pi*a*a) #current in A\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The current that will produce a flux of 0.5 mWb =',round(I,3),'A'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current that will produce a flux of 0.5 mWb = 3.979 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.15, Page number: 351<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "In the magnetic circuit of Figure 8.27, calculate the current in the coil \n",
+ "that will produce a magnetic flux density of 1.5 Wb/m^2 in the air gap\n",
+ "assuming that mu_1 = 50 mu_o and that all branches have the same\n",
+ "cross-sectional area of 10 cm^2 . '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "Ur=50 #relative permeability of coil\n",
+ "l1=30*10**-2\n",
+ "s=10*10**-4 \n",
+ "l3=9*10**-2\n",
+ "la=1*10**-2 \n",
+ "B=1.5 #flux density in Wb/m^2\n",
+ "N=400 #number of turns\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "R1=l1/(Uo*Ur*s)\n",
+ "R2=R1\n",
+ "R3=l3/(Uo*Ur*s)\n",
+ "Ra=la/(Uo*s)\n",
+ "R=R1*R2/(R1+R2)\n",
+ "Req=R3+Ra+R\n",
+ "I=B*s*Req/N #current in A\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The current required =',round(I,3),'A'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current required = 44.165 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.16, Page number: 353<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "A U-shaped electromagnet shown in Figure 8.29 is designed to lift a \n",
+ "400-kg mass (which includes the mass of the keeper). The iron\n",
+ "yoke (mu_r = 3000) has a cross section of 40 cm^2 and mean length of 50 cm,\n",
+ "and the air gaps are each 0.1 mm long. Neglecting the reluctance of \n",
+ "the keeper, calculate the number of turns in the coil when\n",
+ "the excitation current is 1 A. '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "m=400 #mass in kg\n",
+ "g=9.8 #acceleration due to gravity in m/s^2\n",
+ "Ur=3000 #relative permeability of the iron yoke\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "S=40*10**-4 #cross sectional area of iron yoke in m^2\n",
+ "la=1*10**-4 #air gaps in m\n",
+ "li=50*10**-2 #mean length of yoke in m\n",
+ "I=1 #excitation current in A \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "B=scipy.sqrt(m*g*Uo/S) #field in Wb/m^2\n",
+ "Ra=2*la/(Uo*S) \n",
+ "Ri=li/(Uo*Ur*S) \n",
+ "N=(Ra+Ri)/(Ra*Uo)*B*la #number of turns\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The nmber of turns in the coil when the excitation current is 1 A ='\n",
+ "print round(N,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The nmber of turns in the coil when the excitation current is 1 A =\n",
+ "162.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file