summaryrefslogtreecommitdiff
path: root/Electronic_Measurements_and_Instrumentation_by_Er.R.K.Rajput/CHAPTER_7.ipynb
blob: 03a57d647157ecb84c6e118b2950795c394c28fe (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
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 7:Sensors And Transducers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.2,Page No:401"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "displacement 5.75 mm\n",
      "displacement 12.800 mm\n",
      "resolution of potentiometer 0.050 mm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "R   =10000;                           #resistance in Ω\n",
    "R1  = 3850;                           #resistance of potentiometer Ω\n",
    "R2  = 7560;                           #resistance of potentiometer Ω\n",
    "l   = 50*10**-3;                      #length of uniform wound wire in m\n",
    "x   = 10;\n",
    "\n",
    "#calculations\n",
    "\n",
    "R3  = (R/float(2));                  #resistance of potentiometer in .normal position in Ω\n",
    "r   = (R/float(l));                  #resistance of potentiometer wire per unit length Ω/mm\n",
    "dR1  = R3-R1;                        #change in resistance of potentiometer from its normal position Ω\n",
    "D1  = (dR1/float(r));                #displacement in mm\n",
    "dR2  = (R2-R3);                      #change in resistance of potentiometer from its normal position in Ω\n",
    "D2  = (dR2/float(r));                #displacement in mm\n",
    "RE  = (x/float(r));                  #resolution of potentiometer in mm\n",
    "\n",
    "#result\n",
    "print'displacement %3.2f'%(D1*10**3),'mm';\n",
    "print'displacement %3.3f'%(D2*10**3),'mm';\n",
    "print'resolution of potentiometer %3.3f'%(RE*10**3),'mm';\n",
    " \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.3,Page No:403"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance at 35°C is 50 Ω\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "R25  = 100;                             #resistance of thermistor at 25°C\n",
    "t2   = 35;                              #temperature in °C\n",
    "t1   = 25;                              #temperature in  °C\n",
    "alpha = 0.05;                           #temperature coefficient\n",
    "\n",
    "#calculations\n",
    "t   = t2-t1;                            #temperaturre difference in °C\n",
    "x   = alpha*t;\n",
    "R35 = (R25)*(1-x);                      #resistance in Ω\n",
    "\n",
    "#result\n",
    "print'resistance at 35°C is %d'%R35,'Ω';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.4,Page No:406"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance = 0.04 mH\n",
      "ratio of change in inductance to the original inductance =0.02\n",
      "ratio of change in inductance to the original inductance =0.02\n",
      "hence dl is directly proportional to displacement\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "l    = 1.00;                       #length in mm\n",
    "L    = 2;                          #inductance in mH\n",
    "d    = 0.02;                       #displacement in mm\n",
    "\n",
    "#calculations\n",
    "la    = l-d;                     #length of air gap when d=0.02\n",
    "dl    = (2*(1/float(la)))-L;     #change in inductance in mH\n",
    "r     =  dl/L;                   #ratio of change in inductance to the original inductance\n",
    "dd    =  r/l;                    #ratio of displacement to original gap length\n",
    "\n",
    "#result\n",
    "print'inductance = %3.2f'%dl,'mH';\n",
    "print'ratio of change in inductance to the original inductance =%3.2f'%r;\n",
    "print'ratio of change in inductance to the original inductance =%3.2f'%dd;\n",
    "print'hence dl is directly proportional to displacement';\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.5,Page No:409"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "percentage linearity 0.25 %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "d    = 1.8;                       #output voltage at maximum displacement in V\n",
    "de   = 0.0045;                    #deviation from straight line through the origin\n",
    "\n",
    "#calculations \n",
    "a     = (de/float(d))*100;         #percentage linearity indicating in both -ve and +ve\n",
    "\n",
    "#result\n",
    "print'percentage linearity %3.2f'%a,'%';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.6,Page No:409"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sensitivty of LVDT 3.00 mV/mm\n",
      "resolution 0.0067 mm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Vo    = 1.8;                            #output voltage in mV\n",
    "Vi    = 0.6;                            #input voltage in mV;\n",
    "a     = 500;                            #amplification factor\n",
    "r     = 1/float(4);                     #scale can read \n",
    "v     = 4;                              #output of voltmetr in V\n",
    "D     = 100;                            #millivoltmeter readings\n",
    "\n",
    "#calculation\n",
    "s     = Vo/float(Vi);                        #sensitivity in mV/mm\n",
    "sm    =  a*s;                                #sensitivity of measurement in mV/mm\n",
    "s1    = (v/float(D))*10**3;                  # 1 scale division in mV\n",
    "Vm    = r*s1;                                #minimum voltage  that can be read on voltmeter\n",
    "R     = Vm/float(sm);                        #resolution in mm\n",
    "\n",
    "#result \n",
    "print'sensitivty of LVDT %3.2f'%s,'mV/mm';\n",
    "print'resolution %3.4f'%R,'mm';\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.7,Page No:413"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "capacitance = 13.275 pF\n",
      "change in capacitance 1.475 pF\n",
      "ratio ofper unit change of capacitance to per unit change in displacement = 1.111111\n",
      "capcitance when mica is inserted = 13.88 pF\n",
      "change in capacitance when mica sheet is inserted = 1.62 pF\n",
      "ratio ofper unit change of capacitance to per unit change in displacement = 1.168\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "A     = 300*10**-6;                     #area of plate in m**2\n",
    "d     = 0.2*10**-3;                     #distance between plates in mm\n",
    "e0    = 8.85*10**-12;                   #permittivity in F/m\n",
    "er2    = 8;                             #dielectric constant of mica \n",
    "d1    = 0.18*10**-3;                    #distance between plates in mm\n",
    "er1   = 1;                              #dielectric constant\n",
    "D1    = 0.19;\n",
    "D2    =  0.01;                          #thickness of mica sheet in mm\n",
    "D3    = 0.17;                           #displacement in mm\n",
    "D4    = 0.01;\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "#calculation\n",
    "C    = ((e0*A)/float(d));                    #value of capacitance in pF\n",
    "dD   = d-d1;                                 #change in displacement in mm\n",
    "dC   = ((e0*A)/(float(d1)))-C;               #change in capacitance in capacitance\n",
    "x1   = (dC/float(C));                        #per unit change in capacitance \n",
    "x2   = (dD/float(d));                        #per unit change of displacement\n",
    "d3   =  d-d1;                                #length of air gap between plates in mm\n",
    "x    =  x1/float(x2);                        #ratio of unit change of capacitance to unit change in displacement\n",
    "D    =  (D1/(float(er1)))+((D2/float(er2)));\n",
    "C1   =  (e0*A)/float(D*10**-3);              #initial capacitance of transducer in mm\n",
    "d4   =  d1-d3;                               #length of air gap in mm\n",
    "d1   = (D3/float(er1))+(D4/float(er2));\n",
    "C2   =  (e0*A)/float(d1*10**-3);             # capacitance with displacement is applien in pF\n",
    "dC2  = C2-C1;                                #change in capacitance in pF\n",
    "y1   = (dC2/float(C1));                      #per unit change in capacitance \n",
    "y2   = (dD/float(d));                        #per unit change of displacement\n",
    "Y    = y1/float(y2);                         #ratio of unit change of capacitance to unit change in displacement\n",
    "\n",
    "#result\n",
    "print'capacitance = %2.3f'%(C*10**12),'pF';\n",
    "print'change in capacitance %3.3f'%(dC*10**12),'pF';\n",
    "print'ratio ofper unit change of capacitance to per unit change in displacement = %f'%x;\n",
    "print'capcitance when mica is inserted = %3.2f'%(C1*10**12),'pF';\n",
    "print'change in capacitance when mica sheet is inserted = %2.2f'%(dC2*10**12),'pF';\n",
    "print'ratio ofper unit change of capacitance to per unit change in displacement = %3.3f'%Y;\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.8,Page No:417"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage = 192.50 V\n",
      "charge sensitivity = 2.233 pC/N\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "t    = 2.5*10**-3;                               #thickness in m\n",
    "g    = 0.055;                                    #voltage intensity in Vm/N\n",
    "p    = 1.4*10**6;                                #pressure in N/m**2\n",
    "e    = 40.6*10**-12;                             #permittivity of quartz in F/m\n",
    "\n",
    "#calculation\n",
    "E     =  g*t*p;                                 #output voltage in V\n",
    "q     =  e*g;                                   #charge sensitivity in pC/N\n",
    "\n",
    "#result\n",
    "print'output voltage = %3.2f'%E,'V';\n",
    "print'charge sensitivity = %3.3f'%(q*10**12),'pC/N';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.9,Page No:417"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "force = 43.64 N\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "r   = 6*10**-3;                      #radius in m\n",
    "t   = 1.8*10**-3;                    #thickness in m\n",
    "g   = 0.055;                         #voltage intensity in Vm/N\n",
    "E   = 120;                           #voltage developed in V\n",
    "\n",
    "#calculation\n",
    "A    = r*r;                          #area in m**2\n",
    "p    = E/(float(g*t));               #pressure in N/m**2\n",
    "F    = p*A;                          #force in N\n",
    "\n",
    "\n",
    "#result\n",
    "print'force = %3.2f'%F,'N';\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.10,Page No:417"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "strain = 0.00000\n",
      "charge = 900.0 pC\n",
      "capacitance = 300 pf\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "r  = 6*10**-3;                       #radius in m\n",
    "t  = 1.5*10**-3;                     #thickness in m\n",
    "e  = 12.5*10**-9;                    #permittivity in F/m\n",
    "F  = 6;                              #force in N\n",
    "d  = 150*10**-12;                    #charge density in pC/N\n",
    "E  = 12*10**6;                       #modulus of elasticity in N/m**2\n",
    "s  = 0.167*10**6;                    #stress \n",
    "\n",
    "#calculation\n",
    "A  = r*r;\n",
    "p  = F/float(A);                       #pressure in MN/m**2\n",
    "p1 = p*10**-6;\n",
    "e1  = s/float(E);                      #strain \n",
    "g  = d/float(e);                       #voltage sensitivity in V*m/N;\n",
    "E1 = g*t*p;                            #voltage generated in V\n",
    "Q  = d*F;                              #charge in C\n",
    "C  = (Q)/float(E1);                    #capacitance in F\n",
    "\n",
    "#result\n",
    "print'strain = %3.5f'%e;\n",
    "print'charge = %3.1f'%(Q*10**12),'pC';\n",
    "print'capacitance = %3.3d'%(C*10**12),'pf';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  Example:7.11,Page No:421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall angle 1.55 °(Equal to 1 minute 4 seconds)\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p  =  0.00912;                        #resistivity in Ωm\n",
    "B  =  0.48;                           #flux density in Wb/m**2\n",
    "RH =  3.55*10**-4;                    #hall coefficient in m**3/C\n",
    "\n",
    "#calculation\n",
    "Ex  = p;                              #Ex in terms of Jx in °\n",
    "Ey  = RH*B;                           #ey interms of Jx in °\n",
    "x= Ex/float(Ey);\n",
    "t  = math.atan(x);\n",
    "\n",
    "print'hall angle %3.2f'%t,'°(Equal to 1 minute 4 seconds)';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.12,Page No:421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage between contacts = 0.00256 V\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p  =  0.00912;                        #resistivity in Ωm\n",
    "B  =  0.48;                           #flux density in Wb/m**2\n",
    "RH =  3.55*10**-4;                    #hall coefficient in m**3/C\n",
    "I  = 0.015;                           # current in A\n",
    "l  = 15*10**-3;                       #length in m\n",
    "b  = 10**-3;                          #breadth in m\n",
    "\n",
    "\n",
    "#calculation\n",
    "A   = l*b;                            #area in m**2\n",
    "Jx  = I/float(A);                     #current density in A/m**2\n",
    "Ey  = RH*B*Jx;                        #Ey in V/m\n",
    "V   = Ey*I;                           #voltage between contacts in V\n",
    "\n",
    "#result\n",
    "print'voltage between contacts = %5.5f'%V,'V';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.13,Page No:432"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "poissons ratio = 1.6\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Gf  =  4.2;                       #guage factor of resistance \n",
    "\n",
    "#calculation\n",
    "u  =(Gf-1)/float(2);              #poisson's  ratio\n",
    "\n",
    "#result\n",
    "print'poissons ratio = %1.1f'%u;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.14,Page No:432"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in resistance = 48.00 mΩ\n",
      "Note:printing mistake in textbook\n",
      "change in resistance = 48.00 mΩ\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "R      = 120;                                 #resistance in Ω\n",
    "Gf     = 2;                                   #guage factor \n",
    "s      = 400*10**6;                           #elastic limit stress in N/m**2\n",
    "E      = 200*10**9;                           #modulus of elasticity in N/m**2\n",
    "alpha  = 20*10**-6;                           #resistance temperature coefficient in /°C\n",
    "x      =  1/float(10);                        #cahnge in stress \n",
    "dt     = 20;                                  #change in temperature in °C\n",
    "\n",
    "#calculations\n",
    "sc     =  s*x;                              #change in stress in N/m**2\n",
    "e      =  sc/float(E);                      #strain \n",
    "dR     =  Gf*e*R;                           #change in resistance in mΩ\n",
    "dR1    =  R*alpha*dt;                       #change in resistance in mΩ\n",
    "\n",
    "#result\n",
    "print'change in resistance = %3.2f'%(dR*10**3),'mΩ';\n",
    "print'Note:printing mistake in textbook';\n",
    "print'change in resistance = %3.2f'%(dR1*10**3),'mΩ';\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.15,Page No:433"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in length = 3.72e-06 m\n",
      "force = 2.438 kN\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "L      =  0.12;                        #length in m\n",
    "A      = 3.8*10**-4;                   #area in m**2\n",
    "R      = 220;                          #resistance in Ω\n",
    "Gf     = 2.2;                          #guage factor\n",
    "dR     = 0.015;                        #change in resistance in Ω\n",
    "E      = 207*10**9;                    #elasticity in N/m**2\n",
    "\n",
    "#calculations\n",
    "dL     =  (dR*L)/float(R*Gf);    #change in length in m      \n",
    "s      =  (E*dL)/float(L);                              \n",
    "F      =  s*A;                   #force in kN            \n",
    "\n",
    "#result\n",
    "print'change in length = %2.2e'%dL,'m';\n",
    "print'force = %3.3f'%(F*10**-3),'kN';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.16,Page No:444"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "strain  = 594.5 microstrain\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Rg     =  100;                 #resistance in Ω\n",
    "Rsh    =  80000;               #resistance in Ω\n",
    "Gf     = 2.1;\n",
    "\n",
    "#calculations\n",
    "x    = (Rg/float(Rg+Rsh));    #equivalent strain\n",
    "eeq  = x/(float(Gf));         #strain  in microstrain\n",
    "\n",
    "#result\n",
    "print'strain  = %3.1f'%(eeq*10**6),'microstrain';\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.17,Page No:445"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "strain = 356.43 microstrain\n",
      "Note:calculation mistake in text book,Rg value is taken wrong in calculating s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "n     =  4;                                 #four arm bridge\n",
    "Rg    =  200;                               #resistance in Ω\n",
    "Rsh   = 100*10**3;                          #resistance in Ω\n",
    "x     = 140;                                #number of divisions\n",
    "Gf    = 2.0;                                #guage factor\n",
    "\n",
    "#calculation\n",
    "eeff  = Rg/float(n*Gf*(Rg+Rsh));            #effective strain\n",
    "d     = eeff/float(x);                      #1 division scale\n",
    "s     = float(d)*Rg;                        #strain when loaded\n",
    "\n",
    "#result\n",
    "print'strain = %3.2f'%(s*10**6),'microstrain';\n",
    "print'Note:calculation mistake in text book,Rg value is taken wrong in calculating s';\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.18,Page No:447"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "longitudinal stress = 70.01 MN/m**2\n",
      "longitudinal stress = 146.2 MN/m**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "ex     =   0.00016;                    #strain values in axial \n",
    "ey     =   0.00064;                    #strain values in circumferential direction\n",
    "E      =   200*10**9;                  #modulus of elasticity in N/,**2\n",
    "u      =   0.26;                       #poisson's ratio \n",
    "\n",
    "#calculation\n",
    "sigmax  =  (E*(ex+(u*ey)))/float(1-(u**2));         #longitudinal stress in N/m**2\n",
    "sigmay  =  (E*(ey+(u*ex)))/float(1-(u**2));         #hoop stress in N/m**2\n",
    "\n",
    "#result\n",
    "\n",
    "print'longitudinal stress = %3.2f'%(sigmax/10**6),'MN/m**2';\n",
    "print'longitudinal stress = %3.1f'%(sigmay/10**6),'MN/m**2';\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.19,Page No:447"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "modulus of elasticity = 147.6 N/M**2\n",
      "poissons ratio  = 0.2727\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "A     =  110*10**-6;                 #area in m**2\n",
    "P     =  25;                         #load in kN\n",
    "ex    =  1540;                       #strain values in axial direction\n",
    "ey    =  -420;                       #strain values in transvers  direction\n",
    "\n",
    "#calculation\n",
    "sigmax    =  P/float(A);               #axial stress in N/M**2\n",
    "E         =  sigmax/float(ex);         #modulus of elasticity in N/M**2\n",
    "u         =  (-ey*E)/float(sigmax);    #poisson's ratio\n",
    "\n",
    "#result\n",
    "print'modulus of elasticity = %3.1f'%E,'N/M**2'\n",
    "print'poissons ratio  = %3.4f'%u;\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.21,Page No:450"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "emax  = 6.73e-05\n",
      "emin  = -1.927e-05\n",
      "sigmamax = 13.514 MN/m**2\n",
      "sigmamin  = 0.201 MN/m**2\n",
      "maximum shear stress = 6.656 MN/m**2\n",
      "location of principle planes = 16.845034 °\n",
      "location of principle planes = 106.845034 °\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "e1    =  60*10**-6;                        #strain in microstrains\n",
    "e2    =  48*10**-6;                        #strain in microstrain\n",
    "e3    =  -12*10**-6;                       #strain in microstrain\n",
    "E     =  200*10**9;                        #modulus of elsticity in N/m**2\n",
    "u     =  0.3;\n",
    "\n",
    "#calculation\n",
    "x      = (e1+e3)/float(2);                 #average of strains\n",
    "a      = math.sqrt(((e1-e2)**2)+((e2-e3)**2));\n",
    "b      = 1/math.sqrt(2);\n",
    "y      = a*b;\n",
    "emax   = x+y;                             #principle strains\n",
    "emin   = x-y;                             #principle strains\n",
    "x1     = x/float(1-u);\n",
    "y1     = y/float(1+u); \n",
    "sigmamax  = E*(x1+y1);                    #principle stress\n",
    "sigmamin  = E*(x1-y1);                    #principle stress\n",
    "tmax      = E*y1;                         #maximum shear stress in MN/m**2\n",
    "k         = ((2*e2)-e1-e3)/float((e1-e3));\n",
    "theta     = (math.atan(k));      #location of principle planes\n",
    "theta1    =(theta*180)/float(math.pi);\n",
    "theta2    =theta1+180;\n",
    "theta11   = (theta1)/float(2);\n",
    "theta22   = (theta2)/float(2);\n",
    "\n",
    "\n",
    "\n",
    "print'emax  = %2.2e'%(emax);\n",
    "print'emin  = %2.3e'%(emin);\n",
    "print'sigmamax = %3.3f'%(sigmamax*10**-6),'MN/m**2';\n",
    "print'sigmamin  = %3.3f'%(sigmamin*10**-6),'MN/m**2';\n",
    "print'maximum shear stress = %3.3f'%(tmax*10**-6),'MN/m**2';\n",
    "print'location of principle planes = %f'%theta11,'°';\n",
    "print'location of principle planes = %f'%theta22,'°';\n",
    " \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example:7.22,Page No:454"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sensitivity of load = 13.79 uV/kN\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "d      = 0.06;                    #diameter in m\n",
    "Rg     = 120;                     #nominal resistance of each guage Ω\n",
    "Gf     = 2.0;                     #guage factor \n",
    "v      = 6;                       #supply voltage in V\n",
    "E      = 200*10**9;               #modulus of elasticity in N/m**2\n",
    "u      = 0.3;                     #poisson's ratio\n",
    "P      = 1000;                    #load in N\n",
    "\n",
    "#calculation\n",
    "\n",
    "A      = (math.pi/float(4))*d*d;\n",
    "s      =  P/float(A);                      #stress in N/m**2\n",
    "e      =  s/float(E);                      #strain \n",
    "x      = Gf*e;                             #fraction change in resistence i.e dR/R\n",
    "a      = v/float(4);\n",
    "y      = 2*(1+u)*(x)*a;                    #output volatge in uV\n",
    "                  \n",
    "#result\n",
    "print'sensitivity of load = %3.2f'%(y*10**6),'uV/kN';"
   ]
  }
 ],
 "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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}