summaryrefslogtreecommitdiff
path: root/A_TEXTBOOK_OF_ELECTRICAL_TECHNOLOGY_VOL-III_by_B.L.Thareja/chapter45.ipynb
blob: 6a963318aa71406f53c6c0cf7f2405c1cc9a59b9 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER 45 : RATING AND SERVICE CAPACITY"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.1 , PAGE NO :- 1796"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor = 66.0 KW.\n"
     ]
    }
   ],
   "source": [
    "'''An electric motor operates at full-load of 100KW for 10 minutes,at 3/4 full load for the next 10 minutes and at 1/2 load for\n",
    "next 20 minutes,no-load for the next 20 minutes and this cycle repeats continously.Find the continous rating of the suitable \n",
    "motor.'''\n",
    "\n",
    "import math as m\n",
    "#Loads\n",
    "l1 = 100.0        #kW        (load 1)\n",
    "l2 = 0.75*l1      #kW        (load 2)\n",
    "l3 = 0.5*l1       #kW        (load 3)\n",
    "l4 = 0.0            #kW        (no-load)\n",
    "\n",
    "#coresponding time\n",
    "t1 = 10.0         #minutes\n",
    "t2 = 10.0         #minutes\n",
    "t3 = 20.0         #minutes\n",
    "t4 = 20.0         #minutes\n",
    "\n",
    "#size of motor required\n",
    "size = m.sqrt((l1*l1*t1 + l2*l2*t2 + l3*l3*t3 + l4*l4*t4)/(t1+t2+t3+t4/3))     #kW\n",
    "print \"Size of motor =\",round(size),\"KW.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.2 , PAGE NO :- 1797"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor = 141.0 KW.\n"
     ]
    }
   ],
   "source": [
    "'''An electric motor has to be selected for a load which rises uniformly from zero to 200KW in 10 minutes after which it remains \n",
    "constant at 200KW for the next 10 minutes,followed by a no-load period of 15 minutes before the cycle repeats itself.Estimate a \n",
    "suitable size of continuosly rated motor.'''\n",
    "\n",
    "import math as m\n",
    "#Loads\n",
    "l1 = 200.0/2        #kW        (load 1)\n",
    "l2 = 200.0          #kW        (load 2)\n",
    "l3 = 0.0            #kW        (no-load)\n",
    "\n",
    "#coresponding time\n",
    "t1 = 10.0         #minutes\n",
    "t2 = 10.0         #minutes\n",
    "t3 = 15.0         #minutes\n",
    "\n",
    "\n",
    "#size of motor required\n",
    "size = m.sqrt((l1*l1*t1 + l2*l2*t2 + l3*l3*t3)/(t1+t2+t3/3))     #kW\n",
    "print \"Size of motor =\",round(size),\"KW.\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.3 , PAGE NO :- 1797 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor =  70.0 KW.\n"
     ]
    }
   ],
   "source": [
    "'''A certain motor has to perform the following duty cycle:\n",
    "(a) 100KW for 10 minutes               (No-load for 5 minutes)\n",
    "(b) 50KW for 8 minutes                 (No-load for 4 minutes)\n",
    "The duty cycle is repeated indefinitely.Draw the curve for the load cycle.Assuming that the heating is propotional to the square of\n",
    "the load,determine suitable size of a continuosly-rated motor.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Loads\n",
    "l1 = 100.0      #KW      (load 1)\n",
    "l3 = 50.0       #KW      (load 2)\n",
    "\n",
    "#Time\n",
    "t1 = 10.0       #minutes\n",
    "t2 = 5.0        #minutes\n",
    "t3 = 8.0        #minutes\n",
    "t4 = 4.0        #minutes\n",
    "\n",
    "#Size of the motor is\n",
    "size = m.sqrt((l1*l1*t1 + l3*l3*t3)/(t1+t2+t3+t4))      #KW\n",
    "print \"Size of motor = \",round(size,-1),\"KW.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.4 , PAGE NO :- 1799"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor =  69.07 H.P.\n"
     ]
    }
   ],
   "source": [
    "'''A motor has to perform the following duty cycle :-\n",
    "(i) 100 H.P (10 mins)            (ii) No Load (5 mins)\n",
    "(iii)60 H.P (8 mins)             (iv) No Load (4 mins)\n",
    "which is repeated infinitely.Determine the suitable size of continuosly rated motor.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Loads\n",
    "l1 = 100.0      #H.P      (load 1)\n",
    "l3 = 60.0       #H.P     (load 2)\n",
    "\n",
    "#Time\n",
    "t1 = 10.0       #minutes\n",
    "t2 = 5.0        #minutes\n",
    "t3 = 8.0        #minutes\n",
    "t4 = 4.0        #minutes\n",
    "\n",
    "#Size of the motor is\n",
    "size = m.sqrt((l1*l1*t1 + l3*l3*t3)/(t1+t2+t3+t4))      #H.P\n",
    "print \"Size of motor = \",round(size,2),\"H.P.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.5 , PAGE nO :- 1800"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor = 48.11 H.P .\n"
     ]
    }
   ],
   "source": [
    "'''A motor working in a coal mine has to exert power starting from zero and rising uniformly to 100 H.P in 5 min\n",
    "after which it works at a constant rate of 50 H.P for 10 min.Then, a no load period of 3 min.The cycle is repeated\n",
    "indefinitely,estimate suitable size of motor.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Load\n",
    "l1 = 100.0     #H.P    (load 1)\n",
    "l2 = 50.0      #H.P    (load 2)\n",
    "l3 = 0.0       #H.P    (no-load)\n",
    "\n",
    "#Time\n",
    "t1 = 5.0          #min    (time 1) \n",
    "t2 = 10.0         #min    (time 2)\n",
    "t3 = 3.0          #min    (time 3)\n",
    "\n",
    "#Using Simpson's one-third rule of Integration\n",
    "rating = m.sqrt((1.0/3*l1*l1*t1 + l2*l2*t2)/(t1 + t2 + t3) )     #H.P\n",
    "\n",
    "print \"Size of motor =\",round(rating,2),\"H.P .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.6 , PAGE NO :- 1800"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of motor =  263.19 H.P .\n",
      "Therefore, suitable size of motor is 300.0 H.P\n"
     ]
    }
   ],
   "source": [
    "'''A motor has following duty cycle\n",
    "Load rising from 200 to 400 H.P              -              4 min.\n",
    "Uniform load 300 H.P                         -              2 min.\n",
    "Regenerative braking (50 H.P to 0)           -              1 min.\n",
    "Idle                                         -              1 min.\n",
    "Estimate suitable H.P rating of the motor that can be used.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Loads\n",
    "l1 = 200.0       #H.P      (load 1)\n",
    "l2 = 400.0       #H.P      (load 2)\n",
    "l3 = 300.0       #H.P      (load 3)\n",
    "l4 = 50.0        #H.P      (load 4)\n",
    "\n",
    "#Time\n",
    "t1 = 4.0        #min       (time 1)\n",
    "t2 = 2.0        #min       (time 2)\n",
    "t3 = 1.0        #min       (time 3)\n",
    "t4 = 1.0        #min       (idle time)\n",
    "\n",
    "rating = m.sqrt((1.0/3*(l1*l1 + l1*l2 + l2*l2)*t1 + l3*l3*t2 + 1.0/3*l4*l4*t3)/(t1 + t2 + t3 + t4))   #H.P\n",
    "\n",
    "print \"Size of motor = \",round(rating,2),\"H.P .\"\n",
    "print \"Therefore, suitable size of motor is\",round(rating,-2),\"H.P\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.7 , PAGE NO :- 1802"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Suitable motor size = 30.0 H.P .\n"
     ]
    }
   ],
   "source": [
    "'''The load cycle of a motor for 15 min in driving some equipment is as follows :\n",
    "0 - 5 min     -     30 H.P\n",
    "5 - 9 min     -     No load\n",
    "9 - 12 min    -     45 H.P\n",
    "12 - 15 min   -     No load\n",
    "The load cycle is repeated indefinitely.Suggest a suitable size of continuosly rated motor.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Loads\n",
    "l1 = 30.0       #H.P\n",
    "l3 = 45.0       #H.P\n",
    "\n",
    "#Time\n",
    "t1 = 5.0        #min\n",
    "t2 = 4.0        #min\n",
    "t3 = 3.0        #min\n",
    "t4 = 3.0        #min\n",
    "\n",
    "#Size of motor is\n",
    "Size = m.sqrt((l1*l1*t1 + l3*l3*t3)/(t1+t2+t3+t4))     #H.P\n",
    "print \"Suitable motor size =\",round(Size,-1),\"H.P .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.8 , PAGE NO :- 1802"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Size of continously rated motor =  505.0 H.P .\n"
     ]
    }
   ],
   "source": [
    "'''A motor driving a colliery winder has the following acceleration period :\n",
    "  load cycle 0-15 sec    :   Load rises uniformly from 0-1000 H.P .\n",
    "  Full speed period      :   15-85 sec. Load constant at 600 H.P .\n",
    "  Decceleration period   :   85-95 sec. Regenerative braking the H.P returned uniformly from 200 to 0 H.P.\n",
    "  95 - 120 sec           :   Motor stationary.\n",
    "Estimate the size of continuosly rated motor.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "#Loads\n",
    "l1 = 1000.0        #H.P         (load 1)\n",
    "l2 = 600.0         #H.P         (load 2)\n",
    "l3 = 200.0         #H.P         (load 3)\n",
    "\n",
    "#Time\n",
    "t1 = 15.0            #s\n",
    "t2 = 70.0            #s\n",
    "t3 = 10.0            #s\n",
    "t4 = 25.0            #s\n",
    "\n",
    "#Size of motor is\n",
    "\n",
    "size = m.sqrt((l1*l1*t1/3 + l2*l2*t2 + l3*l3*t3/3)/(t1+t2+t3+t4))      #H.P\n",
    "\n",
    "while(round(size)%5!=0):\n",
    "    size = size + 1\n",
    "    \n",
    "print \"Size of continously rated motor = \",round(size),\"H.P .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.9 , PAGE NO :- 1807"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 1/2 hour rating =  75.13 KW.\n"
     ]
    }
   ],
   "source": [
    "'''A 40KW motor when run continuosly on full load,attains a temperature of 35C , above the surrounding air.Its heating time \n",
    "constant is 90 min.What would be the 1/2 hour rating of the motor for this temperature rise?Assume that the machine cools down \n",
    "completely between each load period and that the losses are propotional to square of the load.'''\n",
    "\n",
    "\n",
    "from sympy import Symbol,Eq,solve\n",
    "import math as m\n",
    "# Let 'P' KW be 1/2 hour rating of the motor\n",
    "# theta1 - final temp rise at P KW\n",
    "# theta2 - final temp rise at 40 KW\n",
    "#Losses at P KW is directlt propotional to P^2\n",
    "\n",
    "theta2 = 35.0      # *C\n",
    "tau =  1.5         #hr        (time constant)\n",
    "t = 0.5            #hr        (motor running time)\n",
    "\n",
    "#Now,  (theta1/theta2) = loss at P KW/loss at 40KW = (P/40)^2\n",
    "P = Symbol('P')\n",
    "theta1 = theta2*(P/40)*(P/40)            #*C\n",
    "\n",
    "#Now, theta2 = theta1*(1 - exp(-t/tau))\n",
    "\n",
    "theta2a =  theta1*(1-m.exp(-t/tau))      #*C\n",
    "eq = Eq(theta2,theta2a)\n",
    "P = solve(eq)\n",
    "P1 = P[1]                #KW\n",
    "\n",
    "print \"1/2 hour rating = \",round(P1,2),\"KW.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.10 , PAGE NO :- 1807"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 hour rating =  24.0 H.P.\n"
     ]
    }
   ],
   "source": [
    "'''Determine the one-hour rating of a 15 H.P motor having heating time contant of 2 hours.The motor attains the temperature of\n",
    "40*C on continuos run at full load.Assume that the losses are propotional to square of the load and the motor is allowed to cool\n",
    "down to the ambient temperature before being loaded again.'''\n",
    "\n",
    "from sympy import Symbol,Eq,solve\n",
    "import math as m\n",
    "# Let 'P' H.P be 1 hour rating of the motor\n",
    "# theta2 - final temp rise at P H.P\n",
    "# theta1 - final temp rise at 15 H.P\n",
    "#Losses at P H.P is directlt propotional to P^2\n",
    "\n",
    "theta1 = 40.0      # *C\n",
    "tau =  2.0         #hr        (time constant)\n",
    "t = 1.0            #hr        (motor running time)\n",
    "\n",
    "#Now,  (theta2/theta1) = loss at P H.P/loss at 15 H.P = (P/15)^2\n",
    "P = Symbol('P')\n",
    "theta2 = theta1*(P/15)*(P/15)            #*C\n",
    "\n",
    "#Now, theta1 = theta2*(1 - exp(-t/tau))\n",
    "\n",
    "theta1a =  theta2*(1-m.exp(-t/tau))      #*C\n",
    "eq = Eq(theta1,theta1a)\n",
    "P = solve(eq)\n",
    "P1 = P[1]                #H.P\n",
    "\n",
    "print \"1 hour rating = \",round(P1),\"H.P.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.11 , PAGE NO :- 1808"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature rise of motor =  35.6 *C .\n"
     ]
    }
   ],
   "source": [
    "'''The heating and cooling time constants of a motor are 1 hour and 2 hours respectively.Final temperature rise attained is \n",
    "100*C.This motor runs at full load for 30 minutes and then kept idle for 12 min and the cycle is repeated indefinitely.Determine \n",
    "the temperature rise of motor after one cycle.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "theta2 = 100.0         #*C    (Final temperature rise)\n",
    "tau_h = 1.0            #hr    (heating time constant)\n",
    "tau_c = 2.0            #hr    (cooling time constant)\n",
    "t1 = 30.0/60           #hr    (motor running time)\n",
    "t2 = 12.0/60           #hr    (motor idle time)\n",
    "\n",
    "#Heating cycle\n",
    "theta1 = theta2*(1 - m.exp(-t1/tau_h))\n",
    "\n",
    "#Cooling cycle\n",
    "thetac = theta1*m.exp(-t2/tau_c)\n",
    "\n",
    "print \"Temperature rise of motor = \",round(thetac,2),\"*C .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.12 , PAGE NO :- 1808"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum overload that can be carried by motor =  25.82 KW.\n"
     ]
    }
   ],
   "source": [
    "'''Calculate the maximum overload that can be carried by a 20KW output motor,if the temperature rise is not to exceed 50*C after\n",
    "one hour on overload .The temperature rise on full load,after 1 hour is 30*C and after 2 hour is 40*C . Assume losses propotional\n",
    "to square of load.'''\n",
    "\n",
    "from sympy import solve,Symbol,Eq\n",
    "import math as m\n",
    "\n",
    "# As theta = thetaf*(1 - exp(-t/T))\n",
    "\n",
    "theta1 = 30.0      #*C        (temperature rise in time1)\n",
    "t1 = 1              #hr        (time 1)\n",
    "theta2 = 40.0      #*C        (temperature rise in time2)\n",
    "t2 = 2              #hr        (time 2)\n",
    "#Now   theta1/theta2 = (1-exp(-t1/T))/(1-exp(-t2/T))\n",
    "#Let us assume that x = exp(-1/T).Therefore\n",
    "x = Symbol('x')\n",
    "ratio1 = (1 - x**t1)/(1-x**t2)       #(theta1/theta2)\n",
    "ratio2 = theta1/theta2\n",
    "\n",
    "#As ratio1 = ratio2\n",
    "eq = Eq(ratio1,ratio2)\n",
    "x1 = solve(eq)\n",
    "x = x1[0]             #variable \n",
    "\n",
    "#x = exp(-1/T) . Therefore,\n",
    "T = -1/m.log(x)\n",
    "\n",
    "#Now, theta1 = thetaf1*(1 - exp(-t1/T))\n",
    "\n",
    "thetaf1 = theta1/(1-x**t1)           #*C\n",
    "\n",
    "#Also theta3 = thetaf3*(1 - exp(-t3/T))\n",
    "theta3 = 50.0        #*C         (max temp)\n",
    "t3 = 1               #hr         (time 3) \n",
    "thetaf3 = theta3/(1-x**t3)            #*C\n",
    "\n",
    "#Given that temp is directly propotional to square of power output i.e   thetaf1/thetaf3 = (Power1/Power3)^2\n",
    "P1 = 20.0    #KW\n",
    "P3 = m.sqrt(thetaf3/thetaf1)*P1         #KW\n",
    "\n",
    "print \"Maximum overload that can be carried by motor = \",round(P3,2),\"KW.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.13 , PAGE NO :- 1809"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Final steady temperature rise = 50.0 *C.\n",
      "Cooling time constant = 0.93 hr\n"
     ]
    }
   ],
   "source": [
    "'''In a transformer the temperature rise is 25*C after 1 hour and 37.5*C after 2 hours,starting from cold conditions.Calculate \n",
    "its final steady temperature rise and the heating time constant.If the transformer temerature falls from the final steady state\n",
    "value to 40*C in 1.5 hours when disconnected,calculate its cooling time constant.Ambient temperature is 30*C.'''\n",
    "\n",
    "from sympy import solve,Symbol,Eq\n",
    "import math as m\n",
    "\n",
    "# As theta = thetaf*(1 - exp(-t/T))\n",
    "\n",
    "theta1 = 25.0      #*C        (temperature rise in time1)\n",
    "t1 = 1              #hr        (time 1)\n",
    "theta2 = 37.5      #*C        (temperature rise in time2)\n",
    "t2 = 2              #hr        (time 2)\n",
    "#Now   theta1/theta2 = (1-exp(-t1/T))/(1-exp(-t2/T))\n",
    "#Let us assume that x = exp(-1/T).Therefore\n",
    "x = Symbol('x')\n",
    "ratio1 = (1 - x**t1)/(1-x**t2)       #(theta1/theta2)\n",
    "ratio2 = theta1/theta2\n",
    "\n",
    "#As ratio1 = ratio2\n",
    "eq = Eq(ratio1,ratio2)\n",
    "x1 = solve(eq)\n",
    "x = x1[0]             #variable \n",
    "\n",
    "#x = exp(-1/T) . Therefore,\n",
    "T = -1/m.log(x)\n",
    "\n",
    "#As  theta1 = thetaf1*(1 - exp(-t1/T))\n",
    "thetaf1 = theta1/(1-x**t1)              #*C\n",
    "print \"Final steady temperature rise =\",round(thetaf1,2),\"*C.\"\n",
    "\n",
    "#Cooling conditions\n",
    "theta_rise = 40.0 - 30.0           #*C      (temp rise above ambient conditions)\n",
    "t3 = 1.5                     #hr      (time taken)\n",
    "\n",
    "#Now,  theta_rise = thetaf1*exp(-t3/T)\n",
    "T = -t3/m.log(theta_rise/thetaf1)             #hr\n",
    "print \"Cooling time constant =\",round(T,2),\"hr\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.14 , PAGE NO :- 1809"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature of machine = 70.58 *C.\n"
     ]
    }
   ],
   "source": [
    "'''The initial temperature of machine is 20*C.Calculate the temperature of machine after 1.2 hours,if its final steady \n",
    "temperature rise is 85*C and the heating time constant is 2.4 hours.Ambient temperature is 25*C.''' \n",
    "\n",
    "import math as m\n",
    "thetaf = 85.0         #*C      (final temp. rise)\n",
    "theta1 = 20.0         #*C      (initial temp)\n",
    "t1 = 1.2              #hr      (time taken)\n",
    "T = 2.4               #hr      (heat time constant)\n",
    "#Now, Temperature rise above coling medium is\n",
    "theta = thetaf - (thetaf - theta1)*m.exp(-t1/T)    #*C\n",
    "\n",
    "#Therefore, temp. of machine after t1 time is\n",
    "temp = theta + 25.0\n",
    "\n",
    "print \"Temperature of machine =\",round(temp,2),\"*C.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.15 , PAGE NO :- 1809"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Final steady temperature rise = 45.0 *C .\n",
      "Time constant = 2.47 hr.\n",
      "The steady temperature rise = 30.0 *C .\n"
     ]
    }
   ],
   "source": [
    "'''The following rises were observed in a teperature rise test on a D.C machine at full loads. :-\n",
    "After  1 hour  -     15*C\n",
    "After  2 hours -     25*C\n",
    "Find out    (i) Final steady temperature rise and time constant.\n",
    "            (ii)The steady temperature rise after 1 hour at 50% overload,from cold.\n",
    "Assume that the final temperature rise on 50% overload is 90*C.'''\n",
    "\n",
    "\n",
    "from sympy import solve,Symbol,Eq\n",
    "import math as m\n",
    "\n",
    "# As theta = thetaf*(1 - exp(-t/T))\n",
    "\n",
    "theta1 = 15.0      #*C        (temperature rise in time1)\n",
    "t1 = 1              #hr        (time 1)\n",
    "theta2 = 25.0      #*C        (temperature rise in time2)\n",
    "t2 = 2              #hr        (time 2)\n",
    "#Now   theta1/theta2 = (1-exp(-t1/T))/(1-exp(-t2/T))\n",
    "#Let us assume that x = exp(-1/T).Therefore\n",
    "x = Symbol('x')\n",
    "ratio1 = (1 - x**t1)/(1-x**t2)       #(theta1/theta2)\n",
    "ratio2 = theta1/theta2\n",
    "\n",
    "#As ratio1 = ratio2\n",
    "eq = Eq(ratio1,ratio2)\n",
    "x1 = solve(eq)\n",
    "x = x1[0]             #variable \n",
    "\n",
    "#x = exp(-1/T) . Therefore,\n",
    "T = -1/m.log(x)                     #hr     (time constant)\n",
    "\n",
    "#As  theta1 = thetaf1*(1 - exp(-t/T))\n",
    "thetaf1 = theta1/(1-x**t1)          #*C     (Final steady temp. rise)\n",
    "print \"Final steady temperature rise =\",round(thetaf1,2),\"*C .\"\n",
    "print \"Time constant =\",round(T,2),\"hr.\"\n",
    "\n",
    "#(ii) Now at 50% overload .Final temp rise is\n",
    "thetaf3 = 90.0              #*C\n",
    "t3 = 1                      #hr     (time taken)\n",
    "#As ,  theta = thetaf*(1 - exp(-t/T))\n",
    "theta3 = thetaf3*(1 - m.exp(-t3/T))            #*C\n",
    "\n",
    "print \"The steady temperature rise =\",round(theta3,2),\"*C .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.16 , PAGE NO :- 1813"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Moment of Inertia = 2.947543e+06 kg-m^2\n"
     ]
    }
   ],
   "source": [
    "'''The following data refers to a 500 H.P rolling mill,induction motor equipped with a flywheel.\n",
    "               No load speed                      ->   40 rpm\n",
    "               Slip at full load(torque)          ->   12%\n",
    "               Load torque during actual rolling  ->  41500 kg-m\n",
    "               Duration of each rolling period    ->   10 sec.\n",
    "Determine inertia of flywheel required in the above case to limit motor torque to twice its full load value.Neglect no-load \n",
    "losses and assume that the rolling mill torque falls to zero between each rolling period.Assume motor slip propotional to\n",
    "full load torque.'''\n",
    "\n",
    "\n",
    "import math as m\n",
    "N = 40.0                    #rpm           (No load speed)\n",
    "P = 500.0*(735.5)           #W             (Power)\n",
    "w = 2*(3.14)*N/60           #rad/sec       (angular speed)\n",
    "T0 = 0                      #kg-m          (initial torque)\n",
    "Tl = 41500.0                #kg-m          (Torque load)  \n",
    "t = 10.0                    #sec           (time taken)\n",
    "s = 0.12                    #              (slip)\n",
    "g = 9.81                    #m/s^2 \n",
    "Tfull = P/(w*(1-s))         #N-m           (full load torque)\n",
    "Tfull = Tfull/g             #kg-m\n",
    "Tm = 2*Tfull                #kg-m          (Max torque)\n",
    "S = 2*3.14*(0.12*40)/60\n",
    "#Now,   S = K*Tfl\n",
    "K = S/Tfull                   #constant\n",
    "#Also,  Tm = Tl - (Tl-T0)*exp(-tg/IK) .Therefore I is\n",
    "I =(-t*g)/(K*m.log((Tl-Tm)/(Tl-T0)))       #kg-m^2\n",
    "\n",
    "print \"Moment of Inertia = %e kg-m^2\" %round(I,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.17 , PAGE NO :- 1814  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tm =  47.84 kg-m.\n",
      "Actual Speed = 942.59 rpm.\n"
     ]
    }
   ],
   "source": [
    "'''A 6 pole,50 Hz Induction Motor has a flywheel of 1200 kg-m^2 as moment of inertia.Load torque is 100 kg-m for 10 sec.No load\n",
    "period is long enough for the flywheel,to regain its full speed.Motor has a slip of 6% at a torque of 50 kg-m.Calculate\n",
    "(i)Maximum torque exerted by motor\n",
    "(ii)Speed at the end of deacceleration period.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "Tl = 100.0      #kg-m          (load torque)\n",
    "t = 10.0        #s             (time taken)\n",
    "g = 9.81        #m/s^2         (gravitational acceleration)\n",
    "I = 1200.0      #kg-m^2        (moment of inertia)\n",
    "p = 6           #              (poles)\n",
    "f = 50.0        #Hz            (frequency)\n",
    "s = 0.06        #              (slip)\n",
    "Tfull = 50.0    #kg-m          (full load torque)\n",
    "Ns = 120*f/p\n",
    "Nr = (1-s)*Ns\n",
    "\n",
    "#Now, S = K*T\n",
    "S = 2*3.14*(Ns - Nr)/60    #rad/sec\n",
    "K = S/Tfull         #constant\n",
    "\n",
    "#As Tm = Tl*(1-exp(-t*g/I*K))\n",
    "Tm = Tl*(1 - m.exp(-t*g/(I*K)))      #kg-m\n",
    "print \"Tm = \",round(Tm,2),\"kg-m.\"\n",
    "\n",
    "#(ii)Slip speed\n",
    "S = K*Tm            #rad/sec      (slip speed)\n",
    "S = S*(60/(2*3.14))   #rpm\n",
    "N = Ns - S          #rpm           (actual speed)\n",
    "print \"Actual Speed =\",round(N,2),\"rpm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.18 , PAGE NO :- 1815"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Speed 1 =  691.75 rpm.\n",
      "Speed 2 =  731.62 rpm.\n",
      "Speed 1 =  683.89 rpm.\n",
      "Speed 2 =  731.0 rpm.\n",
      "Speed 1 =  683.62 rpm.\n",
      "Speed 2 =  730.98 rpm.\n"
     ]
    }
   ],
   "source": [
    "'''An Induction Motor equipped with a flywheel is driving a rolling mill which requires a load torque of 1900 N-m for 10 sec\n",
    "followed by 250 N-m for 30 sec.This cycle being repeated indefinitely.The synchronus speed of motor is 750 rpm and it has slip of\n",
    "10% when delivering 1400 N-m torque.The total Moment of Inertia of the flywheel and other rotating parts is 2100 kg-m^2.Draw the \n",
    "curves showing the torque exerted by the motor and the speed for five complete cycles,assuming the initial torque is zero.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "Tl1 = 1900.0      #N-m         (load torque 1)\n",
    "t1 = 10.0         #s           (time 1)\n",
    "Tl2 = 280.0       #N-m         (load torque 2)\n",
    "t2 = 30.0         #s           (time 2)\n",
    "s = 0.1           #            (slip)\n",
    "Ns = 750.0        #rpm         (synchronus speed)\n",
    "I = 2100.0        #kg-m^2      (moment of inertia)\n",
    "Tm = 1400.0       #N-m\n",
    "S = Ns*s          #rpm         (slip speed)\n",
    "S = S*(2*3.14/60) #rad/sec     \n",
    "\n",
    "K = S/Tm          #constant\n",
    "T0 = 0            #N-m\n",
    "#(i) During  First Cycle\n",
    "Tm = Tl1 -(Tl1-T0)*m.exp(-t1/(I*K))       #N-m\n",
    "s2 = K*Tm*(60/(2*3.14))    #rpm\n",
    "Speed1 = Ns - s2   #rpm\n",
    "print \"Speed 1 = \",round(Speed1,2),\"rpm.\"\n",
    "\n",
    "# Now, Tm = T0 + (Tm' - T0)*exp(-t/(I*K))\n",
    "Tmb = Tm    #N-m\n",
    "T0 = Tl2    #N-m         (No Load Torque)\n",
    "\n",
    "Tm = T0 + (Tmb - T0)*m.exp(-t2/(I*K))\n",
    "S2 = K*Tm*(60/(2*3.14))    #rpm\n",
    "Speed2 = Ns - S2     #rpm\n",
    "print \"Speed 2 = \",round(Speed2,2),\"rpm.\"\n",
    "#################################################################\n",
    "\n",
    "#(ii) During Second cycle\n",
    "T0 = Tm\n",
    "Tm2 = Tl1 -(Tl1-T0)*m.exp(-t1/(I*K))       #N-m\n",
    "s2 = K*Tm2*(60/(2*3.14))    #rpm\n",
    "Speed1 = Ns - s2   #rpm\n",
    "print \"Speed 1 = \",round(Speed1,2),\"rpm.\"\n",
    "\n",
    "# Now, Tm = T0 + (Tm' - T0)*exp(-t/(I*K))\n",
    "Tm2b = Tm2    #N-m\n",
    "T0 = Tl2    #N-m         (No Load Torque)\n",
    "\n",
    "Tm = T0 + (Tm2b - T0)*m.exp(-t2/(I*K))\n",
    "S2 = K*Tm*(60/(2*3.14))    #rpm\n",
    "Speed2 = Ns - S2     #rpm\n",
    "print \"Speed 2 = \",round(Speed2,2),\"rpm.\"\n",
    "###################################################################\n",
    "\n",
    "#(iii) During Third cycle\n",
    "T0 = Tm\n",
    "Tm3 = Tl1 -(Tl1-T0)*m.exp(-t1/(I*K))       #N-m\n",
    "s2 = K*Tm3*(60/(2*3.14))    #rpm\n",
    "Speed1 = Ns - s2   #rpm\n",
    "print \"Speed 1 = \",round(Speed1,2),\"rpm.\"\n",
    "\n",
    "# Now, Tm = T0 + (Tm' - T0)*exp(-t/(I*K))\n",
    "Tm3b = Tm3    #N-m\n",
    "T0 = Tl2    #N-m         (No Load Torque)\n",
    "\n",
    "Tm = T0 + (Tm3b - T0)*m.exp(-t2/(I*K))\n",
    "S2 = K*Tm*(60/(2*3.14))    #rpm\n",
    "Speed2 = Ns - S2     #rpm\n",
    "print \"Speed 2 = \",round(Speed2,2),\"rpm.\"\n",
    "####################################################################"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## EXAMPLE 45.19 , PAGE NO :- 1817"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Moment of inertia = 2860.94 kg-m^2.\n"
     ]
    }
   ],
   "source": [
    "'''A motor fitted with a flywheel supplies a load torque of 150 kg-m for 15 sec.During the no-load period,the flywheel regains \n",
    "its original speed.The motor torque is required to be limited to 85 kg-m.Determine moment of inertia of flywheel.\n",
    "The no-load speed of motor is 500 rpm and it has slip of 10% on full load.'''\n",
    "\n",
    "from sympy import Symbol,solve,Eq,exp\n",
    "import math as m\n",
    "\n",
    "Tm = 85.0        #kg-m     (Max torque)\n",
    "Tl = 150.0       #kg-m     (load torque with flywheel)\n",
    "T0 = 0           #kg-m     (constant load torque)\n",
    "t = 15.0         #s        (time)\n",
    "N = 500.0        #rpm      (no load speed)\n",
    "s = 0.1          #         (slip)\n",
    "g = 9.82        #m/s^2      \n",
    "# s = K*T\n",
    "K = 2*(3.14)*N*s/(60*Tm)      #constant\n",
    "\n",
    "# As Tm = Tl*(1 - exp(-t*g/(I*K)))\n",
    "\n",
    "I =(-t*g)/(K*m.log(1 - Tm/Tl))      #kg-m^2           (Moment of inertia)\n",
    "\n",
    "print \"Moment of inertia =\",round(I,2),\"kg-m^2.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.20 , PAGE NO :- 1817"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Moment of inertia of flywheel = 1908.86 kg-m^2.\n",
      "Time taken after removal of additional load = 8.88 s.\n"
     ]
    }
   ],
   "source": [
    "'''A 3-phase ,50 KW,6 pole,960 rpm induction motor has a constant load torque of 300 N-m and at wide intervals additional \n",
    "torque of 1500 N-m for 10 sec.Calculate\n",
    "(a)The moment of inertia of the flywheel used for load equalization,if the motor torque is not to exceed twice the rated torque.\n",
    "(b)Time taken after removal of additional load,before the motor torque becomes 700 N-m.'''\n",
    "\n",
    "from sympy import Symbol,Eq,solve\n",
    "import math as m\n",
    "\n",
    "P = 50.0e+3      #W          (output power)\n",
    "Nr = 960.0       #rpm        (rotational speed)\n",
    "p = 6.0          #           (no. of poles)\n",
    "t = 10.0         #s          (time)\n",
    "T0 = 300.0       #N-m        (constant load torque)\n",
    "Tl = T0 + 1500.0 #N-m        (total load torque)\n",
    "f = 50.0         #Hz         (frequency)  \n",
    "\n",
    "#   Power = T*w (torque*ang_speed)\n",
    "T = P/(2*3.14*Nr/60)     #N-m        (Full-load torque)\n",
    "Tm = 2*T                 #N-m        (Max torque)\n",
    "\n",
    "Ns = 120*f/p      #rpm        (synchronus speed)\n",
    "\n",
    "#Slip speed\n",
    "sl = Ns-Nr        #rpm\n",
    "\n",
    "#Now,  s = K*T\n",
    "K = 2*3.14*sl/(60*T)      #constant\n",
    "\n",
    "#As Tm = Tl - (Tl - T0)*exp(-t/I*K)\n",
    "\n",
    "I = (-t)/(K*m.log((Tl - Tm)/(Tl - T0)))         #kg-m^2     (moment of inertia)\n",
    "\n",
    "print \"Moment of inertia of flywheel =\",round(I,2),\"kg-m^2.\"\n",
    "\n",
    "#(b) Tm2 = T0 + (Tm-T0)*exp(-t/I*K)\n",
    "Tm2 = 700.0            #N-m                         (Max torque - case 2)\n",
    "\n",
    "t1= (-I*K)*m.log((Tm2 - T0)/(Tm - T0))         #s               (time after removal of load)\n",
    "print \"Time taken after removal of additional load =\",round(t1,2),\"s.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## EXAMPLE 45.21 , PAGE NO :- 1818"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Moment of Inertia = 551.35 kg-m^2.\n"
     ]
    }
   ],
   "source": [
    "'''A 3-phase,8 pole,50 cps.Induction Motor equipped with a flywheel supplies a constant load torque of 100 N-m and at wide \n",
    "intervals an additional load torque of 300 N-m for 6 sec.The motor runs at 735 rpm at 100 N-m torque.Find moment of inertia of \n",
    "the flywheel,if the motor torque is not to exceed 250 N-m.'''\n",
    "\n",
    "from sympy import Symbol,Eq,solve\n",
    "import math as m\n",
    "\n",
    "T0 = 100.0           #N-m   (constant load torque)\n",
    "Tl = T0 + 300.0      #N-m   (Total load torque)\n",
    "f = 50.0             #Hz    (frequency)\n",
    "P = 8.0              #      (poles)\n",
    "Tm = 250.0           #N-m   (Max torque) \n",
    "Ns = 120*f/P         #rpm   (Synchronus speed)\n",
    "sl =  Ns - 735.0     #rpm   (Slip speed)\n",
    "t = 6.0              #s     (time)\n",
    "#Now, s = K*T0\n",
    "K = 2*3.14*sl/(60*T0)    #constant\n",
    "\n",
    "#Also,   Tm = Tl - (Tl-T0)*exp(-t/I*K)\n",
    "\n",
    "I = -t/(K*m.log((Tl - Tm)/(Tl-T0)))           #kg-m^2       (moment of inertia)\n",
    "\n",
    "print \"Moment of Inertia =\",round(I,2),\"kg-m^2.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.22 , PAGE NO :- 1818"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum torque developed by motor =  615.35 N-m.\n",
      "Speed at the end of deacceleration period = 938.47 rpm.\n"
     ]
    }
   ],
   "source": [
    "'''A 6 pole,50 Hz,3-phase wound rotor Induction Motor has a flywheel coupled to its shaft.The total moment of inertia is \n",
    "1000kg-m^2.Load torque is 1000 N-m for 10 sec followed by a no-load period which is long enough for the motor to reach its \n",
    "no-load speed.Motor has a slip of 5% at a torque of 500 N-m.Find\n",
    "(a)Maximum torque developed by motor\n",
    "(b)Speed at the end of deacceleration period.'''\n",
    "\n",
    "import math as m\n",
    "\n",
    "P = 6.0                #           (No of poles)\n",
    "I = 1000.0             #kg-m^2     (Moment of Inertia)\n",
    "Tl = 1000.0            #N-m        (Load torque with  flywheel)\n",
    "t = 10.0               #s          (time)\n",
    "s = 0.05               #           (slip)\n",
    "Tfl = 500.0            #N-m           (full load Torque)\n",
    "f = 50.0               #Hz         (frequency)\n",
    "\n",
    "Ns = 120*f/P           #rpm        (Synchronus speed)\n",
    "\n",
    "#Now, s = K*Tfl\n",
    "K = 2*3.14*(Ns*s)/(60*Tfl)        #constant\n",
    "\n",
    "#K = 6.2e-3          #(considered value)                     \n",
    "\n",
    "#Also Tm = Tl*(1-exp(-t/I*K)\n",
    "Tm = Tl*(1 - m.exp(-t/(I*K)))              #N-m\n",
    "print \"Maximum torque developed by motor = \",round(Tm,2),\"N-m.\"\n",
    "         \n",
    "#(b)    s = K*Tfl  where s = 2*3.14*(Ns - N)/60\n",
    "N = Ns - (60/(2*3.14))*K*Tm            #rpm\n",
    "print \"Speed at the end of deacceleration period =\",round(N,2),\"rpm.\"   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EXAMPLE 45.23 , PAGE NO :- 1819"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Moment of inertia of flywheel = 275.67 kg-m^2.\n"
     ]
    }
   ],
   "source": [
    "'''A motor fitted with a flywheel supplies a load torque of 1000 N-m for 2 seconds.During no load period,the flywheel regains its\n",
    "original speed.The motor torque is to be limited to 500 N-m.Find moment of inertia of the flywheel.No load speed of the motor is \n",
    "500 rpm and its full load slip is 10%.'''\n",
    "\n",
    "from  sympy import solve,Eq,Symbol\n",
    "import math as m\n",
    "N = 500.0             #rpm       (No load speed)\n",
    "s = 0.1               #          (slip)\n",
    "Tfl = 500.0           #N-m       (full load torque)\n",
    "Tl = 1000.0           #N-m       (load torque with flywheel)\n",
    "t = 2.0               #s         (time)     \n",
    "#Now, s = K*Tfl\n",
    "K = (2*3.14*(N*s))/(Tfl*60)      #constant\n",
    "\n",
    "\n",
    "#Also,  Tm = Tl*(1 - exp(-t/I*K))\n",
    "I =-t/(K*m.log(1 - Tfl/Tl))       #(moment of inertia)\n",
    "\n",
    "print \"Moment of inertia of flywheel =\",round(I,2),\"kg-m^2.\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}