{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 : AC Steadystate Circuit Analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1, Page No 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#calculate power fed to load\n",
      " \n",
      "V=100.0 \n",
      "\n",
      "#Calculations\n",
      "Va=(V/(math.sqrt(2)*math.pi))*(2+1/math.sqrt(2)) \n",
      "Rd=10.0 \n",
      "Pa=Va**2/Rd \n",
      "\n",
      "#Results\n",
      "print(Pa,'load power(W)') "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(371.26245525794906, 'load power(W)')\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#calculate firing angle value\n",
      "\n",
      "Po=15000.0 \n",
      "Ro=1.5 \n",
      "Va=math.sqrt(Po*Ro) \n",
      "\n",
      "#Calculations\n",
      "a=math.degrees(math.acos((Va*2*math.pi/(3*math.sqrt(6)*V))-1))\n",
      "print(a,'firing angle(deg)') \n",
      "Ia=Va/Ro \n",
      "Ith=Ia/3.0 \n",
      "\n",
      "#Results\n",
      "print(Ith,'avg current through diodes(A)') "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(73.58755434217028, 'firing angle(deg)')\n",
        "(33.333333333333336, 'avg current through diodes(A)')\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#calculate value of commutating capacitor\n",
      "Iamax=100.0 \n",
      "V=100.0 \n",
      "f_max=400.0 \n",
      "\n",
      "#Calculations\n",
      "c=Iamax/(2*V*f_max) \n",
      "\n",
      "#Results\n",
      "print(c,'value of commutating capacitor(F)') "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(0.00125, 'value of commutating capacitor(F)')\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.4 Page No 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#to determine value of capacitor\n",
      "\n",
      "  \n",
      "f=50.0 \n",
      "w=2*math.pi*f \n",
      "Z_lm=complex(3,2.7) \n",
      "Z_la=complex(7,3) \n",
      "\n",
      "#Calculations\n",
      "I_m=(-1)*math.degrees(math.atan((Z_lm.imag)/(Z_la.imag))) \n",
      "a=90.0 \n",
      "I_a=a+I_m \n",
      "c=1/(w*((Z_lm.real)-(Z_la.real)*math.cos(math.radians((-1)*I_a)))) \n",
      "\n",
      "#Results\n",
      "print(c,'value of capacitor(F)') "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(-0.0018916018169502632, 'value of capacitor(F)')\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.6, Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#to calculate starting torque and atarting current,motor performance\n",
      "\n",
      "  \n",
      "V_a=110*complex(math.cos(math.radians(90)),math.sin(math.radians(90))) \n",
      "V_m=220*complex(math.cos(math.radians(0)),math.sin(math.radians(0))) \n",
      "R_1=3 \n",
      "R_2=2.6 \n",
      "X_1=2.7 \n",
      "X_2=2.7 \n",
      "X=110 \n",
      "V_f=(1.0/2)*(V_m-1j*V_a)\n",
      "V_b=(1.0/2)*(V_m+1j*V_a) \n",
      "Z_f=(complex(0,X)*complex(R_2,X_2))/(complex(0,X)+complex(R_2,X_2)) \n",
      "Z_b=Z_f \n",
      "Z_ftot=complex(R_1,X_1)+Z_f \n",
      "Z_btot=complex(R_1,X_1)+Z_b \n",
      "I_f=V_f/Z_ftot \n",
      "I_b=V_b/Z_btot \n",
      "T_s=(2/157)*(Z_f.real)*(abs(I_f)**2-abs(I_b)**2) \n",
      "print(T_s,'starting torque(Nm)') \n",
      "I_m=I_f+I_b \n",
      "I_a=1j*(I_f-I_b) \n",
      "print(abs(I_a),'starting current(A)') \n",
      "s=0.04 \n",
      "\n",
      "Z_f=(complex(0,X)*complex(R_2/s,X_2))/(complex(0,X)+complex(R_2/s,X_2)) \n",
      "Z_b=(complex(0,X)*complex(R_2/(2-s),X_2))/(complex(0,X)+complex(R_2/(2-s),X_2)) \n",
      "Z_ftot=complex(R_1,X_1)+Z_f \n",
      "Z_btot=complex(R_1,X_1)+Z_b \n",
      "I_f=V_f/Z_ftot \n",
      "I_b=V_b/Z_btot \n",
      "w_s=157.1 \n",
      "T_s=(2/157.1)*(abs(I_f)**2*(Z_f.real)-abs(I_b)**2*(Z_b.real)) \n",
      "print(T_s,'starting torque(Nm)') \n",
      "I_m=I_f+I_b \n",
      "\n",
      "#Calculations\n",
      "m=math.degrees(math.atan((I_m.imag)/(I_m.real)))\n",
      "I_a=1j*(I_f-I_b) \n",
      "a=math.degrees(math.atan((I_a.imag)/(I_a.real)))\n",
      "P_m=w_s*(1.0-s)*T_s \n",
      "P_L=200.0 \n",
      "P_out=P_m-P_L \n",
      "P_min=V*abs(I_m)*math.cos(math.radians(m)) \n",
      "P_ain=V*abs(I_a)*math.cos(math.radians(a))\n",
      "P_in=P_min+P_ain \n",
      "n=P_out/P_in \n",
      "print(n,'efficiency') \n",
      "\n",
      "r=Z_ftot/Z_btot     #r=V_mf/V_bf\n",
      "#V_mf+V_bf=220\n",
      "V_mf=220/(1+r) \n",
      "V_mb=220-V_mf \n",
      "V_a=1j*(V_mf-V_mb) \n",
      "\n",
      "#Results\n",
      "print(abs(V_a),'V_a(V)') \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(0.0, 'starting torque(Nm)')\n",
        "(14.313452498677325, 'starting current(A)')\n",
        "(3.5887587638431966, 'starting torque(Nm)')\n",
        "(0.2815652638045585, 'efficiency')\n",
        "(176.4417668704772, 'V_a(V)')\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}