summaryrefslogtreecommitdiff
path: root/Electronic_Instrumentation_And_Measurements_by_J.B.Gupta/Chapter_05_1.ipynb
blob: 3c3e234267473e24984f5d39f847a0455c9540e2 (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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
{
 "metadata": {
  "name": "",
  "signature": "sha256:3339b00236a2f81e5e5e7b7f9b1a7ab1f4ae4cfea924466604e158fa53da71b7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter - 5 : Digital Meters"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.1 - Page No : 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data\n",
      "V_REF= 10 # in volt\n",
      "w2= V_REF/2 # The second MSB weight in volt\n",
      "print \"The second MSB weight = %0.f V\" %w2\n",
      "w3= V_REF/4 # The third MSB weight in volt\n",
      "print \"The third MSB weight = %0.1f V\" %w3\n",
      "w4= V_REF/8 # The forth MSB weight in volt\n",
      "print \"The forth MSB weight = %0.2f V\" %w4\n",
      "\n",
      "# (i)\n",
      "r_DAC= w4 # resolution of the DAC in volt\n",
      "print \"(i) : Resolutio of the DAC = %0.2f V\" %r_DAC  \n",
      "\n",
      "#(ii)\n",
      "FSO= V_REF+w2+w3+w4 #full scale output in volt\n",
      "print \"(ii) : Full scale output = %0.2f V\" %FSO\n",
      "\n",
      "# (iii)\n",
      "FSO_R= FSO/4 # full scale output when the feedback resistor is made one fourth of R in volt\n",
      "print \"(iii) : The full scale output when the feedback resistor is made one fourth of R i volt = %0.4f\" %FSO_R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The second MSB weight = 5 V\n",
        "The third MSB weight = 2.5 V\n",
        "The forth MSB weight = 1.25 V\n",
        "(i) : Resolutio of the DAC = 1.25 V\n",
        "(ii) : Full scale output = 18.75 V\n",
        "(iii) : The full scale output when the feedback resistor is made one fourth of R i volt = 4.6875\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.2 - Page No : 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "V_REF= -5 # in volt\n",
      "V_A= -5 # in volt\n",
      "V_C=V_A # in volt\n",
      "V_D=V_C # in volt\n",
      "V_B= 0 \n",
      "Vout= -1*(V_A+V_B/2+V_C/4+V_D/8) \n",
      "print \"Output voltage = %0.3f V\" %Vout "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage = 6.875 V\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.3\n",
      " - Page No :"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "D=16 \n",
      "D1= D/2 # first MSB output in volt\n",
      "print \"First MSB output  = %0.f V\" %D1 \n",
      "D2= D/4 # second MSB output in volt\n",
      "print \"Second MSB output = %0.f V\" %D2 \n",
      "D3= D/8 # third MSB output in volt\n",
      "print \"Third MSB output  = %0.f V\" %D3\n",
      "D4= D/16 # fourth MSB output in volt\n",
      "print \"Fourth MSB output = %0.f V\" %D4 \n",
      "D5= D/32 # fifth MSB output in volt\n",
      "print \"Fifth MSB output  = %0.1f V\" %D5\n",
      "D6= D/64 # sixth MSB (LSB) output in volt\n",
      "print \"Sixth MSB (LSB) output = %0.2f V\" %D6 \n",
      "print \"The resolution is equal to the weight of the LSB       = %0.2f V\" %D6\n",
      "# Full scale output occurs for a digital input of 111111\n",
      "FSO= D1+D2+D3+D4+D5+D6 # in volt\n",
      "print \"Full scale output occurs for a digital input of 111111 = %0.2f V\" %FSO\n",
      "# The output voltage for a digital input of 101011\n",
      "D0=16 \n",
      "D1=16 \n",
      "D2=0 \n",
      "D3=16 \n",
      "D4=0 \n",
      "D5=16 \n",
      "Vout= ( D0*2**0 + D1*2**1 + D2*2**2 + D3*2**3 + D4*2**4 + D5*2**5  )/64 # in volt\n",
      "print \"The output voltage for  digital input of 101011        = %0.2f V\" %Vout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "First MSB output  = 8 V\n",
        "Second MSB output = 4 V\n",
        "Third MSB output  = 2 V\n",
        "Fourth MSB output = 1 V\n",
        "Fifth MSB output  = 0.5 V\n",
        "Sixth MSB (LSB) output = 0.25 V\n",
        "The resolution is equal to the weight of the LSB       = 0.25 V\n",
        "Full scale output occurs for a digital input of 111111 = 15.75 V\n",
        "The output voltage for  digital input of 101011        = 10.75 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.4 - Page No : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R=100 # in kohm\n",
      "R=R*10**3 #in ohm\n",
      "C=1*10**-6 # in F\n",
      "V_REF= 5 # in volt\n",
      "t=0.2 # time taken to read unknown voltage in sec\n",
      "T=R*C # in sec\n",
      "Vx= T/t*V_REF # in volt\n",
      "print \"The value of Unknown voltage = %0.1f V\" %Vx"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Unknown voltage = 2.5 V\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.5 - Page No : 124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "# For an 8-bit converter reference voltage V_REF be taken as 100 V\n",
      "V_REF= 100 # in volt\n",
      "f=75*10**6 # in Hz\n",
      "# For setting\n",
      "D7=1 \n",
      "Vout1= V_REF*2**7/2**8 # in volt\n",
      "print \"For D7 = 1, The output voltage    = %0.f volt\" %Vout1\n",
      "# since 180-100 = 80 > 50  set D7=1\n",
      "\n",
      "# For setting\n",
      "D6=1 \n",
      "Vout2= V_REF*2**6/2**8 # in volt\n",
      "print \"For D6 = 1, The output voltage    = %0.f volt\" %Vout2\n",
      "# Hence for setting D7=1 and D6=1 output voltage\n",
      "Vout3= Vout1+Vout2 # in volt\n",
      "print \"D7 and D6 = 1, The output voltage = %0.f volt\" %Vout3\n",
      "# since 80>75  set D6=1\n",
      "# For setting D5=1, D6=1 and D7=1\n",
      "Vout4   = V_REF*2**5/2**8 + Vout1+ Vout2 # in volt\n",
      "print \"For D6 = 1, The output voltage    = %0.1f volt\" %Vout4\n",
      "print \"All other digits will be set to zero or 1. Output will be accordingly indicated as a result of successive approximation.\"\n",
      "print \"The Converted 8-bit digital form will be 1110010\"\n",
      "T=1/f #in sec\n",
      "print \"Conversion time = %0.1f ns\" %(T*10**9)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For D7 = 1, The output voltage    = 50 volt\n",
        "For D6 = 1, The output voltage    = 25 volt\n",
        "D7 and D6 = 1, The output voltage = 75 volt\n",
        "For D6 = 1, The output voltage    = 87.5 volt\n",
        "All other digits will be set to zero or 1. Output will be accordingly indicated as a result of successive approximation.\n",
        "The Converted 8-bit digital form will be 1110010\n",
        "Conversion time = 13.3 ns\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.6 - Page No : 124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "N=8 # Number of bits\n",
      "f=1*10**6 # in Hz\n",
      "T=1/f \n",
      "Tc= N*T # in second\n",
      "print \"Time of conversion = %0.f \u00b5s\" %(Tc*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time of conversion = 8 \u00b5s\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.7 - Page No : 124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Vin= 2 # in volt\n",
      "Vout= 10 # in volt\n",
      "R=100 # kohm\n",
      "R=R*10**3 # in ohm\n",
      "C= 0.1 # in miu F\n",
      "C=C*10**-6 # in F\n",
      "#  Vout= -1/(R*C)*integrate('Vin','t',0,t) = -Vin*t/(R*C)\n",
      "t= Vout*R*C/Vin # in sec\n",
      "print \"The maximum time upto which the reference voltage can be integrated = %0.f ms\" %(t*10**3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum time upto which the reference voltage can be integrated = 50 ms\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.8 - Page No : 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "n=3 \n",
      "R=1/10**n \n",
      "fs1=1 # full scale range of 1 v\n",
      "r1= fs1*R # resolution for full scale range of 1 V\n",
      "print \"Resolution for full scale range of 1 V  = %0.3f V\" %r1\n",
      "fs2=10 # full scale range of 10 v\n",
      "r2= fs2*R # resolution for full scale range of 10 V\n",
      "print \"Resolution for full scale range of 10 V = %0.2f V\" %r2\n",
      "# The display for 2 V reading on 10 V scale of 3*1/2 digital meter would be 02.00 i.e\n",
      "reading=2 \n",
      "LSD= 5*R # in volt\n",
      "Total_pos_Error= reading*0.5/100+LSD #in volt\n",
      "print \"Total possible error = %0.3f V\" %Total_pos_Error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resolution for full scale range of 1 V  = 0.001 V\n",
        "Resolution for full scale range of 10 V = 0.01 V\n",
        "Total possible error = 0.015 V\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.9 - Page No : 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R= 1/10**4 # resolution\n",
      "print \"Resolution of voltmeter = %0.4f\" %R\n",
      "reading1= 16.58 \n",
      "reading2= 0.7254 \n",
      "print \"There are 5 digit places in 4\u00bd display, so \",round(reading1,2),\" would be displayed as 16.580 V on a 10V range \"\n",
      "print \"Any reading up to 4th decimal can be displayed.\"\n",
      "print \"Hence \",round(reading2,4),\" will be displayed as : \",reading2\n",
      "R= 10*R # resolution on 10 V range\n",
      "print \"Resolution of 10 V range =\",round(R,3),\" So\"\n",
      "print \"0.7254 will be displayed as : \",round(reading2,3),\"instead of\",reading2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resolution of voltmeter = 0.0001\n",
        "There are 5 digit places in 4\u00bd display, so  16.58  would be displayed as 16.580 V on a 10V range \n",
        "Any reading up to 4th decimal can be displayed.\n",
        "Hence  0.7254  will be displayed as :  0.7254\n",
        "Resolution of 10 V range = 0.001  So\n",
        "0.7254 will be displayed as :  0.725 instead of 0.7254\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.10 - Page No : 135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division \n",
      "#Given data\n",
      "n=3 \n",
      "R=1/10**n \n",
      "fs1=10 # full scale range of 10 v\n",
      "r1= fs1*R # resolution for full scale range of 10 V\n",
      "print \"Resolution for full scale range of 10 V = \",r1\n",
      "fs2=100 # full scale range of 100 v\n",
      "r2= fs2*R # resolution for full scale range of 100 V\n",
      "print \"Resolution for full scale range of 100 V = \",r2\n",
      "print \"The display of 14.53 V reading on 10 V scale would be 14.530\"\n",
      "print \"The display of 14.53 V reading on 100 V scale would be 0145.3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resolution for full scale range of 10 V =  0.01\n",
        "Resolution for full scale range of 100 V =  0.1\n",
        "The display of 14.53 V reading on 10 V scale would be 14.530\n",
        "The display of 14.53 V reading on 100 V scale would be 0145.3\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.11 - Page No : 135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "#Given data\n",
      "Vmax= 255 # in volt\n",
      "Vx= 180 # in volt\n",
      "f=10 # in kHz\n",
      "f=f*10**3 # in Hz\n",
      "t= (Vmax-Vx)/(2*pi*f*Vmax) # time taken to read the unknown voltage in second\n",
      "t=t*10**6 # in micro second\n",
      "print \"Time taken to read the unknown voltage = %0.2f \u00b5s\" %t "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken to read the unknown voltage = 4.68 \u00b5s\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.12 - Page No : 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=2.5 # in kHz\n",
      "f=f*10**3 # in Hz\n",
      "# Part (i) when\n",
      "t=0.1 # in sec\n",
      "count= f*t \n",
      "print \"When GATE ENABLE time is 0.1 sec then the counter count or display = %0.f\" %count\n",
      "# Part (ii) when\n",
      "t=1 # in sec\n",
      "count= f*t \n",
      "print \"When GATE ENABLE time is 1 sec then the counter count or display   = %0.f\" %count\n",
      "# Part (iii) when\n",
      "t=10 # in sec\n",
      "count= f*t \n",
      "print \"When GATE ENABLE time is 10 sec then the counter count             = %0.f\" %count"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When GATE ENABLE time is 0.1 sec then the counter count or display = 250\n",
        "When GATE ENABLE time is 1 sec then the counter count or display   = 2500\n",
        "When GATE ENABLE time is 10 sec then the counter count             = 25000\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.13 - Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "N=45 # unit less\n",
      "t=10 # in ms\n",
      "t=t*10**-3 # in sec\n",
      "f=N/t # Hz\n",
      "f=f*10**-3 # in kHz\n",
      "print \"The value of frequency = %0.1f kHz\" %f"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of frequency = 4.5 kHz\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.14 - Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "totalPulse= 174 # unit less\n",
      "t=100 #time period of total pulses in miu s\n",
      "t=t*10**-6 # in sec\n",
      "t1= t/totalPulse # time period of one pulse in sec\n",
      "f= 1/t1 # frequency in Hz\n",
      "f=f*10**-6 # in MHz\n",
      "print \"The value of frequency = %0.2f MHz\" %f \n",
      "resolution= totalPulse/t # in sec\n",
      "resolution=resolution*10**-6 # per micro sec\n",
      "print \"Resolution of measurement = %0.2f per \u00b5s\" %resolution"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of frequency = 1.74 MHz\n",
        "Resolution of measurement = 1.74 per \u00b5s\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  5.15 - Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "t=1/(2*10**6)  # time of one cycle o 2MHz clock in sec\n",
      "N=500 # number of cycle\n",
      "t1= N*t # time of 1 cycle by the electronic counter in sec\n",
      "f= 1/t1 # in Hz\n",
      "f=f*10**-3 # in kHz\n",
      "print \"The value of frequency of input signal = %0.f kHz\" %f"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of frequency of input signal = 4 kHz\n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}