{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 2: BASICS OF MAGNETIC CIRCUITS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page number 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "l = 4.0      #Length(m)\n",
      "w = 2.0      #Width(m)\n",
      "B = 0.12     #Magnetic flux density(Tesla)\n",
      "\n",
      "#Calculation \n",
      "A = l*w      #Area(m^2)\n",
      "flux = B*A   #Magnetic flux(Wb)\n",
      "\n",
      "#Result\n",
      "print('Magnetic flux , \u03a6 = %.2f Wb' %flux)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic flux , \u03a6 = 0.96 Wb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page number 54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d_in = 3.0      #Inside diameter(cm)\n",
      "d_out = 6.0     #Outside diameter(cm)\n",
      "N = 200.0       #Number of turns\n",
      "I = 3.0         #Current(A)\n",
      "flux = 0.015    #Flux(Wb)\n",
      "\n",
      "#Calculation\n",
      "d = d_in+(d_out-d_in)/2      #Distance(cm)\n",
      "l = math.pi*d                #Mean length of core(cm)\n",
      "A = math.pi*d**2/4*10**-4    #Area(m^2)\n",
      "B = flux/A                   #Flux density(Wb/m^2)\n",
      "MMF = N*I                    #Magnetomotive force(At)\n",
      "H = N*I/(l*10**-2)           #Magnetic field intensity(At/m)\n",
      "\n",
      "#Result\n",
      "print('Flux density , B = %.2f Wb/m^2' %B)\n",
      "print('Magnetomotive force , MMF = %.1f At' %MMF)\n",
      "print('Magnetic field intensity , H = %.2f At/m' %H)\n",
      "print('\\nNOTE : ERROR : Calculation & unit mistakes in textbook')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flux density , B = 9.43 Wb/m^2\n",
        "Magnetomotive force , MMF = 600.0 At\n",
        "Magnetic field intensity , H = 4244.13 At/m\n",
        "\n",
        "NOTE : ERROR : Calculation & unit mistakes in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3, Page number 55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "u_r = 625.0  #Relative permeability of rectangular core\n",
      "N = 25.0     #Number of turns\n",
      "I = 2.0      #Current(A)\n",
      "a = 5.5      #Lenght of rectangular core(cm)\n",
      "b = 1.5      #Width of rectangular core(cm)\n",
      "\n",
      "#Calculation\n",
      "l = 2*(a+b)                 #Mean length of core(cm)\n",
      "H = N*I/(l*10**-2)          #Magnetic field intensity(At/m)\n",
      "u_0 = 4*math.pi*10**-7      #Permeability of free space(H/m)\n",
      "u = u_0*u_r                 #Permeabilty\n",
      "B = u*H                     #Magnetic flux density(Wb/m^2)\n",
      "\n",
      "#Result\n",
      "print('Magnetic field intensity , H = %.f At/m ' %H)\n",
      "print('Permeabilty , \u00b5 = %.2e ' %u)\n",
      "print('Magnetic flux density , B = %.2f Wb/m^2 ' %B)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field intensity , H = 357 At/m \n",
        "Permeabilty , \u00b5 = 7.85e-04 \n",
        "Magnetic flux density , B = 0.28 Wb/m^2 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4, Page number 57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 6.0          #Number of turns\n",
      "I = 3.0          #Current(A)\n",
      "flux = 0.056     #Flux(Wb)\n",
      "\n",
      "#Calculation\n",
      "MMF = N*I        #Magnetomotive force(At)\n",
      "R_m = MMF/flux   #Reluctance(At/Wb)\n",
      "\n",
      "#Result\n",
      "print('Magnetomotive force , MMF = %.f At' %MMF)\n",
      "print('Reluctance , R_m = %.1f At/Wb' %R_m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetomotive force , MMF = 18 At\n",
        "Reluctance , R_m = 321.4 At/Wb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5, Page number 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "I = 15.0                      #Current through conductor(A)\n",
      "N = 10.0                      #Number of turns\n",
      "u_0 = 4.0*math.pi*10**-7      #Permeability of free space(H/m)\n",
      "u_r = 1.0                     #Relative permeability of air medium\n",
      "r = 0.015                     #Distance(m)\n",
      "\n",
      "#Calculation\n",
      "B = u_0*u_r*N*I/(2*math.pi*r)   #Magnetic flux density(T)\n",
      "\n",
      "#Result\n",
      "print('Magnetic flux density , B = %.1e T' %B)\n",
      "print('\\nNOTE : ERROR : Distance is 1.5 cm & not 2.5 cm as given in textbook')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic flux density , B = 2.0e-03 T\n",
        "\n",
        "NOTE : ERROR : Distance is 1.5 cm & not 2.5 cm as given in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6, Page number 60-61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N = 200.0        #Number of turns \n",
      "d_in = 7.0       #Inner diameter(cm)\n",
      "d_out = 10.0     #Outer diameter(cm)\n",
      "A = 0.005        #Cross sectional area(m^2)\n",
      "I = 5.0          #Current through coil(A)\n",
      "\n",
      "#Calculation\n",
      "u_0 = 4.0*math.pi*10**-7       #Permeability of free space(H/m)\n",
      "R = d_out-d_in\n",
      "l = round(2*math.pi*R/100,2)   #Mean circumference length(m)\n",
      "#For case(i)\n",
      "H = N*I/l                      #Magnetic field intensity(At/m)\n",
      "#For case(ii)\n",
      "B = u_0*H*1000                 #Flux density(mWb/m^2)\n",
      "#For case(iii)\n",
      "flux = B*A*1000                #Flux(\u00b5Wb)\n",
      "\n",
      "#Result\n",
      "print('Magnetic field intensity , H = %.1f At/m' %H)\n",
      "print('Flux density , B = %.1f mWb/m^2' %B)\n",
      "print('Flux , \u03a6 = %.f \u00b5Wb' %flux)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnetic field intensity , H = 5263.2 At/m\n",
        "Flux density , B = 6.6 mWb/m^2\n",
        "Flux , \u03a6 = 33 \u00b5Wb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7, Page number 62-63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.1          #Length(m)\n",
      "w = 0.01         #Width(m)\n",
      "h = 0.1          #Height(m)\n",
      "N = 450.0        #Number of turns\n",
      "I = 0.2          #Current(A)\n",
      "u_r = 850.0      #Relative permeability\n",
      "\n",
      "#Calculation\n",
      "MMF = N*I                          #Magnetomotive force(At)\n",
      "l_c = (h-w)*4                      #Mean length of the path(m)\n",
      "A = w*w                            #Cross sectional area(m^2)\n",
      "u_0 = 4.0*math.pi*10**-7           #Permeability of free space(H/m)\n",
      "R_m = l_c/(u_0*u_r*A)              #Reluctance(At/Wb)\n",
      "flux = MMF/R_m                     #Flux(Wb)\n",
      "B = flux/A                         #Magnetic flux density(Wb/m^2)\n",
      "H = B/(u_0*u_r)                    #Magnetic field intensity(At/m)\n",
      "\n",
      "#Result\n",
      "print('Flux , \u03a6 = %.2e Wb' %flux)\n",
      "print('Flux density , B = %.2f Wb/m^2' %B)\n",
      "print('Field intensity , H = %.1f At/m' %H)\n",
      "print('\\nNOTE : Changes in obtained answer from that of textbook is due to more precision')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flux , \u03a6 = 2.67e-05 Wb\n",
        "Flux density , B = 0.27 Wb/m^2\n",
        "Field intensity , H = 250.0 At/m\n",
        "\n",
        "NOTE : Changes in obtained answer from that of textbook is due to more precision\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8, Page number 64-65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N = 450.0       #Number of turns wound on left side of limb\n",
      "A = 4.0         #Cross sectional area(m^2)\n",
      "phi_2 = 3.0     #Flux(Wb) in the right limb\n",
      "u_r = 500.0     #Relative permeability\n",
      "l_1 = 0.12      #Length of middle limb(m)\n",
      "l_2 = 0.24      #Length of right limb(m)\n",
      "\n",
      "#Calculation\n",
      "u_0 = 4.0*math.pi*10**-7        #Permeability of free space(H/m)\n",
      "phi_1 = phi_2*l_2/l_1           #Flux in middle limb(Wb)\n",
      "phi = phi_1+phi_2               #Total flux(Wb)\n",
      "B = phi/A                       #Flux density in the left limb(Wb/m^2)\n",
      "H = B/(u_0*u_r)                 #Magnetic field intensity(At/m)\n",
      "MMF = H*l_2                     #Magnetomotive force(At)\n",
      "B_2 = phi_2/A                   #Flux density in the right limb(Wb/m^2)\n",
      "H_2 = B_2/(u_0*u_r)             #Magnetic field(At/m)\n",
      "MMF_2 = H_2*l_2                 #Magnetomotive force(At)\n",
      "MMF_t = MMF+MMF_2               #Total magnetomotive force(At)\n",
      "I = MMF_t/N                     #Current(A)\n",
      "\n",
      "#Result\n",
      "print('Current , I = %.2f A' %I)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current , I = 2.55 A\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.9, Page number 67-68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.45               #Mean length(m)\n",
      "A = 25.0*10**-4        #Cross sectional area(m^2)\n",
      "l_g = 0.8*10**-3       #Length of air gap(m)\n",
      "N = 500.0              #Number of turns \n",
      "I = 1.25               #Current(A) \n",
      "flux = 1.5*10**-3      #Flux(Wb)\n",
      "\n",
      "#Calculation\n",
      "u_0 = 4.0*math.pi*10**-7        #Permeability of free space(H/m)\n",
      "B = flux/A                      #Magnetic flux density(Wb/m^2)\n",
      "MMF = N*I                       #Magnetomotive force(At)\n",
      "R_m = MMF/flux                  #Reluctance(At/Wb)\n",
      "H = B/u_0                       #Magnetizing force(At/m)\n",
      "MMF_ag = H*l_g                  #Magnetomotive force(At)\n",
      "MMF_i = MMF-MMF_ag              #Magnetomotive force for iron ring(At)\n",
      "H_i = MMF_i/l                   #Magnetic field intensity for iron part(At/m)\n",
      "u_r = B/(u_0*H_i)               #Relative permeability for iron\n",
      "\n",
      "#Result\n",
      "print('Reluctance , R_m = %.2e At/Wb' %R_m)\n",
      "print('Relative permeability of the iron ring iron , \u00b5_r = %.f ' %u_r)\n",
      "print('\\nNOTE : Reluctance part is not solved in textbook')\n",
      "print('ERROR : Current is 1.25A not 2.25A & flux is 1.5 mWb not 2.5 mWb as given in textbook')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reluctance , R_m = 4.17e+05 At/Wb\n",
        "Relative permeability of the iron ring iron , \u00b5_r = 884 \n",
        "\n",
        "NOTE : Reluctance part is not solved in textbook\n",
        "ERROR : Current is 1.25A not 2.25A & flux is 1.5 mWb not 2.5 mWb as given in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10, Page number 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "A = 2.0*10**-4        #Cross sectional area(m^2)\n",
      "N = 200.0             #Number of turns \n",
      "flux = 1.5*10**-3     #Flux(Wb)\n",
      "u_r = 4000.0          #Relative permeability of core\n",
      "l_g = 0.01            #Length of air gap(m)\n",
      "a = 9.0               #Length(cm)\n",
      "w = 3.0               #Width(cm)\n",
      "\n",
      "#Calculation\n",
      "u_0 = 4.0*math.pi*10**-7        #Permeability of free space(H/m)\n",
      "R_mg = l_g/(u_0*A)              #Reluctance of air gap(At/Wb)\n",
      "l = 4*(a-w-w+(1.5+1.5))-1       #Mean length of iron(cm)\n",
      "u = u_0*u_r                     #Permeability\n",
      "R_mi = l*10**-2/(u*A)           #Reluctance of iron(At/Wb)\n",
      "R_mt = R_mg+R_mi                #Total reluctance(At/Wb)\n",
      "I = R_mt*flux/N                 #Current(A)\n",
      "\n",
      "#Result\n",
      "print('Total reluctance , R_mt = %.3e AT/Wb' %R_mt)\n",
      "print('Current flowing through the coil , I = %.1f A' %I)\n",
      "print('\\nNOTE : ERROR : Total flux is 1.5 mWB & not 2.5 mWB as given in textbook question')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total reluctance , R_mt = 4.002e+07 AT/Wb\n",
        "Current flowing through the coil , I = 300.1 A\n",
        "\n",
        "NOTE : ERROR : Total flux is 1.5 mWB & not 2.5 mWB as given in textbook question\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.11, Page number 70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 150.0    #Current through conductor(A)\n",
      "l = 2.0      #Conductor length(m)\n",
      "B = 0.35     #Magnetic flux density(T)\n",
      "\n",
      "#Calculation\n",
      "F = B*l*I    #Force(N)\n",
      "\n",
      "#Result\n",
      "print('Force , F = %.f N' %F)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force , F = 105 N\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.12, Page number 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 25.0*10**-2      #Length of air-core coil(m)\n",
      "A = 4.0*10**-4       #Cross sectional area(m^2)\n",
      "N = 65.0             #Number of turns\n",
      "\n",
      "#Calculation\n",
      "u_0 = 4.0*math.pi*10**-7        #Permeability of free space(H/m)\n",
      "u_r = 1.0\n",
      "u = u_0*u_r                     #Permeability\n",
      "L = N**2*u*A/l*10**6            #Inductance(\u00b5H)\n",
      "\n",
      "#Result\n",
      "print('Inductance of the coil , L = %.1f \u00b5H' %L)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inductance of the coil , L = 8.5 \u00b5H\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.13, Page number 80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "k_h = 110.0       #Hysteresis co-efficient(J/m^3)\n",
      "V_cvol = 0.005    #Volume of core(m^3)\n",
      "B_m = 1.12        #Maximum flux density(T)\n",
      "f = 60.0          #Frequency(Hz)\n",
      "n = 1.6\n",
      "\n",
      "#Calculation\n",
      "P_h = k_h*V_cvol*B_m**n*f   #Hysteresis loss(W)\n",
      "\n",
      "#Result\n",
      "print('Hysteresis loss , P_h = %.2f W' %P_h)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hysteresis loss , P_h = 39.56 W\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}