summaryrefslogtreecommitdiff
path: root/sample_notebooks/Salman
diff options
context:
space:
mode:
Diffstat (limited to 'sample_notebooks/Salman')
-rwxr-xr-xsample_notebooks/Salman/ElecEngg2.ipynb604
1 files changed, 604 insertions, 0 deletions
diff --git a/sample_notebooks/Salman/ElecEngg2.ipynb b/sample_notebooks/Salman/ElecEngg2.ipynb
new file mode 100755
index 00000000..fd0e270d
--- /dev/null
+++ b/sample_notebooks/Salman/ElecEngg2.ipynb
@@ -0,0 +1,604 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2 : Diode Applications"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2\n",
+ ": Page No 96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import pi\n",
+ "# Given data\n",
+ "R_L = 1 # in K ohm\n",
+ "R_L = R_L * 10**3 # in ohm\n",
+ "V_m = 15 # in V\n",
+ "V_i = '15*sin(314*t)' \n",
+ "I_m= V_m/R_L # in A\n",
+ "I_dc = I_m/pi # in A\n",
+ "I_dc = I_dc * 10**3 # in mA\n",
+ "print \"Average current through the diode = %0.2f mA\" %I_dc\n",
+ "I_drms = V_m/(2*R_L) \n",
+ "I_drms = I_drms * 10**3 # in mA\n",
+ "print \"RMS current = %0.1f mA\" %I_drms\n",
+ "I_m = V_m/R_L \n",
+ "I_m = I_m*10**3 # in mA\n",
+ "print \"Peak diode current = %0.f mA\" %I_m\n",
+ "PIV = 2*V_m # in V\n",
+ "print \"Peak inverse voltage = %0.f V\" %PIV"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average current through the diode = 4.77 mA\n",
+ "RMS current = 7.5 mA\n",
+ "Peak diode current = 15 mA\n",
+ "Peak inverse voltage = 30 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3\n",
+ ": Page No 101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R1 = 2.2*10**3 # in ohm\n",
+ "R2 = 4.7*10**3 # in ohm\n",
+ "R_AB = (R1*R2)/(R1+R2) # in ohm\n",
+ "Vi = 20 # in V\n",
+ "V_o = (Vi * R_AB)/(R_AB+R1) # in V\n",
+ "PIV= Vi # in volts\n",
+ "print \"The output voltage = %0.1f V\" %V_o\n",
+ "print \"Peak inverse voltage = %0.f volts\" %PIV"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The output voltage = 8.1 V\n",
+ "Peak inverse voltage = 20 volts\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ " Example 2.4.2 (again 2.4)\n",
+ ": Page No 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_in = 10 # in V\n",
+ "R_L = 2000 # in ohm\n",
+ "R1 = 100 # in ohm\n",
+ "V_R= 0.7 # in V\n",
+ "V_o = V_in * ( (R_L)/(R1+R_L) ) # in V\n",
+ "print \"The peak magnitude of the positive output voltage = %0.f V\" %V_o \n",
+ "Vo=-V_R # in V\n",
+ "print \"The peak magnitude of the negative output voltage = %0.f V\" %Vo"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The peak magnitude of the positive output voltage = 10 V\n",
+ "The peak magnitude of the negative output voltage = -1 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ " Example 2.4\n",
+ ": Page No 124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_in = 10 # in V\n",
+ "R1 = 2000 # in ohm\n",
+ "R2 = 2000 # in ohm\n",
+ "V_o = V_in * (R1/(R1+R2) ) # in V\n",
+ "# Vdc= 5/(T/2)*integrate('sin(omega*t)','t',0,T/2) and omega*T= 2*pi, So\n",
+ "Vdc= -5/pi*(cos(pi)-cos(0)) # in V\n",
+ "print \"The value of Vdc = %0.2f volts\" %Vdc\n",
+ "PIV= V_in/2 # in V\n",
+ "print \"The PIV value = %0.2f volts\" %PIV"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of Vdc = 3.18 volts\n",
+ "The PIV value = 5.00 volts\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7\n",
+ ": Page No 141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V=240 # in V\n",
+ "R= 1 # in k\u03a9\n",
+ "R=R*10**3 # in \u03a9\n",
+ "Vsrms= V/4 # in V\n",
+ "Vm= sqrt(2)*Vsrms # in V\n",
+ "V_Ldc= -Vm/pi # in V\n",
+ "print \"The value of average load voltage = %0.f volts\" %V_Ldc"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of average load voltage = -27 volts\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8\n",
+ ": Page No 142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V = 220 # in V\n",
+ "f=50 # in Hz\n",
+ "N2byN1=1/4 \n",
+ "R_L = 1 # in kohm\n",
+ "R_L= R_L*10**3 # in ohm\n",
+ "V_o = 220 # in V\n",
+ "V_s = N2byN1*V_o # in V\n",
+ "V_m = sqrt(2) * V_s # in V\n",
+ "V_Ldc = (2*V_m)/pi # in V\n",
+ "print \"Average load output voltage = %0.2f V\" %V_Ldc\n",
+ "P_dc = (V_Ldc)**2/R_L # in W\n",
+ "print \"DC power delivered to load = %0.2f watt\" %P_dc\n",
+ "PIV = V_m # in V\n",
+ "print \"Peak inverse Voltage = %0.2f V\" %PIV\n",
+ "f_o = 2*f # in Hz\n",
+ "print \"Output frequency = %0.f Hz\" %f_o"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average load output voltage = 49.52 V\n",
+ "DC power delivered to load = 2.45 watt\n",
+ "Peak inverse Voltage = 77.78 V\n",
+ "Output frequency = 100 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.16\n",
+ ": Page No 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_dc = 12 # in V\n",
+ "R_L = 500 # in ohm\n",
+ "R_F = 25 # in ohm\n",
+ "I_dc = V_dc/R_L # in A\n",
+ "V_m = I_dc * pi * (R_L+R_F) # in V\n",
+ "V_rms = V_m/sqrt(2) # in V\n",
+ "V = V_rms # in V\n",
+ "print \"The voltage = %0.f V\" %round(V)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The voltage = 28 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 54
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.17\n",
+ ": Page No 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_dc = 100 # in V\n",
+ "V_m = (V_dc*pi)/2 # in V\n",
+ "PIV = 2*V_m # in V\n",
+ "print \"Peak inverse voltage for center tapped FWR = %0.2f V\" %PIV\n",
+ "PIV1 = V_m # in V\n",
+ "print \"Peak inverse voltage for bridge type FWR = %0.2f V\" %PIV1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Peak inverse voltage for center tapped FWR = 314.16 V\n",
+ "Peak inverse voltage for bridge type FWR = 157.08 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 55
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.19\n",
+ ": Page No 153"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_Gamma = 0.7 # in V\n",
+ "R_f = 0 # in ohm\n",
+ "V_rms = 120 # in V\n",
+ "V_max = sqrt(2)*V_rms # in V\n",
+ "R_L = 1 # in K ohm\n",
+ "R_L = R_L * 10**3 # in ohm\n",
+ "I_max = (V_max - (2*V_Gamma))/R_L # in A\n",
+ "I_dc = (2*I_max)/pi # in mA\n",
+ "V_dc = I_dc * R_L # in V\n",
+ "print \"The dc voltage available at the load = %0.2f V\" %V_dc\n",
+ "PIV = V_max # in V\n",
+ "print \"Peak inverse voltage = %0.1f V\" %PIV\n",
+ "print \"Maximum current through diode = %0.1f mA\" %(I_max*10**3)\n",
+ "P_max = V_Gamma * I_max # in W\n",
+ "print \"Diode power rating = %0.2f mW\" %(P_max*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The dc voltage available at the load = 107.15 V\n",
+ "Peak inverse voltage = 169.7 V\n",
+ "Maximum current through diode = 168.3 mA\n",
+ "Diode power rating = 117.81 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.20\n",
+ ": Page No 154"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V1 = 10 # in V\n",
+ "V2 = 0.7 # in V\n",
+ "V3 = V2 # in V\n",
+ "V = V1-V2-V3 # in V\n",
+ "R1 = 1 # in ohm\n",
+ "R2 = 48 # in ohm\n",
+ "R3 = 1 # in ohm\n",
+ "R = R1+R2+R3 # in ohm\n",
+ "I = V/R # in A\n",
+ "I = I * 10**3 # in mA\n",
+ "print \"Current = %0.f mA\" %I"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Current = 172 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.22\n",
+ ": Page No 155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R_L = 1 # in K ohm\n",
+ "R_L = R_L * 10**3 # in ohm\n",
+ "r_d = 10 # in ohm\n",
+ "V_m = 220 # in V\n",
+ "I_m = V_m/(r_d+R_L) # in A\n",
+ "print \"Peak value of current = %0.2f A\" %I_m\n",
+ "I_dc = (2*I_m)/pi # in A\n",
+ "print \"DC value of current = %0.2f A\" %I_dc\n",
+ "Irms= I_m/sqrt(2) # in A\n",
+ "r_f = sqrt((Irms/I_dc)**2-1)*100 # in %\n",
+ "print \"Ripple factor = %0.1f %%\" %r_f\n",
+ "Eta = (I_dc)**2 * R_L/((Irms)**2*(R_L+r_d))*100 # in %\n",
+ "print \"Rectification efficiency = %0.1f %%\" %Eta"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Peak value of current = 0.22 A\n",
+ "DC value of current = 0.14 A\n",
+ "Ripple factor = 48.3 %\n",
+ "Rectification efficiency = 80.3 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 58
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.23\n",
+ ": Page No 156"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_s = 12 # in V\n",
+ "R_L = 5.1 # in k ohm\n",
+ "R_L = R_L * 10**3 # in ohm\n",
+ "R_s = 1 # in K ohm\n",
+ "R_s = R_s * 10**3 # in ohm\n",
+ "V_L = (V_s*R_L)/(R_s+R_L) # in V\n",
+ "print \"Peak load voltage = %0.f V\" %V_L"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Peak load voltage = 10 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.24\n",
+ ": Page No 157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_s = 10 # in V\n",
+ "R_L = 100 # in ohm\n",
+ "I_L = V_s/R_L # in A\n",
+ "print \"The load current during posotive half cycle = %0.1f A\" %I_L\n",
+ "I_D2 = 0 # in A\n",
+ "R2 = R_L # in ohm\n",
+ "I_L1 = -(V_s)/(R2+R_L) # in A\n",
+ "print \"The load current during negative half cycle = %0.2f A\" %I_L1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The load current during posotive half cycle = 0.1 A\n",
+ "The load current during negative half cycle = -0.05 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.25\n",
+ ": Page No 158"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_m = 50 # in V\n",
+ "V_dc = (2*V_m)/pi # in V\n",
+ "print \"The dc voltage = %0.2f V\" %V_dc"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The dc voltage = 31.83 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.26\n",
+ ": Page No 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R1 = 1.1 # in K ohm\n",
+ "R2 = 2.2 # in K ohm\n",
+ "Vi= 170 # in V\n",
+ "V_o = (Vi*R1)/(R1+R2) # in V\n",
+ "print \"The output voltage = %0.2f V\" %V_o\n",
+ "V_dc = (2*V_o)/pi # in V\n",
+ "print \"The dc voltage = %0.2f V\" %V_dc"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The output voltage = 56.67 V\n",
+ "The dc voltage = 36.08 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 62
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file