{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 6 Power control devices"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 6_1 PG-6.15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Therefore peak value of the input voltage is 28.2843 V \n",
      "\n",
      "\n",
      " Therefore forward and reverse blocking voltge of SCR>28.2843 V \n",
      "\n",
      "\n",
      " Vl_peak=26.5843 V \n",
      "\n",
      "\n",
      " Il_peak=0.8861 A \n",
      "\n",
      "\n",
      " rms value of current flowing through the SCR is 0.443 A \n",
      "\n",
      "\n",
      " voltage which cause SCR to switch off is 1.85 V \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "Es=20##rms value of the supply voltage \n",
    "Ep=sqrt(2)*Es##peak value\n",
    "print \"\\n Therefore peak value of the input voltage is %.4f V \\n\"%(Ep)\n",
    "print \"\\n Therefore forward and reverse blocking voltge of SCR>%.4f V \\n\"%(Ep)\n",
    "Rl=30##load resistance\n",
    "Ih=5e-3##holding current\n",
    "Vtm=1.7##state voltage drop\n",
    "Vl_peak=Ep-Vtm#\n",
    "print \"\\n Vl_peak=%.4f V \\n\"%(Vl_peak)\n",
    "Il_peak=Vl_peak/Rl#\n",
    "print \"\\n Il_peak=%.4f A \\n\"%(Il_peak)\n",
    "Il_rms=Il_peak/2#\n",
    "print \"\\n rms value of current flowing through the SCR is %.3f A \\n\"%(Il_rms)\n",
    "#SCR current rating should be greater than Il_rms\n",
    "Es_off=Vtm+Ih*Rl##voltage which cause SCR to switch off\n",
    "print \"\\n voltage which cause SCR to switch off is %.2f V \\n\"%(Es_off)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 6_2 PG-6.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Refer to the figure-6.19 shown\n",
      "\n",
      " Position of R2 at top to trigger at 10 degree \n",
      "\n",
      " Therefore R1=4.6894 kohm \n",
      "\n",
      " We use R1=4.7 kohm standard value \n",
      "\n",
      "\n",
      " Position of R2 at bottom to trigger at 90 degree \n",
      "\n",
      " Therefore R3=252.22 ohm \n",
      "\n",
      " We use R3=270 ohm standard value \n",
      "\n",
      "\n",
      " Therefore R2=1.18 kohm \n",
      "\n",
      " We use the pot=1.5 kohm standard value for precise judgement\n"
     ]
    }
   ],
   "source": [
    "from math import sin, pi\n",
    "print \"Refer to the figure-6.19 shown\"\n",
    "Es=25##rms value of the supply voltage \n",
    "Vd1=0.7##diode drop\n",
    "Vg=0.75##SCR triggering voltage\n",
    "alpha1=10##minimum phase angle \n",
    "alpha2=90##maximum phase angle\n",
    "Ep=sqrt(2)*Es##peak value\n",
    "\n",
    "Es1=Ep*sin(alpha1*pi/180)\n",
    "Es2=Ep*sin(alpha2*pi/180)\n",
    "Vt=Vd1+Vg##voltage across R3\n",
    "print \"\\n Position of R2 at top to trigger at 10 degree \"\n",
    "Vr1=Es1-Vt##since Vt=Vr2+Vr3\n",
    "#I1_min>>Ig ie 200 microA\n",
    "I1_min=1e-3#\n",
    "R1=Vr1/I1_min#\n",
    "print \"\\n Therefore R1=%.4f kohm \\n\"%(R1*1e-3)\n",
    "print \" We use R1=4.7 kohm standard value \\n\\n\"\n",
    "R1=4.7e3##standard value R1\n",
    "x=Vt/I1_min##x=R2+R3\n",
    "print \" Position of R2 at bottom to trigger at 90 degree \"\n",
    "Vr3=Vt#\n",
    "I1=Es2/(R1+x)#\n",
    "R3=Vr3/I1#\n",
    "print \"\\n Therefore R3=%.2f ohm \\n\"%(R3)\n",
    "print \" We use R3=270 ohm standard value \\n\"\n",
    "R3=270##standard value R3\n",
    "R2=x-R3##since x=R2+R3\n",
    "print \"\\n Therefore R2=%.2f kohm \\n\"%(R2*1e-3)\n",
    "print \" We use the pot=1.5 kohm standard value for precise judgement\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 6_3 PG-6.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Therefore frequency of oscillation is 2.305 kHz \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "Rt=5##resistance in kohm\n",
    "Ct=0.1##capacitance in micro farad\n",
    "n=0.58##standoff ratio\n",
    "\n",
    "T=Rt*Ct*log(1/(1-n))##time period in seconds\n",
    "fo=1/T##frequency of oscillations\n",
    "fo=fo#\n",
    "print \"\\n Therefore frequency of oscillation is %.3f kHz \\n\"%(fo)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 6_4 PG-6.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "We know that Vp=Vbb(1-exp(-T/(Rt*Ct)))\n",
      "\n",
      " Therefore frequency of oscillation is 1.218 kHz \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "Vbb=20#\n",
    "Ct=0.1e-6##capacitance\n",
    "Rt=10e3##resistance \n",
    "Vv=1.5##valley potential\n",
    "Vd=0.7##cut in voltage of diode \n",
    "n=0.6##stand off ratio\n",
    "Vp=n*Vbb+Vd#\n",
    "print \"We know that Vp=Vbb(1-exp(-T/(Rt*Ct)))\"\n",
    "x=(Vp-Vv)/Vbb##x=(1-exp(-T/(Rt*Ct))\n",
    "y=1-x##y=exp(-T/(Rt*Ct)\n",
    "z=Rt*Ct#\n",
    "T=-log(y)*z##time period\n",
    "fo=1/T##frequency of oscillations\n",
    "fo=fo*1e-3#\n",
    "print \"\\n Therefore frequency of oscillation is %.3f kHz \\n\"%(fo)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 6_5 PG-6.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " For turn ON\n",
      "\n",
      "  Rt<(Vbb-Vp)/Ip\n",
      "\n",
      "  therefore Rt<342857 0hm \n",
      "\n",
      " \n",
      "  For turn OFF\n",
      "\n",
      "  Rt>(Vbb-Vv)/Iv\n",
      "\n",
      "  therefore Rt>1947 0hm \n",
      "\n",
      "\n",
      "  So range of Rt is 1.947 kohm< Rt <342.86 kohm \n",
      "\n"
     ]
    }
   ],
   "source": [
    "Vbb=30#\n",
    "Vv=0.8##valley potential\n",
    "Iv=15e-3\n",
    "Vd=0.7##cut in voltage of diode \n",
    "n=0.33##stand off ratio\n",
    "Vp=18#\n",
    "Ip=35e-6#\n",
    "print \" For turn ON\"\n",
    "print \"\\n  Rt<(Vbb-Vp)/Ip\"\n",
    "Rt=(Vbb-Vp)/Ip#\n",
    "print \"\\n  therefore Rt<%.0f 0hm \\n\"%(Rt)\n",
    "print \" \\n  For turn OFF\"\n",
    "print \"\\n  Rt>(Vbb-Vv)/Iv\"\n",
    "Rt1=(Vbb-Vv)/Iv\n",
    "print \"\\n  therefore Rt>%.0f 0hm \\n\"%(Rt1)\n",
    "print \"\\n  So range of Rt is %.3f kohm< Rt <%.2f kohm \\n\"%(Rt1*1e-3,Rt*1e-3)"
   ]
  }
 ],
 "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
}
