summaryrefslogtreecommitdiff
path: root/Theory_Of_Machines/ch15.ipynb
blob: 05026c42fa6312b59123d4ad611aa9e59994d89b (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
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
{
 "metadata": {
  "name": "",
  "signature": "sha256:13844e2491f60bc4c521c5dd5ea680eaf26c07059f7a5c77baf4e368f712f152"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15 : Inertia Forces in Reciprocating Parts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.1 Page No : 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "OC = 200./1000          #m\n",
      "PC = 700./1000 \t\t\t#m\n",
      "omega = 120. \t\t\t#rad/s\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.5\n",
      "OM = 127./1000\n",
      "CM = 173./1000\n",
      "QN = 93./1000\n",
      "NO = 200./1000 \t\t\t#m\n",
      "\n",
      "#Velocity and acceleration of the piston:\n",
      "#Calculating the velocity of the piston P\n",
      "vP = omega*OM \t\t\t#m/s\n",
      "#Calculating the acceleration of the piston P\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#Velocity and acceleration of the mid-point of the connecting rod:\n",
      "#By measurement\n",
      "OD1 = 140./1000\n",
      "OD2 = 193./1000 \t\t\t#m\n",
      "#Calculating the velocity of D\n",
      "vD = omega*OD1 \t\t\t#m/s\n",
      "#Calculating the acceleration of D\n",
      "aD = omega**2*OD2 \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the velocity of the connecting rod PC\n",
      "vPC = omega*CM \t\t\t#m/s\n",
      "#Calculating the angular velocity of the connecting rod PC\n",
      "omegaPC = vPC/PC \t\t\t#rad/s\n",
      "#Calculating the math.tangential component of the acceleration of P with respect to C\n",
      "atPC = omega**2*QN \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod PC\n",
      "alphaPC = atPC/PC \t\t\t#ra/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the piston P, vP  =  %.2f m/s.\"%(vP)\n",
      "print \" Acceleration of the piston P, aP  =  %d m/s**2.\"%( aP)\n",
      "print \" Velocity of D, vD  =  %.1f m/s.\"%(vD)\n",
      "print \" Acceleration of D, aD  =  %.1f m/s**2.\"%(aD)\n",
      "print \" Angular velocity of the connecting rod PC, omegaPC  =  %.2f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod PC alphaPC  =  %.2f rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the piston P, vP  =  15.24 m/s.\n",
        " Acceleration of the piston P, aP  =  2880 m/s**2.\n",
        " Velocity of D, vD  =  16.8 m/s.\n",
        " Acceleration of D, aD  =  2779.2 m/s**2.\n",
        " Angular velocity of the connecting rod PC, omegaPC  =  29.66 rad/s.\n",
        " Angular acceleration of the connecting rod PC alphaPC  =  1913.14 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.2 Page No : 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "OC = 150./1000     #m\n",
      "PC = 600./1000     #m\n",
      "CD = 150./1000 \t\t#m\n",
      "N = 450. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.6\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#By measurement\n",
      "OM = 145./1000\n",
      "CM = 78./1000\n",
      "QN = 130./1000\n",
      "NO = 56./1000 \t\t\t#m\n",
      "\n",
      "#Velocity and acceleration of alider:\n",
      "#Calculating the velocity of the slider P\n",
      "vP = omega*OM \t\t\t#m/s\n",
      "#Calculating the acceleration of the slider P\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#Velocity and acceleration of point D on the connecting rod:\n",
      "#Calculating the length od CD1\n",
      "CD1 = CD/PC*CM \t\t\t#m\n",
      "#By measurement\n",
      "OD1 = 145./1000\n",
      "OD2 = 120./1000 \t\t\t#m\n",
      "\n",
      "#Calculating the velocity of point D\n",
      "vD = omega*OD1 \t\t\t#m/s\n",
      "#Calculating the acceleration of point D\n",
      "aD = omega**2*OD2 \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the velocity of the connecting rod PC\n",
      "vPC = omega*CM \t\t\t#m/s\n",
      "#Calculating the angular velocity of the connecting rod\n",
      "omegaPC = vPC/PC \t\t\t#rad/s\n",
      "#Calculating the tangential component of the acceleration of P with respect to C\n",
      "atPC = omega**2*QN \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod PC\n",
      "alphaPC = atPC/PC \t\t\t#rad/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the slider P vP  =  %.3f m/s.\"%(vP)\n",
      "print \" Acceleration of the slider P aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" Velocity of point D vD  =  %.3f m/s.\"%(vD)\n",
      "print \" Acceleration of point D aD  =  %.2f m/s**2.\"%(aD)\n",
      "print \" Angular velocity of the connecting rod omegaPC  =  %.3f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod PC alphaPC  =  %.2f rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the slider P vP  =  6.833 m/s.\n",
        " Acceleration of the slider P aP  =  124.4 m/s**2.\n",
        " Velocity of point D vD  =  6.833 m/s.\n",
        " Acceleration of point D aD  =  266.48 m/s**2.\n",
        " Angular velocity of the connecting rod omegaPC  =  6.126 rad/s.\n",
        " Angular acceleration of the connecting rod PC alphaPC  =  481.14 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.3 Page No : 527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 300./1000\n",
      "l = 1. \t\t\t#m\n",
      "N = 200. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Crank angle at which the maximum velocity occurs:\n",
      "#Calculating the ratio of length of connecting rod to crank radius\n",
      "n = l/r\n",
      "#Velocity of the piston vP  =  omega*r*(math.sin(math.radians(theta)+math.sin(math.radians(2*theta)/(2*n))    .....(i)\n",
      "#For maximum velocity d(vP)/d(theta)  =  0                                  .....(ii)\n",
      "#Substituting (i) in (ii) we get 2(math.cos(theta))**2+n*math.cos(theta)-1  =  0\n",
      "a = 2.\n",
      "b = n\n",
      "c = -1.\n",
      "costheta = (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "#Calculating the crank angle from the inner dead centre at which the maximum velocity occurs\n",
      "theta = round(math.degrees(math.acos(costheta))) \t\t\t#degrees\n",
      "#Calculating the maximum velocity of the piston:\n",
      "vPmax = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Results:\n",
      "print \" Crank angle from the inner dead centre at which the maximum velocity occurs theta  =  %.2f degrees.\"%(theta)\n",
      "print \" Maximum velocity of the piston( vPmax)  =  %.2f m/s.\"%(vPmax)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Crank angle from the inner dead centre at which the maximum velocity occurs theta  =  75.00 degrees.\n",
        " Maximum velocity of the piston( vPmax)  =  6.54 m/s.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.4 Page No : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 0.3             #m\n",
      "l = 1.5 \t\t\t#m\n",
      "N = 180. \t\t\t#rpm\n",
      "theta = 40. \t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the piston\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Velocity of the piston:\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the velocity of the piston\n",
      "vP = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Position of the crank for zero acceleration of the piston:\n",
      "ap1 = 0\n",
      "#Calculating the position of the crank from the inner dead centre for zero acceleration of the piston\n",
      "#We have ap1  =  omega**2*r*(math.cos(theta1)+math.cos(2*theta1)/n) or 2*(math.cos(theta1))**2+n*math.cos(theta1)-1  =  0\n",
      "a = 2.\n",
      "b = n\n",
      "c = -1.\n",
      "costheta1 = (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "#Calculating the crank angle from the inner dead centre for zero acceleration of the piston\n",
      "theta1 = math.degrees(math.acos(costheta1)) \t\t\t#degrees\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the piston vP  =  %.2f m/s.\"%( vP)\n",
      "print \" Acceleration of the piston aP  =  %.2f m/s**2.\"%(aP)\n",
      "print \" Position of the crank for zero acceleration of the piston theta1  =  %.2f degrees or\\\n",
      " %.2f degrees.\"%(theta1,360-theta1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the piston vP  =  4.19 m/s.\n",
        " Acceleration of the piston aP  =  85.36 m/s**2.\n",
        " Position of the crank for zero acceleration of the piston theta1  =  79.27 degrees or 280.73 degrees.\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.5 Page No : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 150./1000\n",
      "l = 600./1000 \t\t\t#m\n",
      "theta = 60. \t\t\t#degrees\n",
      "N = 450. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Velocity and acceleration of the slider:\n",
      "#Calculating the ratio of length of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the velocity of the slider\n",
      "vP = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Calculating the acceleration of the slider\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the angular velocity of the connecting rod\n",
      "omegaPC = omega*math.cos(math.radians(theta))/n \t\t\t#rad/s\n",
      "#Calculating the angular acceleration of the connecting rod\n",
      "alphaPC = round(omega**2*math.sin(math.radians(theta))/n) \t\t\t#rad/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the slider vP  =  %.1f m/s.\"%(vP)\n",
      "print \" Acceleration of the slider aP  =  %.2f m/s**2.\"%(aP)\n",
      "print \" Angular velocity of the connecting rod omegaPC  =  %.1f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod alphaPC  =  %d rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the slider vP  =  6.9 m/s.\n",
        " Acceleration of the slider aP  =  124.91 m/s**2.\n",
        " Angular velocity of the connecting rod omegaPC  =  5.9 rad/s.\n",
        " Angular acceleration of the connecting rod alphaPC  =  481 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.6 Page No : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 175./1000     #m\n",
      "L = 200./1000     #m\n",
      "r = L/2           #m\n",
      "l = 400./1000 \t  #m\n",
      "N = 500. \t\t  #rpm\n",
      "mR = 180. \t\t  #kg\n",
      "theta = 60        #degrees\n",
      "#Solution:\n",
      "omega = round(2*math.pi*N/60,1) \t\t\t#rad/s\n",
      "\n",
      "# Graphical method\n",
      "ON = 0.038       # m\n",
      "aR = omega**2 * ON\n",
      "FI = mR * aR/1000\n",
      "print \" Inertia force FI  =  %.2f kN.\"%(FI)\n",
      "\n",
      "#Calculating the angular speed of the crank\n",
      "\n",
      "#Analytical method:\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)/1000 \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Inertia force FI  =  %.2f kN.\"%(FI)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Inertia force FI  =  18.78 kN.\n",
        " Inertia force FI  =  18.53 kN.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.7 Page No : 533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "\n",
      "# Variables:\n",
      "r = 300./1000       #m\n",
      "l = 1.2             #m\n",
      "D = 0.5 \t\t\t#m\n",
      "mR = 250. \t\t\t#kg\n",
      "theta = 60. \t\t#degrees\n",
      "dp = 0.35 \t\t\t#p1-p2 N/mm**2\n",
      "N = 250. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the net load on the piston\n",
      "FL = (dp)*math.pi/4*(D*1000)**2 \t\t\t#N\n",
      "#Calculating the ratio of length of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the accelerating or inertia force on reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = (FL-FI)/1000 \t\t\t#kN\n",
      "#Pressure on slide bars:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the pressure on the slide bars\n",
      "FN = FP*math.tan(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the thrust in the connecting rod\n",
      "FQ = FP/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the tangential force on the crank pin\n",
      "FT = FQ*math.sin(math.radians(theta+phi)) \t\t\t#kN\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = FT*r \t\t\t#kN-m\n",
      "\n",
      "#Results:\n",
      "print \" Pressure on the slide bars FN  =  %.2f kN.\"%(FN)\n",
      "print \" Thrust in the connecting rod FQ  =  %.2f kN.\"%(FQ)\n",
      "print \" Tangential force on the crank-pin FT  =  %.2f kN.\"%(FT)\n",
      "print \" Turning moment on the crank shaft T  =  %.3f kN-m.\"%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure on the slide bars FN  =  10.97 kN.\n",
        " Thrust in the connecting rod FQ  =  50.65 kN.\n",
        " Tangential force on the crank-pin FT  =  48.30 kN.\n",
        " Turning moment on the crank shaft T  =  14.491 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.8 Page No : 534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 300./1000      #m\n",
      "L = 450./1000      #m\n",
      "r = L/2            #m\n",
      "d = 50./1000       #m\n",
      "l = 1.2 \t\t\t#m\n",
      "N = 200. \t\t\t#rpm\n",
      "mR = 225. \t\t\t#kg\n",
      "theta = 125. \t\t\t#degrees\n",
      "p1 = 30*1000.       #N/m**2\n",
      "p2 = 1.5*1000. \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the area of the piston\n",
      "A1 = math.pi/4*D**2 \t\t\t#m**2\n",
      "#Calculating the area of the piston rod\n",
      "a = math.pi/4*d**2 \t\t\t#m**2\n",
      "#Calculating the force on the piston due to steam pressure\n",
      "FL = round(p1*A1-p2*(A1-a)) \t\t\t#N\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = FL-FI+mR*9.81 \t\t\t#N\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the effective turning moment on the crank shaft\n",
      "T = FP*math.sin(math.radians(theta+phi))/math.cos(math.radians(phi))*r \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Effective turning moment of the crank shaft T  =  %.f N-m.\"%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Effective turning moment of the crank shaft T  =  3020 N-m.\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.9 Page No : 534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 1800. \t\t\t#rpm\n",
      "r = 50./1000        #m\n",
      "l = 200./1000       #m\n",
      "D = 80./1000        #m\n",
      "x = 10./1000 \t\t#m\n",
      "mR = 1. \t\t\t#kg\n",
      "p = 0.7 \t\t\t#N/mm**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Net load on the gudgeon pin:\n",
      "#Calculating the load on the piston\n",
      "FL = round(math.pi/4*(D*1000)**2*p) \t\t\t#N\n",
      "#Refer Fig. 15.10\n",
      "#By measurement\n",
      "theta = 33. \t\t\t#degrees\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net load on the gudgeon pin\n",
      "FP = FL-FI \t\t\t#N\n",
      "#Thrust in the connecting rod:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the thrust in the connecting rod\n",
      "FQ = FP/math.cos(math.radians(phi)) \t\t\t#N\n",
      "#Calculating the reaction between the piston and cylinder\n",
      "FN = FP*math.tan(math.radians(phi)) \t\t\t#N\n",
      "#Engine speed at which the abov values will become zero:\n",
      "#Calculating the speed at which FI = FL\n",
      "omega1 = math.sqrt((math.pi/4*(D*1000)**2*p)/(mR*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n))) \t\t\t#rad/s\n",
      "#Calculating the corresponding speed in rpm\n",
      "N1 = omega1*60/(2*math.pi) \t\t\t#rpm\n",
      "\n",
      "print phi\n",
      "#Results:\n",
      "print \" Net load on the gudgeon pin FP  =  %.f N.\"%(FP)\n",
      "print \" Thrust in the connecting rod FQ  =  %.1f N.\"%(FQ)\n",
      "print \" Reaction between the piston and cylinder FN  =  %d N.\"%(FN)\n",
      "print \" Engine speed at which the above values will become zero N1  =  %d rpm.\"%(N1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "7.82568845753\n",
        " Net load on the gudgeon pin FP  =  1848 N.\n",
        " Thrust in the connecting rod FQ  =  1865.8 N.\n",
        " Reaction between the piston and cylinder FN  =  254 N.\n",
        " Engine speed at which the above values will become zero N1  =  2612 rpm.\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.10 Page No : 536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "aP = 36. \t\t\t#m/s**2\n",
      "theta = 30. \t\t#degrees\n",
      "p = 0.5 \t\t\t#N/mm**2\n",
      "RF = 600. \t\t\t#N\n",
      "D = 300./1000       #m\n",
      "r = 300./1000 \t\t#m\n",
      "mR = 180. \t\t\t#kg\n",
      "n = 4.5\n",
      "\n",
      "#Solution:\n",
      "#Reaction on the guide bars:\n",
      "#Calculating the load on the piston\n",
      "FL = round(p*math.pi/4*(D*1000)**2) \t\t\t#N\n",
      "#Calculating the inertia force due to reciprocating parts\n",
      "FI = mR*aP \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = (FL-FI-RF)/1000 \t\t\t#kN\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the reaction on the guide bars\n",
      "FN = FP*math.tan(phi) \t\t\t#kN\n",
      "#Calculating the thrust on the crank shaft bearing\n",
      "FB = (FP*math.cos(math.radians(phi+theta)))/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r \t\t\t#kN-m\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Reaction on the guide bars FN  =  %.f kN.\"%(FN)\n",
      "print \" Thrust on the crank shaft bearing FB  =  %.1f kN.\"%(FB)\n",
      "print \" Turning moment on the crank shaft T  =  %.2f kN-m.\"%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Reaction on the guide bars FN  =  3 kN.\n",
        " Thrust on the crank shaft bearing FB  =  22.9 kN.\n",
        " Turning moment on the crank shaft T  =  5.06 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.11 Page No : 537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 100./1000          #m\n",
      "L = 120./1000          #m\n",
      "r = L/2                #m\n",
      "l = 250./1000 \t\t\t#m\n",
      "mR = 1.1     \t\t\t#kg\n",
      "N = 2000. \t    \t\t#rpm\n",
      "theta = 20. \t\t\t#degrees\n",
      "p = 700. \t\t    \t#kN/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Net force on the piston:\n",
      "#Calculating the force due to gas pressure\n",
      "FL = p*math.pi/4*D**2 \t\t\t#kN\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the piston\n",
      "FI = round(mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)) \t\t\t#N\n",
      "#Calculating the net force on the piston\n",
      "FP = (FL*1000)-FI+mR*9.81 \t\t\t#N\n",
      "#Resulmath.tant force on the gudgeon pin:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(theta)/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the resultant load on the gudgeon pin\n",
      "FQ = round(FP/math.cos(phi)) \t\t\t#N\n",
      "#Calculating the thrust on the cylinder walls\n",
      "FN = FP*math.tan(math.radians(4.7)) \t\t\t#N \n",
      "#Speed above which the gudgeon pin load would be reversed in direction:\n",
      "#Calculating the minimum speed for FP to be negative\n",
      "omega1 = math.sqrt((FL*1000+mR*9.81)/(mR*r*(math.cos(theta)+math.cos(2*theta)/n))) \t\t\t#rad/s\n",
      "#Calculating the corresponding speed in rpm\n",
      "N1 = 273*60/(2*math.pi) \t\t\t#rpm\n",
      "\n",
      "#Results:\n",
      "print \" Net force on the piston FP  =  %.1f N.\"%(FP)\n",
      "print \" Resultant load on the gudgeon pin FQ  =  %d N.\"%(FQ)\n",
      "print \" Thrust on the cylinder walls FN  =  %.1f N.\"%(FN)\n",
      "print \" Speed above which the gudgeon pin load would be reversed in direction N1 > %d rpm.\"%(N1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Net force on the piston FP  =  2255.6 N.\n",
        " Resultant load on the gudgeon pin FQ  =  2265 N.\n",
        " Thrust on the cylinder walls FN  =  185.4 N.\n",
        " Speed above which the gudgeon pin load would be reversed in direction N1 > 2606 rpm.\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.12 Page No : 538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 120. \t\t\t#rpm\n",
      "D = 250./1000       #m\n",
      "L = 400./1000       #m\n",
      "r = L/2             #m\n",
      "l = 0.6             #m\n",
      "d = 50./1000 \t\t#m\n",
      "mR = 60. \t\t\t#kg\n",
      "theta = 45. \t\t#degrees\n",
      "p1 = 550.*1000      #N/m**2\n",
      "p2 = 70.*1000 \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Turning moment on the crankshaft:\n",
      "#Calculating the area of the piston on the cover end side\n",
      "A1 = math.pi/4*D**2 \t\t\t#m**2\n",
      "#Calculating the area of the piston rod\n",
      "a = math.pi/4*d**2 \t\t\t#m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = p1*A1-p2*(A1-a) \t\t\t#N\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = (FL-FI)/1000 \t\t\t#kN\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r*1000\t\t\t#N-m\n",
      "#Calculating the thrust on the bearings\n",
      "FB = (FP*math.cos(math.radians(theta+phi)))/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Acceleration of the flywheel:\n",
      "P = 20.*1000 \t\t\t#W\n",
      "m = 60. \t\t\t#kg\n",
      "k = 0.6 \t\t\t#m\n",
      "#Calculating the mass moment of inertia of the flywheel\n",
      "I = m*k**2 \t\t\t#kg-m**2\n",
      "#Calculating the resisting torque\n",
      "TR = P*60/(2*math.pi*N) \t\t\t#N-m\n",
      "#Calculating the acceleration of the flywheel\n",
      "alpha = (T-TR)/I \t\t\t#rad/s**2\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Turning moment on the crank shaft T  =  %f N-m.\"%(T)   # rounding off error \n",
      "print \" Thrust on the bearings FB  =  %.2f kN.\"%(FB)\n",
      "print \" Acceleration of the flywheel alpha  =  %.1f rad/s**2.\"%(alpha)\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Turning moment on the crank shaft T  =  3929.026139 N-m.\n",
        " Thrust on the bearings FB  =  11.98 kN.\n",
        " Acceleration of the flywheel alpha  =  108.2 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.13 Page No : 540"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 300./1000       #m\n",
      "L = 500./1000       #m\n",
      "r = L/2 \t\t\t#m\n",
      "n = 4.5\n",
      "N = 180. \t\t\t#rpm\n",
      "mR = 280. \t\t\t#kg\n",
      "theta = 45. \t\t#degrees\n",
      "p1 = 0.1 \t\t\t#N/mm**2\n",
      "CR = 14. \t\t\t#Compression ration V1/V2\n",
      "p4 = 2.2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.12\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the pressure corresponding to point 2\n",
      "p2 = p1*(CR)**1.35 \t\t\t#N/mm**2\n",
      "#Calculating the swept volume\n",
      "VS = math.pi/4*D**2*L \t\t\t#m**3\n",
      "VC = VS/(CR-1) \t\t\t#m**3\n",
      "#Calculating the volume corresponding to point 3\n",
      "V3 = VC+(1/10*VS) \t\t\t#m**3\n",
      "#Calculating the print lacement of the piston corresponding to crank print lacement of 45 degrees\n",
      "x = r*((1-math.cos(math.radians(theta)))+(math.sin(math.radians(theta)))**2/(2*n)) \t\t\t#m\n",
      "#Calculating the volume corresponding to point 4'\n",
      "V4dash = VC+(math.pi/4*D**2*x) \t\t\t#m**2\n",
      "#Calculating the pressure corresponding to point 4'\n",
      "p3 = p2\n",
      "p4dash = p3*(V3/V4dash)**1.35 \t\t\t#N/mm**2\n",
      "\n",
      "#Calculating the difference of pressures on two sides of the piston\n",
      "p = (p4-p1)*10**6 \t\t\t#N/m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = p*math.pi/4*D**2 \t\t\t#N\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = FL-FI+mR*9.81 \t\t\t#N\n",
      "#Crank-pin effort:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the crank-pin effort\n",
      "FT = (FP*math.sin(math.radians(theta+phi)))/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "#Calculating the thrust on the bearings\n",
      "FB = (FP*math.cos(math.radians(theta+phi)))/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "#Calculating the turning moment on the crankshaft\n",
      "T = FT*r \t\t\t#kN-m\n",
      "\n",
      "#Results:\n",
      "print \" Crank-pin effort FT  =  %.3f kN.\"%(FT)\n",
      "print \" Thrust on the bearings FB  =  %.3f kN.\"%(FB)\n",
      "print \" Turning moment on the crankshaft T  =  %.2f kN-m.\"%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Crank-pin effort FT  =  109.501 kN.\n",
        " Thrust on the bearings FB  =  79.438 kN.\n",
        " Turning moment on the crankshaft T  =  27.38 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.14 Page No : 542"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 240./1000       #m\n",
      "L = 360./1000       #m\n",
      "r = L/2             #m\n",
      "l = 0.6 \t\t\t#m\n",
      "N = 300. \t\t\t#rpm\n",
      "mR = 160. \t\t\t#kg\n",
      "pA = (8+1.03)*10**5\n",
      "pE = (-0.75+1.03)*10**5 \t\t\t#N/m**2\n",
      "FR = 500. \t    \t\t#N\n",
      "theta = 75. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.13\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the stroke volume\n",
      "VS = math.pi/4*D**2*L \t\t\t#m**3\n",
      "#Calculating the volume of steam at cut-off\n",
      "VB = VS/3 \t\t\t#m**3\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the print lacement of the piston when the crank position is 75 degrees from the top dead centre\n",
      "x = r*((1-math.cos(math.radians(theta)))+(math.sin(math.radians(theta)))**2/(2*n)) \t\t\t#m**3\n",
      "#Calculating the volume corresponding to point C'\n",
      "VCdash = VS*x/L \t\t\t#m**3\n",
      "#Calculating the pressure corresponding to point C'\n",
      "pB = pA\n",
      "pCdash = round((pB*VB)/VCdash) \t\t\t#N/m**2\n",
      "#Calculating the difference of pressures on the two sides of the piston\n",
      "p = round(pCdash-pE) \t\t\t#N/m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = round(math.pi/4*D**2*p) \t\t\t#N\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = round(mR*omega**2*r*(math.cos(math.radians(theta))+(math.cos(math.radians(2*theta))/n))) \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = FL-FI+mR*9.81-FR \t\t\t#N\n",
      "#Turning moment on the crankshaft:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = round(math.degrees(math.asin(sinphi)),3)\n",
      "\n",
      "#Calculating the turning moment on the crankshaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Turning moment on the crankshaft T  =  %d N-m.\"%(T)\n",
      "\n",
      "# note : rounding error. please check using calculator"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Turning moment on the crankshaft T  =  5778 N-m.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.15 Page No : 545"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "l = 300.            #mm\n",
      "l1 = 200. \t\t\t#mm\n",
      "m = 15. \t\t\t#kg\n",
      "I = 7000. \t\t\t#kg-mm**2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.16 and Fig. 15.17\n",
      "#Calculating the radius of gyration of the connecting rod about an axis pasmath.sing through its centre of gravity\n",
      "kG = math.sqrt(I/m) \t\t\t#mm\n",
      "#Calculating the distance of other mass from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#mm\n",
      "#Calculating the magnitude of mass placed at the small end centre\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the mass placed at a dismath.tance l2 from the centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the small end centre m1  =  %.2f kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.2f mm from the centre of gravity m2  =  %.2f kg.\"%(l2,m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the small end centre m1  =  0.17 kg.\n",
        " Mass placed at a distance 2.33 mm from the centre of gravity m2  =  14.83 kg.\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.16 Page No : 546"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:  \n",
      "h = 650./1000          #m\n",
      "l1 = (650.-25)/1000    #m\n",
      "m = 37.5 \t\t\t#kg\n",
      "tp = 1.87 \t\t\t#seconds\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.18 and Fig. 15.19\n",
      "#Calculating the radius of gyration of the connecting rod about an axis pasmath.sing through its centre of gravity\n",
      "kG = math.sqrt((tp/(2*math.pi))**2*(9.81*h)-h**2) \t\t\t#m\n",
      "#Calculating the dismath.tance of mass m2 from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of mass placed at the small end centre\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of mass placed at a dismath.tance l2 from centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the small end centre A m1  =  %d kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.3f m from G m2  =  %.1f kg.\"%(l2,m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the small end centre A m1  =  10 kg.\n",
        " Mass placed at a distance 0.228 m from G m2  =  27.5 kg.\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.17 Page No : 547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "m = 55. \t\t\t#kg\n",
      "l = 850./1000       #m\n",
      "d1 = 75./1000       #m\n",
      "d2 = 100./1000 \t\t#m\n",
      "tp1 = 1.83          #sec\n",
      "tp2 = 1.68 \t\t\t#seconds\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.20\n",
      "#Calculating the length of equivalent simple pendulum when suspended from the top of small end bearing\n",
      "L1 = 9.81*(tp1/(2*math.pi))**2 \t\t\t#m\n",
      "#Calculating the length of equivalent simple pendulum when suspended from the top of big end bearing\n",
      "L2 = 9.81*(tp2/(2*math.pi))**2 \t\t\t#m\n",
      "#Radius of gyration of the rod about an axis pasmath.sing through the centre of gravity and perpendicular to the plane of oscillation:\n",
      "#Calculating the distances of centre of gravity from the top of small end and big end bearings\n",
      "#We have h1*(L1-h1)  =  h2*(L2-h2) or h1**2-h2**2+h2*L2-h1*L1  =  0                                                                    .....(i)\n",
      "#Also h1+h2  =  d1/2+l+d2/2 or h1+h2-d1/2-l-d2/2  =  0                                                                               .....(ii)\n",
      "def f(x):\n",
      "    y = [0,0]\n",
      "    h1 = x[0]\n",
      "    h2 = x[1]\n",
      "    y[0] = h1**2-h2**2+h2*L2-h1*L1\n",
      "    y[1] = h1+h2-d1/2-l-d2/2\n",
      "    return y\n",
      "\n",
      "z = fsolve(f,[1,1])\n",
      "h1 = z[0]\n",
      "h2 = z[1] \t\t\t#m\n",
      "\n",
      "#Calculating the required radius of gyration of the rod\n",
      "kG = math.sqrt(h1*(L1-h1)) \t\t\t#m\n",
      "#Calculating the moment of inertia of the rod\n",
      "I = m*(kG)**2 \t\t\t#kg-m**2\n",
      "#Dynamically equivalent system for the rod:\n",
      "#Calculating the distance of the mass situated at the centre of small end bearing from the centre of gravity\n",
      "l1 = h1-d1/2 \t\t\t#m\n",
      "#Calculating the distance of the second mass from the centre of gravity towards big end bearing\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of the mass situated at the centre of small end bearing\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the second mass\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Radius of gyration of the rod about an axis passing through the centre of\\\n",
      " gravity and perpendicular to the plane of oscillation, kG  =  %.3f m.\"%(kG)\n",
      "print \" Moment of inertia of the rod, I  =  %.2f kg-m**2.\"%(I)\n",
      "print \" Magnitude of the mass situated at the centre of small end bearing, m1  =  %.2f kg.\"%(m1)\n",
      "print \" Magnitude of the second mass, m2  =  %.2f kg.\"%(m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Radius of gyration of the rod about an axis passing through the centre of gravity and perpendicular to the plane of oscillation, kG  =  0.345 m.\n",
        " Moment of inertia of the rod, I  =  6.56 kg-m**2.\n",
        " Magnitude of the mass situated at the centre of small end bearing, m1  =  13.32 kg.\n",
        " Magnitude of the second mass, m2  =  41.68 kg.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.18 Page No : 550"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "m = 2. \t\t\t#kg\n",
      "l = 250./1000   #m\n",
      "l1 = 100./1000  #m\n",
      "kG = 110./1000 \t\t\t#m\n",
      "alpha = 23000. \t\t\t#rad/s**2\n",
      "\n",
      "#Solution:\n",
      "#Equivalent dynamical system:\n",
      "#Calculating the distance of the second mass from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of the mass placed at the gudgeon pin\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the mass placed at a distance l2 from centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "#Correction couple:\n",
      "#Calculating the magnitude of l3\n",
      "l3 = l-l1 \t\t\t#m\n",
      "#Calculating the new radius of gyration\n",
      "k1 = math.sqrt(l1*l3) \t\t\t#m**2\n",
      "#Calculating the correction couple\n",
      "Tdash = m*(k1**2-kG**2)*alpha \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the gudgeon pin, m1  =  %.1f kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.3f m from the centre of gravity m2  =  %.1f kg.\"%(l2,m2)\n",
      "print \" Correction couple Tdash  =  %.1f N-m.\"%(Tdash)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the gudgeon pin, m1  =  1.1 kg.\n",
        " Mass placed at a distance 0.121 m from the centre of gravity m2  =  0.9 kg.\n",
        " Correction couple Tdash  =  133.4 N-m.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.19 Page No : 554"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 125.           #mm\n",
      "OC = r             #mm\n",
      "l = 500.           #mm\n",
      "PC = l             #mm\n",
      "PG = 275.          #mm\n",
      "kG = 150. \t\t\t#mm\n",
      "mC = 60. \t\t\t#kg\n",
      "N = 600. \t\t\t#rpm\n",
      "theta = 45. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.24\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Acceleration of the piston:\n",
      "#By measurement\n",
      "NO = 90./1000 \t\t\t#m\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#The magnitude position and direction of inertia force due to the mass of the connecting rod:\n",
      "#By measurement\n",
      "gO = 103./1000 \t\t\t#m\n",
      "#Calculating the magnitude of the inertia force of the connecting rod\n",
      "FC = mC*omega**2*gO/1000 \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Acceleration of the piston aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" The magnitude of inertia force due to the mass of the connecting rod FC  =  %.1f kN.\"%(FC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Acceleration of the piston aP  =  355.3 m/s**2.\n",
        " The magnitude of inertia force due to the mass of the connecting rod FC  =  24.4 kN.\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.20 Page No : 555"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 240./1000      #m\n",
      "L = 600./1000      #m\n",
      "r = L/2            #m\n",
      "l = 1.5            #m\n",
      "GC = 500./1000     #m\n",
      "kG = 650./1000 \t   #m\n",
      "mR = 300.\n",
      "mC = 250. \t\t\t#kg\n",
      "N = 125. \t\t\t#rpm\n",
      "theta = 30. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.25\n",
      "#Calculating the angular speed of the crank\n",
      "omega = round(2*math.pi*N/60,1) \t\t\t#rad/s\n",
      "#Analytical method:\n",
      "#Calculating the distance of centre of gravity of the connecting rod from P\n",
      "l1 = l-GC \t\t\t#m\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force due to total mass of the reciprocating parts at P\n",
      "FI = int((mR+(l-l1)/l*mC)*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)) \t\t\t#N\n",
      "#Calculating the corresponding torque due to FI\n",
      "TI = int(FI*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/ \\\n",
      "(2*math.sqrt(n**2-(math.sin(math.radians(theta)))**2)))) \t\t\t#N-m\n",
      "#Calculating the equivalent length of a simple pendulum when swung about an axis through P\n",
      "L = ((kG)**2+(l1)**2)/l1 \t\t\t#m\n",
      "#Calculating the correcting torque\n",
      "TC = mC*l1*(l-L) *(omega**2 * math.sin(math.radians(60)))/(2*n**2)\t\t\t#N-m\n",
      "#Calculating the torque due to the weight of the connecting rod at C\n",
      "TW = mC*9.81*(l1/n)*math.cos(math.radians(theta)) \t\t\t#N-m\n",
      "#Calculating the total torque exerted on the crankshaft\n",
      "Tt = TI+TC+TW \t\t\t#Total torque exerted on the crankshaft N-m\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Total torque exerted on the crankshaft  =  %.1f N-m.\"%(round(Tt,-1))\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total torque exerted on the crankshaft  =  3840.0 N-m.\n"
       ]
      }
     ],
     "prompt_number": 110
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.21 Page No : 558"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 1200. \t\t\t#rpm\n",
      "L = 110./1000\n",
      "r = L/2\n",
      "l = 250./1000\n",
      "PC = l\n",
      "CG = 75./1000 \t\t\t#m\n",
      "mC = 1.25 \t\t\t#kg\n",
      "theta = 40. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.26\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Radius of gyration of the connecting rod about an axis through its mass centre:\n",
      "#Calculating the distance of the centre of gravity from the point of suspension\n",
      "l1 = l-CG \t\t\t#m\n",
      "PG = l1\n",
      "#Calculating the frequency of oscillation\n",
      "n = 21./20 \t\t\t#Hz\n",
      "#Calculating the radius of gyration of the connecting rod about an axis through its mass centre\n",
      "kG = round(math.sqrt((9.81*l1/(2*math.pi*n)**2)-l1**2)*1000) \t\t\t#mm\n",
      "#Acceleration of the piston:\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod\n",
      "alphaPC = (-omega**2*math.sin(math.radians(theta)))/n \t\t\t#rad/s**2\n",
      "#Inertia torque exerted on the crankshaft:\n",
      "#Calculating the mass of the connecting rod at P\n",
      "m1 = (l-l1)/l*mC \t\t\t#kg\n",
      "#Calculating the vertical inertia force\n",
      "FI = round(m1*aP) \t\t\t#N\n",
      "#By measurement\n",
      "OM = 0.0425\n",
      "NC = 0.035 \t\t\t#m\n",
      "#Calculating the corresponding torque due to FI\n",
      "TI = FI*OM \t\t\t#N-m\n",
      "#Calculating the equivalent length of a simple pendulum when swung about an axis pasmath.sing through P\n",
      "L = ((kG/1000)**2+(l1)**2)/l1 \t\t\t#m\n",
      "#Calculating the correction couple\n",
      "Tdash = mC*l1*(l-L)*alphaPC \t\t\t#N-m\n",
      "#Calculating the corresponding torque on the crankshaft\n",
      "TC = -Tdash*math.cos(math.radians(theta))/n \t\t\t#N-m\n",
      "#Calculating the torque due to mass at P\n",
      "TP = m1*9.81*OM \t\t\t#N-m\n",
      "#Calculating the equivalent mass of the connecting rod at C\n",
      "m2 = mC*(l1/l) \t\t\t#kg\n",
      "#Calculating the torque due to mass at C\n",
      "TW = m2*9.81*NC \t\t\t#N-m\n",
      "#Calculating the inertia force exerted on the crankshaft\n",
      "Ti = TI+TC-TP-TW \t\t\t#Inertia torque exerted on the crankshaft N-m\n",
      "\n",
      "#Results:\n",
      "print \" Radius of gyration of the connecting rod about an axis through its mass centre kG  =  %d mm.\"%(kG)\n",
      "print \" Acceleration of the piston aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" Angular acceleration of the connecting rod alphaPC  =  %.1f rad/s**2.\"%(alphaPC)\n",
      "print \" Inertia torque exerted on the crankshaft  =  %.3f N-m.\"%(Ti)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Radius of gyration of the connecting rod about an axis through its mass centre kG  =  94 mm.\n",
        " Acceleration of the piston aP  =  698.5 m/s**2.\n",
        " Angular acceleration of the connecting rod alphaPC  =  -2233.1 rad/s**2.\n",
        " Inertia torque exerted on the crankshaft  =  12.696 N-m.\n"
       ]
      }
     ],
     "prompt_number": 112
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.22 Page No : 559"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "l = 225./1000      #m\n",
      "PC = l             #m\n",
      "L = 150./1000      #m\n",
      "r = L/2            #m\n",
      "D = 112.5/1000     #m\n",
      "PG = 150./1000     #m\n",
      "kG = 87.5/1000 \t   #m\n",
      "mC = 1.6\n",
      "mR = 2.4 \t\t\t#kg\n",
      "theta = 40 \t\t\t#degrees\n",
      "p = 1.8*10**6 \t\t#N/m**2\n",
      "N = 2000. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.27\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#By measurement\n",
      "NO = 0.0625\n",
      "gO = 0.0685\n",
      "IC = 0.29\n",
      "IP = 0.24\n",
      "IY = 0.148\n",
      "IX = 0.08 \t\t\t#m\n",
      "#Calculating the force due to gas pressure\n",
      "FL = math.pi/4*D**2*p \t\t\t#N\n",
      "#Calculating the inertia force due to mass of the reciprocating parts\n",
      "FI = mR*omega**2*NO \t\t\t#N\n",
      "#Calculating the net force on the piston\n",
      "FP = FL-FI \t\t\t#N\n",
      "#Calculating the inertia force due to mass of the connecting rod\n",
      "FC = mC*omega**2*gO \t\t\t#N\n",
      "#Calculating the force acting perpendicular to the crank OC\n",
      "FT = ((FP*IP)-((mC*9.81*IY)+(FC*IX)))/IC \t\t\t#N\n",
      "#By measurement\n",
      "FN = 3550.\n",
      "FR = 7550.\n",
      "FQ = 13750. \t\t\t#N\n",
      "\n",
      "#Results:\n",
      "print \" Resultant force on the crank pin FQ  =  %d N.\"%(FQ)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Resultant force on the crank pin FQ  =  13750 N.\n"
       ]
      }
     ],
     "prompt_number": 36
    }
   ],
   "metadata": {}
  }
 ]
}