{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter8 Harmonic and PowerFactor with the converter system"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.1,Pg.no.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "value of AC converter power=Pc= 5.06 MVAR\n",
      "value of the capacitance of shunt filter=C = 0.4 millifarads\n",
      "Inductance of filter=L= 1.08 milliHenry\n",
      "Resistance of filter=R= 33.91 milliOhms\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import sqrt\n",
    "I5=0.2                                      #amplitude of 5th harmonic current in Kilo Amperes\n",
    "Vp= 11/(sqrt(3))                            #Input supply phase voltage in Kilo Volts\n",
    "P=5                                         #supply power per phase of filter in MVAR\n",
    "Pc=P+((Vp**2*I5**2)/(5*P))                  #AC Converter power per phase in MVAR\n",
    "Pc=round(Pc,2)\n",
    "print 'value of AC converter power=Pc=',Pc,'MVAR'\n",
    "C=(Pc*10**3*3) /(11**2*314)                 #capacitance of the ShuntFilter in milliFarad\n",
    "C=round(C,2)\n",
    "print 'value of the capacitance of shunt filter=C =',C,'millifarads'\n",
    "L=(106*10**6)/(400*4*25*250*3.14**2)        #inductance of filter in mHenry\n",
    "L=round(L,2)\n",
    "print 'Inductance of filter=L=',L,'milliHenry'\n",
    "Q=50                                        #value of Q\n",
    "W5=2*3.14*5*50                              #angular frequency of 5th harmonic\n",
    "R=(W5*L)/Q                                  #Resistance of filter in milliOhms\n",
    "R=round(R,2)\n",
    "print 'Resistance of filter=R=',R,'milliOhms'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.2,Pg.no.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For six pulse converter most effective harmonic is 6th and for worst case a=90 degree\n",
      "voltage ripple=Wv= 24.1 percent\n",
      "Harmonic current for 6th harmonic=I6= 10.0 amp\n",
      "additional inductance required=L= 4.93 milliHenry\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "print 'For six pulse converter most effective harmonic is 6th and for worst case a=90 degree'\n",
    "Wv=24.1                          #voltage ripple in percentage\n",
    "print 'voltage ripple=Wv=',Wv,'percent'\n",
    "Id=200.0\n",
    "I6=(5*Id)/100                    #Harmonic current for 6th harmonic in amp\n",
    "I6=round(I6,1)\n",
    "print 'Harmonic current for 6th harmonic=I6=',I6,'amp'\n",
    "Edc=460.0                          #dc voltage in volts\n",
    "W=2*3.14*50\n",
    "La=1.0                             #inductance already present in the circuit in milliHenry\n",
    "L=((Wv*Edc*10)/(I6*6*W))-La      #additional inductance required in milliHenry\n",
    "L=5.93-1.0\n",
    "L=round(L,2)\n",
    "print 'additional inductance required=L=',L,'milliHenry'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.3,Pg.no.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AC line current of the thyristor=I2= 163.4 amperes\n",
      "effective reactance of the thyristor=Xt= 0.1 ohms\n",
      "cosine value of the commutational angle=C= 0.97\n",
      "commutation angle=CA= 14.07 degrees\n",
      "cosine value of the firing value=F= 0.72\n",
      "firing angle=FA= 43.95 degrees\n",
      "AC line current=I2= 163.4 amps\n",
      "Current through each device=Ied= 116.0 amps\n",
      "power factor=PF= 0.71\n",
      "active power drawn from the mains=AP= 83390.99 Watts\n",
      "Reactive power drawn=RP= 82709.96 VAR\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import sqrt,pi\n",
    "Id=200         #rated dc current in amperes\n",
    "I2=0.817*Id    #AC line current in amperes\n",
    "print 'AC line current of the thyristor=I2=',I2,'amperes'\n",
    "E2=415         #AC line voltage in volts\n",
    "Edc=400        #dc terminal voltage in volts\n",
    "Xt=0.04*E2/I2   #effective reactance of the thyristor in ohms\n",
    "Xt=round(Xt,2)\n",
    "print 'effective reactance of the thyristor=Xt=',Xt,'ohms'\n",
    "C=1-((Id*Xt)/(E2*sqrt(3)))                   #cosine value of the commutational angle\n",
    "C=round(C,2)\n",
    "print 'cosine value of the commutational angle=C=',C\n",
    "CA=math.acos(C)*180/pi\n",
    "CA=round(CA,2)\n",
    "print 'commutation angle=CA=',CA,'degrees'\n",
    "F=Edc/(1.35*E2*(1+C)/2)                #cosine value of the firing angle\n",
    "F=round(F,2)\n",
    "print 'cosine value of the firing value=F=',F\n",
    "FA=math.acos(F)*180/pi\n",
    "FA=round(FA,2)\n",
    "print 'firing angle=FA=',FA,'degrees'\n",
    "I2=0.817*Id                            #AC line current in amps\n",
    "print 'AC line current=I2=',I2,'amps'\n",
    "Ied=0.58*Id                            #current through each device in amps\n",
    "print 'Current through each device=Ied=',Ied,'amps'\n",
    "PF=F*(1+C)/2                           #power factor\n",
    "PF=round(PF,2)\n",
    "print 'power factor=PF=',PF\n",
    "AP=sqrt(3)*E2*I2*PF                    #active power drawn from the mains in Watts\n",
    "AP=round(AP,2)\n",
    "print  'active power drawn from the mains=AP=',AP,'Watts'\n",
    "RP=sqrt(3)*E2*I2*sqrt(1-PF**2)           #reactive power in VAR\n",
    "RP=round(RP,2)\n",
    "print 'Reactive power drawn=RP=',RP,'VAR'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.4,Pg.no.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AC line current of the thyristor=I2= 81.7 amperes\n",
      "power factor=PF= 0.69\n",
      "Reactive power to be supplied by shunt compensator=RP= 23557.8 VAR\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import pi,sqrt\n",
    "Id=100           #rated dc current in amperes\n",
    "I2=0.817*Id      #AC line current in amperes\n",
    "I2=round(I2,2)\n",
    "print 'AC line current of the thyristor=I2=',I2,'amperes'\n",
    "E2=230           #AC line voltage in volts\n",
    "Edc=200          #dc terminal voltage in volts\n",
    "PF=math.cos(pi/4)*(1+math.cos(pi/10))/2        #power factor\n",
    "PF=round(PF,2)\n",
    "print 'power factor=PF=',PF\n",
    "RP=sqrt(3)*E2*I2*sqrt(1-PF**2)           #reactive power to be supplied by shunt compensator in VAR\n",
    "RP=round(RP,2)\n",
    "print  'Reactive power to be supplied by shunt compensator=RP=',RP,'VAR'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.5,Pg.no.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "value of MVAR rating of the capacitor=Pc= 7.68 MVAR\n",
      "value of the capacitance of shunt filter=C = 606.41 microfarads\n",
      "Inductance of filter=L= 0.01 milliHenry\n",
      "Resistance of filter=R= 0.99 milliOhms\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import sqrt\n",
    "I11=400/11              #amplitude of 11th harmonic current in Amperes\n",
    "V1= 11/(sqrt(3))        #Input supply phase voltage in Kilo Volts\n",
    "P=7                      #supply power per phase of f i l t e r in MVAR/\n",
    "Pc=P+((V1**2*I11**2*10**-3)/(11*P))         #AC Converter MVAR rating of the capacitor\n",
    "Pc=round(Pc,2)\n",
    "print 'value of MVAR rating of the capacitor=Pc=',Pc,'MVAR'\n",
    "W=2*3.14*50\n",
    "C=(Pc*10**6)/(V1**2*W)                    #capacitance of the ShuntFilter in microFarad\n",
    "C=round(C,2)\n",
    "print 'value of the capacitance of shunt filter=C =',C,'microfarads'\n",
    "W11=11*W\n",
    "L=10**8/(C*W11**2)                        #inductance of filter in mHenry\n",
    "L=round(L,2)\n",
    "print 'Inductance of filter=L=',L,'milliHenry'\n",
    "Q=35                                      #value of Q\n",
    "R=(W11*L)/Q                               #Resistance of filter in milliOhms\n",
    "R=round(R,2)\n",
    "print 'Resistance of filter=R=',R,'milliOhms'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.6,Pg.no.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For six pulse converter most effective harmonic is 6th and for worst case a=90 degree\n",
      "voltage ripple=Wv= 24.1 percent\n",
      "Harmonic current for 6th harmonic=I6= 9.81 amp\n",
      "max. value of current ripple=Wi= 3.27 percent\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "print 'For six pulse converter most effective harmonic is 6th and for worst case a=90 degree'\n",
    "h=6.0\n",
    "Wv=24.1            #voltage ripple in percentage\n",
    "print 'voltage ripple=Wv=',Wv,'percent'\n",
    "Edc=460.0            #dc voltage in volts\n",
    "W=2*3.14*50\n",
    "Ldc=6.0              #total dc circuit inductance in milliHenry\n",
    "I6=Wv*Edc*10/(Ldc*h*W)             #Harmonic current for 6th harmonic in amp\n",
    "I6=round(I6,2)\n",
    "print 'Harmonic current for 6th harmonic=I6=',I6,'amp'\n",
    "Id=300.0\n",
    "Wi=100*I6/Id             #maximum value of current ripple in percentage\n",
    "Wi=round(Wi,2)\n",
    "print 'max. value of current ripple=Wi=',Wi,'percent'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.7,Pg.no.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage ripple of the 6th harmonic=Wv= 17.38 percent\n",
      "For six pulse converter most effective harmonic is 6th and for worst case A=90degrees\n",
      "maximum voltage ripple=Wv6= 24.24 percent\n",
      "voltage ripple of the 12th harmonic=Wv= 8.42 percent\n",
      "maximum voltage ripple=Wv12= 11.87 percent\n",
      "percentage reduction in max. voltage ripple=PR= 51.03 percent\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import pi,sqrt\n",
    "#given\n",
    "A=pi/4\n",
    "h=6\n",
    "#calculations\n",
    "Wv=sqrt(2)*sqrt(h**2-math.cos(A)**2*(h**2-1))*100/(h**2-1)\n",
    "Wv=round(Wv,2)\n",
    "print 'voltage ripple of the 6th harmonic=Wv=',Wv,'percent'\n",
    "print 'For six pulse converter most effective harmonic is 6th and for worst case A=90degrees'\n",
    "A=pi/2\n",
    "Wv6=sqrt(2)*sqrt(h**2-math.cos(A)**2*(h**2-1))*100/(h**2-1)   #maximum voltage ripple in percentage\n",
    "Wv6=round(Wv6,2)\n",
    "print 'maximum voltage ripple=Wv6=',Wv6,'percent'\n",
    "A=pi/4\n",
    "h=12\n",
    "Wv=sqrt(2)*sqrt(h**2-math.cos(A)**2*(h**2-1))*100/(h**2-1)\n",
    "Wv=round(Wv,2)\n",
    "print 'voltage ripple of the 12th harmonic=Wv=',Wv,'percent'\n",
    "A=pi/2\n",
    "Wv12=sqrt(2)*sqrt(h**2-math.cos(A)**2*(h**2-1))*100/(h**2-1) #maximum voltage ripple in percentage\n",
    "Wv12=round(Wv12,2)\n",
    "print 'maximum voltage ripple=Wv12=',Wv12,'percent'\n",
    "PR=(Wv6-Wv12)*100/Wv6                                  #percentage reduction in max. voltage ripple\n",
    "PR=round(PR,2)\n",
    "print 'percentage reduction in max. voltage ripple=PR=',PR,'percent'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.8,Pg.no.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cosine of triggering angle=C= 0.65\n",
      "triggering angle of the device=A= 49.46 degrees\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import sqrt\n",
    "#givem\n",
    "Wv=18.6\n",
    "h=6 \n",
    "#calculations\n",
    "C=sqrt(14.68/35)    #cosine of triggering angle\n",
    "C=round(C,2)\n",
    "print 'cosine of triggering angle=C=',C\n",
    "A=math.acos(C)*180/pi\n",
    "A=round(A,2)\n",
    "print 'triggering angle of the device=A=',A,'degrees'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example8.9,Pg.no.29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cosine of the triggering angle=C= 0.75\n",
      "triggering angle of the device=A= 41.41 degrees\n",
      "power factor=PF= 0.74\n",
      "Reactive power to be supplied by shuntcompensator=RP= 79.0 KVAR\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from math import pi,sqrt\n",
    "E2=415              #AC line voltage in volts\n",
    "Edc=380             #dc terminal voltage in volts\n",
    "C=1.1*Edc/(1.35*E2)\n",
    "C=round(C,2)\n",
    "print 'cosine of the triggering angle=C=',C\n",
    "A=math.acos(C)*180/pi\n",
    "A=round(A,2)\n",
    "print 'triggering angle of the device=A=',A,'degrees'\n",
    "PF=C*(1+math.cos(pi/12))/2            #power factor\n",
    "PF=round(PF,2)\n",
    "print 'power factor=PF=',PF\n",
    "Id=200\n",
    "I2=0.817*Id\n",
    "RP=sqrt(3)*E2*I2*sqrt(1-PF**2)/1000         #reactive power to be supplied by shunt compensator in KVAR\n",
    "RP=round(RP,2)\n",
    "print 'Reactive power to be supplied by shuntcompensator=RP=',RP,'KVAR'"
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
