{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter - 34 : REGULATED POWER SUPPLIES "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.1 Pg 955"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "LR=20.00 microV/V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VL=100*10**-6#\n",
    "VS=5#\n",
    "LR=VL/VS#\n",
    "print 'LR=%0.2f microV/V'%(LR*10**6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.2 Pg 955"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VL=14.00 microV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "LR=1.4*10**-6#\n",
    "VS=10#\n",
    "#LR=VL/VS#\n",
    "VL=LR*VS\n",
    "print 'VL=%0.2f microV'%(VL*10**6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.3 Pg 956"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "LR=125.00 microV/mA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "IL=40*10**-3#\n",
    "VNL=8#\n",
    "VFL=7.995#\n",
    "LR=(VNL-VFL)/IL#\n",
    "print 'LR=%0.2f microV/mA'%(LR*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.4 Pg 956"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VFL=5.00\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VNL=5#\n",
    "IL=20*10**-3#\n",
    "LR=10*10**-6#\n",
    "#LR=(VNL-VFL)/IL#\n",
    "VFL=VNL-IL*LR#\n",
    "print 'VFL=%0.2f'%VFL"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.5 Pg 957"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VAR=0.20 mV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "#e.g 34.5\n",
    "V0=10#\n",
    "R=0.00002\n",
    "VAR=V0*R#\n",
    "print 'VAR=%0.2f mV'%(VAR*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.6 Pg 957"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "vl=12.00 V\n",
      "Vd=18.00 V\n",
      "Iz=0.05 A\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "#e.g 34.6\n",
    "vs=30#\n",
    "rs=240#\n",
    "vz=12#\n",
    "rl=500#\n",
    "vl=vz#\n",
    "print 'vl=%0.2f V'%vl\n",
    "Is=(vs-vz)/rs\n",
    "Vd=Is*rs#\n",
    "print 'Vd=%0.2f V'%Vd\n",
    "Iz=Is-(vl/rl)\n",
    "print 'Iz=%0.2f A'%Iz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.7 Pg 957"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vomin=5.11 \n",
      "Vsmin=5.71 \n",
      "Vomax=5.25 \n",
      "Vsmax=14.25 \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vz=5.1#\n",
    "rz=10#\n",
    "Izmin=1*10**-3#\n",
    "Izmax=15*10**-3#\n",
    "Rs=600#\n",
    "Vomin=Vz+Izmin*rz#\n",
    "print 'Vomin=%0.2f '%Vomin\n",
    "Vsmin=Izmin*Rs+Vomin#\n",
    "print 'Vsmin=%0.2f '%Vsmin\n",
    "Vomax=Vz+Izmax*rz#\n",
    "print 'Vomax=%0.2f '%Vomax\n",
    "Vsmax=Izmax*Rs+Vomax#\n",
    "print 'Vsmax=%0.2f '%Vsmax"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.8 Pg 958"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Is=24.00 mA\n",
      "ILmax=21.00 mA\n",
      "RLmin=571.43 ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vs=24#\n",
    "Rs=500#\n",
    "Vz=12#\n",
    "Izmin=3*10**-3#\n",
    "Izmax=90*10**-3#\n",
    "rz=0#\n",
    "Is=(Vs-Vz)/Rs#\n",
    "print 'Is=%0.2f mA'%(Is*10**3)\n",
    "ILmax=Is-Izmin#\n",
    "print 'ILmax=%0.2f mA'%(ILmax*10**3)\n",
    "RLmin=Vz/ILmax#\n",
    "print 'RLmin=%0.2f ohm'%(RLmin)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.9 Pg 958"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IL=5.00 mA\n",
      "Izmax=25.00 mA\n",
      "Izmin=7.00 mA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vsmin=22#\n",
    "Rs=1*10**3#\n",
    "Vz=10#\n",
    "RL=2*10**3#\n",
    "Vsmax=40#\n",
    "IL=Vz/RL#\n",
    "print 'IL=%0.2f mA'%(IL*10**3)\n",
    "Izmax=((Vsmax-Vz)/Rs)-IL#\n",
    "print 'Izmax=%0.2f mA'%(Izmax*10**3)\n",
    "Izmin=((Vsmin-Vz)/Rs)-IL#\n",
    "print 'Izmin=%0.2f mA'%(Izmin*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.10 Pg 958"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rsmax=30.00 ohm\n",
      "Pzmx=1.90 W\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vz=10#\n",
    "Vsmin=13#\n",
    "Vsmax=16#\n",
    "ILmin=10*10**-3#\n",
    "ILmax=85*10**-3#\n",
    "Izmin=15*10**-3#\n",
    "Rsmax=(Vsmin-Vz)/(Izmin+ILmax)#\n",
    "print 'Rsmax=%0.2f ohm'%Rsmax\n",
    "Izmax=((Vsmax-Vz)/Rsmax)-ILmin#\n",
    "Pzmax=Izmax*Vz#\n",
    "print 'Pzmx=%0.2f W'%Pzmax"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.11 Pg 959"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rsmax=499.67 ohm\n",
      "Rsmin=77.89 ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "Vsmin=19.5#\n",
    "Vsmax=22.5#\n",
    "RL=6*10**3#\n",
    "Vz=18#\n",
    "Izmin=2*10**-6#\n",
    "Pzmax=60*10**-3#\n",
    "rz=20#\n",
    "Izmax=sqrt(Pzmax/rz)#\n",
    "IL=Vz/RL#\n",
    "ILmax=IL#\n",
    "ILmin=IL#\n",
    "Rsmax=(Vsmin-Vz)/(Izmin+ILmax)#\n",
    "print 'Rsmax=%0.2f ohm'%Rsmax\n",
    "Rsmin=(Vsmax-Vz)/(Izmax+ILmin)#\n",
    "print 'Rsmin=%0.2f ohm'%Rsmin"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.12 Pg 959"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Izmin=0.86 mA\n",
      "Izmax=2.68 mA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vsmin=8#\n",
    "Vsmax=12#\n",
    "Rs=2.2*10**3#\n",
    "Vz=5#\n",
    "RL=10*10**3#\n",
    "Ismin=(Vsmin-Vz)/Rs#\n",
    "Ismax=(Vsmax-Vz)/Rs#\n",
    "IL=Vz/RL#\n",
    "Izmin=Ismin-IL#\n",
    "print 'Izmin=%0.2f mA'%(Izmin*10**3)\n",
    "Izmax=Ismax-IL#\n",
    "print 'Izmax=%0.2f mA'%(Izmax*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.13 Pg 960"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rsmin=83.33 ohm\n",
      "Iz=28.00 mA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VL=5#\n",
    "Vz=5#\n",
    "IL=20*10**-3#\n",
    "Pzmax=500*10**-3#\n",
    "Vsmax=15#\n",
    "Vsmin=9#\n",
    "Izmax=Pzmax/Vz#\n",
    "Ismax=IL+Izmax#\n",
    "Vz=VL#\n",
    "Rsmin=(Vsmax-Vz)/(Izmax+IL)#\n",
    "print 'Rsmin=%0.2f ohm'%Rsmin\n",
    "ILmax=IL#\n",
    "Iz=((Vsmin-Vz)/Rsmin)-ILmax#\n",
    "print 'Iz=%0.2f mA'%(Iz*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.14 Pg 960"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ib=233.03 microA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vz=10#\n",
    "Vbe=0.7#\n",
    "RL=100#\n",
    "Vs=15#\n",
    "B=100#\n",
    "Rs=33#\n",
    "VL=Vz+Vbe#\n",
    "IL=VL/RL#\n",
    "Is=(Vs-VL)/Rs#\n",
    "Ic=Is-IL#\n",
    "Ib=Ic/B#\n",
    "print 'Ib=%0.2f microA'%(Ib*10**6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.15 Pg 960"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IB=38.00 microA\n",
      "Iz=3.68 mA\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vs=15#\n",
    "Vz=8.3#\n",
    "B=100#\n",
    "R=1.8*10**3#\n",
    "RL=2*10**3#\n",
    "Vbe=0.7#\n",
    "VL=Vz-Vbe#\n",
    "Vce=Vs-VL#\n",
    "IR=(Vs-Vz)/R#\n",
    "IL=VL/RL#\n",
    "IB=IL/B#\n",
    "print 'IB=%0.2f microA'%(IB*10**6) #In question beta is 100 but while solving it is taken as 50 which is wrong\n",
    "Iz=IR-IB#\n",
    "print 'Iz=%0.2f mA'%(Iz*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.16 Pg 961"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rmax=119.05 ohm\n",
      "Izmax=63.00 mA\n",
      "Pzmax=0.79 W\n",
      "PRmax=0.47 W\n",
      "VCEmax=8.00 V\n",
      "PDmax=16.00 W\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "ILmin=0#\n",
    "ILmax=2#\n",
    "VL=12#\n",
    "Vsmin=15#\n",
    "Vsmax=20#\n",
    "B=100#\n",
    "VBE=0.5#\n",
    "Vz=12.5#\n",
    "Izmin=1*10**-3#\n",
    "IBmax=ILmax/B#\n",
    "IR=IBmax+Izmin\n",
    "Rmax=(Vsmin-Vz)/IR#\n",
    "print 'Rmax=%0.2f ohm'%Rmax\n",
    "Izmax=(Vsmax-Vz)/Rmax#\n",
    "print 'Izmax=%0.2f mA'%(Izmax*10**3)\n",
    "Pzmax=Vz*Izmax#\n",
    "print 'Pzmax=%0.2f W'%Pzmax\n",
    "PRmax=(Vsmax-Vz)*Izmax#\n",
    "print 'PRmax=%0.2f W'%PRmax\n",
    "VCEmax=Vsmax-VL#\n",
    "print 'VCEmax=%0.2f V'%VCEmax\n",
    "PDmax=VCEmax*ILmax#\n",
    "print 'PDmax=%0.2f W'%PDmax"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.17 Pg 961"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RD=600.00 ohm\n",
      "R1=530.00 ohm\n",
      "R2=670.00 ohm\n",
      "R3=1.51 kohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "VL=12#\n",
    "IL=200*10**-3#\n",
    "Vs=30#\n",
    "Rs=10#\n",
    "B1=150#\n",
    "Ic1=10*10**-3#\n",
    "VBE1=0.7#\n",
    "B2=100#\n",
    "VBE2=0.7#\n",
    "Vz=6#\n",
    "Rz=10#\n",
    "Iz=20*10**-3#\n",
    "ID=10*10**-3#\n",
    "I1=10*10**-3#\n",
    "RD=(VL-Vz)/ID#\n",
    "print 'RD=%0.2f ohm'%RD\n",
    "#a=R1/R2#\n",
    "a=(VL/(Vz+VBE2))-1#\n",
    "Ic2=Ic1#\n",
    "IB2=Ic2/B2#\n",
    "V2=Vz+VBE2#\n",
    "Vz=12#\n",
    "R1=(Vz-V2)/I1#\n",
    "print 'R1=%0.2f ohm'%R1\n",
    "R2=R1/a#\n",
    "print 'R2=%0.2f ohm'%R2\n",
    "hfe1=B1#\n",
    "IB1=(IL+I1+ID)/hfe1#\n",
    "I=IB1+Ic2#\n",
    "R3=(Vs-(VBE1+VL))/I#\n",
    "print 'R3=%0.2f kohm'%(R3*10**-3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.18 Pg 961"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vout=8.20 V\n",
      "IE1=8.20 mA\n",
      "P1=137.76 mW\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "Vs=25#\n",
    "Vz=15#\n",
    "RL=1*10**3#\n",
    "VBE2=0.7#\n",
    "Vout=(Vz/2)+VBE2#\n",
    "print 'Vout=%0.2f V'%Vout\n",
    "IL=Vout/RL#\n",
    "IE1=IL#\n",
    "print 'IE1=%0.2f mA'%(IE1*10**3)\n",
    "Vce1=Vs-Vout#\n",
    "P1=Vce1*IE1#\n",
    "print 'P1=%0.2f mW'%(P1*10**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.19 Pg 961"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voutmin=1.25 V\n",
      "Voutmax=30.16 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "IADJ=100*10**-6#\n",
    "Vin=35#\n",
    "VREF=1.25#\n",
    "R2=0#\n",
    "R1=220#\n",
    "Voutmin=VREF*(1+(R2/R1))+IADJ*R2#\n",
    "print 'Voutmin=%0.2f V'%Voutmin\n",
    "R2=5000#\n",
    "Voutmax=VREF*(1+(R2/R1))+IADJ*R2#\n",
    "print 'Voutmax=%0.2f V'%Voutmax"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.20 Pg 962"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vo=9.77 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "R1=220#\n",
    "R2=1500#\n",
    "Vo=1.25*(1+(R2/R1))#\n",
    "print 'Vo=%0.2f V'%Vo #answer given in book is wrong"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex 34.21 Pg 962"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vo=13.75 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "\n",
    "R1=240#\n",
    "R2=2.4*10**3#\n",
    "Vo=1.25*(1+(R2/R1))#\n",
    "print 'Vo=%0.2f V'%Vo"
   ]
  }
 ],
 "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
}
