{
 "metadata": {
  "name": "",
  "signature": "sha256:477bd6a59c5c41b919502c0727994ee33a0452f8b8b2d97d47ae8f442ad83a0e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 - POWER SYSTEM COMPONENTS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate base impedence \n",
      "#Given data :\n",
      "BaseVoltage=1100.##in Volts\n",
      "BasekVA=10**6##kVA\n",
      "BasekV=BaseVoltage/1000.##kV\n",
      "IB=BasekVA/BasekV##in Ampere\n",
      "ZB=BasekV*1000./IB##in ohm\n",
      "print '%s %.5f' %(\"Base Impedence (in ohm) :\",ZB)#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Base Impedence (in ohm) : 0.00121\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Per unit resistance \n",
      "#Given data :\n",
      "R=5.##in ohm\n",
      "kVA_B=10.##kVA\n",
      "kV_B=11.##kV\n",
      "RB=kV_B**2*1000/kVA_B##in ohm\n",
      "Rpu=R/RB##in ohm\n",
      "print '%s %.6f' %(\"Per unit resistance (pu) :\",Rpu)#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Per unit resistance (pu) : 0.000413\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Leakage reactance Per unit\n",
      "#Given data :\n",
      "kVA_B=2.5##kVA\n",
      "kV_B=0.4##kV\n",
      "reactance=0.96##in ohm\n",
      "Z_BLV=kV_B**2*1000./kVA_B##in ohm\n",
      "Zpu=reactance/Z_BLV##in ohm\n",
      "print '%s %.3f' %(\"Leakage reactance Per unit (pu) :\",Zpu)#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Leakage reactance Per unit (pu) : 0.015\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Leakage reactance Per unit\n",
      "import cmath\n",
      "import math\n",
      "#Given data :\n",
      "Zr=30.\n",
      "Zi=110.##in ohm\n",
      "kVA_B=100.*1000.##kVA\n",
      "kV_B=132.##kV\n",
      "Z_BLV=kV_B**2*1000./kVA_B##in ohm\n",
      "Zpur=Zr*kVA_B/kV_B**2/1000.##pu\n",
      "Zpui=Zi*kVA_B/kV_B**2/1000.##pu\n",
      "print '%s' %(\"Leakage reactance Per unit (pu) :\")#\n",
      "print '%.3f %s %.3f' %(Zpur,'+j',Zpui)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Leakage reactance Per unit (pu) :\n",
        "0.172 +j 0.631\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate New Per unit impedence\n",
      "#Given data :\n",
      "oldkVA_B=30000##kVA\n",
      "oldkV_B=11##kV\n",
      "oldZpu=0.2##pu\n",
      "newkVA_B=50000.##kVA\n",
      "newkV_B=33.##kV\n",
      "newZpu=oldZpu*newkVA_B/oldkVA_B*(oldkV_B/newkV_B)**2##pu\n",
      "print '%s %.3f' %(\"New Per unit impedence(pu) :\",newZpu)#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "New Per unit impedence(pu) : 0.037\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}