summaryrefslogtreecommitdiff
path: root/Electric_Machinery_and_Transformers/CHAP_14.ipynb
blob: 2f2f742380c99545a6cb947068503caf66adc6f0 (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
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 14: TRANSFORMERS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.1, Page number 487"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N_1 = 500.0     #Number of turns in the hv side i.e primary\n",
      "N_2 = 100.0     #Number of turns in the lv side i.e secondary\n",
      "I_2 = 12.0      #Load current i.e secondary(A)\n",
      "\n",
      "#Calculation\n",
      "#For step-down transformer\n",
      "alpha = N_1/N_2    #Transformation ratio\n",
      "I_1 = I_2/alpha    #Load component of primary current(A)\n",
      "#For step-up transformer\n",
      "N1 = 100.0        #Number of turns in the lv side i.e primary\n",
      "N2 = 500.0        #Number of turns in the hv side i.e secondary\n",
      "alpha_c = N1/N2   #Transformation ratio\n",
      "\n",
      "#Result\n",
      "print('Case(a): Transformation ratio , \u03b1 = %.f ' %alpha)\n",
      "print('Case(b): Load component of primary current , I_1 = %.1f A' %I_1)\n",
      "print('Case(c): Transformation ratio if transformer is used as step-up , \u03b1 = %.1f ' %alpha_c)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Transformation ratio , \u03b1 = 5 \n",
        "Case(b): Load component of primary current , I_1 = 2.4 A\n",
        "Case(c): Transformation ratio if transformer is used as step-up , \u03b1 = 0.2 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.2, Page number 488"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_h = 2300.0       #Primary voltage i.e hv(V)\n",
      "V_l = 115.0        #Secondary voltage i.e lv(V)\n",
      "f = 60.0           #Frequency(Hz)\n",
      "S = 4.6            #Rating of the step-down transformer(kVA)\n",
      "V_per_turn = 2.5   #Induced EMF per turn(V/turn)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "N_h = V_h/V_per_turn       #Number of high-side turns\n",
      "N_l = V_l/V_per_turn       #Number of low-side turns\n",
      "N_1 = N_h\n",
      "N_2 = N_l\n",
      "#Case(b)\n",
      "V_1 = V_h\n",
      "V_2 = V_l\n",
      "S_1 = S\n",
      "S_2 = S\n",
      "I_1 = S_1*1000/V_1         #Rated primary current(A)\n",
      "I_2 = S_2*1000/V_2         #Rated secondary current(A)\n",
      "I_h = I_1\n",
      "I_l = I_2\n",
      "#Case(c)\n",
      "alpha_stepdown_c = N_1/N_2 #Step-down transformation ratio\n",
      "alpha_stepup_c = N_l/N_h   #Step-up transformation ratio\n",
      "#Case(d)\n",
      "alpha_stepdown_d = I_2/I_1 #Step-down transformation ratio\n",
      "alpha_stepup_d = I_h/I_l   #Step-up transformation ratio\n",
      "\n",
      "#Result\n",
      "print('Case(a): Number of high-side turns , N_h = %.f t = N_1 ' %N_h)\n",
      "print('         Number of low-side turns , N_l = %.f t = N_2 ' %N_l)\n",
      "print('Case(b): Rated primary current , I_h = I_1 = %.f A' %I_h)\n",
      "print('         Rated secondary current , I_l = I_2 = %.f A' %I_l)\n",
      "print('Case(c): Step-down transformation ratio , \u03b1 = %.f ' %alpha_stepdown_c);\n",
      "print('         Step-up transformation ratio , \u03b1 = %.2f ' %alpha_stepup_c);\n",
      "print('Case(d): Step-down transformation ratio , \u03b1 = %.f ' %alpha_stepdown_d);\n",
      "print('         Step-up transformation ratio , \u03b1 = %.2f ' %alpha_stepup_d);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Number of high-side turns , N_h = 920 t = N_1 \n",
        "         Number of low-side turns , N_l = 46 t = N_2 \n",
        "Case(b): Rated primary current , I_h = I_1 = 2 A\n",
        "         Rated secondary current , I_l = I_2 = 40 A\n",
        "Case(c): Step-down transformation ratio , \u03b1 = 20 \n",
        "         Step-up transformation ratio , \u03b1 = 0.05 \n",
        "Case(d): Step-down transformation ratio , \u03b1 = 20 \n",
        "         Step-up transformation ratio , \u03b1 = 0.05 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.3, Page number 489"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N_1 = 500.0     #Number of primary turns\n",
      "N_2 = 25.0      #Number of secondary turns\n",
      "Z_L = 8.0       #Impedance(ohm)\n",
      "V_1 = 10.0      #Output voltage of the amplifier(V)\n",
      "\n",
      "#Calculation\n",
      "alpha = N_1/N_2         #Step-down transformation ratio\n",
      "Z_1 = alpha**2*Z_L      #Impedance reflected to the transformer primary at the output of the amplifier(ohm)\n",
      "I_1 = V_1/Z_1*1000      #Matching transformer primary current(mA)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Impedance reflected to the transformer primary at the output of the amplifier , Z_1 = %.f \u03a9' %Z_1)\n",
      "print('Case(b): Matching transformer primary current , I_1 = %.3f mA' %I_1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Impedance reflected to the transformer primary at the output of the amplifier , Z_1 = 3200 \u03a9\n",
        "Case(b): Matching transformer primary current , I_1 = 3.125 mA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.4, Page number 490"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N_1 = 600.0      #Number of primary turns \n",
      "N_2 = 150.0      #Some number of secondary turns \n",
      "N_3 = 300.0      #Some number of secondary turns \n",
      "Z_2 = 30.0       #Resistive load across N_2(ohm)\n",
      "Z_3 = 15.0       #Resistive load across N_3(ohm)\n",
      "V_p = 16.0       #Primary applied voltage(V)\n",
      "cos_theta = 1.0  #Unity PF\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "Z_2_prime = Z_2*(N_1/N_2)**2   #Impedance reflected to the primary by load Z_2(ohm)\n",
      "#Case(b)\n",
      "Z_3_prime = Z_3*(N_1/N_3)**2   #Impedance reflected to the primary by load Z_3(ohm)\n",
      "#Case(c)\n",
      "Z_1 = (Z_2_prime*Z_3_prime)/(Z_2_prime+Z_3_prime) #Total impedance reflected to primary(ohm)\n",
      "#Case(d)\n",
      "I_1 = V_p/Z_1                  #Total current drawn from the supply(A)\n",
      "#Case(e)\n",
      "P_t = V_p*I_1*cos_theta        #Total power drawn from the supply at unity PF(W)\n",
      "#Case(f)\n",
      "R_2 = Z_2\n",
      "V_2 = V_p*(N_2/N_1)            #Voltage across load Z_2(V)\n",
      "P_2 = V_2**2/R_2               #Power dissipated in load Z_2(W)\n",
      "#Case(g)\n",
      "R_3 = Z_3\n",
      "V_3 = V_p*(N_3/N_1)            #Voltage across Z_3 in volt\n",
      "P_3 = V_3**2 / R_3             #Power dissipated in load Z_3(W)\n",
      "#Case(h)\n",
      "P_total = P_2+P_3              #Total power dissipated in both loads(W)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Impedance reflected to the primary by load Z_2 = %.f \u03a9' %Z_2_prime)\n",
      "print('Case(b): Impedance reflected to the primary by load Z_3 = %.f \u03a9' %Z_3_prime)\n",
      "print('Case(c): Total impedance reflected to the primary , Z_1 = %.1f \u03a9' %Z_1)\n",
      "print('Case(d): Total current drawn from the supply , I_1 = %.1f A' %I_1)\n",
      "print('Case(e): Total power drawn from the supply at unity power factor , P_t = %.1f W' %P_t)\n",
      "print('Case(f): Voltage across load Z_2 , V_2 = %.f V' %V_2)\n",
      "print('         Power dissipated in load Z_2 , P_2 = %.2f W' %P_2)\n",
      "print('Case(g): Voltage across load Z_3 , V_3 = %.f V' %V_3)\n",
      "print('         Power dissipated in load Z_3 , P_3 = %.2f W' %P_3)\n",
      "print('Case(h): Total power dissipated in both loads , P_t = %.1f W ' %P_total)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Impedance reflected to the primary by load Z_2 = 480 \u03a9\n",
        "Case(b): Impedance reflected to the primary by load Z_3 = 60 \u03a9\n",
        "Case(c): Total impedance reflected to the primary , Z_1 = 53.3 \u03a9\n",
        "Case(d): Total current drawn from the supply , I_1 = 0.3 A\n",
        "Case(e): Total power drawn from the supply at unity power factor , P_t = 4.8 W\n",
        "Case(f): Voltage across load Z_2 , V_2 = 4 V\n",
        "         Power dissipated in load Z_2 , P_2 = 0.53 W\n",
        "Case(g): Voltage across load Z_3 , V_3 = 8 V\n",
        "         Power dissipated in load Z_3 , P_3 = 4.27 W\n",
        "Case(h): Total power dissipated in both loads , P_t = 4.8 W \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.5, Page number 491"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 100.0       #Power rating of the single channel power amplifier(W)\n",
      "Z_p = 3200.0    #Output impedance ohm of the single channel power amplifier(ohm)\n",
      "N_p = 1500.0    #Number of primary turns in a tapped impedance-matching transformer\n",
      "Z_L1 = 8.0      #Amplifier output using a tapped impedance-matching transformer(ohm)\n",
      "Z_L2 = 4.0      #Amplifier output using a tapped impedance-matching transformer(ohm)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "alpha = (Z_p/Z_L1)**0.5      #Transformation ratio\n",
      "N_2 = N_p/alpha              #Total number of secondary turns to match 8 ohm speaker\n",
      "#Case(b)\n",
      "alpha_b = (Z_p/Z_L2)**0.5    #Transformation ratio\n",
      "N_1 = N_p/alpha_b            #Number of primary turns to match 4 ohm speaker\n",
      "#Case(c)\n",
      "turns_difference = N_2-N_1   #Difference in secondary and primary turns\n",
      "alpha_c = (N_p/turns_difference)  #Transformation ratio\n",
      "Z_L = Z_p/alpha_c**2         #Impedance that must be connected(ohm)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Total number of secondary turns to match 8 \u03a9 impedance speaker , N_2 = %.f t' %N_2)\n",
      "print('Case(b): Number of turns to match 4 \u03a9 impedance speaker , N_1 = %.f t' %N_1)\n",
      "print('Case(c): Impedance that must be connected , Z_L = %.2f \u03a9' %Z_L)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Total number of secondary turns to match 8 \u03a9 impedance speaker , N_2 = 75 t\n",
        "Case(b): Number of turns to match 4 \u03a9 impedance speaker , N_1 = 53 t\n",
        "Case(c): Impedance that must be connected , Z_L = 0.69 \u03a9\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.6, Page number 492"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 100.0        #Power rating of the single channel power amplifier(W)\n",
      "Z_L1 = 8.0       #Amplifier output using a tapped impedance-matching transformer(ohm)\n",
      "Z_L2 = 4.0       #Amplifier output using a tapped impedance-matching transformer(ohm)\n",
      "P_servo = 10.0   #Power rating of the servo motor(W)\n",
      "Z_servo = 0.7    #Impedance of the servo motor(ohm)\n",
      "\n",
      "#Calculation\n",
      "root_Z_AB = 8**0.5-4**0.5\n",
      "Z_AB = (root_Z_AB)**2\n",
      "\n",
      "#Result\n",
      "print('Impedance between terminals A and B , Z_AB = %.2f \u03a9' %Z_AB)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Impedance between terminals A and B , Z_AB = 0.69 \u03a9\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.7, Page number 494"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "V_s = 10.0*cmath.exp(1j*0*math.pi/180)    #Supply voltage of the source(V)\n",
      "R_s = 1000.0                              #Resistance of the source(ohm)\n",
      "R_L = 10.0                                #Load resistance(ohm)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "alpha = (R_s/R_L)**0.5       #Transformation ratio of the matching transformer for MPT\n",
      "#Case(b)\n",
      "V = abs(V_s)                 #Considering only absolute value of Supply voltage for easy simplification\n",
      "V_1 = V/2                    #Terminal voltage of the source at MPT(V)\n",
      "#Case(c)\n",
      "V_2 = V_1/alpha              #Terminal voltage across the load at MPT(V)\n",
      "#Case(d)\n",
      "Z_L = R_L\n",
      "I_2 = V_2/Z_L                #Secondary load current(A). Method 1\n",
      "I2 = V/(2*alpha*R_L)         #Secondary load current(A). Method 2\n",
      "#Case(e)\n",
      "I_1 = I_2/alpha              #Primary load current drawn from the source(A). Method 1\n",
      "I1 = V/(2*R_s)               #Primary load current drawn from the source(A). Method 2\n",
      "#Case(f)\n",
      "P_L = (I_2)**2*R_L           #Maximum power dissipated in the load(W)\n",
      "#Case(g)\n",
      "P_s = (I_1)**2*R_s           #Power dissipated internally within the source(W)\n",
      "#Case(h)\n",
      "theta = 0\n",
      "P_T1 = abs(V)*I_1*math.cos(theta) #Total power supplied by the source(W). Method 1\n",
      "P_T2 = P_L+P_s               #Total power supplied by the source(W). Method 2\n",
      "#Case(i)\n",
      "P_T = P_T1\n",
      "n = P_L/P_T*100              #Power transfer efficiency(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Transformation ratio of the matching transformer for MPT , \u03b1 = %.f ' %alpha)\n",
      "print('Case(b): Terminal voltage of the source at MPT , V_1 = %.1f V' %V_1)\n",
      "print('Case(c): Terminal voltage across the load at MPT , V_2 = %.1f V' %V_2)\n",
      "print('Case(d): Secondary load current , I_2 = %.f mA (Method 1)' %(1000*I_2))\n",
      "print('         Secondary load current , I_2 = %.f mA (Method 2)' %(1000*I2))\n",
      "print('Case(e): Primary load current drawn from the source , I_1 = %.f mA (Method 1)' %(1000*I_1))\n",
      "print('         Primary load current drawn from the source , I_1 = %.f mA (Method 2)' %(1000*I1))\n",
      "print('Case(f): Maximum power dissipated in the load , P_L = %.f mW' %(1000*P_L))\n",
      "print('Case(g): Power dissipated internally within the source , P_s = %.f mW' %(1000*P_s))\n",
      "print('Case(h): Total power supplied by the source , P_T = %.f mW (Method 1)' %(1000*P_T1))\n",
      "print('         Total power supplied by the source , P_T = %.f mW (Method 2)' %(1000*P_T2))\n",
      "print('Case(i): Power transfer efficiency , \u03b7 = %.f percent' %n)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Transformation ratio of the matching transformer for MPT , \u03b1 = 10 \n",
        "Case(b): Terminal voltage of the source at MPT , V_1 = 5.0 V\n",
        "Case(c): Terminal voltage across the load at MPT , V_2 = 0.5 V\n",
        "Case(d): Secondary load current , I_2 = 50 mA (Method 1)\n",
        "         Secondary load current , I_2 = 50 mA (Method 2)\n",
        "Case(e): Primary load current drawn from the source , I_1 = 5 mA (Method 1)\n",
        "         Primary load current drawn from the source , I_1 = 5 mA (Method 2)\n",
        "Case(f): Maximum power dissipated in the load , P_L = 25 mW\n",
        "Case(g): Power dissipated internally within the source , P_s = 25 mW\n",
        "Case(h): Total power supplied by the source , P_T = 50 mW (Method 1)\n",
        "         Total power supplied by the source , P_T = 50 mW (Method 2)\n",
        "Case(i): Power transfer efficiency , \u03b7 = 50 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.8, Page number 495"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V = 20.0         #No-load voltage(V)\n",
      "R_s = 18.0       #Internal resistance of the power amplifier(ohm)\n",
      "R_L = 8.0        #Load resistance(ohm)\n",
      "\n",
      "#Calculation\n",
      "V_L = (R_L/(R_L+R_s))* V    #Load voltage(V)\n",
      "P_L = (V_L)**2/R_L          #Power delivered to the speaker when connected directly to the amplifier(W)\n",
      "alpha = (R_s/R_L)**0.5      #Turns ratio of the transformer to maximize speaker power\n",
      "V_2 = V/(2*alpha)           #Secondary voltage(V)\n",
      "P_L2 = (V_2)**2/R_L         #Maximum power delivered to the speaker(W)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Power delivered to the speaker when connected directly to the amplifier , P_L = %.2f W' %P_L)\n",
      "print('Case(b): Turns ratio of the transformer to maximize speaker power , \u03b1 = %.1f ' %alpha)\n",
      "print('Case(c): Maximum power delivered to the speaker using matching transformer of part(b) , P_L = %.1f W' %P_L2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Power delivered to the speaker when connected directly to the amplifier , P_L = 4.73 W\n",
        "Case(b): Turns ratio of the transformer to maximize speaker power , \u03b1 = 1.5 \n",
        "Case(c): Maximum power delivered to the speaker using matching transformer of part(b) , P_L = 5.6 W\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.9, Page number 500"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 1.0        #Rating of the transformer(kVA)\n",
      "V_1 = 220.0      #Primary voltage(V)\n",
      "V_2 = 110.0      #Secondary voltage(V)\n",
      "f_o = 400.0      #Original frequency(Hz)\n",
      "f_f = 60.0       #Frequency for which the transformer is to be used(Hz)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "alpha = V_1/V_2        #Transformation ratio\n",
      "E_h = V_1*(f_f/f_o)    #Maximum rms voltage applied to HV side(V)\n",
      "E_1 = E_h\n",
      "E_l = E_1/alpha        #Maximum voltage output of LV side(V)\n",
      "#Case(b)\n",
      "V_h = V_1              #High voltage(V)\n",
      "I_h = kVA*1000/V_h     #High current(A)\n",
      "Vh = E_h\n",
      "kVA_new = Vh*I_h/1000  #kVA rating of transformer under reduced frequency\n",
      "\n",
      "#Result\n",
      "print('Case(a): Maximum rms voltage that may be applied to high-voltage side , E_h = %.f V' %E_h)\n",
      "print('         Maximum voltage output of the low-voltage side , E_l = %.1f V' %E_l)\n",
      "print('Case(b): kVA rating of transformer under conditions of reduced frequency , V_h*I_h = %.2f kVA' %kVA_new)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Maximum rms voltage that may be applied to high-voltage side , E_h = 33 V\n",
        "         Maximum voltage output of the low-voltage side , E_l = 16.5 V\n",
        "Case(b): kVA rating of transformer under conditions of reduced frequency , V_h*I_h = 0.15 kVA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.10, Page number 501"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 1.0       #kVA rating of the transformer\n",
      "V_1 = 220.0     #Primary voltage(V)\n",
      "V_2 = 110.0     #Secondary voltage(V)\n",
      "f_o = 400.0     #Frequency(Hz)\n",
      "f_f = 60.0      #Frequency for which the transformer is to be used(Hz)\n",
      "P_orig = 10.0   #Original iron losses of the transformer(W)\n",
      "\n",
      "#Calculation \n",
      "B = f_o/f_f                  #Flux density\n",
      "P_iron = P_orig*B**2         #Iron losses(W)\n",
      "\n",
      "#Result\n",
      "print('Iron losses if is operated at reduced frequency of 60 Hz , P_iron = %.f W' %P_iron)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Iron losses if is operated at reduced frequency of 60 Hz , P_iron = 444 W\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.11, Page number 504"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0     #Rating of the step-down transformer(kVA)\n",
      "V_1 = 2300.0    #Primary voltage(V)\n",
      "V_2 = 230.0     #Secondary voltage(V)\n",
      "f = 60.0        #Frequency(Hz)\n",
      "r_1 = 0.1       #Primary winding resistance(ohm)\n",
      "x_1 = 0.3       #Primary winding reactance(ohm)\n",
      "r_2 = 0.001     #Secondary winding resistance(ohm)\n",
      "x_2 = 0.003     #Secondary winding reactance(ohm)\n",
      "\n",
      "#Calculation\n",
      "alpha = V_1/V_2             #Transformation ratio\n",
      "#Case(a)\n",
      "I_2 = kVA*1000/V_2          #Secondary current(A)\n",
      "I_1 = I_2/alpha             #Primary current(A)\n",
      "#Case(b)\n",
      "Z_2 = complex(r_2,x_2)      #Secondary internal impedance(ohm)\n",
      "Z_2_m = abs(Z_2)            #Magnitude of Z_2(ohm)\n",
      "Z_1 = complex(r_1,x_1)      #Primary internal impedance(ohm)\n",
      "Z_1_m = abs(Z_1)            #Magnitude of Z_1(ohm)\n",
      "#Case(c)\n",
      "I_2_Z_2 = I_2*Z_2_m         #Secondary internal voltage drop(V)\n",
      "I_1_Z_1 = I_1*Z_1_m         #Primary internal voltage drop(V)\n",
      "#Case(d)\n",
      "E_2 = V_2+I_2_Z_2           #Secondary induced voltage(V)\n",
      "E_1 = V_1-I_1_Z_1           #Primary induced voltage(V)\n",
      "#Case(e)\n",
      "ratio_E = E_1/E_2           #Ratio of primary to secondary induced voltage\n",
      "ratio_V = V_1/V_2           #Ratio of primary to secondary terminal voltage\n",
      "\n",
      "#Result\n",
      "print('Case(a): Secondary current , I_2 = %.f A' %I_2)\n",
      "print('         Primary current , I_1 = %.1f A' %I_1)\n",
      "print('Case(b): Secondary internal impedance , Z_2 = %.5f \u03a9' %Z_2_m)\n",
      "print('         Primary internal impedance , Z_1 = %.3f \u03a9' %Z_1_m)\n",
      "print('Case(c): Secondary internal voltage drop , I_2*Z_2 = %.2f V' %I_2_Z_2)\n",
      "print('         Primary internal voltage drop , I_1*Z_1 = %.1f V' %I_1_Z_1)\n",
      "print('Case(d): Secondary induced voltage , E_2 = %.2f V' %E_2)\n",
      "print('         Primary induced voltage , E_1 = %.1f V' %E_1)\n",
      "print('Case(e): Ratio of primary to secondary induced voltages , E_1/E_2 = %.2f ' %ratio_E)\n",
      "print('         Ratio of primary to secondary iterminal voltages , V_1/V_2 = %.1f ' %ratio_V)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Secondary current , I_2 = 2174 A\n",
        "         Primary current , I_1 = 217.4 A\n",
        "Case(b): Secondary internal impedance , Z_2 = 0.00316 \u03a9\n",
        "         Primary internal impedance , Z_1 = 0.316 \u03a9\n",
        "Case(c): Secondary internal voltage drop , I_2*Z_2 = 6.87 V\n",
        "         Primary internal voltage drop , I_1*Z_1 = 68.7 V\n",
        "Case(d): Secondary induced voltage , E_2 = 236.87 V\n",
        "         Primary induced voltage , E_1 = 2231.3 V\n",
        "Case(e): Ratio of primary to secondary induced voltages , E_1/E_2 = 9.42 \n",
        "         Ratio of primary to secondary iterminal voltages , V_1/V_2 = 10.0 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.12, Page number 505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_1 = 2300.0    #Primary voltage(V)\n",
      "V_2 = 230.0     #Secondary voltage(V)\n",
      "I_2 = 2174.0    #Secondary current(A)\n",
      "I_1 = 217.4     #Primary current(A)\n",
      "Z_2 = 0.00316   #Secondary internal impedance(ohm)\n",
      "Z_1 = 0.316     #Primary internal impedance(ohm)\n",
      "\n",
      "#Calculation\n",
      "alpha = V_1/V_2             #Transformation ratio\n",
      "#Case(a)\n",
      "Z_L = V_2/I_2               #Load impedance(ohm)\n",
      "#Case(b)\n",
      "Z_p = V_1/I_1               #Primary input impedance(ohm)\n",
      "Zp = alpha**2*Z_L           #Primary input impedance(ohm)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Load impedance , Z_L = %.4f \u03a9' %Z_L)\n",
      "print('Case(b): Primary input impedance , Z_p = %.2f \u03a9 (Method 1)' %Z_p)\n",
      "print('         Primary input impedance , Z_p = %.2f \u03a9 (Method 2)' %Zp)\n",
      "print('Case(c): Impedance of load Z_L = %.4f \u03a9, is much greater than internal secondary impedance Z_2 = %.5f \u03a9' %(Z_L,Z_2))\n",
      "print('         Primary input impedance Z_p = %.2f \u03a9, is much greater than the internal primary impedance Z_1 = %.3f \u03a9' %(Z_p,Z_1))\n",
      "print('Case(d): Z_L must be much greater than Z_2 so that major part of the voltage produced by E_2 is dropped across Z_L')\n",
      "print('         As Z_L is reduced in proportion to Z_2, the load current increases and more voltage is dropped internally across Z_2')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Load impedance , Z_L = 0.1058 \u03a9\n",
        "Case(b): Primary input impedance , Z_p = 10.58 \u03a9 (Method 1)\n",
        "         Primary input impedance , Z_p = 10.58 \u03a9 (Method 2)\n",
        "Case(c): Impedance of load Z_L = 0.1058 \u03a9, is much greater than internal secondary impedance Z_2 = 0.00316 \u03a9\n",
        "         Primary input impedance Z_p = 10.58 \u03a9, is much greater than the internal primary impedance Z_1 = 0.316 \u03a9\n",
        "Case(d): Z_L must be much greater than Z_2 so that major part of the voltage produced by E_2 is dropped across Z_L\n",
        "         As Z_L is reduced in proportion to Z_2, the load current increases and more voltage is dropped internally across Z_2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.13, Page number 505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0     #Rating of the step-down transformer(kVA)\n",
      "V_1 = 2300.0    #Primary voltage(V)\n",
      "V_2 = 230.0     #Secondary voltage(V)\n",
      "f = 60.0        #Frequency(Hz)\n",
      "r_1 = 0.1       #Primary winding resistance(ohm)\n",
      "x_1 = 0.3       #Primary winding reactance(ohm)\n",
      "r_2 = 0.001     #Secondary winding resistance(ohm)\n",
      "x_2 = 0.003     #Secondary winding reactance(ohm)\n",
      "Z_L = 0.1058    #Load impedance(ohm)\n",
      "\n",
      "#Calculation\n",
      "alpha = V_1/V_2             #Transformation ratio\n",
      "R_c1 = r_1+alpha**2*r_2     #Equivalent internal resistance referred to the primary side(ohm)\n",
      "X_c1 = x_1+alpha**2*x_2     #Equivalent internal reactance referred to the primary side(ohm)\n",
      "Z_c1 = complex(R_c1,X_c1)   #Equivalent internal impedance referred to the primary side(ohm)\n",
      "Z_c1_m = abs(Z_c1)          #Magnitude of Z_e1(ohm)\n",
      "Z_L_prime = alpha**2*Z_L    #Equivalent secondary load impedance referred to the primary side(ohm)\n",
      "R_L = Z_L                   #Load resistance(ohm)\n",
      "X_L = 0                     #Load reactance(ohm)\n",
      "I_1 = V_1/complex((R_c1+alpha**2*R_L),(X_c1+alpha**2*X_L))  #Primary load current(A)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Equivalent internal resistance referred to the primary side , R_c1 = %.1f \u03a9' %R_c1)\n",
      "print('Case(b): Equivalent internal reactance referred to the primary side , X_c1 = %.1f \u03a9' %X_c1)\n",
      "print('Case(c): Equivalent internal impedance referred to the primary side , Z_c1 = %.3f \u03a9' %Z_c1_m)\n",
      "print('Case(d): Equivalent secondary load impedance referred to the primary side , \u03b1^2*Z_L = %.2f \u03a9' %Z_L_prime)\n",
      "print('Case(e): Primary load current , I_1 = %.f A' %abs(I_1))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Equivalent internal resistance referred to the primary side , R_c1 = 0.2 \u03a9\n",
        "Case(b): Equivalent internal reactance referred to the primary side , X_c1 = 0.6 \u03a9\n",
        "Case(c): Equivalent internal impedance referred to the primary side , Z_c1 = 0.632 \u03a9\n",
        "Case(d): Equivalent secondary load impedance referred to the primary side , \u03b1^2*Z_L = 10.58 \u03a9\n",
        "Case(e): Primary load current , I_1 = 213 A\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14, Page number 508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0        #Rating of the step-down transformer(kVA)\n",
      "V_1 = 2300.0       #Primary voltage(V)\n",
      "V_2 = 230.0        #Secondary voltage(V)\n",
      "R_e2 = 2.0         #Equivalent resistance referred to the primary side(m\u03a9)\n",
      "X_e2 = 6.0         #Equivalent reactance referred to the primary side(m\u03a9)\n",
      "cos_theta2 = 1.0   #Unity PF\n",
      "\n",
      "#Calculation\n",
      "I_2 = kVA/V_2              #Rated secondary current(kA)\n",
      "R_e2_drop = I_2*R_e2       #Full-load equivalent resistance voltage drop(V)\n",
      "X_e2_drop = I_2*X_e2       #Full-load equivalent reactance voltage drop(V) \n",
      "sin_theta2 = (1-cos_theta2**2)**0.5\n",
      "E_2 = complex((V_2*cos_theta2+I_2*R_e2),(V_2*sin_theta2+I_2*X_e2)) #Induced voltage(V)\n",
      "E_2_m = abs(E_2)           #Magnitude of E_2(V)\n",
      "VR = (E_2_m-V_2)/V_2*100   #Percent voltage regulation at unity PF(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Rated secondary current , I_2 = %.3f kA' %I_2)\n",
      "print('Case(b): Full-load equivalent resistance voltage drop , I_2*R_e2 = %.2f V' %R_e2_drop)\n",
      "print('Case(c): Full-load equivalent reactance voltage drop , I_2*X_e2 = %.2f V' %X_e2_drop)\n",
      "print('Case(d): Induced voltage when the transformer is delivering rated current at unity PF , E_2 = %.2f V' %E_2_m)\n",
      "print('Case(e): Voltage regulation at unity PF , VR = %.2f percent' %VR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Rated secondary current , I_2 = 2.174 kA\n",
        "Case(b): Full-load equivalent resistance voltage drop , I_2*R_e2 = 4.35 V\n",
        "Case(c): Full-load equivalent reactance voltage drop , I_2*X_e2 = 13.04 V\n",
        "Case(d): Induced voltage when the transformer is delivering rated current at unity PF , E_2 = 234.71 V\n",
        "Case(e): Voltage regulation at unity PF , VR = 2.05 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.15, Page number 508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0        #Rating of the step-down transformer(kVA)\n",
      "V_1 = 2300.0       #Primary voltage(V)\n",
      "V_2 = 230.0        #Secondary voltage(V)\n",
      "R_e2 = 2.0         #Equivalent resistance referred to the primary side(m\u03a9)\n",
      "X_e2 = 6.0         #Equivalent reactance referred to the primary side(m\u03a9)\n",
      "cos_theta2 = 0.8   #Lagging PF\n",
      "\n",
      "#Calculation\n",
      "I_2 = kVA/V_2              #Rated secondary current(kA)\n",
      "R_e2_drop = I_2*R_e2       #Full-load equivalent resistance voltage drop(V)\n",
      "X_e2_drop = I_2*X_e2       #Full-load equivalent reactance voltage drop(V) \n",
      "sin_theta2 = (1-cos_theta2**2)**0.5\n",
      "E_2 = complex((V_2*cos_theta2+I_2*R_e2),(V_2*sin_theta2+I_2*X_e2)) #Induced voltage(V)\n",
      "E_2_m = abs(E_2)           #Magnitude of E_2(V)\n",
      "VR = (E_2_m-V_2)/V_2*100   #Percent voltage regulation(%)\n",
      "\n",
      "#Result\n",
      "print('Case(d): Induced voltage when the transformer is delivering rated current at 0.8 PF lagging , E_2 = %.2f V' %E_2_m)\n",
      "print('Case(e): Voltage regulation at 0.8 PF lagging , VR = %.2f percent' %VR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(d): Induced voltage when the transformer is delivering rated current at 0.8 PF lagging , E_2 = 241.43 V\n",
        "Case(e): Voltage regulation at 0.8 PF lagging , VR = 4.97 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.16, Page number 508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0        #Rating of the step-down transformer(kVA)\n",
      "V_1 = 2300.0       #Primary voltage(V)\n",
      "V_2 = 230.0        #Secondary voltage(V)\n",
      "R_e2 = 2.0         #Equivalent resistance referred to the primary side(m\u03a9)\n",
      "X_e2 = 6.0         #Equivalent reactance referred to the primary side(m\u03a9)\n",
      "cos_theta2 = 0.6   #Leading PF\n",
      "\n",
      "#Calculation\n",
      "I_2 = kVA/V_2              #Rated secondary current(kA)\n",
      "R_e2_drop = I_2*R_e2       #Full-load equivalent resistance voltage drop(V)\n",
      "X_e2_drop = I_2*X_e2       #Full-load equivalent reactance voltage drop(V) \n",
      "sin_theta2 = (1-cos_theta2**2)**0.5\n",
      "E_2 = complex((V_2*cos_theta2+I_2*R_e2),(V_2*sin_theta2-I_2*X_e2)) #Induced voltage(V)\n",
      "E_2_m = abs(E_2)           #Magnitude of E_2(V)\n",
      "VR = (E_2_m-V_2)/V_2*100   #Percent voltage regulation(%)\n",
      "\n",
      "#Result\n",
      "print('Case(d): Induced voltage when the transformer is delivering rated current at 0.6 PF leading , E_2 = %.1f V' %E_2_m)\n",
      "print('Case(e): Voltage regulation at 0.6 PF leading , VR = %.2f percent' %VR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(d): Induced voltage when the transformer is delivering rated current at 0.6 PF leading , E_2 = 222.5 V\n",
        "Case(e): Voltage regulation at 0.6 PF leading , VR = -3.28 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.17, Page number 511"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "kVA = 20.0    #kVA rating of the step-down transformer\n",
      "S = 20000.0   #Power rating of the step-down transformer in VA\n",
      "V_1 = 2300.0  #Primary voltage(V)\n",
      "V_2 = 230.0   #Secondary voltage(V)\n",
      "P1 = 250.0    #Wattmeter reading(W)\n",
      "I1 = 8.7      #Input current(A)\n",
      "V1 = 50.0     #Input voltage(V)\n",
      "\n",
      "#Calculation\n",
      "alpha = V_1/V_2               #Transformation ratio\n",
      "#Case(a)\n",
      "Z_e1 = V1/I1                  #Equivalent impedance w.r.t HV side(ohm)\n",
      "R_e1 = P1/I1**2               #Equivalent resistance w.r.t HV side(ohm)\n",
      "theta = math.acos(R_e1/Z_e1)   #PF angle(radians)\n",
      "theta_a = theta*180/math.pi   #PF angle(degree)\n",
      "X_e1 = Z_e1*math.sin(theta)   #Equivalent reactance w.r.t HV side(ohm)\n",
      "#Case(b)\n",
      "Z_e2 = Z_e1/alpha**2          #Equivalent impedance w.r.t LV side(ohm)\n",
      "R_e2 = R_e1/alpha**2          #Equivalent resistance w.r.t LV side(ohm)\n",
      "X_e2 = Z_e2*math.sin(theta)   #Equivalent reactance w.r.t LV side(ohm)\n",
      "#Case(c)\n",
      "I_2 = S/V_2                   #Rated secondary load current(A)\n",
      "R_e2_drop = I_2*R_e2          #Full-load equivalent resistance voltage drop(V)\n",
      "X_e2_drop = I_2*X_e2          #Full-load equivalent reactance voltage drop(V)\n",
      "cos_theta2 = 1.0              #Unity PF\n",
      "sin_theta2 = (1-cos_theta2**2)**0.5\n",
      "E_2 = complex((V_2*cos_theta2+I_2*R_e2),(V_2*sin_theta2+I_2*X_e2)) #Induced voltage(V)\n",
      "E_2_m = abs(E_2)              #Magnitude of E_2(V)\n",
      "VR_unity_PF = (E_2_m-V_2)/V_2*100   #Transformer voltage regulation(%)\n",
      "#Case(d)\n",
      "cos_theta_2 = 0.7             #Lagging PF\n",
      "sin_theta_2 = (1-(cos_theta_2)**2)**0.5\n",
      "E2 = complex((V_2*cos_theta_2+I_2*R_e2),(V_2*sin_theta_2+I_2*X_e2))  #Induced voltage(V)\n",
      "E2_m = abs(E2)                #Magnitude of E2(V)\n",
      "VR_lag_PF = (E2_m-V_2)/V_2*100      #Transformer voltage regulation(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Equivalent impedance referred to HV side , Z_e1 = %.2f \u03a9' %Z_e1)\n",
      "print('         Equivalent resistance referred to HV side , R_e1 = %.1f \u03a9' %R_e1)\n",
      "print('         Equivalent reactance referred to HV side , X_e1 = %.2f \u03a9' %X_e1)\n",
      "print('Case(b): Equivalent impedance referred to LV side , Z_e2 = %.1f m\u03a9' %(1000*Z_e2))\n",
      "print('         Equivalent resistance referred to LV side , R_e2 = %.f m\u03a9' %(1000*R_e2))\n",
      "print('         Equivalent reactance referred to LV side , X_e2 = %.1f m\u03a9' %(1000*X_e2))\n",
      "print('Case(c): Transformer voltage regulation , VR = %.2f percent' %VR_unity_PF)\n",
      "print('Case(c): Transformer voltage regulation , VR = %.2f percent' %VR_lag_PF)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Equivalent impedance referred to HV side , Z_e1 = 5.75 \u03a9\n",
        "         Equivalent resistance referred to HV side , R_e1 = 3.3 \u03a9\n",
        "         Equivalent reactance referred to HV side , X_e1 = 4.70 \u03a9\n",
        "Case(b): Equivalent impedance referred to LV side , Z_e2 = 57.5 m\u03a9\n",
        "         Equivalent resistance referred to LV side , R_e2 = 33 m\u03a9\n",
        "         Equivalent reactance referred to LV side , X_e2 = 47.0 m\u03a9\n",
        "Case(c): Transformer voltage regulation , VR = 1.26 percent\n",
        "Case(c): Transformer voltage regulation , VR = 2.14 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.18, Page number 511"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V1_rated = 2300.0  #Primary voltage(V)\n",
      "V_sc = 50.0        #Short circuit test voltage(V)\n",
      "\n",
      "#Calculation\n",
      "Pc_sc_Pc = (V_sc/V1_rated)**2    #Fraction of rated core loss\n",
      "\n",
      "#Result\n",
      "print('Fraction of P_c measured by wattmeter , P_c(sc) = %.6f*P_c ' %Pc_sc_Pc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of P_c measured by wattmeter , P_c(sc) = 0.000473*P_c \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.19, Page number 512"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "kVA = 20.0    #kVA rating of the step-down transformer\n",
      "S = 20000.0   #Power rating of the step-down transformer in VA\n",
      "V_1 = 2300.0  #Primary voltage(V)\n",
      "V_2 = 230.0   #Secondary voltage(V)\n",
      "P1 = 250.0    #Wattmeter reading(W)\n",
      "I1 = 8.7      #Input current(A)\n",
      "V1 = 50.0     #Input voltage(V)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "I1_Ze1 = V1                         #HV impedance drop(V)\n",
      "#Case(b)\n",
      "theta = math.acos(P1/(V1*I1))       #PF angle(radian)\n",
      "theta_a = theta*180/math.pi         #PF angle(degree)\n",
      "I1_Re1 = I1_Ze1*math.cos(theta)     #HV side resistance volt drop(V)\n",
      "#Case(c)\n",
      "I1_Xe1 = I1_Ze1*math.sin(theta)     #HV side resistance volt drop(V)\n",
      "#Case(d)\n",
      "cos_theta1 = 1.0                     #Unity PF\n",
      "sin_theta1 = (1-cos_theta1**2)**0.5\n",
      "E1 = complex((V_1*cos_theta1+I1_Re1),(V_1*sin_theta1+I1_Xe1))  #Induced voltage(V)\n",
      "E1_m = abs(E1)                      #Magnitude of E1(V)\n",
      "VR = (E1_m-V_1)/V_1*100             #Transformer voltage regulation at unity PF(%)\n",
      "#Case(e)\n",
      "cos_theta_1 = 0.7                    #Lagging PF\n",
      "sin_theta_1 = (1-cos_theta_1**2)**0.5\n",
      "E_1 = complex((V_1*cos_theta_1+I1_Re1),(V_1*sin_theta_1+I1_Xe1))  #Induced voltage(V)\n",
      "E_1_m = abs(E_1)                    #Magnitude of E_1(V)\n",
      "VR_1 = (E_1_m-V_1)/V_1*100          #Transformer voltage regulation at 0.7 PF lagging(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): High voltage impedance drop , I_1*Z_e1 = %.f V' %I1_Ze1)\n",
      "print('Case(b): HV side resistance volt drop , I_1*R_e1 = %.2f V' %I1_Re1)\n",
      "print('Case(c): HV side reactance volt drop , I_1*X_e1 = %.2f V' %I1_Xe1)\n",
      "print('Case(d): Transformer voltage regulation at unity PF , VR = %.2f percent' %VR)\n",
      "print('Case(e): Transformer voltage regulation at 0.7 PF lagging , VR = %.2f percent' %VR_1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): High voltage impedance drop , I_1*Z_e1 = 50 V\n",
        "Case(b): HV side resistance volt drop , I_1*R_e1 = 28.74 V\n",
        "Case(c): HV side reactance volt drop , I_1*X_e1 = 40.92 V\n",
        "Case(d): Transformer voltage regulation at unity PF , VR = 1.27 percent\n",
        "Case(e): Transformer voltage regulation at 0.7 PF lagging , VR = 2.15 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.20, Page number 515"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA = 500.0       #kVA rating of the step-down transformer\n",
      "V_1 = 2300.0      #Primary voltage(V)\n",
      "V_2 = 208.0       #Secondary voltage(V)\n",
      "f = 60.0          #Frequency(Hz)\n",
      "P_sc = 8200.0     #Wattmeter reading in SC test(W)\n",
      "I_sc = 217.4      #Short circuit current(A)\n",
      "V_sc = 95.0       #Short circuit voltage(V)\n",
      "P_oc = 1800.0     #Wattmeter reading in OC test(W)\n",
      "I_oc = 85.0       #Open circuit current(A)\n",
      "V_oc = 208.0      #Open circuit voltage(V)\n",
      "\n",
      "#Calculation\n",
      "alpha = V_1/V_2        #Transformation ratio\n",
      "#Case(a)\n",
      "P = P_sc               #Wattmeter reading(W)\n",
      "I1 = I_sc              #Short circuit current(A)\n",
      "R_e1 = P/(I1)**2       #Equivalent resistance w.r.t HV side(ohm)\n",
      "R_e2 = R_e1/alpha**2   #Equivalent resistance referred to LV side(ohm)\n",
      "#Case(b)\n",
      "r_2 = R_e2/2           #Resistance of low-voltage side(ohm)\n",
      "#Case(c)\n",
      "I_m = I_oc             #Open circuit current(A)\n",
      "P_cu = I_m**2*r_2      #Transformer copper loss of the LV side winding during OC-test(W)\n",
      "#Case(d)\n",
      "P_c = P_oc-P_cu        #Transformer core loss(W)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Equivalent resistance to low voltage side , R_e2 = %.3f m\u03a9' %(1000*R_e2))\n",
      "print('Case(b): Resistance of low voltage side , r_2 =  %.2f m\u03a9' %(1000*r_2))\n",
      "print('Case(c): Transformer copper loss of the LV side winding during OC-test , I_m^2*r_2 = %.2f W' %P_cu)\n",
      "print('Case(d): Transformer core loss when rated voltage is applied , P_c = %.1f W' %P_c)\n",
      "print('Case(e): Yes.The error is approximately 5/1800 = 0.278 percent, which is within error produced by the instruments used in test');\n",
      "print('         We may assume that the core loss is %d W' %P_oc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Equivalent resistance to low voltage side , R_e2 = 1.419 m\u03a9\n",
        "Case(b): Resistance of low voltage side , r_2 =  0.71 m\u03a9\n",
        "Case(c): Transformer copper loss of the LV side winding during OC-test , I_m^2*r_2 = 5.13 W\n",
        "Case(d): Transformer core loss when rated voltage is applied , P_c = 1794.9 W\n",
        "Case(e): Yes.The error is approximately 5/1800 = 0.278 percent, which is within error produced by the instruments used in test\n",
        "         We may assume that the core loss is 1800 W\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.21, Page number 516"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_sc = 50.0           #Short circuit voltage(V)\n",
      "V_1 = 2300.0          #Rated primary voltage(V)\n",
      "P_c = 1.8             #Core losses(kW)\n",
      "P_k = 1.8             #Fixed losses(kW)\n",
      "P_cu_rated = 8.2      #Rated copper loss(kW)\n",
      "kVA = 500.0           #Power rating(kVA)\n",
      "PF = 1.0              #Power factor\n",
      "P_o = kVA*PF          #Full-load output at unity PF(kW)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "LF1 = 1.0/4                     #Load fraction\n",
      "LF2 = 1.0/2                     #Load fraction\n",
      "LF3 = 3.0/4                     #Load fraction\n",
      "LF4 = 5.0/4                     #Load fraction\n",
      "P_cu_fl = 8.2                   #Equivalent copper loss at full-load slip(kW)\n",
      "P_cu_LF1 = LF1**2*P_cu_fl       #Equivalent copper loss at 1/4 rated load(kW)\n",
      "P_cu_LF2 = LF2**2*P_cu_fl       #Equivalent copper loss at 1/2 rated load(kW)\n",
      "P_cu_LF3 = LF3**2*P_cu_fl       #Equivalent copper loss at 3/4 rated load(kW)\n",
      "P_cu_LF4 = LF4**2*P_cu_fl ;     #Equivalent copper loss at 5/4 rated load(kW)\n",
      "P_L_fl = P_c+P_cu_fl            #Total losses at rated load(kW)\n",
      "P_L_1 = P_c+P_cu_LF1            #Total losses at 1/4 rated load(kW)\n",
      "P_L_2 = P_c+P_cu_LF2            #Total losses at 1/2 rated load(kW)\n",
      "P_L_3 = P_c+P_cu_LF3            #Total losses at 3/4 rated load(kW)\n",
      "P_L_4 = P_c+P_cu_LF4            #Total losses at 5/4 rated load(kW)\n",
      "P_o_fl = P_o                    #Total output at rated load(kW)\n",
      "P_o_1 = P_o*LF1                 #Total output at 1/4 rated load(kW)\n",
      "P_o_2 = P_o*LF2                 #Total output at 1/2 rated load(kW)\n",
      "P_o_3 = P_o*LF3                 #Total output at 3/4 rated load(kW)\n",
      "P_o_4 = P_o*LF4                 #Total output at 5/4 rated load(kW)\n",
      "P_in_fl = P_L_fl+P_o_fl         #Total input at rated load(kW)\n",
      "P_in_1 = P_L_1+P_o_1            #Total input at 1/4 rated load(kW)\n",
      "P_in_2 = P_L_2+P_o_2            #Total input at 1/2 rated load(kW)\n",
      "P_in_3 = P_L_3+P_o_3            #Total input at 3/4 rated load(kW)\n",
      "P_in_4 = P_L_4+P_o_4            #Total input at 5/4 rated load(kW)\n",
      "n_fl = (P_o_fl/P_in_fl)*100     #Efficiency at rated load(%)\n",
      "n_1 = (P_o_1/P_in_1)*100        #Efficiency at 1/4 rated load(%)\n",
      "n_2 = (P_o_2/P_in_2)*100        #Efficiency at 1/2 rated load(%)\n",
      "n_3 = (P_o_3/P_in_3)*100        #Efficiency at 3/4 rated load(%)\n",
      "n_4 = (P_o_4/P_in_4)*100        #Efficiency at 5/4 rated load(%)\n",
      "#Case(b)\n",
      "PF_b = 0.8                      #PF lagging\n",
      "Po_fl = P_o*PF_b                #Total output at 1rated load(kW)\n",
      "Po_1 = P_o*LF1*PF_b             #Total output at 1/4 rated load(kW)\n",
      "Po_2 = P_o*LF2*PF_b             #Total output at 1/2 rated load(kW)\n",
      "Po_3 = P_o*LF3*PF_b             #Total output at 3/4 rated load(kW)\n",
      "Po_4 = P_o*LF4*PF_b             #Total output at 5/4 rated load(kW)\n",
      "Pin_fl = P_L_fl+Po_fl           #Total input at rated load(kW)\n",
      "Pin_1 = P_L_1+Po_1              #Total input at 1/4 rated load(kW)\n",
      "Pin_2 = P_L_2+Po_2              #Total input at 1/2 rated load(kW)\n",
      "Pin_3 = P_L_3+Po_3              #Total input at 3/4 rated load(kW)\n",
      "Pin_4 = P_L_4+Po_4              #Total input at 5/4 rated load(kW)\n",
      "nfl = (Po_fl/Pin_fl)*100        #Efficiency at rated load(%)\n",
      "n1 = (Po_1/Pin_1)*100           #Efficiency at 1/4 rated load(%)\n",
      "n2 = (Po_2/Pin_2)*100           #Efficiency at 1/2 rated load(%)\n",
      "n3 = (Po_3/Pin_3)*100           #Efficiency at 3/4 rated load(%)\n",
      "n4 = (Po_4/Pin_4)*100           #Efficiency at 5/4 rated load(%)\n",
      "#Case(c)\n",
      "R_e2 = 1.417*10**-3             #Equivalent resistance referred to LV side(ohm)\n",
      "Pc = 1800.0                     #Core losses(W)\n",
      "I_2 = (Pc/R_e2)**0.5            #Load current for maximum efficiency invariant of LF(A)\n",
      "#Case(d)\n",
      "V = 208.0                       #Voltage rating(V)\n",
      "I_2_rated = kVA*1000/V          #Rated secondary current(A)\n",
      "LF_max = I_2/I_2_rated          #Load fraction for maximum efficiency\n",
      "#Case(e)\n",
      "cos_theta = 1.0                 #Unity PF\n",
      "V_2 = V                         #Secondary voltage(V)\n",
      "n_max_e = (V_2*I_2*cos_theta)/((V_2*I_2*cos_theta)+(Pc+I_2**2*R_e2))*100    #Maximum efficiency(%)\n",
      "#Case(f)\n",
      "cos_theta2 = 0.8                #PF lagging\n",
      "n_max_f = (V_2*I_2*cos_theta2)/((V_2*I_2*cos_theta2)+(Pc+I_2**2*R_e2))*100  #Maximum efficiency(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Tabulation at unity PF:')\n",
      "print('__________________________________________________________________________________________________________')\n",
      "print('L.F \\t Core loss \\t Copper loss \\tTotal loss \\t Total Output \\t Total Input \\t Efficiency')\n",
      "print('    \\t   (kW)    \\t    (kW)     \\t  P_L (kW) \\t    P_o(kW)   \\t P_L+P_o(kW) \\t P_o/P_in(percent)')\n",
      "print('__________________________________________________________________________________________________________')\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.3f       \\t %.3f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF1,P_c,P_cu_LF1,P_L_1,P_o_1,P_in_1,n_1))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.3f       \\t %.2f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF2,P_c,P_cu_LF2,P_L_2,P_o_2,P_in_2,n_2))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.3f       \\t %.2f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF3,P_c,P_cu_LF3,P_L_3,P_o_3,P_in_3,n_3))\n",
      "print('1  \\t   %.1f \\t\\t   %.3f       \\t %.2f  \\t\\t   %.1f \\t    %.1f \\t %.2f' %(P_c,P_cu_fl,P_L_fl,P_o_fl,P_in_fl,n_fl))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.3f  \\t %.1f  \\t\\t   %.1f \\t    %.1f \\t %.2f' %(LF4,P_c,P_cu_LF4,P_L_4,P_o_4,P_in_4,n_4))\n",
      "print('__________________________________________________________________________________________________________')\n",
      "print('\\nCase(b): Tabulation at 0.8 PF lagging:')\n",
      "print('__________________________________________________________________________________________________________')\n",
      "print('L.F \\t Core loss \\t Copper loss \\tTotal loss \\t Total Output \\t Total Input \\t Efficiency')\n",
      "print('\\t   (kW)    \\t    (kW)     \\t  P_L (kW) \\t    P_o(kW)   \\t P_L+P_o(kW)\\t P_o/P_in(percent)')\n",
      "print('__________________________________________________________________________________________________________')\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.3f       \\t %.3f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF1,P_c,P_cu_LF1,P_L_1,Po_1,Pin_1,n1))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.2f       \\t %.2f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF2,P_c,P_cu_LF2,P_L_2,Po_2,Pin_2,n2))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.2f       \\t %.2f \\t\\t   %.1f \\t    %.2f \\t %.2f' %(LF3,P_c,P_cu_LF3,P_L_3,Po_3,Pin_3,n3))\n",
      "print('1  \\t   %.1f \\t\\t   %.1f \\t\\t %.2f \\t\\t   %.1f \\t    %.f \\t\\t %.2f' %(P_c,P_cu_fl,P_L_fl,Po_fl,Pin_fl,nfl))\n",
      "print('%.2f  \\t   %.1f \\t\\t   %.1f  \\t %.1f \\t\\t   %.1f \\t    %.1f \\t %.2f' %(LF4,P_c,P_cu_LF4,P_L_4,Po_4,Pin_4,n4))\n",
      "print('__________________________________________________________________________________________________________\\n')\n",
      "print('Case(c): Load current at which maximum efficiency occurs regardless of load PF , I_2 = %.1f A' %I_2)\n",
      "print('Case(d): Load fraction at which maximum efficiency occurs = %.3f (approximately half rated load)' %LF_max)\n",
      "print('Case(e): Maximum efficiency at unity PF , \u03b7_max = %.2f percent' %n_max_e)\n",
      "print('Case(f): Maximum efficiency at 0.8 PF lagging , \u03b7_max = %.2f percent' %n_max_f)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Tabulation at unity PF:\n",
        "__________________________________________________________________________________________________________\n",
        "L.F \t Core loss \t Copper loss \tTotal loss \t Total Output \t Total Input \t Efficiency\n",
        "    \t   (kW)    \t    (kW)     \t  P_L (kW) \t    P_o(kW)   \t P_L+P_o(kW) \t P_o/P_in(percent)\n",
        "__________________________________________________________________________________________________________\n",
        "0.25  \t   1.8 \t\t   0.512       \t 2.312 \t\t   125.0 \t    127.31 \t 98.18\n",
        "0.50  \t   1.8 \t\t   2.050       \t 3.85 \t\t   250.0 \t    253.85 \t 98.48\n",
        "0.75  \t   1.8 \t\t   4.612       \t 6.41 \t\t   375.0 \t    381.41 \t 98.32\n",
        "1  \t   1.8 \t\t   8.200       \t 10.00  \t\t   500.0 \t    510.0 \t 98.04\n",
        "1.25  \t   1.8 \t\t   12.812  \t 14.6  \t\t   625.0 \t    639.6 \t 97.72\n",
        "__________________________________________________________________________________________________________\n",
        "\n",
        "Case(b): Tabulation at 0.8 PF lagging:\n",
        "__________________________________________________________________________________________________________\n",
        "L.F \t Core loss \t Copper loss \tTotal loss \t Total Output \t Total Input \t Efficiency\n",
        "\t   (kW)    \t    (kW)     \t  P_L (kW) \t    P_o(kW)   \t P_L+P_o(kW)\t P_o/P_in(percent)\n",
        "__________________________________________________________________________________________________________\n",
        "0.25  \t   1.8 \t\t   0.512       \t 2.312 \t\t   100.0 \t    102.31 \t 97.74\n",
        "0.50  \t   1.8 \t\t   2.05       \t 3.85 \t\t   200.0 \t    203.85 \t 98.11\n",
        "0.75  \t   1.8 \t\t   4.61       \t 6.41 \t\t   300.0 \t    306.41 \t 97.91\n",
        "1  \t   1.8 \t\t   8.2 \t\t 10.00 \t\t   400.0 \t    410 \t\t 97.56\n",
        "1.25  \t   1.8 \t\t   12.8  \t 14.6 \t\t   500.0 \t    514.6 \t 97.16\n",
        "__________________________________________________________________________________________________________\n",
        "\n",
        "Case(c): Load current at which maximum efficiency occurs regardless of load PF , I_2 = 1127.1 A\n",
        "Case(d): Load fraction at which maximum efficiency occurs = 0.469 (approximately half rated load)\n",
        "Case(e): Maximum efficiency at unity PF , \u03b7_max = 98.49 percent\n",
        "Case(f): Maximum efficiency at 0.8 PF lagging , \u03b7_max = 98.12 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.22, Page number 520"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "V_1 = 2300.0        #Primary voltage(V)\n",
      "V_2 = 230.0         #Secondary voltage(V)\n",
      "P = 20.0            #Power rating of the transformer(kVA)\n",
      "P_sc = 250.0        #Power measured(W)\n",
      "V_sc = 50.0         #Short circuit voltage(V)\n",
      "I_sc = 8.7          #Short circuit current(A)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "V_1b = V_1              #Base voltage(V)\n",
      "Z_eq_pu = V_sc/V_1\n",
      "beta = math.acos(P_sc/(V_sc*I_sc))    #Angle(radian)\n",
      "beta_a = beta*180/math.pi             #Angle(degree)\n",
      "Zeq_pu = Z_eq_pu*cmath.exp(1j*beta)   #Equivalent pu impedance\n",
      "#Case(b)\n",
      "PF_b = 1.0                            #Unity PF\n",
      "theta_b = math.acos(PF_b)*180/math.pi #PF angle(degree)\n",
      "V_1_pu = 1.0*cmath.exp(1j*0*math.pi/180)+1.0*cmath.exp(1j*theta_b*math.pi/180)*Zeq_pu  #pu voltage\n",
      "V_1_pu_m = abs(V_1_pu)                #Magnitude of V_1_pu\n",
      "#Case(c)\n",
      "theta = math.acos(0.7)*180/math.pi    #Power factor angle(degrees)\n",
      "V1_pu = 1.0*cmath.exp(1j*0*math.pi/180)+1.0*cmath.exp(1j*(-theta)*math.pi/180)*Zeq_pu  #pu voltage\n",
      "V1_pu_m = abs(V1_pu)                  #Magnitude of V1_pu\n",
      "#Case(d)\n",
      "VR_unity_PF = (V_1_pu_m-1.0)*100      #Voltage regulation at unity PF(%)\n",
      "#Case(e)\n",
      "VR_lag_PF = (V1_pu_m-1.0)*100         #Voltage regulation at 0.7 lagging PF(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Z_eq(pu)\u2220\u03b2 = %.5f\u2220%.f\u00b0 p.u' %(abs(Z_eq_pu),beta_a))\n",
      "print('Case(b): V_1(pu) at unity PF , |V_1(pu)| = %.4f ' %V_1_pu_m)\n",
      "print('Case(c): V_1(pu) at 0.7 PF lagging , |V_1(pu)| = %.5f ' %V1_pu_m)\n",
      "print('Case(d): Voltage regulation at unity PF , VR = %.2f percent' %VR_unity_PF)\n",
      "print('Case(e): Voltage regulation at 0.7 PF lagging , VR = %.2f percent' %VR_lag_PF)\n",
      "print('Case(f): VRs as found by p.u method are essentially the same as those found in Exs.14-17 and 14-19 using the same data, for the same transformer but with much less effort')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Z_eq(pu)\u2220\u03b2 = 0.02174\u222055\u00b0 p.u\n",
        "Case(b): V_1(pu) at unity PF , |V_1(pu)| = 1.0127 \n",
        "Case(c): V_1(pu) at 0.7 PF lagging , |V_1(pu)| = 1.02146 \n",
        "Case(d): Voltage regulation at unity PF , VR = 1.27 percent\n",
        "Case(e): Voltage regulation at 0.7 PF lagging , VR = 2.15 percent\n",
        "Case(f): VRs as found by p.u method are essentially the same as those found in Exs.14-17 and 14-19 using the same data, for the same transformer but with much less effort\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.23, Page number 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_1 = 2300.0          #Primary voltage(V)\n",
      "V_2 = 230.0           #Secondary voltage(V)\n",
      "S = 500.0             #Power rating of the transformer(kVA)\n",
      "f= 60.0               #Frequency(Hz)\n",
      "V_oc = 208.0          #Open circuit voltage(V)\n",
      "I_oc = 85.0           #Open circuit current(A)\n",
      "P_oc = 1800.0         #Power measured(W)\n",
      "V_sc = 95.0           #Short circuit voltage(V)\n",
      "I_sc = 217.4          #Short circuit current(A)\n",
      "P_sc = 8200.0         #Power measured(W)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "S_b = S ;             #Base voltage(kVA)\n",
      "Psc = 8.2             #Power measured in kW during SC-test\n",
      "P_Cu_pu = Psc/S_b     #Per unit value of P_Cu at rated load\n",
      "#Case(b)\n",
      "Poc = 1.8             #Power measured during OC-test(kW)\n",
      "P_CL_pu = Poc/S_b     #Per unit value of P_CL at rated load\n",
      "#Case(c)\n",
      "PF = 1.0              #Unity Power factor\n",
      "n_pu = PF/(PF+P_CL_pu+P_Cu_pu)*100                   #Efficiency at rated load,unity PF(%)\n",
      "#Case(d)\n",
      "PF_d = 0.8                                           #Lagging Power factor\n",
      "n_pu_d = PF_d/(PF_d+P_CL_pu+P_Cu_pu)*100             #Efficiency at rated load,0.8 lagging PF\n",
      "#Case(e)\n",
      "LF = (P_CL_pu/P_Cu_pu)**0.5                          #Load fraction producing maximum efficiency\n",
      "#Case(f)\n",
      "n_pu_max = (LF*PF)/((LF*PF)+2*(P_CL_pu))*100         #Maximum efficiency at unity PF load\n",
      "#Case(f)\n",
      "n_pu_max_g = (LF*PF_d)/((LF*PF_d)+2*(P_CL_pu))*100   #Maximum efficiency at 0.8 lagging PF load\n",
      "\n",
      "\n",
      "#Result\n",
      "print('Case(a): Per unit copper loss at rated load , P_Cu(pu) = %.4f p.u = R_eq(pu)' %P_Cu_pu)\n",
      "print('Case(b): Per unit core loss at rated load , P_CL(pu) = %.4f p.u' %P_CL_pu)\n",
      "print('Case(c): Efficiency at rated load, unity PF , \u03b7_pu = %.2f percent' %n_pu)\n",
      "print('Case(d): Efficiency at rated load, 0.8 PF lagging , \u03b7_pu = %.2f percent' %n_pu_d)\n",
      "print('Case(e): Load fraction producing maximum efficiency , L.F = %.3f ' %LF)\n",
      "print('Case(f): Maximum efficiency at unity PF load , \u03b7_pu = %.2f percent' %n_pu_max)\n",
      "print('Case(g): Maximum efficiency at 0.8 PF lagging , \u03b7_pu = %.2f percent' %n_pu_max_g)\n",
      "print('Case(h): All efficiency values are identical to those computed in solution to Ex.14-21')\n",
      "print('Case(i): Per-unit method is much simpler and less subject to error than conventional method')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Per unit copper loss at rated load , P_Cu(pu) = 0.0164 p.u = R_eq(pu)\n",
        "Case(b): Per unit core loss at rated load , P_CL(pu) = 0.0036 p.u\n",
        "Case(c): Efficiency at rated load, unity PF , \u03b7_pu = 98.04 percent\n",
        "Case(d): Efficiency at rated load, 0.8 PF lagging , \u03b7_pu = 97.56 percent\n",
        "Case(e): Load fraction producing maximum efficiency , L.F = 0.469 \n",
        "Case(f): Maximum efficiency at unity PF load , \u03b7_pu = 98.49 percent\n",
        "Case(g): Maximum efficiency at 0.8 PF lagging , \u03b7_pu = 98.12 percent\n",
        "Case(h): All efficiency values are identical to those computed in solution to Ex.14-21\n",
        "Case(i): Per-unit method is much simpler and less subject to error than conventional method\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.24, Page number 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_1 = 2300.0          #Primary voltage(V)\n",
      "V_2 = 230.0           #Secondary voltage(V)\n",
      "S = 500.0             #Power rating of the transformer(kVA)\n",
      "f= 60.0               #Frequency(Hz)\n",
      "V_oc = 208.0          #Open circuit voltage(V)\n",
      "I_oc = 85.0           #Open circuit current(A)\n",
      "P_oc = 1800.0         #Power measured(W)\n",
      "V_sc = 95.0           #Short circuit voltage(V)\n",
      "I_sc = 217.4          #Short circuit current(A)\n",
      "P_sc = 8200.0         #Power measured(W)\n",
      "\n",
      "#Calculation\n",
      "S_b = S ;             #Base voltage(kVA)\n",
      "Psc = 8.2             #Power measured in kW during SC-test\n",
      "P_Cu_pu = Psc/S_b     #Per unit value of P_Cu at rated load\n",
      "Poc = 1.8             #Power measured during OC-test(kW)\n",
      "P_CL_pu = Poc/S_b     #Per unit value of P_CL at rated load\n",
      "#Case(a)\n",
      "LF1 = 3.0/4           #Load fraction of rated load \n",
      "PF1 = 1.0             #Unity Power factor\n",
      "n_pu_LF1 = (LF1*PF1)/((LF1*PF1)+P_CL_pu+(LF1)**2*P_Cu_pu)*100     #Efficiency at rated load,unity PF(%)\n",
      "#Case(b)\n",
      "LF2 = 1.0/4           #Load fraction of rated load\n",
      "PF2 = 0.8             #Lagging PF\n",
      "n_pu_LF2 = (LF2*PF2)/((LF2*PF2)+P_CL_pu+(LF2)**2*P_Cu_pu)*100     #Efficiency at 1/4 rated load,0.8 lagging PF(%)\n",
      "#Case(c)\n",
      "LF3 = 5.0/4           #Load fraction of rated load\n",
      "PF3 = 0.8             #Leading PF\n",
      "n_pu_LF3 = (LF3*PF3)/((LF3*PF3)+P_CL_pu+(LF3)**2*P_Cu_pu)*100     #Efficiency at r1/4 rated load,0.8 leading PF(%)\n",
      "\n",
      "\n",
      "#Result\n",
      "print('Case(a): p.u efficiency at 3/4 load unity PF , \u03b7_pu = %.2f percent' %n_pu_LF1)\n",
      "print('Case(b): p.u efficiency at 1/4 load 0.8 PF lagging , \u03b7_pu = %.2f percent' %n_pu_LF2)\n",
      "print('Case(c): p.u efficiency at 5/4 load 0.8 PF leading , \u03b7_pu = %.2f percent' %n_pu_LF3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): p.u efficiency at 3/4 load unity PF , \u03b7_pu = 98.32 percent\n",
        "Case(b): p.u efficiency at 1/4 load 0.8 PF lagging , \u03b7_pu = 97.74 percent\n",
        "Case(c): p.u efficiency at 5/4 load 0.8 PF leading , \u03b7_pu = 97.16 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.25, Page number 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "kVA_1 = 500.0                     #Power rating of the transformer 1(kVA)\n",
      "R_1_pu = 0.01                     #Per-unit value of resistance of the transformer 1\n",
      "X_1_pu = 0.05                     #Per-unit value of reactance of the transformer 1\n",
      "Z_1_pu = complex(R_1_pu,X_1_pu)   #Per-unit value of impedance of the transformer 1\n",
      "PF = 0.8                          #Lagging PF\n",
      "V_2 = 400.0                       #Secondary voltage(V)\n",
      "S_load = 750.0                    #Increased system load(kVA)\n",
      "kVA_2 = 250.0                     #Power rating of the transformer 2(kVA)\n",
      "R_pu_2 = 0.015                    #Per-unit value of resistance of the transformer 2\n",
      "X_pu_2 = 0.04                     #Per-unit value of reactance of the transformer 2\n",
      "\n",
      "#Calculation\n",
      "Z_pu_1 = complex(R_pu_2,X_pu_2)   #New transformer p.u. impedance\n",
      "#Case(a)\n",
      "V_b1 = 400.0                      #Base voltage(V)\n",
      "V_b2 = 400.0                      #Base voltage(V)\n",
      "Z_pu_2 = (kVA_1/kVA_2)*(V_b1/V_b2)**2*(Z_pu_1)        #New transformer p.u impedance\n",
      "Z_2_pu = Z_pu_2                                       #New transformer p.u impedance\n",
      "#Case(b)\n",
      "cos_theta = PF                                        #Power factor\n",
      "sin_theta = (1-(cos_theta)**2)**0.5\n",
      "S_t_conjugate = (kVA_1+kVA_2)*complex(cos_theta,sin_theta)    #kVA of total load\n",
      "#Case(c)\n",
      "S_2_conjugate = S_t_conjugate*(Z_1_pu/(Z_1_pu+Z_2_pu))        #Portion of load carried by the smaller transformer(kVA)\n",
      "S_2_conjugate_m = abs(S_2_conjugate)                          #Magnitude of S_2_conjugate(kVA)\n",
      "S_2_conjugate_a = cmath.phase(S_2_conjugate)*180/math.pi      #Phase angle of S_2_conjugate(degree)\n",
      "#Case(d)\n",
      "S_1_conjugate = S_t_conjugate*(Z_2_pu/(Z_1_pu+Z_2_pu))        #Portion of load carried by the original transformer(kVA)\n",
      "S_1_conjugate_m = abs(S_1_conjugate)                          #Magnitude of S_1_conjugate(kVA)\n",
      "S_1_conjugate_a = cmath.phase(S_1_conjugate)*180/math.pi      #Phase angle of S_1_conjugate(degree)\n",
      "#Case(e)\n",
      "S_1 = S_1_conjugate_m\n",
      "S_b1 = kVA_1                                                  #Base power of trancsformer 1(kVA)\n",
      "LF1 = (S_1/S_b1)*100                                          #Load factor of the original transformer(%)\n",
      "#Case(f)\n",
      "S_2 = S_2_conjugate_m\n",
      "S_b2 = kVA_2                                                  #Base power of trancsformer 1(kVA)\n",
      "LF2 = (S_2/S_b2)*100                                          #Load factor of the new transformer(%)\n",
      "\n",
      "#Result\n",
      "print('Case(a): New transformer p.u impedance , Z_p.u.2 = (%.2f+j%.2f) p.u' %(Z_pu_2.real,Z_pu_2.imag))\n",
      "print('Case(b): kVA of total load , S*_t = (%.f+j%.f) kVA ' %(S_t_conjugate.real,S_t_conjugate.imag))\n",
      "print('Case(c): Portion of load now carried by the smaller transformer , S*_2 = (%.2f+j%.2f) kVA = %.1f\u2220%.1f\u00b0 kVA' %(S_2_conjugate.real,S_2_conjugate.imag,S_2_conjugate_m,S_2_conjugate_a))\n",
      "print('Case(d): Portion of load now carried by the original transformer , S*_1 = (%.2f+j%.1f) kVA = %.1f\u2220%.1f\u00b0 kVA' %(S_1_conjugate.real,S_1_conjugate.imag,S_1_conjugate_m,S_1_conjugate_a))\n",
      "print('Case(e): Load factor of the original transformer , L.F_1 = %.1f percent' %LF1)\n",
      "print('Case(f): Load factor of the new transformer , L.F_w = %.1f percent' %LF2)\n",
      "print('Case(g): Yes. Reduce no-load voltage of the new transformer to some value below that of its present value so that its share of the load is reduced')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): New transformer p.u impedance , Z_p.u.2 = (0.03+j0.08) p.u\n",
        "Case(b): kVA of total load , S*_t = (600+j450) kVA \n",
        "Case(c): Portion of load now carried by the smaller transformer , S*_2 = (206.76+j190.54) kVA = 281.2\u222042.7\u00b0 kVA\n",
        "Case(d): Portion of load now carried by the original transformer , S*_1 = (393.24+j259.5) kVA = 471.1\u222033.4\u00b0 kVA\n",
        "Case(e): Load factor of the original transformer , L.F_1 = 94.2 percent\n",
        "Case(f): Load factor of the new transformer , L.F_w = 112.5 percent\n",
        "Case(g): Yes. Reduce no-load voltage of the new transformer to some value below that of its present value so that its share of the load is reduced\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.26, Page number 523"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "kVA_1 = 500.0                     #Power rating of the transformer 1(kVA)\n",
      "R_1_pu = 0.01                     #Per-unit value of resistance of the transformer 1\n",
      "X_1_pu = 0.05                     #Per-unit value of reactance of the transformer 1\n",
      "Z_1_pu = complex(R_1_pu,X_1_pu)   #Per-unit value of impedance of the transformer 1\n",
      "PF = 0.8                          #Lagging PF\n",
      "V = 400.0                         #Secondary voltage(V)\n",
      "S_load = 750.0                    #Increased system load(kVA)\n",
      "kVA_2 = 250.0                     #Power rating of the transformer 2(kVA)\n",
      "R_pu_2 = 0.015                    #Per-unit value of resistance of the transformer 2\n",
      "X_pu_2 = 0.04                     #Per-unit value of reactance of the transformer 2\n",
      "\n",
      "#Calculation\n",
      "Z_pu_1 = complex(R_1_pu,X_1_pu)                   #New transformer p.u. impedance\n",
      "Z_pu1 = complex(R_pu_2,X_pu_2)                    #New transformer p.u. impedance\n",
      "#Case(a)\n",
      "V_b = V                                           #Base voltage(V)\n",
      "#Case(b)\n",
      "S_b = kVA_1                                       #Base power(kVA)\n",
      "I_b = S_b/V_b*1000                                #Base current(A)\n",
      "#Case(c)\n",
      "Zb = V_b/I_b                                      #Base impedance(ohm). Method 1\n",
      "Z_b = V**2/(S_b*1000)                             #Base impedance(ohm). Method 2\n",
      "#Case(d)\n",
      "Z_1 = Z_b*Z_pu_1*1000                             #Actual impedance of larger transformer(m\u03a9)\n",
      "Z_1_m = abs(Z_1)                                  #Magnitude of Z_1(\u03a9)\n",
      "Z_1_a = cmath.phase(Z_1)*180/math.pi              #Phase angle of Z_1(degree)\n",
      "#Case(e)\n",
      "V_b1 = V_b                                        #Base voltage(V)\n",
      "V_b2 = V_b                                        #Base voltage(V)\n",
      "Z_pu_2 = (kVA_1/kVA_2)*(V_b1/V_b2)**2*(Z_pu1)    #New transformer p.u impedance\n",
      "Z_2_pu = Z_pu_2\n",
      "Z_2 = Z_b*Z_2_pu*1000                             #Actual impedance of smaller transformer(m\u03a9)\n",
      "Z_2_m = abs(Z_2)                                  #Magnitude of Z_2(\u03a9)\n",
      "Z_2_a = cmath.phase(Z_2)*180/math.pi              #Phase angle of Z_2(degree)\n",
      "#Case(f)\n",
      "cos_theta = 0.8                                   #Lagging power factor\n",
      "sin_theta = (1-(cos_theta)**2)**0.5\n",
      "S_T = (kVA_1+kVA_2)*complex(cos_theta,-sin_theta) #kVA of total load\n",
      "I_T = S_T*1000/V_b                                #Total current(A)\n",
      "I_1 = I_T*(Z_2/(Z_1+Z_2))                         #Actual current delivered by larger transformer(A)\n",
      "I_1_m = abs(I_1)                                  #Magnitude of I_1(A)\n",
      "I_1_a = cmath.phase(I_1)*180/math.pi              #Phase angle of I_1(degree)\n",
      "#Case(g)\n",
      "I_2 = I_T*(Z_1/(Z_1+Z_2))                         #Actual current delivered by smaller transformer(A)\n",
      "I_2_m = abs(I_2)                                  #Magnitude of I_2(A)\n",
      "I_2_a = cmath.phase(I_2)*180/math.pi              #Phase angle of I_2(degree)\n",
      "#Case(h)\n",
      "Z1 = Z_1/1000                                     #Actual impedance of larger transformer(\u03a9)\n",
      "E_1 = I_1*Z1+V_b                                  #No-load voltage of larger transformer(V)\n",
      "E_1_m = abs(E_1)                                  #Magnitude of E_1(V)\n",
      "E_1_a = cmath.phase(E_1)*180/math.pi              #Phase angle of E_1(degree)\n",
      "#Case(i)\n",
      "Z2 = Z_2/1000                                     #Actual impedance of smaller transformer(\u03a9)\n",
      "E_2 = I_2*Z2+V_b                                  #No-load voltage of smaller transformer(V)\n",
      "E_2_m = abs(E_2)                                  #Magnitude of E_2(V)\n",
      "E_2_a = cmath.phase(E_2)*180/math.pi              #Phase angle of E_2(degree)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Base voltage , V_b = %.f V' %V_b)\n",
      "print('Case(b): Base current , I_b = %.2f kA' %(I_b/1000))\n",
      "print('Case(c): Base impedance , Z_b = %.2f \u03a9 (Method 1)' %Zb)\n",
      "print('         Base impedance , Z_b = %.2f \u03a9 (Method 2)' %Z_b)\n",
      "print('Case(d): Actual impedance of larger transformer , Z_1 = %.2f\u2220%.1f\u00b0 m\u03a9' %(Z_1_m,Z_1_a))\n",
      "print('Case(e): Actual impedance of smaller transformer , Z_2 = %.2f\u2220%.2f\u00b0 m\u03a9' %(Z_2_m,Z_2_a))\n",
      "print('Case(f): Actual current delivered by larger transformer , I_1 = %.f\u2220%.2f\u00b0 A' %(I_1_m,I_1_a))\n",
      "print('Case(g): Actual current delivered by smaller transformer , I_2 = %.1f\u2220%.1f\u00b0 A' %(I_2_m,I_2_a))\n",
      "print('Case(h): No-load voltage of larger transformer , E_1 = %.2f\u2220%.2f\u00b0 V' %(E_1_m,E_1_a))\n",
      "print('Case(i): No-load voltage of smaller transformer , E_2 = %.2f\u2220%.2f\u00b0 V' %(E_2_m,E_2_a))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Base voltage , V_b = 400 V\n",
        "Case(b): Base current , I_b = 1.25 kA\n",
        "Case(c): Base impedance , Z_b = 0.32 \u03a9 (Method 1)\n",
        "         Base impedance , Z_b = 0.32 \u03a9 (Method 2)\n",
        "Case(d): Actual impedance of larger transformer , Z_1 = 16.32\u222078.7\u00b0 m\u03a9\n",
        "Case(e): Actual impedance of smaller transformer , Z_2 = 27.34\u222069.44\u00b0 m\u03a9\n",
        "Case(f): Actual current delivered by larger transformer , I_1 = 1178\u2220-40.32\u00b0 A\n",
        "Case(g): Actual current delivered by smaller transformer , I_2 = 702.9\u2220-31.1\u00b0 A\n",
        "Case(h): No-load voltage of larger transformer , E_1 = 415.24\u22201.65\u00b0 V\n",
        "Case(i): No-load voltage of smaller transformer , E_2 = 415.24\u22201.65\u00b0 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.27, Page number 525"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "P_L = 14400.0           #Load output power(W)\n",
      "V_L = 120.0             #Load voltage(V)\n",
      "V_b1 = 120.0            #Base voltage at point 1(V)\n",
      "V_b2 = 600.0            #Base voltage at point 2(V)\n",
      "V_b3 = 120.0            #Base voltage at point 3(V)\n",
      "S_b3 = 14.4             #Base power(kVA)\n",
      "X_2 = 0.25              #Reactance(p.u)\n",
      "X_1 = 0.2               #Reactance(p.u)\n",
      "I_L = 120.0             #Load current(A)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "R_L = P_L/(V_L**2)                          #Resistance of the load(ohm)\n",
      "#Case(b)\n",
      "Z_bL = (V_b3**2)/(S_b3*1000)                #Base impedance(ohm)\n",
      "#Case(c)\n",
      "Z_L_pu = R_L/Z_bL                           #Per unit load impedance \n",
      "#Case(d)\n",
      "Z_2_pu = complex(0,X_2)                     #Per unit impedance of T2\n",
      "#Case(e)\n",
      "Z_1_pu = complex(0,X_1)                     #Per unit impedance of T1\n",
      "#Case(g)\n",
      "I_bL = (S_b3*1000)/V_b3                     #Base current in load(A)\n",
      "#Case(h)\n",
      "I_L_pu = I_L/I_bL                           #Per unit load current\n",
      "#Case(i)\n",
      "V_R_pu = I_L_pu*Z_L_pu                      #Per unit voltage across load \n",
      "#Case(j)\n",
      "I_S_pu = I_L_pu                             #Per unit current of source\n",
      "Z_T_pu = Z_L_pu+Z_1_pu+Z_2_pu               #Total p.u impedance\n",
      "V_S_pu = I_S_pu*Z_T_pu                      #Per unit voltage of source\n",
      "V_S_pu_m = abs(V_S_pu)                      #Magnitude of V_S_pu\n",
      "V_S_pu_a = cmath.phase(V_S_pu)*180/math.pi  #Phase angle of V_S_pu(degrees)\n",
      "#Case(k)\n",
      "V_S = V_S_pu*V_b1                           #Actual voltage across source(V)\n",
      "V_S_m = abs(V_S)                            #Magnitude of V_S(V)\n",
      "V_S_a = cmath.phase(V_S)*180/math.pi        #Phase angle of V_S(degrees)\n",
      "#Case(l)\n",
      "I_x_pu = I_L_pu                             #p.u current at point x\n",
      "Z_x_pu = Z_L_pu+Z_2_pu                      #p.u impedance at point x \n",
      "V_x_pu = I_x_pu*Z_x_pu                      #p.u voltage at point x\n",
      "#Case(m)\n",
      "V_x = V_x_pu*V_b2                           #Actual voltage at point x(V)\n",
      "V_x_m = abs(V_x)                            #Magnitude of V_x(V)\n",
      "V_x_a = cmath.phase(V_x)*180/math.pi        #Phase angle of V_x(degrees)\n",
      "\n",
      "\n",
      "#Result\n",
      "print('Case(a): Resistance of the load , R_L = %.f \u03a9' %R_L)\n",
      "print('Case(b): Base impedance of the load , Z_bL = %.f \u03a9' %Z_bL)\n",
      "print('Case(c): Per-unit load impedance , Z_L(pu)  = (%.f+j%.f) p.u' %(Z_L_pu.real,Z_L_pu.imag))\n",
      "print('Case(d): Per-unit impedance of transformer T2 , Z_2(pu)  = j%.2f p.u' %Z_2_pu.imag)\n",
      "print('Case(e): Per-unit impedance of transformer T1 , Z_1(pu)  = j%.1f p.u' %Z_2_pu.imag)\n",
      "print('Case(f): See Fig.14-23b in textbook page no-526')\n",
      "print('Case(g): Base current in the load ,  I_bL = %.f A (resistive)' %I_bL)\n",
      "print('Case(h): Per-unit load current , I_L_pu = (%.f+j%.f) p.u' %(I_L_pu.real,I_L_pu.imag))\n",
      "print('Case(i): Per-unit voltage across load , V_R_pu = (%.f+j%.f) p.u' %(V_R_pu.real,V_R_pu.imag))\n",
      "print('Case(j): Per-unit voltage of source , V_S_pu = %.3f\u2220%.2f\u00b0 pu' %(V_S_pu_m,V_S_pu_a))\n",
      "print('Case(k): Actual voltage across source , V_S = %.1f\u2220%.2f\u00b0 pu' %(V_S_m,V_S_a))\n",
      "print('Case(l): Per-unit voltage at point x in the second transmission loop , V_x(pu) = (%.f+j%.2f) p.u' %(V_x_pu.real,V_x_pu.imag))\n",
      "print('Case(m): Voltage at point x , V_x = %.1f\u2220%.f\u00b0 V' %(V_x_m,V_x_a))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Resistance of the load , R_L = 1 \u03a9\n",
        "Case(b): Base impedance of the load , Z_bL = 1 \u03a9\n",
        "Case(c): Per-unit load impedance , Z_L(pu)  = (1+j0) p.u\n",
        "Case(d): Per-unit impedance of transformer T2 , Z_2(pu)  = j0.25 p.u\n",
        "Case(e): Per-unit impedance of transformer T1 , Z_1(pu)  = j0.2 p.u\n",
        "Case(f): See Fig.14-23b in textbook page no-526\n",
        "Case(g): Base current in the load ,  I_bL = 120 A (resistive)\n",
        "Case(h): Per-unit load current , I_L_pu = (1+j0) p.u\n",
        "Case(i): Per-unit voltage across load , V_R_pu = (1+j0) p.u\n",
        "Case(j): Per-unit voltage of source , V_S_pu = 1.097\u222024.23\u00b0 pu\n",
        "Case(k): Actual voltage across source , V_S = 131.6\u222024.23\u00b0 pu\n",
        "Case(l): Per-unit voltage at point x in the second transmission loop , V_x(pu) = (1+j0.25) p.u\n",
        "Case(m): Voltage at point x , V_x = 618.5\u222014\u00b0 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.28, Page number 526"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "V_1 = 11.0                #Tr.1 voltage(kV)\n",
      "V_b1 = 11.0               #Base Tr.1 voltage(kV)\n",
      "S_1 = 50.0                #KVA rating of power for Tr.1\n",
      "S_2 = 100.0               #KVA rating of power for Tr.2\n",
      "Z_1_pu = complex(0,0.1)   #Per unit impedance of Tr.1\n",
      "Z_2_pu = complex(0,0.1)   #Per unit impedance of Tr.2\n",
      "V_b2 = 55.0               #Base Tr.2 voltage(kV)\n",
      "S_b = 100.0               #Base power(kVA)\n",
      "PF = 0.8                  #Power factor of the load\n",
      "Z_line = complex(0,200)   #Line impedance(ohm)\n",
      "V_L = 10.0                #Load voltage(kV)\n",
      "V_Lb3 = 11.0              #Base line voltage at point 3(V)\n",
      "V_b3 = 11.0               #Line voltage at point 3(V)\n",
      "P_L = 50.0                #Power rating of each transformer(kW)\n",
      "cos_theta_L = 0.8         #Lagging PF of load\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "Z_T1 = Z_1_pu*(V_1/V_b1)**2*(S_2/S_1)      #p.u impedance of T1\n",
      "#Case(b)\n",
      "Z_T2 = Z_2_pu*(V_1/V_b3)**2*(S_2/S_1)      #p.u impedance of T2\n",
      "#Case(c)\n",
      "V_b = V_b2                                 #Base voltage(V)\n",
      "Z_b_line = (V_b**2)/S_b*1000               #Base line impedance(ohm)\n",
      "Z_line_pu = Z_line/Z_b_line                #p.u impedance of the transmission line\n",
      "#Case(d)\n",
      "V_L_pu = V_L/V_Lb3                         #p.u voltage across load\n",
      "#Case(f)\n",
      "I_bL = S_b/V_b3                            #Base current in load(A)\n",
      "#Case(g)\n",
      "VL = V_b3                                  #Load voltage(kV)\n",
      "I_L = P_L/(VL*cos_theta_L)                 #Load current(A)\n",
      "I_L_pu = I_L/I_bL                          #p.u load current\n",
      "theta = math.acos(cos_theta_L)             #PF angle(radian)\n",
      "theta_a = theta*180/math.pi                #PF angle(degree)\n",
      "I_Lpu = I_L_pu*complex(math.cos(theta),-math.sin(theta))   #p.u current in complex form\n",
      "#Case(h)\n",
      "Z_series_pu = Z_T1+Z_line_pu+Z_T2          #p.u series impedance of the transmission line\n",
      "V_S_pu = I_Lpu*Z_series_pu+V_L_pu          #p.u source voltage\n",
      "V_S_pu_m = abs(V_S_pu)                     #Magnitude of V_S_pu\n",
      "V_S_pu_a = cmath.phase(V_S_pu)*180/math.pi #Phase angle of V_S_pu(degrees)\n",
      "#Case(i)\n",
      "V_S = V_S_pu*V_b1                        #Actual value of source voltage(kV)\n",
      "V_S_m = abs(V_S)                         #Magnitude of V_S_pu(kV)\n",
      "V_S_a = cmath.phase(V_S)*180/math.pi     #Phase angle of V_S(degrees)\n",
      "\n",
      "#Result\n",
      "print('Case(a): Per-unit impedance of transformer T1 , Z_T1 = j%.1f p.u' %Z_T1.imag)\n",
      "print('Case(b): Per-unit impedance of transformer T2 , Z_T2 = j%.1f p.u' %Z_T2.imag)\n",
      "print('Case(c): Per-unit impedance of transmission line , Z(line)_pu = j%.4f p.u' %Z_line_pu.imag)\n",
      "print('Case(d): Per-unit voltage across load , V_L_pu = (%.3f+j%.f) p.u' %(V_L_pu.real,V_L_pu.imag))\n",
      "print('Case(e): See Fig.14-24b in textbook Page no-527')\n",
      "print('Case(f): Base current in load , I_bL = %.3f A' %I_bL)\n",
      "print('Case(g): Per-unit load current , I_L_pu = (%.1f%.3fj) p.u' %(I_Lpu.real,I_Lpu.imag))\n",
      "print('Case(h): Per-unit source voltage , V_S_pu = %.3f\u2220%.2f\u00b0 pu' %(V_S_pu_m,V_S_pu_a))\n",
      "print('Case(i): Actual value of source voltage , V_S = %.1f\u2220%.2f\u00b0 kV' %(V_S_m,V_S_a))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Per-unit impedance of transformer T1 , Z_T1 = j0.2 p.u\n",
        "Case(b): Per-unit impedance of transformer T2 , Z_T2 = j0.2 p.u\n",
        "Case(c): Per-unit impedance of transmission line , Z(line)_pu = j0.0066 p.u\n",
        "Case(d): Per-unit voltage across load , V_L_pu = (0.909+j0) p.u\n",
        "Case(e): See Fig.14-24b in textbook Page no-527\n",
        "Case(f): Base current in load , I_bL = 9.091 A\n",
        "Case(g): Per-unit load current , I_L_pu = (0.5-0.375j) p.u\n",
        "Case(h): Per-unit source voltage , V_S_pu = 1.081\u222010.84\u00b0 pu\n",
        "Case(i): Actual value of source voltage , V_S = 11.9\u222010.84\u00b0 kV\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.29, Page number 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Z_pu_1 = 1j*0.1      #p.u impedance \n",
      "MVA_2 = 80.0         #MVA rating os system 2\n",
      "MVA_1 = 100.0        #MVA rating of T1 and T2\n",
      "V_2 = 30.0           #Voltage(kV)\n",
      "V_1 = 32.0           #Voltage(kV)\n",
      "Z_pu_2 = 1j*0.15     #p.u impedance \n",
      "V_b1 = 100.0         #Base voltage of T1(kV)\n",
      "Z_line = 1j*60       #Line impedance(ohm)\n",
      "MVA_M1 = 20.0        #MVA rating of motor load 1\n",
      "Z_pu_M1 = 1j*0.15    #p.u impedance of motor load M1\n",
      "MVA_M2 = 35.0        #MVA rating of motor load 2\n",
      "Z_pu_M2 = 1j*0.25    #p.u impedance of motor load M2\n",
      "MVA_M3 = 25.0        #MVA rating of motor load 3\n",
      "Z_pu_M3 = 1j*0.2     #p.u impedance of motor load M3\n",
      "V_M = 28.0           #Voltage across motor loads M1,M2,M3(kV)\n",
      "\n",
      "#Calculations\n",
      "Z_1_pu = Z_pu_1*(MVA_2/MVA_1)*(V_2/V_1)**2     #p.u imepedance of T1\n",
      "Z_2_pu = Z_pu_2*(MVA_2/MVA_1)*(V_2/V_1)**2     #p.u imepedance of T2\n",
      "V_b_line = V_b1*(V_1/V_2)                      #ase voltage of the long-transmission line(kV)\n",
      "MVA_b = 80.0                                   #Base MVA rating\n",
      "V_b = V_b_line\n",
      "Z_line_pu = Z_line*(MVA_b/(V_b_line)**2)       #p.u impedance of the transmission line\n",
      "Z_M1_pu = Z_pu_M1*(MVA_2/MVA_M1)*(V_M/V_1)**2  #p.u impedance of motor load M1\n",
      "Z_M2_pu = Z_pu_M2*(MVA_2/MVA_M2)*(V_M/V_1)**2  #p.u impedance of motor load M2\n",
      "Z_M3_pu = Z_pu_M3*(MVA_2/MVA_M3)*(V_M/V_1)**2  #p.u impedance of motor load M3\n",
      "\n",
      "#Result\n",
      "print('Case(a): Per-unit impedance of T1 , Z_1(pu) = j%.4f p.u' %Z_1_pu.imag)\n",
      "print('Case(b): Per-unit impedance of T2 , Z_2(pu) = j%.4f p.u' %Z_2_pu.imag)\n",
      "print('Case(c): Base voltage of the long-transmission line between T1 and T2 , V_b(line) = %.1f kV' %V_b_line)\n",
      "print('Case(d): Per-unit impedance of the transmission line , Z(line)_pu = j%.4f p.u' %Z_line_pu.imag)\n",
      "print('Case(e): Per-unit impedance of motor load M1 , Z_M1(pu) = j%.4f p.u' %Z_M1_pu.imag)\n",
      "print('Case(f): Per-unit impedance of motor load M2 , Z_M2(pu) = j%.4f p.u' %Z_M2_pu.imag)\n",
      "print('Case(g): Per-unit impedance of motor load M3 , Z_M3(pu) = j%.2f p.u' %Z_M3_pu.imag)\n",
      "print('Case(h): See Fig.14-25b in textbook page no-529')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Per-unit impedance of T1 , Z_1(pu) = j0.0703 p.u\n",
        "Case(b): Per-unit impedance of T2 , Z_2(pu) = j0.1055 p.u\n",
        "Case(c): Base voltage of the long-transmission line between T1 and T2 , V_b(line) = 106.7 kV\n",
        "Case(d): Per-unit impedance of the transmission line , Z(line)_pu = j0.4219 p.u\n",
        "Case(e): Per-unit impedance of motor load M1 , Z_M1(pu) = j0.4594 p.u\n",
        "Case(f): Per-unit impedance of motor load M2 , Z_M2(pu) = j0.4375 p.u\n",
        "Case(g): Per-unit impedance of motor load M3 , Z_M3(pu) = j0.49 p.u\n",
        "Case(h): See Fig.14-25b in textbook page no-529\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.30, Page number 533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_pa = 1000.0      #Phase voltage(V)\n",
      "I_1a = 1.0         #Line current in primary(A)\n",
      "V_2a = 100.0       #Voltage across secondary(V)\n",
      "Ic_a = 10.0        #Current in lower half of auto-transformer(A)\n",
      "V_s = 100.0        #Voltage in secondary winding(V)\n",
      "I_2b = 10.0        #Current in secondary(A)\n",
      "V_1b = 1000.0      #Voltage across primary(V)\n",
      "Ic_b = 1.0         #Current in lower half of auto-transformer(A)\n",
      "\n",
      "#Calculation\n",
      "S_T1 = (V_pa*I_1a+V_2a*I_1a)/1000          #Total kVA transfer in step-down mode\n",
      "S_T2 = (V_s*I_2b+V_1b*I_2b)/1000           #Total kVA transfer in step-up mode\n",
      "S_x_former_c = V_pa*I_1a/1000              #kVA rating of th autotransformer in Fig.14-27a\n",
      "V_1 = V_pa\n",
      "S_x_former_d = V_1*Ic_b/1000               #kVA rating of th autotransformer in Fig.14-26b\n",
      "\n",
      "#Result\n",
      "print('Case(a): Total kVA transfer in step-down mode , S_T = %.1f kVA transferred' %S_T1)\n",
      "print('Case(b): Total kVA transfer in step-up mode , S_T = %.1f kVA transferred' %S_T2)\n",
      "print('Case(c): kVA rating of the autotransformer in Fig.14-27a , S_x-former = %.f kVA' %S_x_former_c)\n",
      "print('Case(d): kVA rating of the autotransformer in Fig.14-26b , S_x-former = %.f kVA' %S_x_former_d)\n",
      "print('Case(e): Both transformers have the same kVA rating of 1 kVA since the same autotransformer is used in both parts.')\n",
      "print('         Both transformers transform a total of 1 KVA. But the step-down transformer in part(a) conducts only 0.1 kVA')\n",
      "print('         while the step-up transformer in the part(b) conducts 10 kVA from the primary to the secondary')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Total kVA transfer in step-down mode , S_T = 1.1 kVA transferred\n",
        "Case(b): Total kVA transfer in step-up mode , S_T = 11.0 kVA transferred\n",
        "Case(c): kVA rating of the autotransformer in Fig.14-27a , S_x-former = 1 kVA\n",
        "Case(d): kVA rating of the autotransformer in Fig.14-26b , S_x-former = 1 kVA\n",
        "Case(e): Both transformers have the same kVA rating of 1 kVA since the same autotransformer is used in both parts.\n",
        "         Both transformers transform a total of 1 KVA. But the step-down transformer in part(a) conducts only 0.1 kVA\n",
        "         while the step-up transformer in the part(b) conducts 10 kVA from the primary to the secondary\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.31, Page number 535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "S = 500.0         #kVA rating of the distribution transformer\n",
      "V_1 = 2300.0      #Primary voltage(V)\n",
      "V_2 = 208.0       #Secondary voltage(V)\n",
      "f = 60.0          #Frequency(Hz)\n",
      "P_sc = 8200.0     #Wattmeter reading in SC test(W)\n",
      "I_sc = 217.4      #Short circuit current(A)\n",
      "V_sc = 95.0       #Short circuit voltage(V)\n",
      "P_oc = 1800.0     #Wattmeter reading in OC test(W)\n",
      "I_oc = 85.0       #Open circuit current(A)\n",
      "V_oc = 208.0      #Open circuit voltage(V)\n",
      "LF1 = 0.2         #Load fraction \n",
      "LF2 = 0.4         #Load fraction \n",
      "LF3 = 0.8         #Load fraction \n",
      "LF4 = 1.25        #Load fraction \n",
      "PF1 = 0.7         #Power factor\n",
      "PF2 = 0.8         #Power factor\n",
      "PF3 = 0.9         #Power factor\n",
      "PF_fl = 1.0       #Power factor\n",
      "PF4 = 0.85        #Power factor\n",
      "t1 = 4.0          #Period of operation(hours)\n",
      "t2 = 4.0          #Period of operation(hours)\n",
      "t3 = 6.0          #Period of operation(hours)\n",
      "t_fl = 6.0        #Period of operation(hours)\n",
      "t4 = 2.0          #Period of operation(hours)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "t = 24.0                                          #Hours in a day\n",
      "P_c  = P_oc                                       #Wattmeter reading(W). OC test\n",
      "W_c = (P_c*t)/1000                                #Core loss over 24 hour period(kWh)\n",
      "#Case(b)\n",
      "Psc = P_sc/1000                                   #Wattmeter reading(W). SC test\n",
      "P_loss_1 = (LF1**2)*Psc                           #Power loss for 20% Load(kW)\n",
      "P_loss_2 = (LF2**2)*Psc                           #Power loss for 40% Load(kW)\n",
      "P_loss_3 = (LF3**2)*Psc                           #Power loss for 80% Load(kW)\n",
      "P_loss_fl = Psc                                   #Power loss for 100% Load(kW)\n",
      "P_loss_4 = (LF4**2)*Psc                           #Power loss for 125% Load(kW)\n",
      "energy_loss1 = P_loss_1*t1                        #Enegry loss for 20% Load(kWh)\n",
      "energy_loss2 = P_loss_2*t2                        #Enegry loss for 40% Load(kWh)\n",
      "energy_loss3 = P_loss_3*t3                        #Enegry loss for 80% Load(kWh)\n",
      "energy_loss_fl = P_loss_fl*t_fl                   #Enegry loss for 100% Load(kWh)\n",
      "energy_loss4 = P_loss_4*t4                        #Enegry loss for 125% Load(kWh)\n",
      "W_loss_total = energy_loss1+energy_loss2+energy_loss3+energy_loss_fl+energy_loss4 #Total energy loss(kWh)\n",
      "#Case(c)\n",
      "P_1 = LF1*S*PF1                                   #Power output for 20% load(kW)\n",
      "P_2 = LF2*S*PF2                                   #Power output for 40% load(kW)\n",
      "P_3 = LF3*S*PF3                                   #Power output for 80% load(kW)\n",
      "P_fl = S*PF_fl                                    #Power output for 100% load(kW)\n",
      "P_4 = LF4*S*PF4                                   #Power output for 125% load(kW)\n",
      "Energy_1 = P_1*t1                                 #Energy delivered for 20% load(kWh)\n",
      "Energy_2 = P_2*t2                                 #Energy delivered for 40% load(kWh)\n",
      "Energy_3 = P_3*t3                                 #Energy delivered for 80% load(kWh)\n",
      "Energy_fl = P_fl*t_fl                             #Energy delivered for 100% load(kWh)\n",
      "Energy_4 = P_4*t4                                 #Energy delivered for 125% load(kWh)\n",
      "W_out_total = Energy_1+Energy_2+Energy_3+Energy_fl+Energy_4    #Total energy delivered in 24hrs(kwh)\n",
      "#Case(d)\n",
      "n = W_out_total/(W_out_total+W_c+W_loss_total)*100 #All-day efficiency(%)\n",
      "\n",
      "#Result\n",
      "print('case(a): Core loss over the 24 hour period , W_c = P_c*t = %.1f kWh' %W_c)\n",
      "print('Case(b): Total energy loss over the 24 hour period = %.2f kWh' %W_loss_total)\n",
      "print('Case(c): Total energy output over the 24 hour period = %.f kWh' %W_out_total)\n",
      "print('Case(d): All-day efficiency = %.1f percent' %n)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "case(a): Core loss over the 24 hour period , W_c = P_c*t = 43.2 kWh\n",
        "Case(b): Total energy loss over the 24 hour period = 112.87 kWh\n",
        "Case(c): Total energy output over the 24 hour period = 7142 kWh\n",
        "Case(d): All-day efficiency = 97.9 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.32, Page number 540"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "S_1 = 10.0        #VA rating of small transformer\n",
      "V = 115.0         #Voltage rating of transformer(V)\n",
      "V_2_1 = 6.3       #Voltage rating of one part of secondary winding(V)\n",
      "V_2_2 = 5.0       #Voltage rating of other part of secondary winding(V)\n",
      "Z_2_1 = 0.2       #Impedance of one part of secondary winding(ohm)\n",
      "Z_2_2 = 0.15      #Impedance of other part of secondary winding(ohm)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "V_2 = V_2_1+V_2_2                  #Voltage across secondary winding(V)\n",
      "I_2 = S_1/V_2                      #Rated secondary current when the LV secondaries are connected in series-aiding(A)\n",
      "#Case(b)\n",
      "I_c = (V_2_1-V_2_2)/(Z_2_1+Z_2_2)  #Circulating current when LV windings are paralled(A)\n",
      "percent_overload = (I_c/I_2)*100   #Percent overload produced\n",
      "\n",
      "#Result\n",
      "print('Case(a): Rated secondary current when the low-voltage secondaries are connected series-aiding , I_2 = %.3f A' %I_2)\n",
      "print('Case(b): Circulating current when LV windings are paralled , I_c = %.2f A' %I_c)\n",
      "print('         Percent overload produced = %.f percent' %percent_overload)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Rated secondary current when the low-voltage secondaries are connected series-aiding , I_2 = 0.885 A\n",
        "Case(b): Circulating current when LV windings are paralled , I_c = 3.71 A\n",
        "         Percent overload produced = 420 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.33, Page number 541"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "S = 20.0         #kVA rating of transformer\n",
      "N_1 = 230.0      #Number of primary turns\n",
      "N_2 = 20.0       #Number of secondary turns\n",
      "V_1 = 230.0      #Primary voltage(V)\n",
      "V_2 = 20.0       #Secondary voltage(V)\n",
      "V_sc = 4.5       #Short circuit voltage(V)\n",
      "I_sc = 87.0      #Short circuit current(A)\n",
      "P_sc = 250.0     #Power measured(W)\n",
      "\n",
      "#Calculation\n",
      "V_h = V_sc                  #Short circuit voltage on HV side(V)\n",
      "I_h = I_sc                  #Short circuit current on HV side(A)\n",
      "Z_eh = V_h/I_h              #Equivalent impedance reffered to the high side when coils are series connected(ohm)\n",
      "Z_el = Z_eh*(N_2/N_1)**2    #Equivalent impedance reffered to the low side when coils are series connected(ohm)\n",
      "I_2_rated = (S*1000)/V_2    #Rated secondary current when coils are series connected(A)\n",
      "I_2_sc = S/Z_el             #Secondary current when coils in Fig.14-31a are short-circuited with rated voltage applied to HV side(A)\n",
      "percent_overload = (I_2_sc/I_2_rated)*100  #Percent overload\n",
      "\n",
      "#Result\n",
      "print('Case(a): Equivalent impedance reffered to the high side when coils are series-connected , Z_eh = %.4f ohm' %Z_eh)\n",
      "print('Case(b): Equivalent impedance reffered to the low side when coils are series connected , Z_el = %.2e ohm' %Z_el)\n",
      "print('Case(c): Rated secondary current when coils are series connected , I_2(rated) = %.e A' %I_2_rated)\n",
      "print('Case(d): Secondary current when coils in Fig.14-31a are short-circuited with rated voltage applied to HV side , I_2(sc) = %.1e A' %I_2_sc)\n",
      "print('         Percent overload produced = %.f percent' %percent_overload)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Equivalent impedance reffered to the high side when coils are series-connected , Z_eh = 0.0517 ohm\n",
        "Case(b): Equivalent impedance reffered to the low side when coils are series connected , Z_el = 3.91e-04 ohm\n",
        "Case(c): Rated secondary current when coils are series connected , I_2(rated) = 1e+03 A\n",
        "Case(d): Secondary current when coils in Fig.14-31a are short-circuited with rated voltage applied to HV side , I_2(sc) = 5.1e+04 A\n",
        "         Percent overload produced = 5114 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.34, Page number 548"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I_L = 100.0            #Load current(A)\n",
      "cos_theta = 0.7        #Power factor lagging\n",
      "S = 60.0               #kVA rating of transformer\n",
      "V_1 = 2300.0           #Primary voltage(V)\n",
      "V_2 = 230.0            #Secondary voltage(V)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "V_L = 230.0                                #Voltage across load(V)\n",
      "P_T = (3**0.5*V_L*I_L*cos_theta)/1000      #Power consumed by the plant(kW)\n",
      "kVA_T = P_T/cos_theta                      #Apparent power(kVA)\n",
      "#Case(b)\n",
      "kVA = S                                    #kVA rating of transformer\n",
      "V_p = V_2                                  #Phase voltage(V). delta-connection on load side\n",
      "I_P2_rated = (kVA*1000)/(3*V_p)            #Rated secondary phase current(A)\n",
      "I_L2_rated = 3**0.5*I_P2_rated             #Rated secondary line current(A)\n",
      "#Case(c)\n",
      "percent_load = I_L/I_L2_rated*100          #Percent load on each transformer   \n",
      "#Case(d)\n",
      "V_L_d = 2300.0\n",
      "I_P1 = (kVA_T*1000)/(3**0.5*V_L_d)         #Primary phase current(A)\n",
      "I_L1 = I_P1                                #Primary line current(A). Y-connection\n",
      "#Case(e)\n",
      "kVA_transformer = kVA/3                    #kVA rating of each transformer\n",
      "\n",
      "#Result\n",
      "print('Case(a): Power consumed by the plant , P_T = %.1f kW' %P_T)\n",
      "print('         Apparent power , kVA_T = %.1f kVA' %kVA_T)\n",
      "print('Case(b): Rated secondary phase current of transformer bank , I_P2(rated) = %.f A' %I_P2_rated)\n",
      "print('         Rated secondary line current of transformer bank , I_L2(rated) = %.1f A' %I_L2_rated)\n",
      "print('Case(c): Percent load on each transformer = %.1f percent' %percent_load)\n",
      "print('Case(d): Primary phase current drawn by each transformer , I_P1 = %.f A' %I_P1)\n",
      "print('         Primary line current drawn by each transformer , I_L1 = %.f A' %I_L1)\n",
      "print('Case(e): kVA rating of each transformer = %.f kVA' %kVA_transformer)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Power consumed by the plant , P_T = 27.9 kW\n",
        "         Apparent power , kVA_T = 39.8 kVA\n",
        "Case(b): Rated secondary phase current of transformer bank , I_P2(rated) = 87 A\n",
        "         Rated secondary line current of transformer bank , I_L2(rated) = 150.6 A\n",
        "Case(c): Percent load on each transformer = 66.4 percent\n",
        "Case(d): Primary phase current drawn by each transformer , I_P1 = 10 A\n",
        "         Primary line current drawn by each transformer , I_L1 = 10 A\n",
        "Case(e): kVA rating of each transformer = 20 kVA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.35, Page number 548"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I_L = 100.0            #Load current(A)\n",
      "cos_theta = 0.7        #Power factor lagging\n",
      "S = 60.0               #kVA rating of transformer\n",
      "V_1 = 2300.0           #Primary voltage(V)\n",
      "V_2 = 230.0            #Secondary voltage(V)\n",
      "\n",
      "#Calculation\n",
      "#Case(a)\n",
      "V_L = 230.0                                #Voltage across load(V)\n",
      "P_T = (3**0.5*V_L*I_L*cos_theta)/1000      #Power consumed by the plant(kW)\n",
      "kVA_T = P_T/cos_theta                      #Apparent power(kVA)\n",
      "#Case(b)\n",
      "kVA = S                                    #kVA rating of transformer\n",
      "V_p = V_2                                  #Phase voltage(V)\n",
      "I_P2_rated = (kVA*1000)/(3*V_p)            #Rated secondary phase current(A)\n",
      "I_L2_rated = 3**0.5*I_P2_rated             #Rated secondary line current(A)\n",
      "#Case(c)\n",
      "percent_load = I_L/I_L2_rated*100          #Percent load on each transformer   \n",
      "#Case(d)\n",
      "V_L_d = 2300.0\n",
      "I_P1 = (kVA_T*1000)/(3**0.5*V_L_d)         #Primary phase current(A)\n",
      "I_L1 = 3**0.5*I_P1                         #Primary line current(A)\n",
      "#Case(e)\n",
      "kVA_transformer = kVA/3                    #kVA rating of each transformer\n",
      "\n",
      "#Result\n",
      "print('Case(a): Power consumed by the plant , P_T = %.1f kW' %P_T)\n",
      "print('         Apparent power , kVA_T = %.1f kVA' %kVA_T)\n",
      "print('Case(b): Rated secondary phase current of transformer bank , I_P2(rated) = %.f A' %I_P2_rated)\n",
      "print('         Rated secondary line current of transformer bank , I_L2(rated) = %.1f A' %I_L2_rated)\n",
      "print('Case(c): Percent load on each transformer = %.1f percent' %percent_load)\n",
      "print('Case(d): Primary phase current drawn by each transformer , I_P1 = %.f A' %I_P1)\n",
      "print('         Primary line current drawn by each transformer , I_L1 = %.1f A' %I_L1)\n",
      "print('         Primary line current drawn by a \u0394-\u0394 bank is \u221a3 times the line current drawn by a Y-\u0394 bank')\n",
      "print('Case(e): kVA rating of each transformer = %.f kVA' %kVA_transformer)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Power consumed by the plant , P_T = 27.9 kW\n",
        "         Apparent power , kVA_T = 39.8 kVA\n",
        "Case(b): Rated secondary phase current of transformer bank , I_P2(rated) = 87 A\n",
        "         Rated secondary line current of transformer bank , I_L2(rated) = 150.6 A\n",
        "Case(c): Percent load on each transformer = 66.4 percent\n",
        "Case(d): Primary phase current drawn by each transformer , I_P1 = 10 A\n",
        "         Primary line current drawn by each transformer , I_L1 = 17.3 A\n",
        "         Primary line current drawn by a \u0394-\u0394 bank is \u221a3 times the line current drawn by a Y-\u0394 bank\n",
        "Case(e): kVA rating of each transformer = 20 kVA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.36, Page number 554"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "V_L = 33.0                #Line voltage(kV)\n",
      "f = 60.0                  #Frequency(Hz)\n",
      "PF1 = 1.0                 #Unity power factor for I_AB\n",
      "PF2 = 0.7                 #Lagging power factor for I_BC\n",
      "PF3 = 0.9                 #Leading power factor for I_CA\n",
      "IAB = 10.0                #Magnitude of I_AB(kA)\n",
      "IBC = 15.0                #Magnitude of I_BC(kA)\n",
      "ICA = 12.0                #Magnitude of I_CA(kA)\n",
      "\n",
      "#Calculation\n",
      "V_AB = V_L*cmath.exp(1j*0*math.pi/180)                 #Line voltage taken as reference voltage(kV)\n",
      "V_AB_a = cmath.phase(V_AB)*180/math.pi                 #Voltage angle(degree)\n",
      "V_BC = V_L*cmath.exp(1j*-120*math.pi/180)              #Line voltage(kV)\n",
      "V_BC_a = cmath.phase(V_BC)*180/math.pi                 #Voltage angle(degree)\n",
      "V_CA = V_L*cmath.exp(1j*120*math.pi/180)               #Line voltage(kV)\n",
      "V_CA_a = cmath.phase(V_CA)*180/math.pi                 #Voltage angle(degree)\n",
      "theta_1 = math.acos(PF1)*180/math.pi                   #PF1 angle(degree)\n",
      "theta_2 = math.acos(PF2)*180/math.pi                   #PF2 angle(degree)\n",
      "theta_3 = math.acos(PF3)*180/math.pi                   #PF3 angle(degree)\n",
      "I_AB = IAB*cmath.exp(1j*(theta_1)*math.pi/180)         #Current(kA)\n",
      "I_BC = IBC*cmath.exp(1j*(V_BC_a-theta_2)*math.pi/180)  #Current(kA)\n",
      "I_CA = ICA*cmath.exp(1j*(V_CA_a+theta_3)*math.pi/180)  #Current(kA)\n",
      "#Case(a)\n",
      "I_AC = -I_CA\n",
      "I_A = I_AB+I_AC                         #Phase current(kA)\n",
      "I_A_m = abs(I_A)                        #Magnitude of I_A(kA)\n",
      "I_A_a = cmath.phase(I_A)*180/math.pi    #Phase angle of I_A(degrees)\n",
      "#Case(b)\n",
      "I_BA = -I_AB\n",
      "I_B = I_BC+I_BA                         #Phase current(kA)\n",
      "I_B_m = abs(I_B)                        #Magnitude of I_B(kA)\n",
      "I_B_a = cmath.phase(I_B)*180/math.pi    #Phase angle of I_B(degrees)\n",
      "#Case(c)\n",
      "I_CB = -I_BC\n",
      "I_C = I_CA+I_CB                         #Phase current(kA)\n",
      "I_C_m = abs(I_C)                        #Magnitude of I_C(kA)\n",
      "I_C_a = cmath.phase(I_C)*180/math.pi    #Phase angle of I_C(degrees)\n",
      "#Case(d)\n",
      "phasor_sum = I_A+I_B+I_C                #Phasor sum of line currents\n",
      "\n",
      "#Result\n",
      "print('Case(a): Current in line A , I_A = %.2f\u2220%.2f\u00b0 kA' %(I_A_m,I_A_a))\n",
      "print('Case(b): Current in line B , I_B = %.2f\u2220%.2f\u00b0 kA' %(I_B_m,I_B_a))\n",
      "print('Case(c): Current in line C , I_C = %.2f\u2220%.2f\u00b0 kA' %(I_C_m,I_C_a))\n",
      "print('Case(d): Phasor sum of line currents , \u03a3I_L = (%.f+j%.f) ' %(phasor_sum.real,phasor_sum.imag))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Current in line A , I_A = 21.04\u2220-18.68\u00b0 kA\n",
        "Case(b): Current in line B , I_B = 24.81\u2220-171.34\u00b0 kA\n",
        "Case(c): Current in line C , I_C = 11.44\u222066.30\u00b0 kA\n",
        "Case(d): Phasor sum of line currents , \u03a3I_L = (-0+j0) \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.37, Page number 556"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "kVA_1 = 20.0     #kVA rating of transformer 1\n",
      "kVA_2 = 20.0     #kVA rating of transformer 2\n",
      "kVA_3 = 20.0     #kVA rating of transformer 3\n",
      "V_1 = 2300.0     #Primary voltage(V)\n",
      "V_2 = 230.0      #Secondary voltage(V)\n",
      "kVA = 40.0       #kVA supplied by the bank\n",
      "PF = 0.7         #Lagging power factor at which bank supplies kVA\n",
      "\n",
      "#Calculation\n",
      "kVA_transformer = kVA/3**0.5                          #kVA load carried by each transformer\n",
      "percent_ratedload_Tr = kVA_transformer/kVA_1*100      #Percent load carried by each transformer\n",
      "kVA_V_V = 3**0.5*kVA_1                                #Total kVA rating of the transformer bank in V-V\n",
      "ratio_banks = kVA_V_V/(kVA_1+kVA_2+kVA_3)*100         #Ratio of V-V bank to \u0394-\u0394 bank transformer ratings\n",
      "kVA_Tr = kVA/3 \n",
      "percent_increase_load = kVA_transformer/kVA_Tr*100    #Percent increase in load on each transformer when one transformer is removed\n",
      "\n",
      "#Result\n",
      "print('Case(a): kVA load carried by each transformer = %.1f kVA/transformer' %kVA_transformer)\n",
      "print('Case(b): Percent rated load carried by each transformer = %.1f percent' %percent_ratedload_Tr)\n",
      "print('Case(c): Total kVA rating of the transformer bank in V-V = %.2f kVA' %kVA_V_V)\n",
      "print('Case(d): Ratio of V-V bank to \u0394-\u0394 bank transformer ratings = %.1f percent' %ratio_banks)\n",
      "print('Case(e): Percent increase in load on each transformer when one transformer is removed = %.1f percent' %percent_increase_load)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): kVA load carried by each transformer = 23.1 kVA/transformer\n",
        "Case(b): Percent rated load carried by each transformer = 115.5 percent\n",
        "Case(c): Total kVA rating of the transformer bank in V-V = 34.64 kVA\n",
        "Case(d): Ratio of V-V bank to \u0394-\u0394 bank transformer ratings = 57.7 percent\n",
        "Case(e): Percent increase in load on each transformer when one transformer is removed = 173.2 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.38, Page number 562"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V = 440.0           #Rated voltage of SCIM(V)\n",
      "hp = 100.0          #Rated power of SCIM(hp)\n",
      "PF = 0.8            #Power factor\n",
      "V_1 = 155.0         #Primary voltage of transformer(V)\n",
      "V_2 = 110.0         #Secondary voltage of transformer(V)\n",
      "V_a = 110.0         #Armature voltage(V)\n",
      "V_L = 440.0         #Load voltage(V)\n",
      "n = 0.98            #Efficiency of the transformer\n",
      "\n",
      "#Calculation\n",
      "I_L = 124*1.25                          #Motor line current(A). Appendix A-3\n",
      "alpha = V_a/V_L                         #Transformation ratio\n",
      "I_a = (3**0.5/2)*(I_L/(alpha*n))        #Current in the primary of the scott transformers(A)\n",
      "kVA = (V_a*I_a)/((3**0.5/2)*1000)       #kVA rating of the main and teaser transformers\n",
      "\n",
      "#Result\n",
      "print('Case(a): Motor line current , I_L = %.f A' %I_L)\n",
      "print('Case(b): Transformation ratio , \u03b1 = N_1/N_2 = V_a/V_L = %.2f ' %alpha)\n",
      "print('Case(c): Current in the primary of the scott transformers , I_a = %.f A' %I_a)\n",
      "print('Case(d): kVA rating of the main and teaser transformers , kVA = %.1f kVA' %kVA)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Motor line current , I_L = 155 A\n",
        "Case(b): Transformation ratio , \u03b1 = N_1/N_2 = V_a/V_L = 0.25 \n",
        "Case(c): Current in the primary of the scott transformers , I_a = 548 A\n",
        "Case(d): kVA rating of the main and teaser transformers , kVA = 69.6 kVA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.39, Page number 570"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I_L = 1.0       #Load current(kA)\n",
      "V_m = 750.0     #Peak voltage(kV)\n",
      "\n",
      "#Calculation\n",
      "V_L = (V_m)/2**0.5           #Maximum allowable rms voltagethat may be applied to the lines using ac(kV)\n",
      "S_T_ac = 3**0.5*V_L*I_L      #Total 3-phase apparent power(MVA)\n",
      "I_rms = I_L                  #rms value of load current(kA)\n",
      "I_dc =I_rms*2**0.5           #Maximum allowable current that can be delivered by dc transmission(kA)\n",
      "V_dc = V_m                   #dc voltage(kV)\n",
      "S_T_dc = V_dc*I_dc           #Total dc apparent power delivered by two lines(MVA)\n",
      "S_ac_line = S_T_ac/3         #Power per ac line\n",
      "S_dc_line = S_T_dc/2         #Power per dc line\n",
      "\n",
      "#Result\n",
      "print('Case(a): Maximum allowable rms voltage that may be applied to the lines using ac , V_L = %.1f kV' %V_L)\n",
      "print('Case(b): Total 3-phase ac apparent power delivered by three lines , S_T = %.1f MVA' %S_T_ac)\n",
      "print('Case(c): Maximum allowable current that can be delivered by dc transmission , I_dc = %.3f kA' %I_dc)\n",
      "print('Case(d): Total dc apparent power delivered by two lines , S_T = %.1f MVA' %S_T_dc)\n",
      "print('Case(e): Power per ac line , S/ac line = %.1f MVA/line' %S_ac_line)\n",
      "print('Case(f): Power per dc line , S/dc line = %.1f MVA/line' %S_dc_line)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case(a): Maximum allowable rms voltage that may be applied to the lines using ac , V_L = 530.3 kV\n",
        "Case(b): Total 3-phase ac apparent power delivered by three lines , S_T = 918.6 MVA\n",
        "Case(c): Maximum allowable current that can be delivered by dc transmission , I_dc = 1.414 kA\n",
        "Case(d): Total dc apparent power delivered by two lines , S_T = 1060.7 MVA\n",
        "Case(e): Power per ac line , S/ac line = 306.2 MVA/line\n",
        "Case(f): Power per dc line , S/dc line = 530.3 MVA/line\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}