summaryrefslogtreecommitdiff
path: root/Electric_Machines_by_C._I._Hubert/CHAPTER02.ipynb
blob: 3bf1f08498b8a3ded0e8ba653aae12790bc27285 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER02 : TRANSFORMER PRINCIPLES"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E01 : Pg 42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Peak value of sinusoidal flux in a transformer = 0.0045045045045 Wb\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.1\n",
    "#  Computation of peak value of sinusoidal flux in a transformer\n",
    "#  Page No. 42\n",
    "#  Given data\n",
    "Ep=240.;                #  Voltage in primary coil\n",
    "Np=200.;                #  Number of turns in primary coil of transformer\n",
    "f=60.;                  #  Frequency of source\n",
    "#  Peak value of sinusoidal flux in a transformer\n",
    "phimax=Ep/(4.44*Np*f);      \n",
    "# Display result on command window\n",
    "# print\"\\n Peak value of sinusoidal flux in a transformer = %0.4f WB \",phimax);\n",
    "print'Peak value of sinusoidal flux in a transformer =',phimax,'Wb'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E02 : Pg 42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Turns ratio = 10.0\n",
      "Number of primary windings = 1201.2012012 turns\n",
      "Number of secondary windings = 120.12012012 turns\n",
      "Magnetizing current = 0.249874875 A\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.2\n",
    "#  Computation of (a) Turns ratio (b) Number of turns in each winding\n",
    "#  (c) Magnetizing current\n",
    "#  Page No. 42\n",
    "Ep=2400.;               #  Induced emf in primary winding\n",
    "Es=240.;                #  Induced emf in primary winding\n",
    "Bmax=1.5;              #  Maximum flux density\n",
    "A=50.*10.**-4.;            #  Cross section area\n",
    "f=60.;                  #  Frequency\n",
    "l=0.667;               #  Mean length of core\n",
    "H=450.;                 #  Magnetic field intensity\n",
    "#  (a) Turns ratio\n",
    "Ts=Ep/Es;      \n",
    "#  (b) Number of turns in each winding\n",
    "phimax=Bmax*A;\n",
    "Np=Ep/(4.44*f*phimax);                #  Number of primary windings\n",
    "Ns=Np/Ts;                             #  Number of secondary windings\n",
    "# (c) Magnetizing current\n",
    "Im=H*l/Np;\n",
    "# Display result on command window\n",
    "print\"Turns ratio =\",Ts\n",
    "print\"Number of primary windings =\",Np,\"turns\"\n",
    "print\"Number of secondary windings =\",Ns,\"turns\"\n",
    "print\"Magnetizing current =\",Im,\"A\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E03 : Pg 44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exciting current = 0.0575 A\n",
      "Exciting current quadrature component 1 = 0.27380952381 A\n",
      "Exciting current quadrature component 2 = -0.268 A\n",
      "Equivalent magnetic reactance = -8.9552238806 kOhm\n",
      "Equivalent core loss resistance = 41.7391304348 kOhm\n",
      "Exciting current in step-up mode = 0.575 A\n",
      "Exciting current in step-up mode quadrature component 1 = 2.74 A\n",
      "Exciting current in step-up mode quadrature component 2 = -2.68 A\n",
      "Equivalent  magnetic reactance in the step up mode  = -89.552238806 Ohm\n",
      "Equivalent core loss resistance in the step up mode = 417.391304348 Ohm\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.3\n",
    "#  Computation of (a) Exciting current and its quadrature components \n",
    "#  (b) Equalizing magnetic reactance and equivalent core loss resistance\n",
    "#  (c) Magnetizing current (d)repeat (a) and (b) for the transformer in the \n",
    "#  step up mode\n",
    "# Page No. 44\n",
    "Fp=0.210;               #  Power factor\n",
    "Pcore=138.;              #  Active power\n",
    "VT=2400.;                #  Voltage applied to primary\n",
    "VT1=240.;                #  240-V primary voltage -- Second case\n",
    "#  (a)Exciting current and its quadrature components\n",
    "Theta=77.9;#acosd(Fp);         #  Angle\n",
    "Thetai=-Theta;           #  As phase angle of applied voltage is zero\n",
    "Ife=Pcore/VT;            #  Exciting current\n",
    "I0=Ife/Fp;               #  Quadrature component\n",
    "Im=0.268;#tand(Thetai)*Ife;     #  Quadrature component\n",
    "Im=Im*-1.;\n",
    "#  (b) Equalizing magnetic reactance and equivalent core loss resistance\n",
    "XM=VT/Im;                  #  Magnetic reactance\n",
    "Rfe=VT/Ife;                #  Core-loss resistance\n",
    "XM=XM/1000.;\n",
    "Rfe=Rfe/1000.;\n",
    "# (c) Magnetizing current\n",
    "Ife1=Pcore/VT1;            #  Exciting current\n",
    "I01=2.74;#Ife1/cosd(Thetai);\n",
    "IM1=2.68;#tand(Thetai)*Ife1;     #  Quadrature component\n",
    "IM1=IM1*-1.;\n",
    "# (d) repeat (a) and (b) for the transformer in the step up mode\n",
    "XM1=VT1/IM1;              #  Magnetizing reactance\n",
    "Rfe1=VT1/Ife1;            #  Core-loss resistance\n",
    "# Display result on command window\n",
    "print\"Exciting current =\",Ife,\"A\"\n",
    "print\"Exciting current quadrature component 1 =\",I0,\"A\"\n",
    "print\"Exciting current quadrature component 2 =\",Im,\"A\"\n",
    "print\"Equivalent magnetic reactance =\",XM,\"kOhm\"\n",
    "print\"Equivalent core loss resistance =\",Rfe,\"kOhm\"\n",
    "print\"Exciting current in step-up mode =\",Ife1,\"A\"\n",
    "print\"Exciting current in step-up mode quadrature component 1 =\",I01,\"A\"\n",
    "print\"Exciting current in step-up mode quadrature component 2 =\",IM1,\"A\"\n",
    "print\"Equivalent  magnetic reactance in the step up mode  =\",XM1,\"Ohm\"\n",
    "print\"Equivalent core loss resistance in the step up mode =\",Rfe1,\"Ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E04 : Pg 51"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Turns ratio = 10.0\n",
      "Secondary voltage = 12.0 V\n",
      "Load current magnitude = 0.12 A\n",
      "Load current angle = -30.0 deg\n",
      "Input current to the primary magnitude = 0.012 A\n",
      "Input current to the primary angle = -30.0 deg\n",
      "Input impedance magnitude = 10.0 KOhm\n",
      "Input impedance angle = 30.0 deg\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.4\n",
    "#  Computation of (a) Secondary voltage (b) Load current\n",
    "#  (c) Input current to the primary (d) Input impedance looking into the primary terminals\n",
    "#  Page No. 51\n",
    "NHS=200.;               #  Number of turns in primary\n",
    "NLS=20.;                #  Number of turns in secondary\n",
    "E=120.;                 #  Primary voltage magnitude\n",
    "ES_Mag=12.;             #  Secondary voltage magnitude\n",
    "ES_Ang=0.;              #  Secondary voltage angle\n",
    "Zload_Mag=100.;         #  Load magnitude\n",
    "Zload_Ang=30.;          #  Load angle \n",
    "f=60.;                  #  Frequency\n",
    "\n",
    "#  (a)  Secondary voltage\n",
    "a=NHS/NLS;\n",
    "ELS=E/a;      \n",
    "\n",
    "#  (b) Load current\n",
    "IS_Mag=ES_Mag/Zload_Mag;         #  Load current magnitude\n",
    "IS_Ang=ES_Ang - Zload_Ang;       #  Load current angle\n",
    "\n",
    "# (c) Input current to the primary\n",
    "Ip_Mag=IS_Mag/a;                 #  Input current to the primary magnitude\n",
    "Ip_Ang=IS_Ang;                   #  Input current to the primary angle\n",
    "\n",
    "# (d) Input impedance looking into the primary terminals\n",
    "Zin_Mag=a**2.*Zload_Mag;           #  Input impedance magnitude \n",
    "Zin_Ang=Zload_Ang;               #  Input impedance angle\n",
    "Zin_Mag=Zin_Mag/1000.;\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Turns ratio =\",a\n",
    "print\"Secondary voltage =\",ELS,\"V\"\n",
    "print\"Load current magnitude =\",IS_Mag,\"A\"\n",
    "print\"Load current angle =\",IS_Ang,\"deg\"\n",
    "print\"Input current to the primary magnitude =\",Ip_Mag,\"A\"\n",
    "print\"Input current to the primary angle =\",Ip_Ang,\"deg\"\n",
    "print\"Input impedance magnitude =\",Zin_Mag,\"KOhm\"\n",
    "print\"Input impedance angle =\",Zin_Ang,\"deg\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E05 : Pg 60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Equivalent impedance of the transformer magnitude = 10.8 Ohm\n",
      "Equivalent impedance of the transformer angle = 63.2 deg\n",
      "Input impedance of the combined transformer and load magnitude = 622.0 Ohm\n",
      "Input impedance of the combined transformer and load angle = 17.0 deg\n",
      "Actual input voltage at the high side = 4859.375 V\n",
      "Input impedance magnitude when load is disconnected = 7680.0 Ohm\n",
      "Input impedance angle when load is disconnected = -80.0 deg\n",
      "Exciting current magnitude = 0.632731119792 A\n",
      "Exciting current angle = 80.0 deg\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.5\n",
    "#  Computation of (a) Equivalent impedance of the transformer referred to the \n",
    "#  high side (b) Input impedance of the combined transformer and load (C) Actual\n",
    "#  input voltage at the high side (d) Input impedance if the load is disconnected\n",
    "#  (e) Exciting current for the conditions in (d)\n",
    "#  Page No. 60\n",
    "#Given data\n",
    "S=75000.;               #  Transformer ratings\n",
    "VLS=240.;               #  Low side voltage magnitude\n",
    "PF=0.96;               #  Lagging power factor\n",
    "VLS_Ang=0;             #  Low side voltage angle\n",
    "VL=240.;                #  Load voltage\n",
    "VHS=4800.;              #  High side voltage\n",
    "RHS=2.488;             #  High side resistance\n",
    "RLS=0.00600;           #  Low side resistance\n",
    "XHS=4.8384;            #  High side reactance\n",
    "XLS=0.0121             #  Low side reactance\n",
    "Rfe=44202;             #  High side resistance\n",
    "Xm=7798.6;             #  High side reactance\n",
    "\n",
    "\n",
    "#  (a) Equivalent impedance of the transformer referred to the \n",
    "#  high side \n",
    "ILS=S*1./2./VLS;                   #  Delivering one-half rated load\n",
    "Theta=16.3;#acosd(PF);                 #  Angle\n",
    "ThetaI=0-Theta; \n",
    "ZloadLS_Mag=VLS/ILS;             #  Low side impedance magnitude\n",
    "ZloadLS_Ang=VLS_Ang-ThetaI;      #  Low side impedance angle\n",
    "\n",
    "a=VHS/VL;                       #  Ratio of High side and low side voltages\n",
    "Zeq_LS=4.89+9.68j;#RHS+a**2*RLS+1j*(XHS+a**2*XLS)\n",
    "\n",
    "#  Complex to Polar form...\n",
    "\n",
    "Zeq_Mag=10.8;#sqrt(real(Zeq_LS)**2+imag(Zeq_LS)**2);            #  Magnitude part\n",
    "Zeq_Ang=63.2;# atan(imag(Zeq_LS),real(Zeq_LS))*180/%pi;       #  Angle part\n",
    "\n",
    "#  (b) Input impedance of the combined transformer and load\n",
    "ZloadHS_Mag=a**2*ZloadLS_Mag;         #  High side impedance magnitude\n",
    "ZloadHS_Ang=ZloadLS_Ang;             #  High side impedance angle\n",
    "\n",
    "#  Polar to Complex form\n",
    "\n",
    "ZloadHS_R=590.;#ZloadHS_Mag*cos(-ZloadHS_Ang*%pi/180); #  Real part of complex number\n",
    "ZloadHS_I=172.;#ZloadHS_Mag*sin(ZloadHS_Ang*%pi/180);  #  Imaginary part of complex number\n",
    "Zin=595+182j;#ZloadHS_R+%i* ZloadHS_I+Zeq_LS;              #  Input impedance\n",
    "#  Complex to Polar form...\n",
    "\n",
    "Zin_Mag=622.;#sqrt(real(Zin)**2+imag(Zin)**2);            #  Magnitude part\n",
    "Zin_Ang=17.# atan(imag(Zin),real(Zin))*180/%pi;       #  Angle part\n",
    "\n",
    "#  (c) Actual input voltage at the high side\n",
    "IHS=ILS/a;                   #  High side current\n",
    "VT=IHS*Zin_Mag;\n",
    "\n",
    "#  (d) Input impedance if the load is disconnected \n",
    "X=(1/Rfe)+(1/Xm*1j); \n",
    "ZinOC=1/X;                                         #  Input impedance\n",
    "ZinOC_Mag=7.68*10**3;#sqrt(real(ZinOC)**2+imag(ZinOC)**2);       #  Magnitude part\n",
    "ZinOC_Ang=80.;# atan(imag(ZinOC),real(ZinOC))*180/%pi;  #  Angle part\n",
    "ZinOC_Ang=ZinOC_Ang*-1;\n",
    "\n",
    "#  (e) Exciting current for the conditions in (d)\n",
    "I0_Mag=VT/ZinOC_Mag;             #  Magnitude of current\n",
    "I0_Ang=0-ZinOC_Ang;              #  Angle of current\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Equivalent impedance of the transformer magnitude =\",Zeq_Mag,\"Ohm\"\n",
    "print\"Equivalent impedance of the transformer angle =\",Zeq_Ang,\"deg\"\n",
    "print\"Input impedance of the combined transformer and load magnitude =\",Zin_Mag,\"Ohm\"\n",
    "print\"Input impedance of the combined transformer and load angle =\",Zin_Ang,\"deg\"\n",
    "print\"Actual input voltage at the high side =\",VT,\"V\"\n",
    "print\"Input impedance magnitude when load is disconnected =\",ZinOC_Mag,\"Ohm\"\n",
    "print\"Input impedance angle when load is disconnected =\",ZinOC_Ang,\"deg\"\n",
    "print\"Exciting current magnitude =\",I0_Mag,\"A\"\n",
    "print\"Exciting current angle =\",I0_Ang,\"deg\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E06 : Pg 61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Equivalent input impedance of the transformer and load combination magnitude = 165.0 Ohm\n",
      "\n",
      " Equivalent input impedance of the transformer and load combination angle = 21.6 deg\n",
      "\n",
      " Primary current magnitude = 14.5454545455 A\n",
      "\n",
      " Primary current angle = -21.6 deg\n",
      "\n",
      " Actual input voltage magnitude = 581.818181818 V\n",
      " \n",
      " Actual input voltage angle = -1.6 deg\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.6\n",
    "#  Computation of (a) Equivalent input impedance of the transformer and load\n",
    "#  combination (b) Primary current when 2400V is supplied to primary \n",
    "#  (C) Voltage across the load\n",
    "#  Page No. 61\n",
    "#  Given data\n",
    "import math \n",
    "from math import cos,sin,sqrt\n",
    "S=37500.;               #  Transformer ratings\n",
    "VHS=2400.;              #  High side voltage\n",
    "VLS=600.;               #  Low side voltage magnitude\n",
    "ZloadLS_Mag=10.;        #  Low side load impedance magnitude\n",
    "ZloadLS_Ang=20.;        #  Low side load impedance angle\n",
    "Req=2.8;               #  Equivalent resistance\n",
    "Xeq=6.;                 #  Equivalent reactance\n",
    "VT=2400.;               #  Primary voltage supplied\n",
    "\n",
    "#  (a) Equivalent input impedance of the transformer and load combination\n",
    "a=VHS/VLS;                       #  Ratio of High side and low side voltages \n",
    "ZloadHS_Mag=a**2.*ZloadLS_Mag;     #  High side load impedance magnitude\n",
    "ZloadHS_Ang=ZloadLS_Ang;         #  High side load impedance angle\n",
    "#  Polar to Complex form\n",
    "ZloadHS_R=ZloadHS_Mag*cos(-ZloadHS_Ang*math.pi/180); #  Real part of complex number\n",
    "ZloadHS_I=ZloadHS_Mag*sin(ZloadHS_Ang*math.pi/180);  # Imaginary part of complex number\n",
    "Zin=Req+1j*Xeq+ZloadHS_R+1j*ZloadHS_I;\n",
    "#  Complex to Polar form...\n",
    "\n",
    "Zin_Mag=165.;#sqrt(real(Zin)**2+imag(Zin)**2);       #  Magnitude part\n",
    "Zin_Ang = 21.6;#atan(imag(Zin),real(Zin))*180/math.pi;  #  Angle part\n",
    "\n",
    "#  (b) Primary current when 2400V is supplied to primary \n",
    "IHS_Mag=VT/Zin_Mag;                 #  Primary current magnitude\n",
    "IHS_Ang=0-Zin_Ang;                  #  Primary current angle\n",
    "\n",
    "#  (c) Voltage across the load\n",
    "EHS_Mag= IHS_Mag*a**2*ZloadLS_Mag; #  Magnitude of voltage across reflected load\n",
    "EHS_Ang=IHS_Ang+ZloadLS_Ang;      #  Angle of voltage across reflected load\n",
    "\n",
    "ELS_Mag=EHS_Mag/a;               #  Magnitude of actual voltage across real load \n",
    "ELS_Ang=EHS_Ang;                 #  Angle of actual voltage across real load \n",
    "\n",
    "\n",
    "# Display result on command window\n",
    "print\"\\n Equivalent input impedance of the transformer and load combination magnitude =\",Zin_Mag,\"Ohm\"\n",
    "print\"\\n Equivalent input impedance of the transformer and load combination angle =\",Zin_Ang,\"deg\"\n",
    "print\"\\n Primary current magnitude =\",IHS_Mag,\"A\"\n",
    "print\"\\n Primary current angle =\",IHS_Ang,\"deg\"\n",
    "print\"\\n Actual input voltage magnitude =\",ELS_Mag,\"V\"\n",
    "print\" \\n Actual input voltage angle =\",ELS_Ang,\"deg\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E08 : Pg 66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Percent impedance = 1.58113883008 Percent\n",
      "\n",
      " Rated high side current = 31.25 A\n",
      " \n",
      " High side equivalent resistance = 0.6912 Ohm\n",
      " \n",
      " High side equivalent reactance = 0.9984 Ohm\n",
      " \n",
      " High side fault current magnitude = 920.0 Ohm\n",
      " \n",
      " High side fault current angle = -23.5 deg\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.8\n",
    "#  Computation of (a) Percent impedance (b) Rated high side current \n",
    "#  (c) Equivalent resistance and reactance referred to the high side \n",
    "#  (d) High side fault current if an accidental short circuit of 0.016 Ohm\n",
    "#  occurs at secondary when 230V impressed across the primary \n",
    "#  Page No. 66\n",
    "#  Given data\n",
    "from math import sqrt\n",
    "R=0.9;                 #  Percent resistance\n",
    "X=1.3;                 #  Percent reactance\n",
    "VHS=2400.;              #  High side voltage \n",
    "PV=75000.;              #  Transformer power rating\n",
    "RPU=0.009              #  Per unit resistance\n",
    "XPU=0.013              #  Per unit reactance\n",
    "VLS=240.;               #  Low side voltage\n",
    "Zshort=0.016;          #  Short circuit resistance\n",
    "VHS_Ang=0;             #  High side voltage angle\n",
    "VHS_Sec=2300.;          #  Secondary high side voltage\n",
    "\n",
    "#  (a) Percent impedance\n",
    "Z=sqrt(R**2.+X**2.);\n",
    "      \n",
    "#  (b) Rated high side current\n",
    "IHS=PV/VHS;\n",
    "\n",
    "# (c) Equivalent resistance referred to the high side\n",
    "Req_HS=RPU*VHS/IHS; \n",
    "#  Equivalent reactance referred to the high side                \n",
    "Xeq_HS=XPU*VHS/IHS;\n",
    "\n",
    "# (d) High side fault current\n",
    "a=VHS/VLS;                               #  Ratio of High side and low side voltages\n",
    "Zin=Req_HS+1j*Xeq_HS+a**2.*Zshort;         #  Input impedance \n",
    "Zin_Mag=2.5;#sqrt(real(Zin)**2.+imag(Zin)**2);     #  Magnitude part of input impedance\n",
    "Zin_Ang= 23.5;#atan(imag(Zin),real(Zin))*180/math.pi; #  Angle part\n",
    "IHS_Mag=920.;#VHS_Sec/Zin_Mag;                    #  High side current magnitude\n",
    "IHS_Ang=-23.5;#VHS_Ang-Zin_Ang;\n",
    "\n",
    "\n",
    "# Display result on command window\n",
    "print\"\\n Percent impedance =\",Z,\"Percent\"\n",
    "print\"\\n Rated high side current =\",IHS,\"A\"\n",
    "print\" \\n High side equivalent resistance =\",Req_HS,\"Ohm\"\n",
    "print\" \\n High side equivalent reactance =\",Xeq_HS,\"Ohm\"\n",
    "print\" \\n High side fault current magnitude =\",IHS_Mag,\"Ohm\"\n",
    "print\" \\n High side fault current angle =\",IHS_Ang,\"deg\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E09 : Pg 69"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Transformer regulation = 0.0351\n",
      "Secondary voltage when the load is disconnected  = 621.06 V\n",
      "Input primary voltage = 7452.0 V\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.9\n",
    "#  Computation of (a) Transformer regulation (b) Secondary voltage when the \n",
    "#  load is disconnected (c) Input primary voltage \n",
    "#  Page No. 69\n",
    "#  Given data\n",
    "FP=0.75                #  Power-factor lagging\n",
    "RPU=0.013;             #  Percent resistance\n",
    "XPU=0.038;             #  Percent reactance\n",
    "Vrated=600.;            #  Rated voltage of transformer\n",
    "TTR=12.;                #  Transformer turns ratio (7200/600)\n",
    "ELS=621.;               #  Low side voltage\n",
    "\n",
    "\n",
    "\n",
    "#  (a) Transformer regulation\n",
    "Theta=41.4;#acosd(FP);   \n",
    "#  Transformer regulation          \n",
    "RegPU=0.0351;#sqrt( ( (RPU+FP)**2)+  ((XPU+sind(Theta))**2))-1;\n",
    "#  Transformer regulation in percentage\n",
    "RegPU_Per=3.51;#RegPU*100;\n",
    "\n",
    "#  (b) Secondary voltage when the load is disconnected \n",
    "Vnl=(RegPU*Vrated)+Vrated;\n",
    "\n",
    "#  (c) Input primary voltage \n",
    "EHS=ELS*TTR;\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Transformer regulation =\",RegPU\n",
    "print\"Secondary voltage when the load is disconnected  =\",Vnl,\"V\"\n",
    "print\"Input primary voltage =\",EHS,\"V\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E10 : Pg 70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Transformer regulation = -0.0147\n",
      "Secondary voltage when the load is disconnected  = 591.18 V\n",
      "Input primary voltage = 7094.16 V\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.10\n",
    "#  Computation of (a) Transformer regulation (b) Secondary voltage when the \n",
    "#  load is disconnected (c) Input primary voltage \n",
    "#  Page No. 70\n",
    "\n",
    "\n",
    "\n",
    "#  Given data\n",
    "FP=0.75                #  Power-factor leading\n",
    "RPU=0.013;             #  Percent resistance\n",
    "XPU=0.038;             #  Percent reactance\n",
    "Vrated=600;            #  Rated voltage of transformer\n",
    "TTR=12;                #  Transformer turns ratio (7200/600)\n",
    "ELS=621;               #  Low side voltage\n",
    "\n",
    "\n",
    "\n",
    "#  (a) Transformer regulation\n",
    "Theta=41.4;#acosd(FP);   \n",
    "#  Transformer regulation          \n",
    "RegPU=-0.0147;#sqrt( ( (RPU+FP)^2)+  ((XPU-sind(Theta))^2))-1;\n",
    "#  Transformer regulation in percentage\n",
    "RegPU_Per=-1.47;#RegPU*100;\n",
    "\n",
    "#  (b) Secondary voltage when the load is disconnected \n",
    "Vnl=(RegPU*Vrated)+Vrated;\n",
    "\n",
    "#  (c) Input primary voltage \n",
    "\n",
    "EHS=Vnl*TTR;\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Transformer regulation =\",RegPU\n",
    "print\"Secondary voltage when the load is disconnected  =\",Vnl,\"V\"\n",
    "print\"Input primary voltage =\",EHS,\"V\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E11 : Pg 71"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Transformer regulation = 0.748\n",
      "Transformer regulation in percentage= 74.8\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.11\n",
    "#  Computation of transformer regulation\n",
    "#  Page No. 71\n",
    "#  Given data\n",
    "S=10.;                  #  Transformer actual rating 10KVA\n",
    "Srated=25.;             #  Rated 25KVA\n",
    "PF=0.65;               #  Power factor lagging\n",
    "RPU=0.0124;            #  Percent resistance drop\n",
    "XPU=0.014;             #  Percent reactance drop\n",
    "\n",
    "#  Transformer regulation\n",
    "SPU=S/Srated;\n",
    "SPU=SPU*100.;\n",
    "Theta=49.5;#acosd(PF);\n",
    "#  Transformer regulation          \n",
    "RegPU=0.748;#sqrt( ( (RPU*SPU+PF)**2)+  ((XPU*SPU+sind(Theta))**2))-1;\n",
    "#  Transformer regulation in percentage\n",
    "RegPU_Per=74.8;#RegPU*100;\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Transformer regulation =\",RegPU\n",
    "print\"Transformer regulation in percentage=\",RegPU_Per\n",
    "\n",
    "#  Answer varies due to round off errors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E12 : Pg 72"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Core loss = 934.585492228 W\n",
      "Core loss at 375V, 50 Hz supply = 741.178216753 W\n",
      "Efficiency = 96.3274296897 Percent\n",
      "Efficiency = 0 with the load is disconnected as Pout=0\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.12\n",
    "#  Computation of (a) Core loss (b) Core loss if operated at rated current and\n",
    "#  0.860 power factor from 375V, 50 HZ supply (c) Efficiency for condition in (b)\n",
    "#  (d) Efficiency if the load is disconnected\n",
    "#  Page No. 72\n",
    "#  Given data\n",
    "Srated=50000.;              #  Transformer power rating\n",
    "VHS=450.;                   #  High side voltage \n",
    "RPU=0.0125;                #  Percent resistance \n",
    "XPU=0.0224;                #  Percent reactance \n",
    "FP=0.86;                   #  Power factor lagging\n",
    "eta=0.965                  #  Efficiency\n",
    "Hl=0.71                    #  Hysteresis loss\n",
    "Vt60=375.                   #  Supply voltage\n",
    "f1=60.;                     #  Transformer frequency\n",
    "f2=50.;                     #  Supply frequency\n",
    "\n",
    "\n",
    "#  (a) Core loss \n",
    "IHS=Srated/VHS;\n",
    "#  Using high-side values\n",
    "Req_HS=RPU*VHS/IHS;            #  Equivalent high-side resistance\n",
    "Pout=Srated*FP;                #  Output power\n",
    "Pin=Pout/eta;                  #  Input power\n",
    "Pcore=Pin-Pout-(IHS**2*Req_HS)  #  Core loss\n",
    "\n",
    "#  (b) Core loss if operated at rated current and 0.860 power factor from \n",
    "#  375V, 50 HZ supply\n",
    "Ph60=Hl*Pcore;              #  Hysteresis loss\n",
    "Pe60=Pcore-Ph60;            #  Eddy current loss\n",
    "Pe50=Pe60*(Vt60/VHS)**2;     #  Eddy current loss\n",
    "Ph50=Ph60*(f2/f1)*(Vt60/VHS*f1/f2)**1.6; \n",
    "Pcore50=Pe50+Ph50;          #  Core loss\n",
    "\n",
    "#  (c) Efficiency\n",
    "Pout=Vt60*IHS*FP;           #  Output power\n",
    "etanew=Pout/(Pout+Pcore50+IHS**2*Req_HS);\n",
    "\n",
    "#  (d) Efficiency with the load is disconnected\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Core loss =\",Pcore,\"W\"\n",
    "print\"Core loss at 375V, 50 Hz supply =\",Pcore50,\"W\"\n",
    "print\"Efficiency =\",etanew*100,\"Percent\"\n",
    "print\"Efficiency = 0 with the load is disconnected as Pout=0\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E13 : Pg 75"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Efficiency at rated load = 0.9767\n",
      "Efficiency at 70 percent load = 0.9796\n",
      "There is very little change in efficiency\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.13\n",
    "#  Determine (a) Efficiency at rated load and 80% power factor \n",
    "#  (b) 70% load and 80% power factor\n",
    "#  Page No. 75\n",
    "#  Given data\n",
    "FP=0.80;                    #  Power factor \n",
    "PcorePU=0.0045;             #  Percentage core loss\n",
    "RPU=0.0146;                 #  Percentage resistance\n",
    "Sload=70.;                   #  70% rated load\n",
    "Srated=100.;                 #  100% rated load\n",
    "\n",
    "#  (a) Efficiency at rated load and 80% power factor \n",
    "etarated=FP/(FP+RPU+PcorePU);\n",
    "\n",
    "#  (b) Efficiency at 70% load and 80% power factor\n",
    "SPU=Sload/Srated;\n",
    "IPU=SPU;                                 #  I_load is proportional to S_load\n",
    "eta=(SPU*FP)/(SPU*FP+PcorePU+IPU**2*RPU)  #  Efficiency\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Efficiency at rated load =\",round(etarated,4)\n",
    "print\"Efficiency at 70 percent load =\",round(eta,4)\n",
    "print'There is very little change in efficiency'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E14 : Pg 78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Equivalent core-loss resistance = 101.535508637 Ohm\n",
      "Magnetizing reactance = 17.96875 Ohm\n",
      "Per unit resistance = 0.0160085367479\n",
      "Per unit reactance = 0.0310845935728\n",
      "Per unit impedance magnitude = 0.035\n",
      "Per unit impedance angle = 62.8\n",
      "Voltage regulation in percentage = 3.26\n"
     ]
    }
   ],
   "source": [
    "#  Example 2.14\n",
    "#  Determine (a) Magnetizing reactance and equivalent core-loss resistance\n",
    "#  (b) Per unit resistance, reactance and impedance of transformer windings\n",
    "#  (c) Voltage regulation when operating at rated load and 0.75 power factor lagging \n",
    "#  Page No. 78\n",
    "#  Given data\n",
    "Poc=521.;                    #  Open circuit test power\n",
    "Voc=230.;                    #  Open circuit voltage\n",
    "Vo=230.;                     #  Output voltage\n",
    "Ioc=13.04;                  #  Open circuit current\n",
    "Vsc=160.8;                  #  Short circuit voltage\n",
    "Isc=16.3;                   #  Short circuit current\n",
    "Psc=1200.;                   #  Short circuit power\n",
    "S=75000.;                    #  Transformer rating\n",
    "Vhs=4600.;                   #  High side voltage\n",
    "FP=0.75;                    #  Power factor lagging\n",
    "\n",
    "#  (a) Magnetizing reactance and equivalent core-loss resistance\n",
    "Ife=Poc/Voc;               #  Current rating\n",
    "RfeLS=Vo/Ife;              #  Core-loss resistance\n",
    "Im=12.8;#sqrt(Ioc**2.-Ife**2.);      #  Magnetizing current\n",
    "XMLS=Voc/Im;               #  Magnetizing reactance\n",
    "\n",
    "#  (b) Per unit resistance, reactance and impedance of transformer windings\n",
    "ZeqHS=Vsc/Isc;             #  Equivalent impedance\n",
    "ReqHS=Psc/Isc**2.;           #  Equivalent resistance\n",
    "XeqHS=8.77;#sqrt(ZeqHS**2. - ReqHS**2.); #  Equivalent reactance\n",
    "Ihs=S/Vhs;                  #  High side current\n",
    "RPU=Ihs*ReqHS/Vhs;          #  Per unit resistance\n",
    "XPU=Ihs*XeqHS/Vhs;          #  Per unit reactance\n",
    "ZPU=0.016+0.0311j;#RPU+%i*XPU;             #  Per unit impedance\n",
    "#  Complex to Polar form...\n",
    "ZPU_Mag=0.035;#sqrt(real(ZPU)**2.+imag(ZPU)**2.);      #  Magnitude part\n",
    "ZPU_Ang=62.8;#atan(imag(ZPU),real(ZPU))*180./math.pi;  #  Angle part\n",
    "\n",
    "#  (c) Voltage regulation when operating at rated load and 0.75 power factor lagging \n",
    "#  Transformer regulation  \n",
    "Theta=41.4;#acosd(FP);        \n",
    "RegPU=0.0326;#sqrt( (RPU+FP)**2. +  (XPU+sind(Theta))**2. )-1.;\n",
    "#  Transformer regulation in percentage\n",
    "RegPU_Per=3.26;#RegPU*100.;\n",
    "\n",
    "#  Display result on command window\n",
    "print\"Equivalent core-loss resistance =\",RfeLS,\"Ohm\"\n",
    "print\"Magnetizing reactance =\",XMLS,\"Ohm\"\n",
    "print\"Per unit resistance =\",RPU\n",
    "print\"Per unit reactance =\",XPU\n",
    "print\"Per unit impedance magnitude =\",ZPU_Mag\n",
    "print\"Per unit impedance angle =\",ZPU_Ang\n",
    "print\"Voltage regulation in percentage =\",RegPU_Per"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}