{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 Transmission Lines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_1 pgno:65"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum field =  V/m per volt 42064315640.1\n"
     ]
    }
   ],
   "source": [
    "#Chapter 2, Example 1, page 65\n",
    "#Calculate the maximum field at the sphere surface\n",
    "\n",
    "#Calulating Field at surface E based on figure 2.31 and table 2.3\n",
    "from math import pi\n",
    "Q1 = 0.25\n",
    "e0 = 8.85418*10**-12 #Epselon nought\n",
    "RV1= ((1/0.25**2)+(0.067/(0.25-0.067)**2)+(0.0048/(0.25-0.067)**2))\n",
    "RV2= ((0.25+0.01795+0.00128)/(0.75-0.067)**2)\n",
    "RV= RV1+RV2\n",
    "E = (Q1*RV)/(4*pi*e0)\n",
    "print\"Maximum field =  V/m per volt\",E\n",
    "\n",
    "#Answers vary due to round off error\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_2 pgno:66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Part a\t\n",
      "Equivalent radius =  m \t0.0887411967465\n",
      "Charge per bundle =  uC/m \t4.88704086264e-06\n",
      "Charge per sunconducter =  uC/m \t2.44352043132e-06\n",
      "\tPart b\n",
      "\tSub part 1\t\n",
      "Maximum feild =  kV/m \t2607466.95017\n",
      "Maximum feild =  kV/m \t2412255.52075\n",
      "Maximum feild =  kV/m \t2509861.23546\n",
      "\tSub part 2\t\n",
      "EO1 =  kV/m \t2597956.83558\n",
      "EO2 =  kV/m \t2597429.47744\n",
      "EI1 =  kV/m \t2402709.21273\n",
      "EI2 =  kV/m \t2402258.0563\n",
      "\tPart c\t\n",
      "The average of the maximum gradient =  kV/m \t2597693.15651\n"
     ]
    }
   ],
   "source": [
    "#Chapter 2, Exmaple 2, page 66\n",
    "\n",
    "\n",
    "#calculation based on figure 2.32\n",
    "from math import sqrt,pi,log\n",
    "\n",
    "#(a)Charge on each bundle\n",
    "print\"Part a\\t\"\n",
    "req = sqrt(0.0175*0.45)\n",
    "print\"Equivalent radius =  m \\t\", req\n",
    "V = 400*10**3 #Voltage\n",
    "H = 12. #bundle height in m\n",
    "d = 9. #pole to pole spacing in m\n",
    "e0 = 8.85418*10**-12 #Epselon nought\n",
    "Hd = sqrt((2*H)**2+d**2)#2*H**2 + d**2\n",
    "Q = V*2*pi*e0/(log((2*H/req))-log((Hd/d)))\n",
    "q = Q/2\n",
    "print\"Charge per bundle =  uC/m \\t\",Q #micro C/m\n",
    "print\"Charge per sunconducter =  uC/m \\t\",q #micro C/m\n",
    "\n",
    "#(b part i)Maximim & average surface feild\n",
    "print\"\\tPart b\"\n",
    "print\"\\tSub part 1\\t\"\n",
    "r = 0.0175 #subconductor radius\n",
    "R = 0.45 #conductor to subconductor spacing\n",
    "MF = (q/(2*pi*e0))*((1/r)+(1/R)) # maximum feild\n",
    "print\"Maximum feild =  kV/m \\t\",MF\n",
    "MSF = (q/(2*pi*e0))*((1/r)-(1/R)) # maximum surface feild\n",
    "print\"Maximum feild =  kV/m \\t\",MSF\n",
    "ASF = (q/(2*pi*e0))*(1/r) # Average surface feild\n",
    "print\"Maximum feild =  kV/m \\t\",ASF\n",
    "\n",
    "#(b part ii) Considering the two sunconductors on the left\n",
    "print\"\\tSub part 2\\t\"\n",
    "#field at the outer point of subconductor #1 \n",
    "drO1 = 1/(d+r)\n",
    "dRrO1 = 1/(d+R+r)\n",
    "EO1 =  MF -((q/(2*pi*e0))*(drO1+dRrO1))\n",
    "print\"EO1 =  kV/m \\t\",EO1\n",
    "#field at the outer point of subconductor #2 \n",
    "drO2 = 1/(d-r)\n",
    "dRrO2 = 1/(d-R-r)\n",
    "EO2 =  MF -((q/(2*pi*e0))*(dRrO2+drO2))\n",
    "print\"EO2 =  kV/m \\t\",EO2\n",
    "\n",
    "#field at the inner point of subconductor #1 \n",
    "drI1 = 1/(d-r)\n",
    "dRrI1 = 1/(d+R-r)\n",
    "EI1 =  MSF -((q/(2*pi*e0))*(drI1+dRrI1))\n",
    "print\"EI1 =  kV/m \\t\",EI1\n",
    "#field at the inner point of subconductor #2 \n",
    "drI2 = 1/(d+r)\n",
    "dRrI2 = 1/(d-R+r)\n",
    "EI2 =  MSF -((q/(2*pi*e0))*(dRrI2+drI2)) \n",
    "print\"EI2 =  kV/m \\t\",EI2\n",
    "\n",
    "#(part c)Average of the maximim gradient\n",
    "print\"\\tPart c\\t\"\n",
    "Eavg = (EO1+EO2)/2\n",
    "print\"The average of the maximum gradient =  kV/m \\t\",Eavg\n",
    "\n",
    "#Answers might vary due to round off error\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_3 pgno:69"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Electric Feild =  V/m \t35950238891.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter 2, Exmaple 3, page 69\n",
    "#Electric feild induced at x\n",
    "from math import pi\n",
    "e0 = 8.85418*10**-12 #Epselon nought\n",
    "q = 1 # C/m\n",
    "C = (q/(2*pi*e0))\n",
    "#Based on figure 2.33\n",
    "E = C-(C*(1/3+1/7))+(C*(1+1/5+1/9))+(C*(1/5+1/9))-(C*(1/3+1/7))\n",
    "print\"Electric Feild =  V/m \\t\",E\n",
    "\n",
    "#Answers might vary due to round off error\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_4 pgno:70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\tThickness of graded design=  cm \t4.24264068712\n",
      "Curve =  cm**2 \t62.4264068712\n",
      "V1 =  cm**3 \t47402.906725\n",
      "Thickness of regular design =  cm \t14.684289433\n",
      "V2 =  cm**3 \t861.944682812\n"
     ]
    }
   ],
   "source": [
    "#Chapter 2, Exmaple 4, page 70\n",
    "#Calculate the volume of the insulator\n",
    "from math import sqrt,pi,e\n",
    "#Thinkness of graded design\n",
    "V = 150*sqrt(2)\n",
    "Ebd = 50\n",
    "T = V/Ebd\n",
    "print\"\\tThickness of graded design=  cm \\t\",T\n",
    "#Based on figure 2.24\n",
    "r = 2 # radius of the conductor\n",
    "l = 10 #length of graded cylinder; The textbook uses 10 instead of 20\n",
    "zr = l*(T+r)\n",
    "print\"Curve =  cm**2 \\t\",zr\n",
    "#Volume of graded design V1\n",
    "V1 = 4*pi*zr*(zr-r)\n",
    "print\"V1 =  cm**3 \\t\",V1 #Unit is wrong in the textbook\n",
    "#Thickness of regular design as obtained form Eq.2.77\n",
    "pow = V/(2*Ebd)\n",
    "t = 2*(e**pow-1)\n",
    "print\"Thickness of regular design =  cm \\t\",t\n",
    "#Volume of regular design V2\n",
    "V2 = pi*((2+t)**2-4)\n",
    "print\"V2 =  cm**3 \\t\",V2#unit not mentioned in textbook\n",
    " \n",
    "#Answers may vary due to round 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
}