{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 22 : RC and L/R Time Constants"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_1 Page No.  674"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 0.20 Seconds\n"
     ]
    }
   ],
   "source": [
    "# What is the time constant of a 20-H coil having 100 Ohms\u0002 of series resistance?\n",
    "\n",
    "# Given data\n",
    "\n",
    "L = 20.#     # Inductor=20 Henry\n",
    "R = 100.#    # Resistor=100 Ohms\n",
    "\n",
    "T = L/R#\n",
    "print 'The Time Constant = %0.2f Seconds'%T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_2 Page No.  674"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Since 0.2 sec is one time constant, I is 63% of 100 mA\n",
      "The current at 0.2 sec time constant = 0.06 A\n",
      "After 1 sec the current reaches its steady state value of 100 mAmps \n"
     ]
    }
   ],
   "source": [
    "# An applied dc voltage of 10 V will produce a steady-state current of 100 mA in the 100-Ohms coil. How much is the current after 0.2 s? After 1 s?\n",
    "\n",
    "# Given data\n",
    "\n",
    "L = 20.#         # Inductor=20 Henry\n",
    "R = 100.#        # Resistor=100 Ohms\n",
    "I = 100.*10**-3#  # Steady-state current=100 mAmps\n",
    "\n",
    "print 'Since 0.2 sec is one time constant, I is 63% of 100 mA'\n",
    "I1 = 0.63*I#\n",
    "print 'The current at 0.2 sec time constant = %0.2f A'%I1\n",
    "\n",
    "print 'After 1 sec the current reaches its steady state value of 100 mAmps '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_3 Page No.  675"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 2.00e-05 Seconds\n",
      "i.e 20 us\n"
     ]
    }
   ],
   "source": [
    "# If a 1-M Ohms\u0002 R is added in series with the coil, how much will the time constant be for the higher resistance RL circuit?\n",
    "\n",
    "# Given data\n",
    "\n",
    "L = 20.#        # Inductor=20 Henry\n",
    "R = 1.*10**6#    # Resistor=1 MOhms\n",
    "\n",
    "T = L/R#\n",
    "print 'The Time Constant = %0.2e Seconds'%T\n",
    "print 'i.e 20 us'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_4 Page No.  676"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 1.00e-02 Seconds\n"
     ]
    }
   ],
   "source": [
    "# What is the time constant of a 0.01-u\u0003F capacitor in series with a 1-M\u0002 Ohmsresistance?\n",
    "\n",
    "# Given data\n",
    "\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "R = 1*10**6#         # Resistor=1 MOhms\n",
    "\n",
    "T = C*R#\n",
    "print 'The Time Constant = %0.2e Seconds'%T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_5 Page No.  677"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 1.00e-02 Seconds\n",
      "Since 0.01 sec is one time constant, the voltage across C then is 63% of 300 V,\n",
      "The Capacitor voltage at 0.01 Sec = 189.00 Volts\n",
      "After 5 time constants or 0.05 Sec Capacitor voltage = 300.00 volts \n",
      "After 2 hours or 2 days the C will be still charged to 300 V if the supply is still connected\n"
     ]
    }
   ],
   "source": [
    "# With a dc voltage of 300 V applied, how much is the voltage across C in Example 22–4 after 0.01 s of charging? After 0.05 s? After 2 hours? After 2 days?\n",
    "\n",
    "# Given data\n",
    "\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "R = 1.*10**6#         # Resistor=1 MOhms\n",
    "V = 300.#            # Applied DC=300 Volts\n",
    "\n",
    "T = C*R#\n",
    "print 'The Time Constant = %0.2e Seconds'%T\n",
    "\n",
    "print 'Since 0.01 sec is one time constant, the voltage across C then is 63% of 300 V,'\n",
    "\n",
    "T1 = 0.63*V#\n",
    "print 'The Capacitor voltage at 0.01 Sec = %0.2f Volts'%T1\n",
    "\n",
    "T2 = V\n",
    "print 'After 5 time constants or 0.05 Sec Capacitor voltage = %0.2f volts '%V\n",
    "\n",
    "print 'After 2 hours or 2 days the C will be still charged to 300 V if the supply is still connected'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_6 Page No.  678"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "In one time constant, C discharges to 37% of its initial voltage\n",
      "The Capacitor voltage after 0.01 sec start of discharge = 1110 volts\n"
     ]
    }
   ],
   "source": [
    "# If the capacitor is allowed to charge to 300 V and then discharged, how much is the capacitor voltage 0.01 s after the start of discharge? The series resistance is the same on discharge as on charge.\n",
    "\n",
    "# Given data\n",
    "\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "R = 1.*10**6#         # Resistor=1 MOhms\n",
    "V = 3000#            # Applied DC=300 Volts\n",
    "\n",
    "print 'In one time constant, C discharges to 37% of its initial voltage'\n",
    "\n",
    "V1 = 0.37*V#\n",
    "print 'The Capacitor voltage after 0.01 sec start of discharge = %0.f volts'%V1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_7 Page No.  680"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "In one time constant, C discharges to 37% of its initial voltage\n",
      "The Capacitor voltage after 0.01 sec start of discharge = 74 volts\n"
     ]
    }
   ],
   "source": [
    "# Assume the capacitor is discharging after being charged to 200 V. How much will the voltage across C be 0.01 s after the beginning of discharge? The series resistance is the same on discharge as on charge.\n",
    "\n",
    "# Given data\n",
    "\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "R = 1*10**6#         # Resistor=1 MOhms\n",
    "V = 200#            # Capacitor voltage=200 Volts\n",
    "\n",
    "print 'In one time constant, C discharges to 37% of its initial voltage'\n",
    "\n",
    "V1 = 0.37*V#\n",
    "print 'The Capacitor voltage after 0.01 sec start of discharge = %0.f volts'%V1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_8 Page No.  681"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 2.00e-02 Seconds\n"
     ]
    }
   ],
   "source": [
    "# If a 1-M Ohms resistance is added in series with the capacitor 0.01-u\u0003F and resistor 1-M Ohms in, how much will the time constant be?\n",
    "\n",
    "# Given data\n",
    "\n",
    "C = 0.01*10**-6#     # Capacitor=0.01 uFarad\n",
    "R = 2*10**6#         # Resistor= 2 MOhms \n",
    "\n",
    "T = C*R#\n",
    "print 'The Time Constant = %0.2e Seconds'%T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_9 Page No.  682"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Value of Vr = 5.42 Volts\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "# An RC circuit has a time constant of 3 s. The capacitor is charged to 40 V. Then C is discharged. After 6 s of discharge, how much is Vr?\n",
    "\n",
    "# Given data\n",
    "\n",
    "RC = 3#     # RC time constant=3 Sec\n",
    "t = 6#      # Discharge time=6 Sec\n",
    "Vc = 40#    # Capacitor voltage=40 Volts\n",
    "\n",
    "A = t/RC#   # constant factor\n",
    "B = log10(Vc)#\n",
    "\n",
    "Vr = 10**(B-(A*0.434))#\n",
    "print 'The Value of Vr = %0.2f Volts'%Vr"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example No. 22_10 Page No.  682"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Time Constant = 5.00e-04 Seconds\n",
      "i.e 0.5*10**-3 Sec OR 0.5 mSec\n",
      "Time required to charge Capacitor upto 24 Volts = 5.49e-04 Seconds\n",
      "i.e approx 0.549*10**-3 Sec OR 0.549 mSec\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "# An RC circuit has an R of 10 k Ohms\u0002 and a C of 0.05 u\u0003F. The applied voltage for charging is 36 V. (a) Calculate the time constant. (b) How long will it take C to charge to 24 V?\n",
    "\n",
    "C = 0.05*10**-6#     # Capacitor=0.05 uFarad\n",
    "R = 10*10**3#        # Resistor=10 kOhms\n",
    "V = 36#             # Applied voltage=36 Volts\n",
    "v = 12#             # Voltage drops from 36 to 12 Volts\n",
    "A = 2.3#            # Specific factor\n",
    "\n",
    "T = C*R#\n",
    "print 'The Time Constant = %0.2e Seconds'%T\n",
    "print 'i.e 0.5*10**-3 Sec OR 0.5 mSec'\n",
    "\n",
    "t = A*T*log10(V/v)#\n",
    "print 'Time required to charge Capacitor upto 24 Volts = %0.2e Seconds'%t\n",
    "print 'i.e approx 0.549*10**-3 Sec OR 0.549 mSec'"
   ]
  }
 ],
 "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
}