{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 - Single phase transformers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.1 Pg No: 275"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Number of turns in primary winding = 353\n",
      "   Number of turns in secondary winding = 35\n",
      "(b)Emf per turn = 14.00 Volts\n"
     ]
    }
   ],
   "source": [
    "A=500*10**-4 #  m**2\n",
    "B_max=1.5 #  tesla\n",
    "f=50 #  Hz\n",
    "E_1=5000 #  volts\n",
    "E_2=500 #  volts\n",
    "S_f=0.85 #  Stacking factor\n",
    "N_1=int(E_1/(4.44*f*B_max*A*S_f))\n",
    "print '(a)Number of turns in primary winding = %d'%N_1\n",
    "N_2=int(E_2*N_1/E_1)\n",
    "print '   Number of turns in secondary winding = %d'%N_2\n",
    "print '(b)Emf per turn = %.2f Volts'%(E_1/N_1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.2 Pg No: 275"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Number of turns in primary winding = 600\n",
      "   Number of turns in secondary winding = 400\n",
      "(b)Cross section area of the core = 3.54e-03 m**2\n"
     ]
    }
   ],
   "source": [
    "B_max=1.4 #  tesla\n",
    "f=50 #  Hz\n",
    "E_1=660 #  volts\n",
    "E_2=440 #  volts\n",
    "E_T1=1.1 #  volts\n",
    "N_1=int(E_1/E_T1)\n",
    "print '(a)Number of turns in primary winding = %d'%N_1\n",
    "N_2=int(E_2*N_1/E_1)\n",
    "print '   Number of turns in secondary winding = %d'%N_2\n",
    "A=E_1/(4.44*f*N_1*B_max)\n",
    "print '(b)Cross section area of the core = %.2e m**2'%A"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.3 Pg No: 276"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of turns in primary winding = 2880\n",
      "Number of turns in secondary winding = 288\n"
     ]
    }
   ],
   "source": [
    "Phy_max=7.82*10**-3 #  webers\n",
    "f=50 #  Hz\n",
    "E_1=5000 #  volts\n",
    "E_2=500 #  volts\n",
    "N_1=int(E_1/(4.44*f*Phy_max))\n",
    "print 'Number of turns in primary winding = %d'%N_1\n",
    "N_2=int(E_2*N_1/E_1)\n",
    "print 'Number of turns in secondary winding = %d'%N_2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.4 Pg No: 277"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Secondary Voltage = 500.00 volts\n",
      "(b)Primary current = 20.00 amperes\n",
      "   Secondary current = 100.00 amperes\n",
      "(c)Max value of flux = 0.02 Wb\n"
     ]
    }
   ],
   "source": [
    "f=50 #  Hz\n",
    "E_1=2500 #  volts\n",
    "N_1=500\n",
    "N_2=100\n",
    "P=50*1000 #  watts\n",
    "E_2=E_1*N_2/N_1\n",
    "print '(a)Secondary Voltage = %.2f volts'%E_2\n",
    "I_1=P/E_1\n",
    "print '(b)Primary current = %.2f amperes'%I_1\n",
    "I_2=P/E_2\n",
    "print '   Secondary current = %.2f amperes'%I_2\n",
    "Phy_max=E_1/(4.44*f*N_1)\n",
    "print '(c)Max value of flux = %.2f Wb'%Phy_max"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.5 Pg No: 278"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)No load power factor = 0.455\n",
      "(b)Iron loss component of current = 0.02 amperes\n",
      "(c)Magnetising component of current = 0.04 amperes\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "f=50 #  Hz\n",
    "W=80 #  watts\n",
    "V=4400 #  volts\n",
    "I=0.04 #  amperes\n",
    "pf=W/(V*I)\n",
    "print '(a)No load power factor = %.3f'%pf\n",
    "I_w=I*pf\n",
    "print '(b)Iron loss component of current = %.2f amperes'%I_w\n",
    "I_m=I*sqrt(1-pf**2)\n",
    "print '(c)Magnetising component of current = %.2f amperes'%I_m"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.6 Pg No: 279"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)No load input power = 110.00 watts\n",
      "(b)No load power factor = 0.38\n",
      "   Magnetising component of current = 1.20 amperes\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "f=50 #  Hz\n",
    "P=20*1000 #  watts\n",
    "E_1=2200 #  volts\n",
    "E_2=220 #  volts\n",
    "I=1.3 #  amperes\n",
    "I_w=0.5 #  amperes\n",
    "W=E_2*I_w\n",
    "print '(a)No load input power = %.2f watts'%W\n",
    "pf=I_w/I\n",
    "print '(b)No load power factor = %.2f'%pf\n",
    "I_m=I*sqrt(1-pf**2)\n",
    "print '   Magnetising component of current = %.2f amperes'%I_m"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.7 Pg No: 280"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Equivalent resistance reffered to high voltage side = 4.30 ohms\n",
      "   Equivalent reactance reffered to high voltage side = 9.00 ohms\n",
      "   Equivalent impedance reffered to high voltage side = 9.97 ohms\n",
      "(b)Equivalent resistance reffered to low voltage side = 0.04 ohms\n",
      "   Equivalent reactance reffered to low voltage side = 0.09 ohms\n",
      "   Equivalent impedance reffered to low voltage side = 0.10 ohms\n",
      "(c)Total copper loss of transformer = 430.00 watts\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "f=50 #  Hz\n",
    "P=30*1000 #  watts\n",
    "E_1=3000 #  volts\n",
    "E_2=300 #  volts\n",
    "R_1=2.5 #  ohms\n",
    "R_2=0.018 #  ohms\n",
    "X_1=3.8 #  ohms\n",
    "X_2=0.052 #  ohms\n",
    "a=E_1/E_2\n",
    "R1=R_1+a**2*R_2\n",
    "X1=X_1+a**2*X_2\n",
    "Z1=sqrt(R1**2+X1**2)\n",
    "print '(a)Equivalent resistance reffered to high voltage side = %.2f ohms'%R1\n",
    "print '   Equivalent reactance reffered to high voltage side = %.2f ohms'%X1\n",
    "print '   Equivalent impedance reffered to high voltage side = %.2f ohms'%Z1\n",
    "R2=R_1/a**2+R_2\n",
    "X2=X_1/a**2+X_2\n",
    "Z2=sqrt(R2**2+X2**2)\n",
    "print '(b)Equivalent resistance reffered to low voltage side = %.2f ohms'%R2\n",
    "print '   Equivalent reactance reffered to low voltage side = %.2f ohms'%X2\n",
    "print '   Equivalent impedance reffered to low voltage side = %.2f ohms'%Z2\n",
    "I_1=P/E_1\n",
    "I_2=P/E_2\n",
    "P_cu=I_1**2*R1\n",
    "print '(c)Total copper loss of transformer = %.2f watts'%P_cu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.8 Pg No: 281"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I_w = 0.23 Amperes\n",
      "Magnetising current I_m = 0.97 Amperes\n",
      "R_o = 1777.78 ohms\n",
      "Magnetizing reactance X_o = 410.53 ohms\n",
      "Effective resistance reffered to primary side = 1.00 ohms\n",
      "Effective reactance reffered to primary side = 1.73 ohms\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=400./200\n",
    "I_o_Lv=2 #  amperes\n",
    "I_o_Hv=I_o_Lv/a #  amperes\n",
    "V_o=400 #  volts\n",
    "P_occ=90 #  watts\n",
    "pf=P_occ/(V_o*I_o_Hv)\n",
    "I_w=I_o_Hv*pf\n",
    "print 'I_w = %.2f Amperes'%I_w\n",
    "I_m=I_o_Hv*sqrt(1-pf**2)\n",
    "print 'Magnetising current I_m = %.2f Amperes'%I_m\n",
    "R_o=V_o/I_w\n",
    "print 'R_o = %.2f ohms'%R_o\n",
    "X_o=V_o/I_m\n",
    "print 'Magnetizing reactance X_o = %.2f ohms'%X_o\n",
    "V_sc=20 #  volts\n",
    "I_sc=10 #  amperes\n",
    "P_sc=100 #  watts\n",
    "Z_o1=V_sc/I_sc\n",
    "R_o1=P_sc/I_sc**2\n",
    "print 'Effective resistance reffered to primary side = %.2f ohms'%R_o1\n",
    "X_o1=sqrt(Z_o1**2-R_o1**2)\n",
    "print 'Effective reactance reffered to primary side = %.2f ohms'%X_o1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.9 Pg No: 282"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Readings of transformer for OC test\n",
      "Voltage Reading = 460.00 volts\n",
      "Current Reading = 1.00 Amperes\n",
      "Power output reading = 0.00 watts\n",
      "Readings of transformer for SC test\n",
      "Voltage Reading = 10.12 volts\n",
      "Current Reading = 8.00 Amperes\n",
      "Power output reading = 51.20 watts\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "V1=460 #  volts\n",
    "V2=230 #  volts\n",
    "a=V1/V2\n",
    "R1=0.4 #  ohms\n",
    "R2=0.1 #  ohms\n",
    "X1=0.5 #  ohms\n",
    "X2=0.12 #  ohms\n",
    "R_o=650 #  ohms\n",
    "X_o=250 #  ohms\n",
    "I_w=V1/R_o\n",
    "I_m=V1/X_o\n",
    "P_occ=V1*I_w\n",
    "print 'Readings of transformer for OC test'\n",
    "print 'Voltage Reading = %.2f volts'%V1\n",
    "print 'Current Reading = %.2f Amperes'%(sqrt(I_w**2+I_m**2))\n",
    "print 'Power output reading = %.2f watts'%P_occ\n",
    "R_O1=R1+a**2*R2\n",
    "X_O1=X1+a**2*X2\n",
    "Z=sqrt(R_O1**2+X_O1**2)\n",
    "I=4000/V1\n",
    "V_sc=I*Z\n",
    "P_sc=I**2*R_O1\n",
    "print 'Readings of transformer for SC test'\n",
    "print 'Voltage Reading = %.2f volts'%V_sc\n",
    "print 'Current Reading = %.2f Amperes'%I\n",
    "print 'Power output reading = %.2f watts'%P_sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.10 Pg No: 283"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R_O = 1285.71 ohms\n",
      "X_O Magnetising reactance = 392.05 ohms\n",
      "Equivalent Resistance reffered to LV Side = 0.16 ohms\n",
      "Equivalent Reactance reffered to LV Side = 0.39 ohms\n",
      "Secondary Terminal Voltage = 579.25 volts\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "V1=300 #  volts\n",
    "I_o=0.8 #  amperes\n",
    "W_o=70 #  watts\n",
    "pf=W_o/(V1*I_o)\n",
    "I_w=I_o*pf\n",
    "I_m=I_o*sqrt(1-pf**2)\n",
    "R_O=V1/I_w\n",
    "X_O=V1/I_m\n",
    "a=300.0/600\n",
    "V_sc=20.0 #  volts\n",
    "I_sc=12.0 #  amperes\n",
    "P_sc=90.0 #  watts\n",
    "Z_O2=V_sc/I_sc\n",
    "R_O2=P_sc/I_sc**2\n",
    "X_O2=sqrt(Z_O2**2-R_O2**2)\n",
    "R_O1=a**2*R_O2\n",
    "X_O1=a**2*X_O2\n",
    "I_2=6000/(600*0.8)\n",
    "V2=I_2*(R_O2*pf+X_O2*sqrt(1-pf**2))\n",
    "print 'R_O = %.2f ohms'%R_O\n",
    "print 'X_O Magnetising reactance = %.2f ohms'%X_O\n",
    "print 'Equivalent Resistance reffered to LV Side = %.2f ohms'%R_O1\n",
    "print 'Equivalent Reactance reffered to LV Side = %.2f ohms'%X_O1\n",
    "print 'Secondary Terminal Voltage = %.2f volts'%(600-V2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.11 Pg No: 284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R_O = 500.00 ohms\n",
      "X_O Magnetising reactance = 288.68 ohms\n",
      "Equivalent Resistance reffered to LV Side = 0.23 ohms\n",
      "Equivalent Reactance reffered to LV Side = 0.58 ohms\n",
      "Efficiency = 95.82 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "V1=200 #  volts\n",
    "I_o=0.8 #  amperes\n",
    "W_o=80 #  watts\n",
    "pf=W_o/(V1*I_o)\n",
    "I_w=I_o*pf\n",
    "I_m=I_o*sqrt(1-pf**2)\n",
    "R_O=V1/I_w\n",
    "X_O=V1/I_m\n",
    "a=200.0/400\n",
    "V_sc=25.0 #  volts\n",
    "I_sc=10.0 #  amperes\n",
    "P_sc=90.0 #  watts\n",
    "Z_O2=V_sc/I_sc\n",
    "R_O2=P_sc/I_sc**2\n",
    "X_O2=sqrt(Z_O2**2-R_O2**2)\n",
    "R_O1=a**2*R_O2\n",
    "X_O1=a**2*X_O2\n",
    "I_2=12\n",
    "I_1=I_2/a\n",
    "V2=sqrt((V1*pf+I_1*R_O1)**2+(V1*sqrt(1-pf**2)+I_1*X_O1)**2)\n",
    "P_iron=80 #  watts\n",
    "P_cu=(12.0/10)**2*90\n",
    "P_total=P_cu+P_iron\n",
    "Eff=6000*0.8/(6000*0.8+P_total)\n",
    "print 'R_O = %.2f ohms'%R_O\n",
    "print 'X_O Magnetising reactance = %.2f ohms'%X_O\n",
    "print 'Equivalent Resistance reffered to LV Side = %.2f ohms'%R_O1\n",
    "print 'Equivalent Reactance reffered to LV Side = %.2f ohms'%X_O1\n",
    "print 'Efficiency = %.2f %%'%(Eff*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.12 Pg No: 284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Efficiency = 95.77 %\n",
      "(b)Load KVA at which max efficiency occurs = 7.75\n",
      "   Max Efficiency = 97.06 %\n",
      "(c)Voltage Regulation = -0.57 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "V1=2000 #  volts\n",
    "pf=0.8\n",
    "I1=10000/V1 #  amperes\n",
    "P_iron=60 #  watts\n",
    "V_sc=40 #  volts\n",
    "I_sc=4 #  amperes\n",
    "a=2000.0/200\n",
    "P_sc=70 #  watts\n",
    "Z_O1=V_sc/I_sc\n",
    "R_O1=P_sc/I_sc**2\n",
    "X_O1=sqrt(Z_O1**2-R_O1**2)\n",
    "R_O2=R_O1/a**2\n",
    "X_O2=X_O1/a**2\n",
    "I2=I1*a/2 #  At half load\n",
    "Del_V=I2*(R_O2*pf+X_O2*sqrt(1-pf**2))\n",
    "V2=200-Del_V\n",
    "P_o=V2*I2*pf #  watts\n",
    "P_cu=(2.5/4)**2*P_sc #  At half load\n",
    "Eff=0.5*P_o/(0.5*P_o+P_iron+P_cu)\n",
    "print '(a)Efficiency = %.2f %%'%(Eff*100)\n",
    "I_1=sqrt(P_iron/R_O1)\n",
    "KVA_Load=10*I_1/5\n",
    "print '(b)Load KVA at which max efficiency occurs = %.2f'%KVA_Load\n",
    "Eff_max=P_o/(P_o+P_iron+P_iron)\n",
    "print '   Max Efficiency = %.2f %%'%(Eff_max*100)\n",
    "I_2=50 #  at full load\n",
    "VR=(I_2*(R_O2*pf-X_O2*sqrt(1-pf**2)))/200\n",
    "print '(c)Voltage Regulation = %.2f %%'%(VR*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.13 Pg No: 285"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "KVA Rating of transformer with additive polarity = 1320.00 KVA\n",
      "Efficiency of auto transformer with additive polarity = 100.00 %\n",
      "KVA Rating of transformer with subtractive polarity = 1080.00 KVA\n",
      "Efficiency of auto transformer with subtractive polarity = 100.00 %\n"
     ]
    }
   ],
   "source": [
    "P=120*1000 #  watts\n",
    "V1=2400 #  volts\n",
    "V2=240 #  volts\n",
    "I1=P/V1 #  amperes\n",
    "I2=P/V2 #  amperes\n",
    "KVA_1=V1*(I1+I2)/1000\n",
    "P_trans=V2*I2/1000\n",
    "P_cond_1=KVA_1-P_trans\n",
    "P_loss_1=((1/0.98)-1)**2*P_trans\n",
    "Eff_a=1-(P_loss_1/KVA_1)\n",
    "print 'KVA Rating of transformer with additive polarity = %.2f KVA'%KVA_1\n",
    "print 'Efficiency of auto transformer with additive polarity = %.2f %%'%(Eff_a*100)\n",
    "KVA_2=V1*(I2-I1)/1000\n",
    "P_trans=V2*I2/1000\n",
    "P_cond_2=KVA_2-P_trans\n",
    "P_loss=((1/0.98)-1)**2*P_trans\n",
    "Eff_s=1-(P_loss/KVA_2)\n",
    "print 'KVA Rating of transformer with subtractive polarity = %.2f KVA'%(KVA_2)\n",
    "print 'Efficiency of auto transformer with subtractive polarity = %.2f %%'%(Eff_s*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.14 Pg No: 285"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R_O = 533.33 ohms\n",
      "X_O Magnetising reactance = 283.02 ohms\n",
      "Equivalent Resistance reffered to LV Side = 0.00 ohms\n",
      "Equivalent Reactance reffered to LV Side = 0.50 ohms\n",
      "Voltage Regulation at full load = 3.00 %\n",
      "Efficiency at full load = 94.95 %\n",
      "Efficiency at half load = 94.17 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=0.5\n",
    "V1=200 #  volts\n",
    "I_o=0.8 #  amperes\n",
    "W_o=75 #  watts\n",
    "pf=W_o/(V1*I_o)\n",
    "pf2=0.8\n",
    "R_O=V1/(I_o*pf)\n",
    "X_O=V1/(I_o*sqrt(1-pf**2))\n",
    "V_sc=20 #  volts\n",
    "I_sc=10 #  amperes\n",
    "P_sc=90 #  watts\n",
    "Z_O2=V_sc/I_sc\n",
    "R_O2=P_sc/I_sc**2\n",
    "X_O2=sqrt(Z_O2**2-R_O2**2)\n",
    "R_O1=a**2*R_O2\n",
    "X_O1=a**2*X_O2\n",
    "I_2=4000/400 #  amperes\n",
    "VR=I_2*(R_O2*pf2+X_O2*sqrt(1-pf2**2))/400\n",
    "print 'R_O = %.2f ohms'%R_O\n",
    "print 'X_O Magnetising reactance = %.2f ohms'%X_O\n",
    "print 'Equivalent Resistance reffered to LV Side = %.2f ohms'%R_O1\n",
    "print 'Equivalent Reactance reffered to LV Side = %.2f ohms'%X_O1\n",
    "print 'Voltage Regulation at full load = %.2f %%'%(VR*100)\n",
    "P_o=(400-I_2*(R_O2*pf2+X_O2*sqrt(1-pf2**2)))*I_2*pf2\n",
    "P_i=75 #  watts\n",
    "P_cu=P_sc\n",
    "P_cu_h=0.5**2*P_cu\n",
    "Eff=P_o/(P_o+P_i+P_cu)\n",
    "print 'Efficiency at full load = %.2f %%'%(Eff*100)\n",
    "P_o_h=(400-I_2*0.5*(R_O2*pf2+X_O2*sqrt(1-pf2**2)))*I_2*0.5*pf2\n",
    "Eff_h=P_o_h/(P_o_h+P_i+P_cu_h)\n",
    "print 'Efficiency at half load = %.2f %%'%(Eff_h*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.15 Pg No: 286"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R_O = 781.25 ohms\n",
      "X_O Magnetising reactance = 216.16 ohms\n",
      "Equivalent Resistance reffered to LV Side = 0.00 ohms\n",
      "Equivalent Reactance reffered to LV Side = 0.50 ohms\n",
      "Voltage Regulation at full load = 2.88 %\n",
      "Voltage Regulation at half load = 1.44 %\n",
      "Efficiency at full load = 96.38 %\n",
      "Efficiency at half load = 95.80 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=0.5\n",
    "V1=250 #  volts\n",
    "I_o=1.2 #  amperes\n",
    "W_o=80 #  watts\n",
    "pf=W_o/(V1*I_o)\n",
    "pf2=0.8\n",
    "R_O=V1/(I_o*pf)\n",
    "X_O=V1/(I_o*sqrt(1-pf**2))\n",
    "V_sc=25 #  volts\n",
    "I_sc=10 #  amperes\n",
    "P_sc=95 #  watts\n",
    "Z_O2=V_sc/I_sc\n",
    "R_O2=P_sc/I_sc**2\n",
    "X_O2=sqrt(Z_O2**2-R_O2**2)\n",
    "R_O1=a**2*R_O2\n",
    "X_O1=a**2*X_O2\n",
    "I_2=6000/500 #  amperes\n",
    "VR=I_2*(R_O2*pf2+X_O2*sqrt(1-pf2**2))/500\n",
    "VR_h=0.5*I_2*(R_O2*pf2+X_O2*sqrt(1-pf2**2))/500\n",
    "print 'R_O = %.2f ohms'%R_O\n",
    "print 'X_O Magnetising reactance = %.2f ohms'%X_O\n",
    "print 'Equivalent Resistance reffered to LV Side = %.2f ohms'%R_O1\n",
    "print 'Equivalent Reactance reffered to LV Side = %.2f ohms'%X_O1\n",
    "print 'Voltage Regulation at full load = %.2f %%'%(VR*100)\n",
    "print 'Voltage Regulation at half load = %.2f %%'%(VR_h*100)\n",
    "P_o=(500-I_2*(R_O2*pf2+X_O2*sqrt(1-pf2**2)))*I_2*pf2\n",
    "P_i=80 #  watts\n",
    "P_cu=(12/10)**2*P_sc\n",
    "P_cu_h=0.5**2*P_cu\n",
    "Eff=P_o/(P_o+P_i+P_cu)\n",
    "print 'Efficiency at full load = %.2f %%'%(Eff*100)\n",
    "P_o_h=(500-I_2*0.5*(R_O2*pf2+X_O2*sqrt(1-pf2**2)))*I_2*0.5*pf2\n",
    "Eff_h=P_o_h/(P_o_h+P_i+P_cu_h)\n",
    "print 'Efficiency at half load = %.2f %%'%(Eff_h*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.16 Pg No: 286"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Efficiency of transformer at full load and at unity power factor = 98.74 %\n",
      "(b)Efficiency of transformer at full load and at 0.8 power factor = 98.43 %\n",
      "(a)Efficiency of transformer at 75% of load and at unity power factor = 98.78 %\n",
      "(b)Efficiency of transformer at 75% of load and at 0.8 power factor = 98.48 %\n"
     ]
    }
   ],
   "source": [
    "I_2=200 #  amperes\n",
    "R_O2=0.008 #  ohms\n",
    "x=0.75\n",
    "P_cu=x**2*I_2**2*R_O2 #  watts\n",
    "P_i=190 #  watts\n",
    "KVA=40\n",
    "P_o=40*1000 #  watts\n",
    "Eff=P_o/(P_o+P_i+I_2**2*R_O2)\n",
    "Eff_2=KVA*1000*0.8/(KVA*1000*0.8+P_i+I_2**2*R_O2)\n",
    "print '(a)Efficiency of transformer at full load and at unity power factor = %.2f %%'%(Eff*100)\n",
    "print '(b)Efficiency of transformer at full load and at 0.8 power factor = %.2f %%'%(Eff_2*100)\n",
    "Eff_3=x*P_o/(x*P_o+P_i+P_cu)\n",
    "Eff_4=x*P_o*0.8/(x*0.8*P_o+P_i+P_cu)\n",
    "print '(a)Efficiency of transformer at 75%% of load and at unity power factor = %.2f %%'%(Eff_3*100)\n",
    "print '(b)Efficiency of transformer at 75%% of load and at 0.8 power factor = %.2f %%'%(Eff_4*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.17 Pg No: 287"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Max efficiency will occur at : 70.71 Percent of full load\n",
      "  Maximum Efficiency = 96.59 %\n",
      "(b)Core Loss = 314.59 watts\n",
      "   Copper Loss = 435.41 watts\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=20\n",
    "P_i=250.0 #  watts\n",
    "P_cu=500 #  watts\n",
    "x=sqrt(P_i/P_cu)\n",
    "print '(a)Max efficiency will occur at : %.2f'%(x*100),\n",
    "print 'Percent of full load'\n",
    "P_o=x*KVA*1000\n",
    "Eff=P_o/(P_o+P_i+P_i)\n",
    "print '  Maximum Efficiency = %.2f %%'%(Eff*100)\n",
    "P_cu_n=(P_i+P_cu)/(0.85**2+1)\n",
    "P_i_n=P_i+P_cu-P_cu_n\n",
    "print '(b)Core Loss = %.2f watts'%P_i_n\n",
    "print '   Copper Loss = %.2f watts'%P_cu_n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.18 Pg No: 287"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The secondary current at which max efficiency will occur = 115.47 Amperes\n",
      "Max efficiency at 0.8pf lagging = 97.47 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=1000.0/200\n",
    "R_1=0.25 #  ohms\n",
    "R_2=0.018 #  ohms\n",
    "R_O2=R_2+R_1/a**2\n",
    "P_i=240 #  watts\n",
    "I_2=sqrt(P_i/R_2)\n",
    "print 'The secondary current at which max efficiency will occur = %.2f Amperes'%I_2\n",
    "P_o=200*I_2*0.8 #  watts\n",
    "P_t=2*P_i #  watts\n",
    "Eff=P_o/(P_o+P_t)\n",
    "print 'Max efficiency at 0.8pf lagging = %.2f %%'%(Eff*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.19 Pg No: 288"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Iron Loss = 1666.57 watts\n",
      "(b)Copper Loss at full load = 3333.33 watts\n",
      "(c)Load KVA at which maximum efficiency occurs = 106.06 KVA\n",
      "(d)maximum efficiency of transformer at 0.8pf lagging = 96.22 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=150\n",
    "pf=0.8\n",
    "Eff=0.96\n",
    "P_o=KVA*1000*pf #  watts\n",
    "P_cu=P_o*((1/Eff)-1)*(1-0.5)*4/3\n",
    "P_i=4999.9-P_cu\n",
    "print '(a)Iron Loss = %.2f watts'%P_i\n",
    "print '(b)Copper Loss at full load = %.2f watts'%P_cu\n",
    "x=sqrt(P_i/P_cu)\n",
    "print '(c)Load KVA at which maximum efficiency occurs = %.2f KVA'%(x*KVA)\n",
    "Eff_max=x*KVA*1000*0.8/(x*KVA*1000*0.8+2*P_i)\n",
    "print '(d)maximum efficiency of transformer at 0.8pf lagging = %.2f %%'%(Eff_max*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.22 Pg No: 289"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Efficiency at full load and at unity power factor = 0.00 %\n",
      "(b)Efficiency at half load and at 0.8 power factor = 96.95 %\n",
      "(c) Efficiency at 75 percent of load and 0.7 power factor = 96.98 %\n",
      "(d)load KVA at which maximum efficiency will occcur = 0.00 KVA\n",
      "(e)maximum efficiency at 0.85 power factor = 0.00 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=100\n",
    "P_cu=1200 #  watts\n",
    "P_i=960 #  watts\n",
    "x1=1\n",
    "pf1=1\n",
    "P_o_1=x1*KVA*pf1*1000\n",
    "Eff_1=P_o_1/(P_o_1+P_i+x1**2*P_cu)\n",
    "print '(a)Efficiency at full load and at unity power factor = %.2f %%'%(Eff_1*100)\n",
    "x2=0.5\n",
    "pf2=0.8\n",
    "P_o_2=x2*KVA*1000*pf2\n",
    "Eff_2=P_o_2/(P_o_2+P_i+x2**2*P_cu)\n",
    "print '(b)Efficiency at half load and at 0.8 power factor = %.2f %%'%(Eff_2*100)\n",
    "x3=0.75\n",
    "pf3=0.7\n",
    "P_o_3=x3*KVA*1000*pf3\n",
    "Eff_3=P_o_3/(P_o_3+P_i+x3**2*P_cu)\n",
    "print '(c) Efficiency at 75 percent of load and 0.7 power factor = %.2f %%'%(Eff_3*100)\n",
    "KVA_max=KVA*sqrt(P_i/P_cu)\n",
    "print '(d)load KVA at which maximum efficiency will occcur = %.2f KVA'%(KVA_max)\n",
    "Eff_max=KVA_max*1000*0.85/(KVA_max*1000*0.85+2*P_i)\n",
    "print '(e)maximum efficiency at 0.85 power factor = %.2f %%'%(Eff_max*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.23 Pg No: 289"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Copper loss = 713.22 watts\n",
      "Core loss = 504.78 watts\n",
      "Load current = 7.57 amperes\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=100\n",
    "V2=11000 #  volts\n",
    "x1=1\n",
    "x2=0.5\n",
    "pf1=0.8\n",
    "pf2=1\n",
    "Eff_1=0.985\n",
    "Eff_2=0.99\n",
    "P_cu=(KVA*1000*x1*pf1*((1/Eff_1)-1)-x2*KVA*1000*((1/Eff_2)-1))*(4/3) #   in watts\n",
    "P_i=1218-P_cu #   in watts\n",
    "I_fl=KVA*1000/V2\n",
    "I_2=I_fl*sqrt(P_i/P_cu)\n",
    "print 'Copper loss = %.2f watts'%P_cu\n",
    "print 'Core loss = %.2f watts'%P_i\n",
    "print 'Load current = %.2f amperes'%I_2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.24 Pg No: 290"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Efficiency of transformer at 75 percent of full load = 90.50 %\n",
      "Maximum efficiency = 90.52 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "P_o=500 #  watts\n",
    "Eff_fl=0.9\n",
    "Eff_hl=0.9\n",
    "P_cu=(((P_o-0.5*P_o)/Eff_fl)-0.5*P_o)*4/3 #   in watts\n",
    "P_i=0.5*P_cu #   in watts\n",
    "Eff=P_o*0.75/(P_o*0.75+P_i+0.75**2*P_cu)\n",
    "print 'Efficiency of transformer at 75 percent of full load = %.2f %%'%(Eff*100)\n",
    "P_o_max=P_o*sqrt(P_i/P_cu)\n",
    "Eff_max=P_o_max/(P_o_max+P_i+P_i)\n",
    "print 'Maximum efficiency = %.2f %%'%(Eff_max*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.25 Pg No: 291"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Efficiency of transformer at full load = 97.56 %\n",
      "Efficiency of transformer at half load = 96.90 %\n"
     ]
    }
   ],
   "source": [
    "KVA=100.0\n",
    "P_i=1300 #  watts\n",
    "P_cu=1200 #  watts\n",
    "pf=1\n",
    "Eff_fl=KVA*1000*pf/(KVA*1000*pf+P_i+P_cu)\n",
    "print 'Efficiency of transformer at full load = %.2f %%'%(Eff_fl*100)\n",
    "Eff_hl=KVA*1000*0.5*pf/(KVA*0.5*1000*pf+P_i+0.25*P_cu)\n",
    "print 'Efficiency of transformer at half load = %.2f %%'%(Eff_hl*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.26 Pg No: 291"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage Regulation = 3.75 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=100\n",
    "Eff_max=0.98\n",
    "x=0.8\n",
    "pf=0.8\n",
    "P_o=x*KVA*1000*pf #  watts\n",
    "P_i=(P_o-P_o*Eff_max)/(2*Eff_max) #  watts\n",
    "P_cu=P_i/x**2\n",
    "R_equ=P_cu/(KVA*1000)\n",
    "Z_equ=0.05\n",
    "X_equ=sqrt(Z_equ**2-R_equ**2)\n",
    "VR=R_equ*pf+X_equ*sqrt(1-pf**2)\n",
    "print 'Voltage Regulation = %.2f %%'%(VR*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.27 Pg No: 291"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage Resistance drop = 0.90 %\n",
      "Percentage Reactance drop = 4.05 %\n",
      "Max Efficiency will occur at : 99.10 percent of full load\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=20\n",
    "V1=1100 #  volts\n",
    "V2=220 #  volts\n",
    "a=V1/V2\n",
    "P_i=175 #  watts\n",
    "R1=0.25 #  ohms\n",
    "R2=0.012 #  ohms\n",
    "X1=1.1 #  ohms\n",
    "X2=0.055 #  ohms\n",
    "R_O2=R2+R1/a**2\n",
    "X_O2=X2+X1/a**2\n",
    "I2=KVA*1000/V2\n",
    "V_r=I2*R_O2*100/V2\n",
    "print 'Percentage Resistance drop = %.2f %%'%V_r\n",
    "V_re=I2*X_O2*100/V2\n",
    "print 'Percentage Reactance drop = %.2f %%'%V_re\n",
    "P_cu=I2**2*R_O2\n",
    "x=sqrt(P_i/P_cu)\n",
    "print 'Max Efficiency will occur at : %.2f'%(x*100),\n",
    "print 'percent of full load'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.28 Pg No: 292"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage Regulation = 7.52 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "KVA=500\n",
    "V2=500 #  volts\n",
    "x=0.75\n",
    "pf=1\n",
    "Eff_max=0.97\n",
    "P_i=(KVA*x*1000*pf-KVA*x*1000*pf*Eff_max)/(2*Eff_max) #  watts\n",
    "P_cu=P_i/x**2\n",
    "R_equ=P_cu/(KVA*1000)\n",
    "X_equ=sqrt(0.1**2-R_equ**2) #  ohms\n",
    "VR=R_equ*0.8+X_equ*0.6\n",
    "print 'Voltage Regulation = %.2f %%'%(VR*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.29 Pg No: 292"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iron loss = 350.00 watts\n",
      "Copper Loss = 350.00 watts\n",
      "Maximum Efficiency = 0.00 %\n"
     ]
    }
   ],
   "source": [
    "KVA=25\n",
    "P_iron=350 #  watts\n",
    "#For max efficiency P_iron=P_cu\n",
    "P_cu=P_iron\n",
    "print 'Iron loss = %.2f watts'%P_iron\n",
    "print 'Copper Loss = %.2f watts'%P_cu\n",
    "Eff=KVA*1000/(KVA*1000+P_iron+P_cu)\n",
    "print 'Maximum Efficiency = %.2f %%'%(Eff*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa:3.30 Pg No: 293"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Efficiency = 93.33 %\n",
      "Voltage Regulation = 8.28 %\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "P_i=100 #  watts\n",
    "V2=400 #  volts\n",
    "P_sc=200 #  watts\n",
    "I_2=11.4 #  amperes\n",
    "R_O2=P_sc/I_2**2 #  ohms\n",
    "KVA=5\n",
    "I_2fl=KVA*1000/V2\n",
    "P_cu=I_2fl**2*R_O2\n",
    "pf=0.9\n",
    "Eff=KVA*1000*pf/(KVA*1000*pf+P_cu+P_i)\n",
    "print 'Efficiency = %.2f %%'%(Eff*100)\n",
    "V_2sc=40 #  volts\n",
    "Z_O2=V_2sc/I_2\n",
    "X_O2=sqrt(Z_O2**2-R_O2**2)\n",
    "VR=I_2fl*(R_O2*pf+X_O2*sqrt(1-pf**2))/V2\n",
    "print 'Voltage Regulation = %.2f %%'%(VR*100)"
   ]
  }
 ],
 "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
}
