In [1]:

```
from __future__ import division
from math import ceil
#Caption:Calculate the number of turns on both primary and secondary winding in a single phase transformer
E_1=500 #primary induced emf(in Volts)
E_2=250 #secondary induced emf(in Volts)
F=50 #supply frequency(in Hz)
B_max=1.2 #maximum flux density(in T)
a=0.009 #cross sectional area(in square meter)
F_x=B_max*a #maximum value of flux(in Wb)
N_1=ceil(E_1/(4.44*F*F_x)) #number of primary turns
print 'number of primary turns in transformer =',N_1
N_2=ceil(E_2/(4.44*F*F_x)) #number of secondary turns
print 'number of secondary turns in transformer =',N_2
```

In [2]:

```
#Caption:In a loss less transformer calculate
#(a)Number of turns on high voltage side (b)The primary current (c)The secondary current
V_1=110 #primary voltage(in Volts)
V_2=220 #secondary voltage(in Volts)
N_1=130 #low voltage side turns
N_2=N_1*V_2/V_1 #high voltage side turns
print 'Number of turns on high voltage side =',N_2
O_p=1 #Output of the transformer in KVA
I_2=O_p*1000/V_2 #Secondary current(in Amp)
I_1=O_p*1000/V_1 #Primary current(in Amp)
print 'Primary current = %0.2f Amp'%I_1
print 'Secondary current = %0.2f Amp'%I_2
```

In [3]:

```
#Caption:Calculate the secondary voltage and the volts per turn
N_1=800 #Primary turns in a transformer
N_2=200 #Secondary turns in a transformer
V_1=100 #Primary voltage
V_2=V_1*(N_2/N_1) #Secondary voltage
print 'Secondary voltage = %0.2f Volts '%V_2
V_n=V_1/N_1 #Volts per turn
print 'Volts per turn =',V_n
```

In [4]:

```
#Caption:Calculate the primary current in a single phase transformer
V_1=230 #Primary voltage(in Volts)
V_2=460 #Secondary voltage(in Volts)
I_2=10 #secondary current(in Amp)
I_1=I_2*(V_2/V_1) #Primary current(in Amp)
print 'Primary current = %0.2f Amp'%I_1
```

In [8]:

```
#Caption:Calculate (a)the approximate values of the primary and secondary currents (b)the approimate number of primary turns
V_1=6600 #Primary voltage(in Volts)
V_2=400 #Secondary voltage(in Volts)
N_2=100 #secondary turns
O_p=200 #output of a transformer in KVA
I_1=O_p*1000/V_1 #Full load primary current(in Amp)
print 'Full load primary current = %0.1f Amp'%I_1
I_2=O_p*1000/V_2 #Full load secondary current(in Amp)
print 'Full load secondary current = %0.f Amp '%I_2
N_1=N_2*(V_1/V_2) #Number of primary turns
print 'Number of primary turns =',N_1
```

In [9]:

```
#Caption:Find voltage in secondary terminal
V_1=100 #Primary voltage(in Volts)
N_1=20 #Number of primary turns
N_2=40 #Number of secondary turns
V_2=(N_2/N_1)*V_1 #voltage of the secondary terminal(in Volts)
print 'voltage of the secondary terminal = %0.2f V'%V_2
```

In [11]:

```
#Caption:Calculate the r.m.s value of the induced emf in the secondary coil.
F_x=0.02 #Maximum value of flux(in Wb)
N_2=55 #Number of secondary turns
F=50 #Supply frequency(in Hz)
E_2=4.44*F*F_x*N_2 #r.m.s value of induced emf in the secondary (in Volts)
print 'r.m.s value of induced emf in the secondary = %0.1f Volts '%E_2
```

In [15]:

```
#Caption:In single phase transformer Calculate (a)The maximum flux density in the core and (b)induced emf in the secondary
N_1=80 #Primary turns
N_2=240 #secondary turns
f=50 #Supply frequency(in Hz)
E_1=240 #Supply voltage(in Volts)
F_max=E_1/(4.44*f*N_1) #Maximum value of the flux in the core
a=200 #Cross sectional area of core(in cm**2)
A=a*10**-4 #Cross sectional area of core(in m**2)
B_max=F_max/A #Peak value of flux density in the core(in T)
print 'Peak value of flux density in the core = %0.4f T '%B_max
E_2=E_1*(N_2/N_1) #Induced emf in the secondary winding(in Volts)
print 'Induced emf in the secondary winding = %0.f Volts '%E_2
```

In [18]:

```
#Caption:Calculate (a)Primary and secondary currents on full load (b)the maximum value of flux (c)the number of primary turns.
O_p=200 #Rated output (in KVA)
V_1=3300 #Primary voltage (in Volts)
V_2=240 #Secondary voltage (in Volts)
N_2=100 #Secondary turns
f=50 #supply frequency(in Hz)
I_1=O_p*1000/V_1 #Primary current(in Amp)
print 'Primary current on full load = %0.2f Amp'%I_1
I_2=O_p*1000/V_2 #secondary current(in Amp)
print 'secondary current on full load = %0.2f Amp '%I_2
F_x=V_2/(4.44*f*N_2) #Maximum value of flux(in Wb)
print 'Maximum value of flux = %0.4f Wb '%F_x
N_1=N_2*(V_1/V_2) #Primary turns
print 'Primary turns =',N_1
# Answer wrong in the textbook.
```

In [20]:

```
#Caption:In a single phase transformer primary side is open , Find (a)core loss, (b)loss component of current ,(c)Magnetising current.
O_p=50 #output (in KVA)
V_2=230 #Secondary voltage(in Volts)
P=187 #meter's power reading (in watt)
I_w=P/V_2 #Loss component of current(in Amp)
I_o=6.5 #meter's current reading (in Amp)
I_m=((I_o)**2-(I_w)**2) #Magnetising current(in Amp)
P=V_2*I_w #Core loss(in watt)
print 'Core loss = %0.2f Watt '%P
print 'Loss component of current = %0.3f Amp '%I_w
print 'Magnetising current = %0.2f Amp'%I_m
```

In [22]:

```
from math import pi, degrees, acos, sin, cos
#Caption:In a transformer Calculate
#(a)Magnetising component of no load current (b)the iron loss (c)the maximum value of flux in the core.
V_1=460 #supply voltage(in Volts)
I_o=15 #No load current (in Amp)
p=degrees(acos(0.2)) #power angle(when power factor is 0.2)
n=sin(p*pi/180)
I_m=I_o*n #Magnetising component of no load current
print 'Magnetising component of no load current = %0.2f Amp '%I_m
L_ir=V_1*I_o*cos(p*pi/180)/1000 #the iron loss in transformer(in kWatt)
print 'the iron loss in transformer = %0.2f kW '%L_ir
E_1=V_1 #at no load condition
N_1=550 #primary winding
f=50 #supply frequency (in Hz)
F_m=E_1/(4.44*N_1*f) #the maximum value of flux in the core(in Wb)
print 'the maximum value of flux in the core = %0.4f Wb'%F_m
```

In [25]:

```
#Caption:In a single phase transformer, Find (a)The magnetising current (b)The iron loss current
p=degrees(acos(0.22)) #power angle(when power factor is 0.22)
I_o=0.3 #no load current(in Amp)
I_m=I_o*sin(p*pi/180) #Magnetising current(in Amp)
print 'Magnetising current = %0.4f Amp'%I_m
I_w=I_o*cos(p*pi/180) #Iron loss current (in Amp)
print 'Iron loss current = %0.3f Amp '%I_w
```

In [28]:

```
#Caption:Find the active and reactive components of a single phase transformer.
V_1=440 #supply Voltage(in Volts)
p=degrees(acos(0.3) )#power angle when power factor is 0.3
P_o=80 #power input to the hv winding(in Watt)
I_o=P_o/(V_1*cos(p*pi/180)) #No load current (in Amp)
I_w=I_o*cos(p*pi/180) #Active component of no load current (in Amp)
print 'Active component of no load current = %0.3f Amp '%I_w
I_m=I_o*sin(p*pi/180) #Reactive component of no load current (in Amp)
print 'Reactive component of no load current = %0.3f Amp '%I_m
```

In [29]:

```
#Caption:In a single phase transformer Calculate the current taken by the primary winding.
V_1=6600 #Primary voltage(in Volts)
V_2=400 #Secondary voltage(in Volts)
I_o=0.7 #NO load current(in Amp)
p_o=0.24 #No load power factor
q_o=degrees(acos(p_o)) #power angle when no load power factor is 0.24
I_2=100 #Secondary current(in Amp)
p_2=0.8 #Secondary power factor
q_2=degrees(acos(p_2)) #power angle when secondary power factor is 0.8
K=V_2/V_1 #ratio of primary to secondary voltage
I_1=K*I_2 #primary current(in Amp)
Q=q_o-q_2 #resultant power angle
I=((I_o)**2 + (I_1)**2+2*I_o*I_1*cos(Q*pi/180))**(1/2) #Resultant current taken by the primary(in Amp)
print 'Resultant current taken by the primary = %0.2f Amp '%I
```

In [30]:

```
#Caption:In a single phase transformer Calculate the current taken by the primary winding.
V_1=440 #Primary voltage(in Volts)
V_2=110 #Secondary voltage(in Volts)
I_o=5 #NO load current(in Amp)
p_o=0.2 #No load power factor
q_o=degrees(acos(p_o)) #power angle when no load power factor is 0.24
I_2=120 #Secondary current(in Amp)
p_2=0.8 #Secondary power factor
q_2=degrees(acos(p_2)) #power angle when secondary power factor is 0.8
K=V_2/V_1 #ratio of primary to secondary voltage
I_1=K*I_2 #primary current(in Amp)
Q=q_o-q_2 #resultant power angle
I=((I_o)**2 + (I_1)**2+2*I_o*I_1*cos(Q*pi/180))**(1/2) #Resultant current taken by the primary(in Amp)
print 'Resultant current taken by the primary = %0.2f Amp '%I
```

In [34]:

```
#Caption:In a single phase transformer Calculate Equivalent resistance
V_1=4400 #Primary voltage (in Volts)
V_2=220 #Secondary voltage (in Volts)
R_1=3.45 #Primary resistance (in Ohm)
X_1=5.2 #Primary reactances (in Ohm)
R_2=0.009 #secondary resistance (in Ohm)
X_2=0.015 #secondary reactance (in Ohm)
K=V_2/V_1 #voltage ratio
R_o1=R_1+(R_2/K**2) #Equivalent resistance as referred to primary(in Ohm)
print 'Equivalent resistance as referred to primary = %0.2f Ohm '%R_o1
R_o2=R_2+(R_1*K**2) #Equivalent resistance as referred to secondary(in Ohm)
print 'Equivalent resistance as referred to secondary = %0.4f Ohm '%R_o2
X_o1=X_1+(X_2/K**2) #Equivalent reactance as referred to primary(in Ohm)
print 'Equivalent reactance as referred to primary = %0.2f Ohm'%X_o1
X_o2=X_2+X_1*(K**2) #Equivalent reactance as referred to secondary(in Ohm)
print 'Equivalent reactance as referred to secondary = %0.3f Ohm '%X_o2
Z_o1=((R_o1)**2 + (X_o1)**2)**(1/2) #Equivalent impedence as referred to primary(in Ohm)
print 'Equivalent impedence as referred to primary = %0.2f Ohm'%Z_o1
Z_o2=((R_o2)**2 + (X_o2)**2)**(1/2) #Equivalent impedence as referred to secondary(in Ohm)
print 'Equivalent impedence as referred to secondary = %0.3f Ohm'%Z_o2
```

In [35]:

```
#Caption:In a single phase transformer Calculate the secondary terminal voltage at full load.
V_1=2000 #Primary voltage at no load or full load(in Volts)
V_2=400 #Secondary voltage at no load (in Volts)
K=V_2/V_1 #Ratio of transformation
R_1=5 #Primary resistance(in Ohm)
R_2=0.2 #Secondary resistance(in Ohm)
X_1=12 #Primary reactance(in Ohm)
X_2=0.48 #Secondary reactance(in Ohm)
R_o2=R_2 + (K**2)*R_1 #Equivalent resistance as referred to secondary(in Ohm)
X_o2=X_2 + (K**2)*X_1 #Equivalent reactance as referred to secondary(in Ohm)
O_p=10 #Rated output(i KVA)
I_2=O_p*1000/V_2 #Full load secondary current(in Amp)
p=0.8 #power factor
a=degrees(acos(p)) #power angle
V_d=I_2*R_o2*cos(a*pi/180) + I_2*X_o2*sin(a*pi/180) #Voltage drop (in Volts)
V=V_2-V_d #Secondary terminal voltage at full load (in Volts)
print 'Secondary terminal voltage at full load = %0.2f Volts '%V
```

In [40]:

```
#Caption:In a single phase transformer Calculate the secondary terminal voltage at full load.
V_1=11000 #Primary voltage at no load or full load(in Volts)
V_2=400 #Secondary voltage at no load (in Volts)
K=V_2/V_1 #Ratio of transformation
R_1=4 #Primary resistance(in Ohm)
R_2=0.2 #Secondary resistance(in Ohm)
X_1=10 #Primary reactance(in Ohm)
X_2=0.4 #Secondary reactance(in Ohm)
R_o2=R_2 + (K**2)*R_1 #Equivalent resistance as referred to secondary(in Ohm)
X_o2=X_2 + (K**2)*X_1 #Equivalent reactance as referred to secondary(in Ohm)
O_p=10 #Rated output(in KVA)
I_2=O_p*1000/V_2 #Full load secondary current(in Amp)
Z_o2=((R_o2)**2 +(X_o2)**2)**(1/2) #Equivalent impedance as referred to secondary(in Ohm)
V=V_2-I_2*Z_o2 #Secondary terminal voltage at full load (in Volts)
print 'Secondary terminal voltage at full load = %0.3f Volts '%V
```

In [42]:

```
#Caption:In a single phase transformer Determine equivalent resistance
V_1=2000 #Primary voltage at no load or full load(in Volts)
V_2=400 #Secondary voltage at no load (in Volts)
K=V_2/V_1 #Ratio of transformation
R_1=5.2 #Primary resistance(in Ohm)
R_2=0.2 #Secondary resistance(in Ohm)
X_1=12.5 #Primary reactance(in Ohm)
X_2=0.5 #Secondary reactance(in Ohm)
R_o2=R_2 + (K**2)*R_1 #Equivalent resistance as referred to secondary(in Ohm)
print 'Equivalent resistance as referred to secondary = %0.2f Ohm '%R_o2
X_o2=X_2 + (K**2)*X_1 #Equivalent reactance as referred to secondary(in Ohm)
print 'Equivalent reactance as referred to secondary = %0.2f Ohm '%X_o2
# Answer wrong in the textbook.
```

In [45]:

```
#Caption:Determine equivalent resistance and reactance
V_1=2000 #Primary voltage at no load or full load(in Volts)
V_2=200 #Secondary voltage at no load (in Volts)
K=V_2/V_1 #Ratio of transformation
R_1=2 #Primary resistance(in Ohm)
R_2=0.025 #Secondary resistance(in Ohm)
X_1=4 #Primary reactance(in Ohm)
X_2=0.04 #Secondary reactance(in Ohm)
R_eq12=(K**2)*R_1 #equivalent resistance of primary referred to secondary(in Ohm)
print 'equivalent resistance of primary referred to secondary = %0.2f Ohm '%R_eq12
X_eq12=(K**2)*X_1 #equivalent reactance of primary referred to secondary(in Ohm)
print 'equivalent reactance of primary referred to secondary = %0.2f Ohm '%X_eq12
R_e2=(K**2)*R_1 + R_2 #total resistance of primary referred to secondary(in Ohm)
print 'total resistance of primary referred to secondary = %0.3f Ohm '%R_e2
X_e2=(K**2)*X_1 + X_2 #total reactance of primary referred to secondary(in Ohm)
print 'total reactance of primary referred to secondary = %0.3f Ohm '%X_e2
R_eq21=R_2/(K**2) #equivalent resistance of secondary referred to primar(in Ohm)
print 'equivalent resistance of secondary referred to primary = %0.2f Ohm '%R_eq21
X_eq21=X_2/(K**2) #equivalent reactance of secondary referred to primar(in Ohm)
print 'equivalent reactance of secondary referred to primary = %0.2f Ohm '%X_eq21
R_e1=R_1 + R_2/(K**2) #total resistance of secondary referred to primary(in Ohm)
print 'total resistance of secondary referred to primary = %0.2f Ohm '%R_e1
X_e1=X_1 + X_2/(K**2) #total reactance of secondary referred to primary(in Ohm)
print 'total reactance of secondary referred to primary = %0.2f Ohm '%X_e1
```

In [49]:

```
#Caption:Determine Primary resistance and total resistance of transformer referred to primary.
V_1=2000 #Primary voltage at no load or full load(in Volts)
V_2=220 #Secondary voltage at no load (in Volts)
R_1=1.06 #Primary resistance(in Ohm)
R_2=0.013 #Secondary resistance(in Ohm)
K=V_2/V_1 #Ratio of transformation
R_eq1=(K**2)*R_1 #Primary resistance referred to secondary(in Ohm)
print 'Primary resistance referred to secondary = %0.4f Ohm '%R_eq1
R_eq2=R_2/(K**2) #secondary resistance referred to primary(in Ohm)
print 'secondary resistance referred to primary = %0.4f Ohm '%R_eq2
R_e1=R_1 + R_eq2 #total resistance of transformer referred to primary(in Ohm)
print 'total resistance of transformer referred to primary = %0.4f Ohm '%R_e1
```

In [56]:

```
#Caption:In a single phase transformer Find Full load regulation at a power factor (a) 0.8 lagging (b) unity (c) 0.8 leading.
V_1=6600 #Primary voltage (in Volts)
V_2=250 #Secondary voltage (in Volts)
K=V_2/V_1 #Ratio of transformation
R_1=10 #Primary resistance (in Ohm)
R_2=0.02 #Secondary resistance (in Ohm)
X_o1=35 #Total leakage reactance referred to the primary winding(in Ohm)
R_o2=R_2 + R_1*(K**2) #Equivalent resistance reffered to the secondary(in Ohm)
X_o2=X_o1*(K**2) #Equivalent reactance reffered to the secondary(in Ohm)
O_p=40 #Rated output (in KVA)
I_2=O_p*1000/250 #Secondary current(in Amp)
P_1=0.8 #Power factor
q=(acos(P_1))
V_r1=((I_2*R_o2*cos(q) + I_2*X_o2*sin(q))/V_2)*100 #Voltage regulation at 0.8 lagging power factor(in %)
print 'Voltage regulation at 0.8 lagging power factor = %0.3f %%'%V_r1
V_r0=(I_2*R_o2/V_2)*100 #Voltage regulation at unity power factor(in %)
print 'Voltage regulation at unity power factor = %0.2f %%'%V_r0
V_r2=((I_2*R_o2*cos(q) - I_2*X_o2*sin(q))/V_2)*100 #Voltage regulation at 0.8 leading power factor(in %)
print 'Voltage regulation at 0.8 leading power factor = %0.2f %%'%V_r2
# Answer wrong in the textbook.
```

In [57]:

```
#Caption:Calculate the regulation of transformer
#(I_2*R_a2/E_2)*100=1
Rs_d=1 #Percentage resistive drop
#(I_2*X_a2/E_2)*100=5
Re_d=5 #Percentage reactive drop
#power factor=cosd(q1)=0.8 (lagging)
q1=degrees(acos(0.8) )
#Voltage regulation= ((I_2*R_a2*cosd(q1)+I_2*X_a2*sind(q1))/100)*100
#V_r=(I_2*R_a2/E_2)*100*cosd(q1)+(I_2*X_a2/E_2)*100*sind(q1)
V_r1=Rs_d*cos(q1*pi/180)+Re_d*sin(q1*pi/180) #Voltage regulation when power factor is 0.8 lagging
print 'Voltage regulation when power factor is 0.8 lagging = %0.2f %%'%V_r1
q2=-degrees(acos(0.8) )
#V_r2=(I_2*R_a2/E_2)*100*cosd(q2)+(I_2*X_a2/E_2)*100*sind(q2) #Voltage regulation when power factor is 0.8 leading
V_r2=Rs_d*cos(q2*pi/180)+Re_d*sin(q2*pi/180) #Voltage regulation when power factor is 0.8 leading
print 'Voltage regulation when power factor is 0.8 leading = %0.2f %%'%V_r2,
```

In [43]:

```
#Caption:In a single phase transformer Calculate the efficiency at unity power at Full load and Half load.
P_c=400 #Full load copper loss(in Watts)
P_C=P_c/1000 #Full load copper loss(in KW)
P_i=350 #Full load iron loss(in Watts)
P_I=P_i/1000 #Full load iron loss(in KW)
P_f=1 #Power factor
KVA=25 #Rating of the transformer
O_p=KVA*P_f #Output at full load condition(in KW)
L_1=P_C+P_I #Losses at full load condition(in KW)
I_p=O_p+L_1 #Input at full load condition(in KW)
E_fL=(O_p/I_p)*100 #Efficiency in full load condition
print 'Efficiency of the tranformer at full load condition = %0.2f %%'%E_fL
#At half load condition
O_P=(1/2)*KVA*P_f #Output of the transformer at half load condition
L_2=((1/2)**2)*P_C+P_I #Losses at half load condition(in KW)
I_P=O_P+L_2 #Input at half load condition
E_hL=(O_P/I_P)*100 #Efficiency of the transformer at half load condition(in %)
print 'Efficiency of the transformer at half load condition = %0.2f %%'%E_hL
```

In [58]:

```
#Caption:Calculate the single phase transformer efficiency for 75% of the full load output at power factor unity and 0.8 lagging.
P_i=1.5 #Core loss(in KW)
P_c=4.5 #Full load copper loss(in KW)
P_C=((3/4)**2)*P_c #Copper loss at 75% of full load(in KW)
P_t=P_i+P_C #Total loss at 75% of full load output(in KW)
KVA=300 #Rating of the transformer(in KVA)
P_f1=1 #power factor value when it is unity
P_f2=0.8 #power factor value when it is 0.8 lagging
O_p1=0.75*KVA*P_f1 #Output at 75% of full load and at unity power factor(in KW)
E_f1=(O_p1/(O_p1+P_t))*100 #Efficiency of the transformer for 75% of full load output at power factor unity(in %)
print 'Efficiency of the transformer for 75%% of full load output at power factor unity = %0.2f %%'%E_f1
O_p2=0.75*KVA*P_f2 #Output at 75% of full load and at 0.8 lagging power factor(in KW)
E_f2=(O_p2/(O_p2+P_t))*100 #Efficiency of the transformer for 75% of full load output at power factor 0.8 lagging(in %)
print 'Efficiency of the transformer for 75%% of full load output at power factor 0.8 lagging = %0.2f %%' %E_f2
```

In [59]:

```
#Caption:In a single phase transformer Calculate efficiency at full load, unity power factor.
P_f1=1 #power factor unity
P_f2=0.8 #power factor 0.8 lagging or leading
KVA=25 #Rating of the transformer(in KVA)
O_p1=KVA*P_f1 #Output at unity power factor(in KW)
P_c=400 #copper losses(in Watt)
P_C=P_c/1000 #copper losses(in KW)
P_i=320 #iron losses(in Watt)
P_I=P_i/1000 #iron losses(in KW)
P_T=P_I+P_C #total losses(in KW)
I_p1=O_p1+P_T #Input (in KW)
E_f1=(O_p1/I_p1)*100 #Efficiency of the transformer at full load and unity power factor(in %)
print 'Efficiency of the transformer at full load and unity power factor = %0.2f %%' %E_f1
O_p2=KVA*P_f2 #output at 0.8 lagging power factor(in KW)
I_p2=O_p2+P_T #input incase of 0.8 power factor(in KW)
E_f2=(O_p2/I_p2)*100 #Efficiency of the transformer at full load and 0.8 lagging power factor(in %)
print 'Efficiency of the transformer at full load and 0.8 lagging power factor = %0.2f %%' %E_f2
E_f3=E_f2 #At 0.8 leading power factor. since there is no change in input and output, so efficiency is unchanged
print 'At 0.8 leading power factor. since there is no change in input and output, so efficiency is unchanged = %0.2f %%' %E_f3
```

In [60]:

```
#Caption:Calculate the efficiency of the transformer on Half load and Full load.
KVA=100 #rating of the(in KVA)
P_f=0.8 #power factor
O_p=(1/2)*KVA*P_f #Output at half load(in KW)
P_i=700 #iron loss (in Watt)
P_i1=P_i/1000 #iron loss at half and full load(in KW)
P_c=400 #copper losses (in Watt)
P_c1=((1/2)**2)*P_c/1000 #copper losses at half load condition (in KW)
P_t=P_c1+P_i1 #Total losses in half load condition(in KW)
E_f=(O_p/(O_p+P_t))*100 #Efficiency of the transformer on half load in percentage
print 'Efficiency of the transformer on half load = %0.2f %%' %E_f
O_P=KVA*P_f #Output in case of full load(in KW)
P_c2=P_c/1000 #Copper losss at full load condition(in KW)
P_T=P_c2+P_i1 #Total losses in full load condition(in KW)
E_F=(O_P/(O_P+P_T))*100 #Efficiency of the transformer on full load condition in percentage
print 'Efficiency of the transformer on full load condition = %0.2f %%' %E_F
```

In [61]:

```
#Caption:In a single phase transformer Calculate the efficiency at full load unity power factor
KVA=25 #Rating of the transformer(in KVA)
P_c=400 #Full load copper loss(in Watt)
P_c1=P_c/1000 #Full load copper loss(in KW)
P_i=350 #Iron loss(in Watt)
P_i1=P_i/1000 #Iron loss (in KW)
P_f=1 #Power factor unity
P_f1=0.8 #Power factor 0.8 lagging
O_p1=KVA*P_f #Output at full load and unity power factor(in KW)
P_t1=P_c1+P_i1 #Total losses at full load and unity power factor(in KW)
I_p1=O_p1+P_t1 #Input at full load and unity power factor(in KW)
E_f1=(O_p1/I_p1)*100 #Efficiency of the transformer at full load and unity power factor(in KW)
print 'Efficiency of the transformer at full load and unity power factor = %0.2f kW'%E_f1
O_p2=(1/2)*KVA*P_f1 #Output At half full load, 0.8 power factor lag.(in KW)
P_c2=((1/2)**2)*P_c1 #Copper loss At half full load, 0.8 power factor lag.(in KW)
P_t2=P_c2+P_i1 #Total loss At half full load, 0.8 power factor lag.(in KW)
I_p2=O_p2+P_t2 #Input At half full load, 0.8 power factor lag.(in KW)
E_f2=(O_p2/I_p2)*100 #Efficiency of the transformer at half full load and 0.8 lagging power factor(in KW)
print 'Efficiency of the transformer at half full load and 0.8 lagging power factor = %0.2f kW'%E_f2
#Maximum efficiency occurs when Copper loss = Iron loss,let the maximum efficiency occcur at x times full load
x=(P_i/P_c)**(1/2)
L=x*KVA #load in KVA corresponding to maximum efficiency
print 'the load for maximum efficiency = %0.2f kVA '%L
```

In [66]:

```
#Caption:In a single phase transformer Calculate the efficiency of full load current
KVA=50 #Rating of the transformer(in KVA)
V_1=6600 #Primary voltage(in Volt)
V_2=200 #Secondary voltage(in VOlt)
I_1=KVA*1000/6600 #Full load primary current(in Amp)
P_f1=1 #power factor at unity
P_f2=0.8 #Power factor at 0.8
O_p1=KVA*P_f1 #Output at unity power factor(in KW)
P_i=650 #Iron loss(in Watt)
P_i1=P_i/1000 #Iron loss (in KW)
P_c=885 #Copper loss(in Watt)
P_c1=P_c/1000 #Copper loss(in KW)
I_p1=O_p1+P_c1+P_i1 #Input at unity power factor(in KW)
E_f1=(O_p1/I_p1)*100 #Efficiency of the transformer at unity power factor
print 'Efficiency of the transformer at unity power factor = %0.f %% '%E_f1
O_p2=KVA*P_f2 #Output at 0.8 power factor(in KW)
#Maximum efficiency occurs when Copper loss = Iron loss,let the maximum efficiency occcur at x times full load
x=(P_i1/P_c1)**(1/2)
print 'the maximum efficiency occurs at the full load of = %0.3f'%x
O_P=x*KVA*P_f2 #Output at maximum efficiency(in KW)
E_F=(O_P/(O_P+P_i1+P_c1))*100 #Maximum Efficiency of the transformer at 0.8 power factor
print 'Maximum Efficiency of the transformer = %0.2f %%' %E_F
# Answer wrong in the textbook.
```

In [67]:

```
#Caption:In the single phase transformer,find the ratio of iron and copper loss such that maximum efficiency occurs at 75% of full load.
x=75/100 #the value of load which is 75% of full load
P_r=x**2 #Ratio of the iron loss and copper loss for maximum efficiency
print 'Ratio of the iron and copper loss for the maximum efficiency =',P_r
```

In [70]:

```
#Caption:In a single phase transformer Calculate the iron losses and the full load copper losses.
KVA=400 #Rating of the transformer(in KVA)
E_f1=0.9877 #Transformer efficiency when delivering full load at 0.8 power factor
P_f1=0.8 #power factor at full load
P_f2=1 #power factor at half load
O_p1=KVA*P_f1 #Output on full load when power factor is 0.8(in KW)
I_p1=(O_p1/E_f1) #Input on full load when power factor is 0.8(in KW)
P_t1=I_p1-O_p1 #Total losses on full load when power factor is 0.8(in KW)
O_p2=(1/2)*KVA*P_f2 #Output at half load when power factor is 1
E_f2=0.9913 #Transformer efficiency when delivering half load at 1 power factor
I_p2=O_p2/E_f2 #Input at half load when power factor is 1
P_t2=I_p2-O_p2#Total losses at half load when power factor is 1
#P_t1=P_c+P_i
#P_t2=(1/4)P_c+P_i
P_c=(4/3)*(P_t1-P_t2) #Full load and copper losses
P_i=(1/3)*(4*P_t2-P_t1) #iron losses
print 'full load and copper losses = %0.3f kW'%P_c
print 'iron loss = %0.3f kW '%P_i
```

In [73]:

```
from math import ceil
#Caption:In a transformer find all day efficiency
KVA=15 #Rating of the transformer(in KVA)
E_f=0.98 #Efficiency of the transformer
P_F=1 #for unity power factor
O_P=KVA*P_F #Output of the transformer at unity power factor(in KW)
I_P=O_P/E_f #Input to the transformer(in KW)
P_T=I_P-O_P #Total losses(in KW)
#At Maximum efficiency
P_C=P_T/2 #copper loss for maximum efficiency(in KW)
P_I=P_C #iron losss at maximum efficiency copper loss=iron loss
L_1=2 #load for 12 hours (in KW)
L_2=12 #load for 6 hours (in KW)
L_3=18 #load for next 6 hours (in KW)
P_f1=0.5 #Power factor at L_1 load
P_f2=0.8 #Power factor at L_2 load
P_f3=0.9 #Power factor at L_3 load
T_1=12 #Time when L_1 working(in hours)
T_2=6 #Time when L_2 working(in hours)
T_3=6 #Time when L_3 working(in hours)
O_p1=L_1*T_1+L_2*T_2+L_3*T_3 #All day output(in KWh)
P_i1=P_I*24 #Iron losses for 24 hours(in KWh)
P_c1=T_1*P_C*((L_1/P_f1)/KVA)**2+T_2*P_C*((L_2/P_f2)/KVA)**2+T_3*P_C*((L_3/P_f3)/KVA)**2 #Copper loss for 24 hours(in KWh)
P_t=P_c1+P_i1 #Total losses of transformer for 24 hours(in KWh)
I_p1=O_p1+P_t #All day input(in KWh)
E_f1=(O_p1/I_p1)*100 #All day efficiency of transformer
print 'All day efficiency of transformer = %0.2f %% '%ceil(E_f1)
```

In [74]:

```
#Caption:In a transformer find all day efficiency
KVA=1500 #Rating of the transformer(in KVA)
P_C=4.5 #copper loss for maximum efficiency(in KW)
P_I=3.2 #iron losss at maximum efficiency copper loss=iron loss
L_1=1200 #load for 6 hours (in KW)
L_2=900 #load for next 10 hours (in KW)
L_3=300 #load for next 4 hours (in KW)
L_4=0 #load for next 4 hours (in KW)
P_f1=0.8 #Power factor at L_1 load
P_f2=0.75 #Power factor at L_2 load
P_f3=0.8 #Power factor at L_3 load
P_f4=0 #Power factor at L_4 load
T_1=6 #Number of hours when L_1 working(in hours)
T_2=10 #Number of hours when L_2 working(in hours)
T_3=4 #Number of hours when L_3 working(in hours)
T_4=4 #Number of hours when L_4 working(in hours)
O_p1=L_1*T_1+L_2*T_2+L_3*T_3 #All day output(in KWh)
P_i1=P_I*24 #Iron losses for 24 hours(in KWh)
P_c1=T_1*P_C*((L_1/P_f1)/KVA)**2+T_2*P_C*((L_2/P_f2)/KVA)**2+T_3*P_C*((L_3/P_f3)/KVA)**2 #Copper loss for 24 hours(in KWh)
P_t=P_c1+P_i1 #Total losses of transformer for 24 hours(in KWh)
I_p1=O_p1+P_t #All day input(in KWh)
E_f1=(O_p1/I_p1)*100 #All day efficiency of transformer
print 'All day efficiency of transformer = %0.2f %%' %(E_f1)
```

In [75]:

```
#Caption:In a transformer find all day efficiency
KVA=15 #Rating of the transformer(in KVA)
P_c=0.35 #Full load copper loss (in KW)
P_i=0.25 #iron losss
P_I=P_i*24 #Iron loss per day
L_1=1/4 #load for 9 hours of full load
L_2=1 #load for 7 hours of full load
L_3=3/4 #load for next 6 hours of full load
P_f1=0.6 #Power factor at L_1 load
P_f2=0.8 #Power factor at L_2 load
P_f3=1 #Power factor at L_3 load
T_1=9 #Time when L_1 working(in hours)
T_2=7 #Time when L_2 working(in hours)
T_3=6 #Time when L_3 working(in hours)
P_c1=((1/4)**2)*P_c #Copper loss at 1/4 load
P_C1=9*P_c1 #Copper loss for 9 hours at 1/4 load
P_c2=P_c #Copper loss at full load
P_C2=7*P_c2 #Copper loss for 7 hours at full load
P_c3=((3/4)**2)*P_c #Copper loss at 3/4 load
P_C3=6*P_c3 #Copper loss for 6 hours at 3/4 load
P_C=P_C1+P_C2+P_C3 #Copper loss per day(in KW)
P_T=P_C+P_I #Iron loss per day(in KW)
O_P=L_1*KVA*P_f1*T_1+L_2*KVA*P_f2*T_2+L_3*KVA*P_f3*T_3 #Total output per day(in KWh)
I_P=O_P+P_T #Total input(in KWh)
E_F=(O_P/I_P)*100 #All day efficiency(in %)
print 'All day efficiency = %0.2f %%' %E_F
```

In [76]:

```
#Caption:Calculate the economy of copper in auto transformer and current distribution in primary
V_1=500 #Primary voltage
V_2=400 #Secondary voltage
I_2=100 #Secondary voltage
I_1=V_2*I_2/V_1 #Primary current
print 'Current in primary winding = %0.2f Amp '%I_1
K=V_2/V_1 #Transformer ratio
S=K*100 #Saving (in %)
print 'Economy of copper = %0.2f %%'%S
```

In [77]:

```
#Caption:In a auto transformer determine Transformation ratio secondary current primary current
V_1=250 #Primary voltage(in Voltage)
V_2=125 #Secondary voltage(in Voltage)
K=V_2/V_1 #Transformation ratio
N_1=250 #Primary turns
print 'Transformation ratio =',K
P_f=1 #Unity power factor
L=5 #Value of load(in KW)
I_2=L*1000/(V_2*P_f) #Secondary current(in Amp)
print 'Secondary current = %0.2f Amp '%I_2
I_1=K*I_2 #Primary current(in Amp)
print 'Primary current = %0.2f Amp '%I_1
N_2=K*N_1 #Secondary turns
print 'number of turns across secondary winding =',N_2
```

In [79]:

```
#Caption:In an auto transformer determine current in different section and KVA output and power transferred
KVA=10
V_1=2400 #Voltage in first winding
V_2=240 #Voltage in second winding
I_1=KVA*1000/V_1 #Current rating of 2400 Volts winding
I_2=KVA*1000/V_2 #Current rating of 240 Volts winding
I_l=I_1+I_2 #Total load current
print 'Current rating of 2400 Volts winding = %0.2f Amp '%I_1
print 'Current rating of 240 Volts winding = %0.2f Amp '%I_2
print 'Total load current = %0.2f Amp '%I_l
KVA_r=V_1*I_l/1000 #KVA output rating
print 'KVA output rating = %0.2f KVA '%KVA_r
P_i=V_1*I_1 #power transferred inductively
P_c=V_1*I_2 #power transferred conductively
print 'power transferred inductively = %0.2f VA '%P_i
print 'power transferred conductively = %0.2f VA '%P_c
N_1=2640 #Number Primary winding in case of two winding transformer
N_2=2400 #Number Secondary winding in case of two winding transformer
K=N_1/N_2 #Transformer ratio
Saving=(1/K)*100 #Saving in copper
print 'Saving in copper = %0.2f %%'%Saving
# Answer wrong in the textbook.
```

In [81]:

```
#Caption:In a transformer calculate Power output and power transformed and power conducted
KVA=25
V_s=2200 #Source voltage
V_1=2200 #Voltage in first winding
V_2=220 #Voltage in second winding
I_1=KVA*1000/V_1 #Current rating of 2200 V winding
I_2=KVA*1000/V_2 #Current rating of 220 V winding
V_o=V_1+V_2 #Output voltage
I_l=I_1+I_2 #Input line current
I_o=I_2 #Output current of auto transformer
KVA_r=V_o*I_2/1000 #KVA rating
P_f1=0.8 #
P_o=KVA*P_f1 #Power output at full load and 0.8 power factor
KVA_t=V_1*I_1/1000 #KVA transformed
print 'KVA transformed = %0.2f kVA'%KVA_t
P_t=KVA_t*P_f1 #Power transformed(in KW)
print 'Power transformed = %0.2f kW'%P_t
KVA_c=V_s*I_o/1000 #KVA conducted(in KVA)
P_c=KVA_c*P_f1 #Power conducted(in KW)
print 'Power conducted = %0.2f kW'%P_c
#E_f=Output/(Output+Losses)
#Losses=((1/E_f)-1)*Output
E_f=0.9 #Efficiency of the two winding transformer
P_f2=0.85 #New power factor of the two einding transformer
O_p1=KVA_t*1000*P_f2 #Output of the two winding transformer
L=((1/E_f)-1)*O_p1 #losses in a 2-winding transformer
#Losses in auto transformer=losses in 2-winding transformer
O_P=KVA_r*1000*P_f2 #output of the auto transformer
E_F=(O_P/(O_P+L))*100 #Efficiency of the auto transformer(in %)
print 'Efficiency of the auto transformer = %0.2f %%'%E_F
# Answer wrong in the textbook.
```