{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER 16: LABORATORY POWER SUPPLIES"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16-1, Page Number: 423"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Source Effect= 50.0 mV\n",
      "Line Regulation= 0.42 %\n",
      "Load Effect= 100.0 mV\n",
      "Load Regulation= 0.83 %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "#Output voltages at various instances in V\n",
    "Eo1=12\n",
    "Eo2=11.95\n",
    "Eo3=12\n",
    "Eo4=11.9\n",
    "\n",
    "#Calculation\n",
    "source_effect=Eo1-Eo2                    #Change in output voltage due to 10% change in input\n",
    "line_regulation=source_effect*100/Eo1    #percentage\n",
    "\n",
    "load_effect=Eo3-Eo4                     #Change in output voltage due to change in load from no load to minimum load \n",
    "load_regulation=load_effect*100/Eo3\n",
    "\n",
    "#Results\n",
    "print \"Source Effect=\",source_effect*10**3,\"mV\"\n",
    "print \"Line Regulation=\",round(line_regulation,2),\"%\"\n",
    "print \"Load Effect=\",load_effect*10**3,\"mV\"\n",
    "print \"Load Regulation=\",round(load_regulation,2),\"%\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16-2, Page Number: 428"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum output voltage= 15.2 V\n",
      "Minimum output voltgae= 9.9 V\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "Vz=6                   #Zener voltage in V\n",
    "R2=5.6*10**3           #in ohm\n",
    "R3=5.6*10**3           #in ohm\n",
    "R4=3*10**3             #in ohm\n",
    "\n",
    "#Calculation\n",
    "\n",
    "#When the moving contact is at the botton of R4, \n",
    "Vr3=Vz                 #in V\n",
    "I3=Vz/R3               #in A\n",
    "Eo=I3*(R2+R3+R4)       #in V\n",
    "\n",
    "print \"Maximum output voltage=\",round(Eo,1),\"V\"\n",
    "\n",
    "#When the moving contact is at the top of R4\n",
    "\n",
    "I3=Vz/(R3+R4)         #in A\n",
    "Eo=I3*(R2+R3+R4)      #in V     \n",
    "\n",
    "print \"Minimum output voltgae=\",round(Eo,1),\"V\""
   ]
  }
 ],
 "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
}