summaryrefslogtreecommitdiff
path: root/Electronic_Instrumentation_and_Measurements/Chapter6_2.ipynb
blob: d3729e3e1f9da2cb2b916fa7b2ba585b3b6d557f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER 6: DIGITAL VOLTMETERS AND FREQUENCY METERS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Example 6-1, Page Number: 139"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum time t1 for the digital voltmeter is 1.33 ms\n",
      "Ramp Generator Frequency can be 600 Hz\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "f=1.5*10**6                  #Clock frequency in Hz\n",
    "N=1999                       #Maximum count\n",
    "\n",
    "#Calculations\n",
    "clock_time_period=1/f        #Clock time period in s\n",
    "t1=N*clock_time_period       #Maximum time in s\n",
    "t2=0.25*t1                   #Select t2=0.25*t1\n",
    "t=t1+t2                      #in s\n",
    "fr=1/t                       #in Hz \n",
    "\n",
    "#Results\n",
    "print \"Maximum time t1 for the digital voltmeter is\",round(t1*10**3,2),\"ms\"\n",
    "print \"Ramp Generator Frequency can be\",int(fr),\"Hz\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6-2, Page Number: 149"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For the analog meter,\n",
      "Voltage Error=± 0.5 V\n",
      "Error=± 2.5 %\n",
      "\n",
      "For the digital meter,\n",
      "Voltage Error=± 0.22 V\n",
      "Error=± 1.1 %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "V=20                                             #Voltage to be measured in V\n",
    "analog_range=25                                  #Range of analog meter in V\n",
    "analog_accuracy=2.0/100                          #Accuracy of analog meter at FSD    \n",
    "\n",
    "#Calculations\n",
    "\n",
    "#Analog Instrument:\n",
    "voltage_error=analog_accuracy*analog_range        #in V\n",
    "\n",
    "error=voltage_error*100/V                         #in percentage\n",
    "\n",
    "print \"For the analog meter,\"\n",
    "print \"Voltage Error=±\",round(voltage_error,1),\"V\"\n",
    "print \"Error=±\",round(error,1),\"%\"\n",
    "\n",
    "#Digital Instrument:\n",
    "\n",
    "#For 20 V displayed on a 3 1/2 digit display\n",
    "digit=0.1                                         #in V\n",
    "digital_accuracy=0.6/100                     \n",
    "voltage_error=digital_accuracy*V+digit            #in V  \n",
    "error=voltage_error*100/V                         #in percentage \n",
    "print\n",
    "print \"For the digital meter,\"\n",
    "print \"Voltage Error=±\",round(voltage_error,2),\"V\"\n",
    "print \"Error=±\",round(error,1),\"%\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6-3, Page Number: 153"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "When 6 decade counters are used,f= 1.512 kHz\n",
      "When 4 decade counters are used,f= 1.5 kHz\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "ft=1.0*10**6                  #Clock generator frequency in Hz\n",
    "fi=1.512*10**3              #Input frequency in Hz\n",
    "\n",
    "#Calculations\n",
    "#Using 6 decade counters\n",
    "d=6                         #No. of decade counters used\n",
    "f1=ft/10**d                 #Time base frequency in Hz\n",
    "t1=1/f1                     #Time period in s  \n",
    "n1=fi*t1                    #No. of cycles counted \n",
    "f=n1/t1\n",
    "\n",
    "print \"When 6 decade counters are used,f=\",round(f/1000,3),\"kHz\"\n",
    "\n",
    "#Using 4 decade counters\n",
    "d=4                         #No.of decade counters used\n",
    "f2=ft/10**d                 #Time base frequency in Hz\n",
    "t2=1/f2                     #Time period in s   \n",
    "n2=fi*t2                    #No. of cycles counted\n",
    "f=n2/t2\n",
    "\n",
    "print \"When 4 decade counters are used,f=\",round(f/1000,1),\"kHz\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6-4, Page Number: 154"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "At f=100 Hz,\n",
      "error=± 1.0 count\n",
      "%error=± 1.0 %\n",
      "\n",
      "At f=1 MHz\n",
      "error=± 2.0 count\n",
      "%error=±  2.0e-04 %\n",
      "\n",
      "At f=100 MHz,\n",
      "error=± 101.0 count\n",
      "%error=± 1.01e-04 %\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "accuracy=10**-6                                #Accuracy\n",
    "\n",
    "#At f=100 Hz\n",
    "\n",
    "f=100                                          #Frequency in Hz\n",
    "error=1+f*accuracy                             #in terms of counts\n",
    "percentage_error=error*100/f                   #in percentage\n",
    "\n",
    "print \"At f=100 Hz,\"\n",
    "print \"error=±\",round(error),\"count\"\n",
    "print \"%error=±\",round(percentage_error),\"%\"\n",
    "print\n",
    "#At f=1 MHz,\n",
    "\n",
    "f=1*10**6                                       #Frequency in Hz\n",
    "error=1+f*accuracy                              #in terms of counts\n",
    "percentage_error=error*100/f                    #in percentage\n",
    "\n",
    "print \"At f=1 MHz\"\n",
    "print \"error=±\",round(error),\"count\"\n",
    "print \"%error=± \",'%.1e' % percentage_error,\"%\"\n",
    "print\n",
    "\n",
    "#At f=100 MHz\n",
    "\n",
    "f=100*10**6                                     #Frequency in Hz \n",
    "error=1+f*accuracy                              #in terms of counts  \n",
    "percentage_error=error*100/f                    #in percentage\n",
    "print \"At f=100 MHz,\"\n",
    "print \"error=±\",round(error),\"count\"\n",
    "print \"%error=±\",'%.2e' % percentage_error,\"%\"\n",
    "print"
   ]
  }
 ],
 "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
}