diff options
author | kinitrupti | 2017-05-12 18:40:35 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:40:35 +0530 |
commit | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (patch) | |
tree | 9806b0d68a708d2cfc4efc8ae3751423c56b7721 /sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb | |
parent | 1b1bb67e9ea912be5c8591523c8b328766e3680f (diff) | |
download | Python-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.tar.gz Python-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.tar.bz2 Python-Textbook-Companions-d36fc3b8f88cc3108ffff6151e376b619b9abb01.zip |
Revised list of TBCs
Diffstat (limited to 'sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb')
-rwxr-xr-x | sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb b/sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb new file mode 100755 index 00000000..f808f1b3 --- /dev/null +++ b/sample_notebooks/GudePrithvi/GudePrithvi_version_backup/Chapter_3.ipynb @@ -0,0 +1,536 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:f3be7a31a0f3d765e50f86fbfff2be30e114da24ff9eb4121f1f8157ce8ea60f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3: Transmission Lines"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example number 3.1, Page number 47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Terminating impedance\n",
+ "#Variable declaration\n",
+ "Zo = 100 #o/p impedance(Ohms)\n",
+ "s = 5 #VSWR\n",
+ "\n",
+ "#Calculations\n",
+ "Zmax = Zo*s\n",
+ "\n",
+ "#Results\n",
+ "print \"Terminating impedance = \",Zmax,\"Ohms\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Terminating impedance = 500 Ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.2, Page number 47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Characteristic impedance,Attenuation constant,Phase constant,Power delivered to the load\n",
+ "import math\n",
+ "import cmath\n",
+ "\n",
+ "#Varaible declaration \n",
+ "R = 8 #resistance(Ohms)\n",
+ "L = 2*10**-3 #inductance(H/km)\n",
+ "C = 0.002*10**-6 #capacitance(F)\n",
+ "G = 0.07*10**-6 #conductance(s/km)\n",
+ "f = 2*10**3 #frequency(Hz)\n",
+ "Vs = 2 #input signal(V)\n",
+ "l = 500. #line length(km)\n",
+ "\n",
+ "#Calculations\n",
+ "w = 2*math.pi*f\n",
+ "x = complex(R,w*L)\n",
+ "y = complex(G,w*C)\n",
+ "Zo = cmath.sqrt(x/y)\n",
+ "gamma = cmath.sqrt(x*y)\n",
+ "Is = Vs/Zo.real\n",
+ "Il = Is*cmath.exp(-1*gamma*l)\n",
+ "P = Il**2*Zo.real\n",
+ "\n",
+ "#Results\n",
+ "print \"Characteristic impedance =\",Zo,\"Ohms\"\n",
+ "print \"Attenuation constant =\",round(gamma.real,6),\"NP/km\"\n",
+ "print \"Phase constant =\", round(gamma.imag,6),\"rad/km\"\n",
+ "print \"\\ncalculation error in the textbook\"\n",
+ "print \"\\nPower delivered to the load =\", round((abs(P)/1E-6),1), \"uW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Characteristic impedance = (1012.50018135-155.813417548j) Ohms\n",
+ "Attenuation constant = 0.003987 NP/km\n",
+ "Phase constant = 0.025436 rad/km\n",
+ "\n",
+ "calculation error in the textbook\n",
+ "\n",
+ "Power delivered to the load = 73.3 uW\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.3, Page number 48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Phase velocity\n",
+ "import math\n",
+ "\n",
+ "#Varaible declaration\n",
+ "f = 2*10**3 #frequency(Hz)\n",
+ "B = 0.02543 #phase constant(rad/km)\n",
+ "\n",
+ "#Calculations\n",
+ "w = 2*math.pi*f\n",
+ "Vp = w/B\n",
+ "\n",
+ "#Results\n",
+ "print \"Phase velocity =\",round((Vp/1E+3),2),\"km/sec\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Phase velocity = 494.16 km/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.4, Page number 48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Current drawn from generator,Power delivered to the load,Current flowing through the load\n",
+ "\n",
+ "import cmath\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "f = 37.5*10**6 #frequency(Hz)\n",
+ "V = 200 #Voltage signal(Vrms)\n",
+ "r = 200 #internal resistance(Ohms)\n",
+ "Zo = 200 #characteristic impedance(Ohms)\n",
+ "l = 10 #line length(m)\n",
+ "Zl = 100 #resistive load(Ohms)\n",
+ "c = 3*10**8 #velocity of propagation(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "#Part a\n",
+ "lamda = c/f\n",
+ "Bl = (5*math.degrees(math.pi))/4\n",
+ "x = complex(Zl,(Zo*math.tan(Bl)))\n",
+ "y = complex(Zo,(Zl*math.tan(Bl)))\n",
+ "Zi = Zo*(x/y)\n",
+ "Vs = (Zi.real*Zo)/(Zi.real+Zo)\n",
+ "Is = Zo/(Zi.real+Zo)\n",
+ "\n",
+ "#Part b\n",
+ "P = Vs*Is\n",
+ "\n",
+ "#Part c\n",
+ "Il = math.sqrt(P/Zl)\n",
+ "\n",
+ "#Results\n",
+ "print \"Please note that the solution given in the textbook is incorrect.Hence the difference in answers\\n\"\n",
+ "print \"Current drawn from generator is\",round(Is,3),\"A\" \n",
+ "print \"Power delivered to the load is\",round(P,2),\"W\"\n",
+ "print \"Current flowing through the load is\",round(Il,3),\"A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Please note that the solution given in the textbook is incorrect.Hence the difference in answers\n",
+ "\n",
+ "Current drawn from generator is 0.41 A\n",
+ "Power delivered to the load is 48.47 W\n",
+ "Current flowing through the load is 0.696 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.5, Page number 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Reflection co-efficient, VSWR\n",
+ "import cmath\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "zo = 50 #characteristic impedance(Ohms)\n",
+ "f = 300*10**6 #frequency(Hz)\n",
+ "zl = complex(50,50) #terminating load(Ohms)\n",
+ "c = 3*10**8 #velocity of propagation(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "rho = (zl-zo)/(zl+zo)\n",
+ "phi = cmath.phase(rho)\n",
+ "s = (1+abs(rho))/(1-abs(rho))\n",
+ "\n",
+ "#Results\n",
+ "print \"Reflection co-efficient =\",round(abs(rho),4),\"with phase =\",round(math.degrees(phi),1)\n",
+ "print \"VSWR =\",round(s,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reflection co-efficient = 0.4472 with phase = 63.4\n",
+ "VSWR = 2.62\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.6, Page number 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate position of the stub,Length of stub \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Zl = 100. #load resistance(Ohms)\n",
+ "Zo = 600. #characteristic impedance(Ohms)\n",
+ "f = 100*10**6 #frequency(Hz)\n",
+ "c = 3*10**8 #velocity of propagation(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "l = (lamda*math.atan(math.sqrt(Zl/Zo)))/(2*math.pi)\n",
+ "l_dash = (lamda*math.atan(math.sqrt((Zl*Zo)/(Zo-Zl))))/(2*math.pi)\n",
+ "\n",
+ "#Results\n",
+ "print \"The position of the stub is\", round(l,3),\"m\\n\"\n",
+ "print \"Please note that the solution for l_dash given in the textbook is incorrect\"\n",
+ "print \"Length of stub is\",round(l_dash,3),\"m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The position of the stub is 0.185 m\n",
+ "\n",
+ "Please note that the solution for l_dash given in the textbook is incorrect\n",
+ "Length of stub is 0.707 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.7, Page number 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Terminating impedance\n",
+ "import cmath\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "s = 3.2 #VSWR\n",
+ "Xmin = 0.237 #minimum voltage(V)\n",
+ "Zo = 50 #characteristic impedance(Ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "q = math.tan(math.degrees(2*math.pi*Xmin))\n",
+ "x = complex(1,-(s*q))\n",
+ "y = complex(s, -q)\n",
+ "Zl = Zo*(x/y)\n",
+ "\n",
+ "#Result\n",
+ "print \"Please note that the solution given in the textbook is incorrect.Hence the difference in answers\\n\"\n",
+ "print \"Terminating impedance =\", Zl,\"Ohms\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Please note that the solution given in the textbook is incorrect.Hence the difference in answers\n",
+ "\n",
+ "Terminating impedance = (19.6572514629-23.7885950214j) Ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.8, Page number 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate VSWR,First Vmax is loacted at load and first Vmin is located at,Vmin,Impedance at Vmin\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Zo = 50. #characteristic impedance(Ohms)\n",
+ "Zl = 100. #load resistance(Ohms)\n",
+ "f = 300*10**3 #frequency(Hz)\n",
+ "Pl = 50*10**-3 #load power(W)\n",
+ "c = 3*10**8 #velocity of propagation(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "\n",
+ "#Part a\n",
+ "rho = (Zl-Zo)/(Zl+Zo)\n",
+ "s = (1+abs(rho))/(1-abs(rho))\n",
+ "\n",
+ "#Part b\n",
+ "#Since real Zl>Zo, first Vmax is located at the load\n",
+ "Vmin_pos = lamda/4\n",
+ "\n",
+ "#Part c\n",
+ "Vmax = math.sqrt(Pl*Zl)\n",
+ "Vmin = Vmax/s\n",
+ "\n",
+ "#Part d\n",
+ "Zin_at_Vmin = Zo/s\n",
+ "Zin_at_Vmax = Zo*s\n",
+ "\n",
+ "#Results\n",
+ "print \"VSWR = \", s\n",
+ "print \"First Vmax is loacted at load and first Vmin is located at=\", Vmin_pos,\"m from the load\"\n",
+ "print \"Vmax = \",round(Vmax,2),\"V\",\"\\nVmin = \",round(Vmin,2),\"V\"\n",
+ "print \"Impedance at Vmin is \", Zin_at_Vmin,\"Ohm and impedance at Vmax is\",Zin_at_Vmax,\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "VSWR = 2.0\n",
+ "First Vmax is loacted at load and first Vmin is located at= 250 m from the load\n",
+ "Vmax = 2.24 V \n",
+ "Vmin = 1.12 V\n",
+ "Impedance at Vmin is 25.0 Ohm and impedance at Vmax is 100.0 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.9, Page number 52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Reflection loss, transmission loss, return loss\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Zo = 600. #characteristic impedance(Ohms)\n",
+ "Zs = 50 #source impedance(Ohms)\n",
+ "l = 200 #length of line(m)\n",
+ "Zl = 500. #load resistance(Ohms)\n",
+ "\n",
+ "#Calculations\n",
+ "rho = (Zl-Zo)/(Zl+Zo)\n",
+ "\n",
+ "#Part a\n",
+ "ref_l = math.log10(1/(1-((abs(rho))**2)))\n",
+ "\n",
+ "#Part b\n",
+ "#Since, the line is lossless,\n",
+ "att_l = 0\n",
+ "trans_l = ref_l+att_l\n",
+ "\n",
+ "#Part c\n",
+ "ret_l = math.log10(abs(rho))\n",
+ "\n",
+ "#Results\n",
+ "print \"Reflection loss =\",round(ref_l,4),\"dB\"\n",
+ "print \"Transmission loss =\",round(trans_l,4),\"dB\"\n",
+ "print \"Return loss =\",round(ret_l,3),\"dB (Calculation error in the textbook)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reflection loss = 0.0036 dB\n",
+ "Transmission loss = 0.0036 dB\n",
+ "Return loss = -1.041 dB (Calculation error in the textbook)\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.10, Page number 52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate Characteristic impedance,Phase velocity \n",
+ "\n",
+ "import cmath\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "l = 10 #length of line(km)\n",
+ "zsc = complex(1895.47,2234.29) \n",
+ "zoc = complex(216.99,-143.37)\n",
+ "f = 1*10**3 #frequency(Hz)\n",
+ "\n",
+ "#Calculations\n",
+ "zo = cmath.sqrt(zsc*zoc)\n",
+ "x = cmath.sqrt(zsc/zoc)\n",
+ "t = (1+x)/(1-x)\n",
+ "gamma = cmath.log(t)/(l*2)\n",
+ "B = gamma.imag\n",
+ "w = 2*math.pi*f\n",
+ "Vp = w/B\n",
+ "\n",
+ "#Results\n",
+ "print \"There is calculation mistake throughout the problem in the textbook\\n\"\n",
+ "print \"Characteristic impedance =\",zo,\"Ohms\"\n",
+ "print \"Phase velocity =\",round((Vp/1E+3),3),\"*10^3 m/sec\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "There is calculation mistake throughout the problem in the textbook\n",
+ "\n",
+ "Characteristic impedance = (864.190238563+123.274392427j) Ohms\n",
+ "Phase velocity = 45.994 *10^3 m/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |