{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 02 : Magnetic Circuits and Induction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page No 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "U_o=4*math.pi*10**-7\n",
      "U_r=6000\n",
      "l_g=0.0006\n",
      "l_c=.40\n",
      "A_c=.04*.04\n",
      "B_c=1.2\n",
      "N=600\n",
      "\n",
      "#Calculataions\n",
      "i=(1/(U_o*N))*(((B_c*l_c)/U_r)+(B_c*l_g))\n",
      "phi=B_c*A_c\n",
      "lmda=N*phi\n",
      "A_g=(.04+l_g)**2\n",
      "B_g=phi/A_g\n",
      "\n",
      "#Results\n",
      "print(\"Neglecting fringing,current(A)=%.2f ohm\" %i)\n",
      "print(\"Flux(Wb)=%.4f \" %phi)\n",
      "print(\"Flux linkages(Wb-turns)=%.2f \" %lmda)\n",
      "print(\"Fringing taken into account,current(A)=%.2f \" %B_g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Neglecting fringing,current(A)=1.06 ohm\n",
        "Flux(Wb)=0.0019 \n",
        "Flux linkages(Wb-turns)=1.15 \n",
        "Fringing taken into account,current(A)=1.16 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#Calculation of current reqd to produce flux in the given magnetic circuit.\n",
      "\n",
      "U_o=4*math.pi*10**-7\n",
      "U_r=4000\n",
      "N=600\n",
      "l_c=.30\n",
      "l_g=0\n",
      "dia=.02\n",
      "phi=.5*10**-3        #flux\n",
      "\n",
      "#Calculations\n",
      "A=(math.pi/4)*dia**2\n",
      "i=0;\n",
      "R=((l_c/U_r)+l_g)/(U_o*A)\n",
      "i=(phi*R)/N\n",
      "\n",
      "print(\"no air gap current(A) =%.4f \" %i)\n",
      "#l_g=0.001\n",
      "R=((l_c/U_r)+l_g)/(U_o*A)\n",
      "i=(phi*R)/N\n",
      "print(\"no air gap current(A) =%.4f \" %i)\n",
      "\n",
      "B_g=phi/A\n",
      "print(\"B(T) =%.4f \" %B_g)\n",
      "H_g=B_g/U_o\n",
      "\n",
      "AT_g=H_g*0.001\n",
      "\n",
      "print(\"AT_g =%.4f \" %AT_g)\n",
      "\n",
      "H_c=3000\n",
      "AT_c=H_c*0.30\n",
      "print(\"AT_c =%.4f \" %AT_c)\n",
      "\n",
      "i=(AT_g+AT_c)/N\n",
      "\n",
      "#Results\n",
      "print(\"from magnetisation data, current(A) =%.4f \" %i)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "no air gap current(A) =0.1583 \n",
        "no air gap current(A) =0.1583 \n",
        "B(T) =1.5915 \n",
        "AT_g =1266.5148 \n",
        "AT_c =900.0000 \n",
        "from magnetisation data, current(A) =3.6109 \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#Determination of mmf of the exciting coil\n",
      "\n",
      "U_o=4*math.pi*10**-7\n",
      "A1=.0001\n",
      "A2=.0002\n",
      "l1=.025*10**-2\n",
      "l2=.02*10**-2\n",
      "phi=.75*10**-3\n",
      "\n",
      "#Calculations\n",
      "def reluctance(l,U_r,A):\n",
      "\tRe=l/(U_o*U_r*A)\n",
      "\treturn Re\n",
      "\n",
      "def mmf(R1,R2,R3):\n",
      "\tNi=phi*(R3+((R1*R2)/(R1+R2)))\n",
      "\treturn Ni\n",
      "\n",
      "R_g1=reluctance(l1,1,A1)\n",
      "R_g2=reluctance(l2,1,A1)\n",
      "R_g3=reluctance(l2,1,A2)\n",
      "print(\"when U_r=1,mmf(AT) =%.4f \" %mmf(R_g1,R_g2,R_g3))\n",
      "L1=l1*2*10**3\n",
      "L2=l2*10**3\n",
      "R_c1=reluctance(L1,5000,A1)\n",
      "R_c2=reluctance(L1,5000,A1)\n",
      "R_c3=reluctance(L2,5000,A2)\n",
      "\n",
      "#Results\n",
      "print(\"when U_r=5000,mmf(AT) =%.4f \" %mmf(R_c1+R_g1,R_c2+R_g2,R_c3+R_g3))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when U_r=1,mmf(AT) =1259.9766 \n",
        "when U_r=5000,mmf(AT) =1680.3089 \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 Page No 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variablesimport math\n",
      "# Exciting current calculation needed to setup reqd flux\n",
      "\n",
      "U_o=4*math.pi*10**-7\n",
      "A1=800*10**-6\n",
      "A2=600*10**-6\n",
      "l1=1*10**-3            #air gap length\n",
      "l2=160*10**-3          #length of central limb\n",
      "l3=400*10**-3          #length of side limb\n",
      "phi=.8*10**-3\n",
      "N=500\n",
      "\n",
      "#Calculations\n",
      "def fd(A):\n",
      "\tB=phi/A\n",
      "\treturn B\n",
      "\n",
      "def mmf(l,B):\n",
      "\tF=l/B\n",
      "\treturn F\n",
      "\n",
      "#air gap\n",
      "B_g=fd(A1)\n",
      "F_g=mmf(l1,B_g)/U_o\n",
      "print(\"F_g(AT) =%.4f \" %F_g)\n",
      "#central limb\n",
      "B_c=B_g\n",
      "F_c=mmf(l2,B_c)/10**-3\n",
      "print(\"F_c(AT)=%.4f \" %F_c)\n",
      "#outer limb                flux is divided into half\n",
      "B_o=fd(A2)/2\n",
      "F_o=mmf(l3,B_o)/(4*10**-3)\n",
      "print(\"F_o(AT)=%.4f \" %F_o)\n",
      "i=(F_g+F_c+F_o)/N            #    total mmf/no of turns\n",
      "\n",
      "#Results\n",
      "print(\"exciting current(A)=%.4f \" %i)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "F_g(AT) =795.7747 \n",
        "F_c(AT)=160.0000 \n",
        "F_o(AT)=150.0000 \n",
        "exciting current(A)=2.2115 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5, Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "# determination of excitation coil mmf\n",
      "U_o=4*math.pi*10**-7 \n",
      "A1=25*10**-4 \n",
      "A2=12.5*10**-4 \n",
      "A3=25*10**-4 \n",
      "l1=.5             #length of side limb(ab+cd)\n",
      "l2=.2           #length of central limb(ad)\n",
      "l3=.5             #length of side limb(dea)\n",
      "l4=.25*10**-3           #length of air gap\n",
      "phi=.75*10**-3 \n",
      "N=500 \n",
      "\n",
      "#Calculations\n",
      "def fd(A):\n",
      "\tB=phi/A\n",
      "\treturn B\n",
      "\t\n",
      "def flux(B,l):\n",
      "\tF=B*l/(U_o)\n",
      "\treturn F\n",
      "\t\n",
      "def fl(H,l):\n",
      "\tf=H*l\n",
      "\treturn f\n",
      "\n",
      "B_abcd=fd(A1) \n",
      "F_bc=flux(B_abcd,l4) \n",
      "print(\"B_abcd(T) =%.4f \" %B_abcd)\n",
      "H_ab=200                         #for cast iron for B=0.3\n",
      "F_abcd=fl(H_ab,l1) \n",
      "F_ad=F_abcd+F_bc \n",
      "H_ad=F_ad/l2 \n",
      "print(\"H_ad(AT/m) =%.4f \" %H_ad)\n",
      "B_ad=1.04                        #for cast iron for H=800\n",
      "phi_ad=B_ad*A2 \n",
      "phi_dea=phi+phi_ad \n",
      "B_dea=phi_dea/A3 \n",
      "H_dea=500                         #for cast iron for B=.82\n",
      "F_dea=H_dea*l3 \n",
      "F=F_dea+F_ad \n",
      "\n",
      "#Results\n",
      "print(\"reqd mmf(AT) =%.4f \" %F)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "B_abcd(T) =0.3000 \n",
        "H_ad(AT/m) =798.4155 \n",
        "reqd mmf(AT) =409.6831 \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7, Page No 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#determination of self and mutual inductance b/w 2 coils\n",
      "\n",
      "U_o=4*math.pi*10**-7 \n",
      "U_r=1600 \n",
      "A1=4*10**-4 \n",
      "A2=4*10**-4 \n",
      "A0=2*10**-4 \n",
      "N1=500 \n",
      "N2=1000 \n",
      "\n",
      "#Calculations\n",
      "l1=.01*((6+0.5+1)*2+(4+2)) \n",
      "l2=.01*((3+0.5+1)*2+(4+2)) \n",
      "l0=.01*(4+2) \n",
      "\n",
      "def reluc(l,A):\n",
      "\tR=l/(U_o*U_r*A)\n",
      "\treturn R\n",
      "\t\n",
      "R1=reluc(l1,A1) \n",
      "R2=reluc(l2,A2) \n",
      "R0=reluc(l0,A0) \n",
      "\n",
      "def re(r0,r1,r2):\n",
      "\tre=r0+((r1*r2)/(r1+r2)) \n",
      "\treturn re\n",
      "\n",
      "print('coil 1 excited with 1A') \n",
      "R_1=re(R1,R0,R2) \n",
      "phi1=N1/R_1 \n",
      "phi2=phi1*R0/(R0+R2) \n",
      "L11=N1*phi1 \n",
      "print(\"self inductance(H) =%.4f \" %L11)\n",
      "M21=N2*phi2 \n",
      "print(\"mutual inductance(H) =%.4f \" %M21)\n",
      "print('coil 2 excited with 1A') \n",
      "R_2=re(R2,R0,R1) \n",
      "phi2=N2/R_2 \n",
      "L22=N2*phi2 \n",
      "print(\"self inductance(H) =%.4f \" %L22)\n",
      "M12=M21 \n",
      "\n",
      "#Results\n",
      "print(\"mutual inductance(H) =%.4f \" %M12)\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "coil 1 excited with 1A\n",
        "self inductance(H) =0.7267 \n",
        "mutual inductance(H) =0.6460 \n",
        "coil 2 excited with 1A\n",
        "self inductance(H) =3.5529 \n",
        "mutual inductance(H) =0.6460 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8 Page No 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#determination of R_c,R_g,L,W_f\n",
      "\n",
      "U_o=4*math.pi*10**-7 \n",
      "U_r=6000 \n",
      "l_g=0.0006 \n",
      "l_c=.40 \n",
      "A_c=.04*.04 \n",
      "B_c=1.2 \n",
      "N=600 \n",
      "\n",
      "#Calculations\n",
      "def current(B_g):\n",
      "\ti=(1/(U_o*N))*(((B_c*l_c)/U_r)+(B_g*l_g))\n",
      "\treturn i\n",
      "\n",
      "print(\"neglecting fringing,current(A)= %.4f \" %current(B_c))\n",
      "\n",
      "phi=B_c*A_c \n",
      "print(\"flux(Wb)=%.4f \" %phi)\n",
      "\n",
      "def flux_linkage(phi):\n",
      "\tlmda=N*phi\n",
      "\treturn lmda\n",
      "\n",
      "print(\"flux linkages(Wb-turns)= %.4f \" %flux_linkage(phi))\n",
      "\n",
      "def reluc(l,U,A):\n",
      "\tR=l/(U_o*U*A)\n",
      "\treturn R\n",
      "R_c=reluc(l_c,U_r,A_c) \n",
      "print(\"R_c=%.4f \" %R_c)\n",
      "R_g=reluc(l_g,1,A_c) \n",
      "print(\"R_g=%.4f \" %R_g)\n",
      "\n",
      "L=N**2/(R_c+R_g) \n",
      "print(\"coil inductance(H)=%.4f \" %L)\n",
      "W_f=(N*phi)**2/(2*L) \n",
      "\n",
      "#Results\n",
      "print(\"energy stored in the magnetic field(J)=%.4f \" %W_f)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "neglecting fringing,current(A)= 1.0610 \n",
        "flux(Wb)=0.0019 \n",
        "flux linkages(Wb-turns)= 1.1520 \n",
        "R_c=33157.2798 \n",
        "R_g=298415.5183 \n",
        "coil inductance(H)=1.0857 \n",
        "energy stored in the magnetic field(J)=0.6112 \n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}