In [1]:

```
from __future__ import division
#Caption:Find the current per path of armature
I_a=200 #rated armature current(in Amp)
P=12 #number of poles in machine
A_1=2 #number of parallel paths with wave winding
A_2=P #number of parallel paths with lap winding
I_1=I_a/A_1 #current per path in case of wave winding(in Amp)
print 'current per path in case of wave winding = %0.2f A'%I_1
I_2=I_a/A_2 #current per path in case of lap winding(in Amp)
print 'current per path in case of lap winding = %0.2f A'%I_2
```

In [2]:

```
#Caption:Calculate the induced emf in machine
N_1=500 #starting speed of machine(in rpm)
E_1=200 #emf of the machine at N_1 (in V)
N_2=600 #new speed of machine(in rpm)
E_2=E_1*N_2/N_1 #emf of the machine atN_2 (in V)
print 'induced emf while the machine is running at 600 rpm = %0.2f V '%E_2
```

In [3]:

```
#Caption:calculate the generated emf
S_1=80 #Number of armature slots
S_2=6 #Number of conductor per slot
Z=S_1*S_2 #Number of armature conductors
F=50 #Flux per pole(in mWb)
F_1=F*10**-3 #(in Wb)
P=6 #Number of poles
A=P #Number of parallel paths
N=1200 #armature speed(in rpm)
E_g=F_1*Z*N*P/(60*A) #EMF generated in 6 pole lap wound dc generator (in Volts)
print 'EMF generated in 6 pole lap wound dc generator = %0.2f V'%E_g
```

In [4]:

```
#Caption:Calculate the voltage generated in 4 pole generator
S_1=51 #Number of slots
S_2=20 #Number of conductor per slot
Z=S_1*S_2 #number of armature conductors
F=7 #flux per pole(in mWb)
F_1=F*10**-3 #flux per pole(in Wb)
P=4 #Number of poles
A=2 #Number of parallel paths (armature is wave wound)
N=1500 #speed of the machine(in rpm)
E_g=F_1*Z*N*P/(60*A) #generated emf
print 'voltage generated in machine = %0.2f V'%E_g
```

In [5]:

```
#Caption:Find out the speed for 6 pole machine
F=60 #flux per pole(in m Wb)
F_1=F*10**-3 #flux per pole(in Wb)
Z=480 #Number of armature conductors
P=6 #Number of poles
A=2 #Number of parallel paths(Armature wave wound)
E_g=320 #generated emf (in V)
N=E_g*60*A/(F_1*Z*P) #speed(in rpm)
print 'speed of the machine = %0.2f rpm '%N
```

In [8]:

```
from math import ceil
#Caption:calculate the suitable number of conductor per slot hence determine the actual value of flux
F_1=0.05 #flux per pole(in Wb )
N=350 #speed(in rpm)
P=8 #no of poles
A=P #no of parallel path
E_g=240 #voltage generated (in V)
Z_1=E_g*60*A/(F_1*N*P) #total no of armature conductor required
C_s=ceil(Z_1/120) #number of conductor per slot
print 'number of conductor per slot =' ,C_s
A_s=120 #armature slots
Z_2=A_s*C_s #total conductors in armature slot
F_2=E_g*60*A/(N*Z_2*P) #Actual value of flux(in Wb)
print 'Actual value of flux = %0.4f Wb '%F_2
```

In [14]:

```
#Caption:Calculate the emf if the speed is 1500 rpm
P=8 #Number of poles
F=2 #flux per pole (in mWb)
F_1=2*10**-2 #flux per pole (in Wb)
Z=960 #number of conductor
A=P #Number of parallel paths(lap winding)
N=1500 #speed (in rpm)
E_g=P*F*1e-2*Z*N/(60*A) #emf generated (in Volts)
print 'emf generated = %0.f V'%E_g
```

In [17]:

```
#Caption:Calculate the increase of main field flux in percentage
N_1=750 #speed of dc machine(in rpm)
E_1=220 #induced emf in dc machine when running at N_1
N_2=700 #speed of dc machine second time (in rpm)
E_2=250 #induced emf in dc machine when running at N_2
F=E_2*N_1/(E_1*N_2)
Inc=(F-1)
print 'increase in main field flux of the dc machine = %0.2f %%'%(Inc*100)
```

In [18]:

```
#caption: a)find the emf generated in a 6 pole machine b)find speed at which machine generated 550 V emf
F_1=0.06 #Flux per pole(in Wb)
N_1=250 #speed of the rotor(in rpm)
A=2 #number of parllel (paths armature wave wound)
P=6 #poles in machine
Z=664 #total conductor in machine
E_g=P*F_1*N_1*Z/(60*A) #emf generated
print 'emf generated in machine = %0.2f V'%E_g
E_2=550 #new emf generating machine(in V)
F_2=0.058 #flux per pole (in Wb) for generating E_2
N_2=60*E_2*A/(P*F_2*Z) #new speed at which machine generating E_2(in rpm)
print 'new speed of the rotor = %0.2f rpm '%N_2
```

In [20]:

```
#Caption :determine the value of torque in Nw-m
F=24 #flux per pole (in m Wb)
F_1=F*10**-3 #flux per pole (in Wb)
Z=760 #number of conductors in armature
P=4 #number of pole
A=2 #number of parallel paths
I_a=50 #armature cuurrent(in Amp)
T_a=0.159*F_1*Z*P*I_a/A #torque develope(in Nw-m)
print 'torque developed in machine = %0.f Nw-m '%T_a
```

In [22]:

```
#Caption: calculate the total torque in Nw-m
P=6 #poles
A=P #number of parallel paths
S=60 #slots in motor
C_s=12 #conductor per slot
Z=S*C_s #total conductor in machine
I_a=50 #armature current(in Amp)
F_1=20#flux per pole(in m Wb)
F_2=F_1*10**-3 #flux per pole)(in Wb)
T=0.15924*F_2*Z*P*I_a/A #total torque (in Nw-m)
print 'total torque by motor = %0.2f Nw-m '%T
```

In [23]:

```
#Caption:Calculate the drop in speed when motor takes 51 Amp
V=220 #supply voltage(in V)
R_sh=220 #shunt field resistance(in Ohm)
R_a=0.2 #armature resistance(in Ohm)
I_sh=V/R_sh #shunt field current(in Amp)
N_1=1200 #starting speed of the motor(in rpm)
I_1=5.4 #at N_1 speed current in motor(in Amp)
I_a1=I_1-I_sh #armature current at speed N_1(in Amp)
E_b1=V-I_a1*R_a #emf induced due to I_a1(in V)
I_2=51 #new current which motor taking(in Amp)
I_a2=I_2-I_sh #armature current at I_2(in Amp)
E_b2=V-I_a2*R_a #emf induced due to I_a2(in V)
N_2=E_b2*N_1/E_b1 #speed of the motor when taking I_2 current(in rpm)
N_r=ceil(N_1-N_2) #reduction in speed(in rpm)
print 'reduction in speed = %0.2f rpm '%N_r
```

In [75]:

```
#Caption:In a dc machine Calculate (a)induced emf (b)Electro magnetic torque (c)armature copper loss
V=220 #voltage at the armature of dc motor
I_a=15 #current through armature(in Amp)
R_a=1 #armature resistance(in Ohm)
w=100 #speed of the machine(in radian/sec)
E=V-I_a*R_a #induced emf(in V)
print 'induced emf = %0.2f V '%E
T=E*I_a/w #electro magnentic torque developed(in Nw-m)
print 'electro magnentic torque developed = %0.2f Nw-m '%T
L=(I_a**2)*R_a #Armature copper loss(in Watt)
print 'Armature copper loss = %0.2f Watt' %L
```

In [24]:

```
#Caption:Calculate the electro magnetic torque
E=250 #emf induced in dc machine(in V)
I_a=20 #current flowing through the armature(in Amp)
N=1500 #speed(in rpm)
T_e=0.1591*E*I_a*60/N #torque developed in machine(in Nw-m)
print 'electro magnetic torque developed in dc machine = %0.2f Nw-m '%T_e
```

In [25]:

```
#Caption:calculate the gross torque in dc machine
P=4 #number of poles
Z=1600 #number of armature conductor
F=0.027 #flux per pole(in Wb)
A=2 #number of parallel paths (wave wound)
I=75 #current in machine(in Amp)
N=1000 #speed of the motor(in rpm)
T=0.1591*P*F*Z*I/A #torque generate in machine(in Nw-m)
print 'Torque generated in machine = %0.2f Nw-m '%T
```

In [27]:

```
#Caption:Calculate the value of back emf
V=230 #applied voltage (in V)
R_a=0.1 #armature resistance(in Ohm)
I_a=60 #armature current (in Amp)
E_b=V-I_a*R_a #back emf(in Volts)
print 'back emf produced by machine = %0.2f V '%E_b
```

In [28]:

```
#Capyion:find the change in back emf from no load to load
V=220 #given voltage to machine(in V)
R_a=0.5 #armature circuit resistance(in ohm)
I_1=25 #full load armature current(in Amp)
I_2=5 #no load armature current(in Amp)
E_1=V-I_1*R_a #back emf at full load(in V)
E_2=V-I_2*R_a #back emf at no load(in V)
E=E_2-E_1 #change in back emf no load to load
print 'change in back emf from no load to load = %0.2f Volts '%E
```

In [29]:

```
#Caption: Determine the back emf in dc shunt motor
V=220 #voltage(in V)
R_a=0.7 #Armature resistance(in Ohm)
R_f=200 #field resistant(in Ohm)
P_1=8*10**3 #motor output power(in Watt)
P_2=8*10**3/0.8 #motor input power(in Watt)
I_m=P_2/V #motor input current(in Amp)
I_sh=V/R_f #shunt field current (in Amp)
I_a=I_m-I_sh #Armature current(in Amp)
E_b=V-I_a*R_a #Back emf (in V)
print 'Back emf produced in motor = %0.2f Volts '%E_b
```

In [30]:

```
#Caption :Determine the total armature power developed when working as a)Generator b)motor
P=25*10**3 #output generator power(in Watt)
V=250 #output generator voltage(in V)
R_f=125 #field resistance(in Ohm)
R_a=0.05 #armature resistance(in Ohm)
I_sh=V/R_f #shunt field current(in Amp)
#IN case of generator
I_o=P/V #output generator current(in Amp)
I_a1=I_o+I_sh #armature current for a generator(in Amp)
E_a1=250+I_a1*R_a #generated emf in armature(in V)
P_a1=E_a1*I_a1 #generated power in armature when working as a generator(in Watt)
P_g=P_a1*10**-3 #generated power in armature when working as a generator(in kW)
print 'power developed in armature when working as a generator = %0.2f kW '%P_g
#IN case of motor
I_in=P/V #motor input current(in Amp)
I_a2=I_in-I_sh #armature current for a motor(in Amp)
E_a2=250-I_a2*R_a #generated emf in armature when working as a motor(in V)
P_a2=E_a2*I_a2 #generated power in armature when working as a motor(in Watt)
P_m=P_a2*10**-3 #generated power in armature when working as a motor(in KW)
print 'power developed in armature when working as a motor = %0.2f kW '%P_m
```

In [31]:

```
#Caption :Calculated power developed in armature when machine running as (a)Generator (b)Motor
V=250 #line voltage(in V)
R_sh=125 #shunt field resistance(in Ohm)
I_sh=V/R_sh #shunt field current(in Amp)
I_l=80 #line current(in Amp)
R_a=0.1 #armature resistance(in Ohm)
#As A Generator
I_a1=I_l+I_sh #armature current in generator(in Amp)
E_g=V+I_a1*R_a #generated emf(in V)
P_1=E_g*I_a1*10**-3 #power developed in armature (in KW)
print 'power developed in armature when machine running as a generator = %0.2f kW '%P_1
#As A Motor
I_a2=I_l-I_sh #armature current in motor(in Amp)
E_b=V-I_a2*R_a #back emf in motor(in V)
P_2=E_b*I_a2*10**-3 #power developed in armature (in KW)
print 'power developed in armature when machine running as a Motor = %0.2f kW'%P_2
```

In [33]:

```
#Caption:Calculated speed of the motor when the current is 10 Amp
V=230 #supply voltage(in V)
R_a=0.8 #armature resistance(in Ohm)
R_f=0.8#field resistance(in Ohm)
I_1=20 #dc motor taking current from supply(in Amp)
E_1=V-R_a*I_1 #emf generated due to I_1(in V)
N_1=600 #speed of the motor due to I_1
I_2=10 #current(in Amp) at which speed of the motor need to calculate
E_2=V-R_a*I_2 #emf generated due to I_2(in Volts)
N_2=E_2*I_1*N_1/(E_1*I_2) #speed of the motor when machine drawing 10(in Amp) current
print 'speed of the motor when machine drawing 10 Amp current = %0.0f rpm '%N_2
```

In [50]:

```
#Caption:Percentage change in speed of a d.c. motor
V=240 #supply voltage(in V)
R_a=0.5 #armature resistance(in Ohm)
I_1=100 #armature current (in Amp)
I_2=50 #changed armature current(in Amp)
E_1=V-R_a*I_1 #induced emf(in V)
E_2=V-R_a*I_2 #changed induced emf due to I_2
#flux per pole is constant
N_r=E_2/E_1 #ratio of speed in machine due to voltage change
N_rp=(N_r-1)*100 #Percentage change in speed of d.c. motor
print 'Percentage change in speed of d.c. motor =',round(N_rp ,2)
# Answer wrong in the textbook.
```

In [52]:

```
#Caption:Find the speed at which motor will run when connected in series with a 4 Ohm resistance
V=200 #supply voltage (in V)
R_m=1 #motor resistance b/w terminals(in Ohm)
I_1=15 #motor input current(in Amp)
N_1=800 #speed of the motor (in rpm)
E_1=V-(I_1*R_m) #back emf developed(in V)
R=4 #resistance connected in series with motor (in Ohm)
I_2=I_1 #when resistance of 4 Ohm connected in series with the motor ,motor input current is same
E_2=V-I_2*(R_m+R) #back emf developed when R connected in series with motor(in V)
N_2=E_2*N_1/E_1 #speed of the motor when it connected in series with a 4 Ohm resistance(in rpm)
print 'speed of the motor when it connected in series with a 4 Ohm resistance = %0.1f rpm '%N_2
```

In [53]:

```
#Caption:Determine the speed when armature current is 75 Amp and the excitation is increased by 15 %
V=220 #supply voltage(in V)
R_a=0.03 #armature resistance(in Ohm)
R_se=0.07 #field resistance(in Ohm)
I_a1=40 #armature current in first case(in Amp)
N_1=900 #motor running speed at 40 Amp armature current(in rpm)
E_1=V-I_a1*(R_a+R_se) #induced emf due to 40 Amp armature current (in V)
I_a2=75 #armature current in second case(in Amp)
E_2=V-I_a2*(R_a+R_se) #induced emf due to 75 Amp armature current (in V)
#Flux is F_1 when I_a1 and F_2 when I_a2. F_2=1.15*F_1 because Excitation is increased by 15% so F=(F_1/F_2)
F=1.15 #Ratio of F_2/F_1
N_2=ceil(N_1*E_2/(F*E_1)) #motor speed when armature current is 75 Amp and the excitation is increased by 15 %(in rpm)
print 'motor speed when armature current is 75 Amp and the excitation is increased by 15 %% = %0.2f rpm'%N_2
```

In [55]:

```
#Caption:Calculate H.P. is being transmitted by the shaft of motor
V=220 #supply voltage(in V)
N=900 #running speed of a shunt motor(in rpm)
T=1000 #torque exerted by motor (in Nw-m)
w=2*3.14159*N/60 #angular speed(in rad/sec)
P=w*T #power transmitted (in Watt)
H_p=P/735.5 #power transmitted in H.P.(metric)
print 'power transmitted by the shaft of motor = %0.1f H.P.(metric)' %H_p
```

In [57]:

```
#Caption:Calculate the torque
P_1=70 #power transmitted by the shaft of a motor in H.P(metric)
P_2=P_1*735.5 #power (in Watts)
N=500 #speed of the motor(in rpm)
w=2*3.1416*N/60 #angular speed (in radian/sec)
T=P_2/w #torque in motor (in Nw-m)
print 'torque in motor = %0.1f Nw-m '%T
```

In [59]:

```
#Caption:Find the speed when the armature takes 70 Amp
V=400 #voltage for a shunt motor (in V)
R_a=0.2 #armature resistance(in Ohm)
I_a1=100 #starting armature current(in Amp)
N_1=1000 #speed of the motor when I_a1 armature current flows in armature
E_1=V-I_a1*R_a #emf induced at I_a1 armature current (in V)
I_a2=70 #changed armature current(in Amp)
E_2=V-I_a2*R_a #emf induced for I_a2 current(in V)
#flux is constant
N_2=ceil(E_2*N_1/E_1) #speed of the motor when 70 Amp current flowing through armature
print 'speed of the motor when 70 Amp current flowing through armature = %0.1f rpm'%N_2
```

In [62]:

```
#Caption:resistance required to be connected in series to reduced speed of machine to 800 rpm (in Ohm)
V=400 #voltage applied across the motor(in V)
R_sh=100 #shunt resistance of motor(in Ohm)
I=70 #total current flowing through motor(in Amp)
I_sh=V/R_sh #current flowing through the shunt resistance(in Amp)
I_a1=I-I_sh #current flowing through the armature(in Amp)
R_a1=0.03 #resistance of armature(in Ohm)
R_se=0.5 #series resistance with armature(in Ohm)
R_a=R_a1+R_se #total resistance in armature circuit(in Ohm)
E_1=V-I_a1*R_a #emf induced due to this R_a resistance(in V)
N_1=900 #given speed of the motor(in r.p.m.)
N_2=800 #desired speed of the motor(in r.p.m.)
E_2=E_1*(N_2/N_1) #emf induced due to armature resistance when motor spped is 800(in V)
R_a2=(400-E_2)/66 #resistance required to be connected in series(in Ohm)
print 'net resistance of armature which reduce speed of the machine to 800 rpm = %0.3f Ohm '%R_a2
R=R_a2-R_a1 #additional resistance required to be connected in series to reduced speed of machine to 800 rpm (in Ohm)
print 'additional resistance required to be connected in series to reduced speed of machine to 800 rpm = %0.3f Ohm '%R
```

In [63]:

```
#Caption:Motor speed at full load
V=230 #supply voltage
I_a1=2 #no load current(in Amp)
N_1=1500 #speed of the motor at no load
R_a=0.3 #Armature resistance(in Ohm)
I_a2=50 #full load current(in Amp)
E_1=V-I_a1*R_a #emf generated at no load
E_2=V-I_a2*R_a #emf generated at full load
N_2=(E_2/E_1)*N_1 #full load speed (flux assumed constant)
print 'D.c. motor speed at full load when flux assumed constant = %0.2f rpm '%ceil(N_2)
```

In [92]:

```
#Caption:calculate the speed of a d.c. shunt generator when it running as d.c. motor and taking 50 KW power at 250 volt
#calculation when machine is running as generator
V=250 #applied voltage to d.c. shunt generator
P_1=50000 #power delivers by d.c. shunt generator at V_1
N_1=400 #generator running at V_1 ,P_1
R_a=0.02 #armature resistance(in Ohm)
R_sh=50 #field resistance(in Ohm)
I_l=P_1/V #load current(in Amp)
I_sh=V/R_sh #field current(in Amp)
I_a1=I_l+I_sh #armature current when machine working as a generator(in Amp)
C_d=1 #contact drop (in volt per brush)
E_1=V+I_a1*R_a+2*C_d #induced emf by machine when working as a generator(in V)
#calculation when machine is running as motor
I_a2=I_l-I_sh#armature current when machine working as a motor(in Amp)
E_2=V-I_a2*R_a-2*C_d #induced emf by machine when working as a motor(in V)
N_2=(E_2/E_1)*N_1 #speed of the machine when running as shunt motor(in r.p.m.)
print 'speed of the machine when running as shunt motor and taking 50 KW power at 250 volt = %0.2f r.p.m. '%N_2
```

In [64]:

```
#Caption:Calculate the value of resistance to be connected in series with the armature to reduce the speed to 750 r.p.m.
V=220 #applied voltage to shunt motor(in V)
I_a1=40 #armature current in first case(in Amp)
R_a=0.5 #armature circuit resistance(in Ohm)
N_1=900 #speed of the motor at I_a1 (in rpm)
E_b1=V-I_a1*R_a #emf generated in armature circuit due to I_a1(in V)
N_2=750 #desired motor speed (in rpm)
I_a2=30 #armature current in case of N_2 motor speed(in Amp)
E_b2=(N_2/N_1)*E_b1 #emf generated in second case when motor speed is N_2
#R resistance added in series with the armature circuit to reduced the speed of motor
R=(205-E_b2)/30 #resistance added in series with the armature circuit to reduced the speed of motor
print 'resistance added in series with the armature circuit to reduced the speed of motor = %0.2f Ohm '%R
```

In [65]:

```
#Caption:what resistance should be placed in series with armature to reduced the speed of the motor to 700 rpm
V=220 #applied voltage to shunt motor(in V)
R_a=0.3 #armature circuit resistance(in Ohm)
I_a=15 #armature current(in Amp)
E_b1=V-I_a*R_a #emf generated in armature circuit(in V)
N_1=1000 #motor speed when E_b1 generated(in rpm)
N_2=700 #desired motor speed (in rpm)
E_b2=(N_2/N_1)*E_b1 #emf generated in second case when motor speed is N_2
R=(215.5-E_b2)/15 #resistance added in series with the armature circuit to reduced the speed of motor (in Ohm)
print 'resistance added in series with the armature circuit to reduced the speed of motor = %0.2f Ohm '%R
```

In [75]:

```
#Caption:In a shunt motor find the resistance required in series with the armature circuit to reduce the speed of motor by 50 percent
I_a1=40 #Armature current(in Amp)
R_a=0.6 #Armature circuit resistance(in Ohm)
#T_1/T_2=I_a1/I_a2
#T_1=T_2
V=220
I_a2=I_a1 #current when speed reduced 50%
E_b1=V-(R_a*I_a1) #emf induced in circuit
N_r=0.5 #Ratio of speed (N_2/N_1)
#E_b2=V-I_a2*R
#R is a total armature resistance in the second case
#N_2/N_1=E_b2/E_b1
#N_r=(V-I_a2*R)/E_b1
R=(V-(N_r*E_b1))/I_a2-R_a #the resistance required in series with the armature circuit to reduce the speed of motor 50%
print 'the resistance required in series with the armature circuit to reduce the speed of motor by 50%% = %0.1f Ohm' % R
```

In [76]:

```
#Caption:Calculate the induced emf in a D.C. machine for speed of 600 rpm
#assuming the flux is constant
N_1=500 #primary speed of the motor(in rpm)
E_1=180 #induced emf in d.c. machine when running at N_1 (in V)
N_2=600 #secondary speed of the motor (in rpm)
E_2=(N_2/N_1)*E_1 #induced emf in d.c. machine when running at N_2 (in V)
print 'the emf induced in a D.C. machine when machine running at 600 rpm speed = %0.2f V '% E_2
```

In [78]:

```
#Caption:In a dc machine calculate speed at which the induced emf will be 250 Volts
E_1=220 #Primary emf(in Volts)
N_1=750 #Speed of the machine at 220 Volts
E_2=250 #Secondary emf(in Volts)
N_2=(E_2/E_1)*N_1 #Speed of the machine at which emf will be 250 Volts
print 'Speed of the machine at which emf will be 250 Volts = %0.f'%N_2
N_3=700 #Speed of the machine when main field flux increase
E_3=250 #induced emf when flux increase(in Volts)
F_x=(E_3/E_2)*(N_2/N_3) #Ratio of flux when speed is N_3 and N_2
F=(F_x-1)*100 #Percentage change in flux for induced emf of 250 Volts and speed 700 rpm(in %)
print 'Percentage change in flux when induced emf 250 Volts and speed 700 rpm = %0.2f %%'% F
```

In [79]:

```
#Caption:Calculate induced emf when running at speed of 1380 rpm.
P=4 #Poles in d.c. machine
Z=594 #number of conductor in d.c. machine
F=0.0075 #flux per pole(in Wb)
N=1380 #speed of the motor
A=2 #number of parallel paths
E=P*F*N*Z/(60*A) #emf generated in machine when running at speed of 1380 rpm.
print 'emf generated in machine when running at speed of 1380 rpm = %0.2f V '%ceil(E)
```

In [81]:

```
#Caption:Calculate the speed and calculate the electro magnetic torque.
V_1=230 #supply voltage(in V)
I_a1=100 #motor taking current from supply(in Amp)
N_1=600 #speed of the motor when I_a1 current taking from supply(in rpm)
R_a=0.12 #resistance of armature circuit(in Ohm)
R_f=0.03 #resistance of series winding(in Ohm)
R=R_a+R_f #total resistance(in Ohm)
I_a2=50 #desired current of the motor
E_1=V_1-I_a1*R #emf induced when current I_a1 flowing
E_2=V_1-I_a2*R #emf induced when current I_a2 flowing
N_2=(E_2/E_1)*(I_a1/I_a2)*N_1 #speed of the motor when 50 Amp current taking from supply(in rpm)
print 'speed of the motor when 50 Amp current taking from supply = %0.2f rpm '%N_2
T_1=E_1*I_a1*60/(2*3.14*N_1) #electro-magnetic torque generated when motor running at 600 rpm(in Nw-m)
print 'electro-magnetic torque generatedwhen motor running at 600 rpm = %0.2f Nw-m '%T_1
T_2=E_2*I_a2*60/(2*3.14*N_2) #electro-magnetic torque generated in second case(in Nw-m)
print 'electro-magnetic torque generated in second case = %0.2f Nw-m '%T_2
# Answer in the textbok are not accurate.
```

In [83]:

```
#Caption:What resistance must be inserted in series with the armature to reduce the speed to 500 rpm
V=250 #applied voltage to a shunt motor(in V)
I_a=20 #armature current(in Amp)
R_a=0.5 #armature resistance(in Ohm)
N_1=1000 #speed of the motor due to these readings(in rpm)
E_1=V-I_a*R_a #emf induced in machine(in V)
N_2=500 #desired speed of the motor(in rpm)
E_2=(N_2/N_1)*E_1 #emf in case of motor speed N_2
#R_1 additional resistance added to reduce the speed to 500 rpm
R_1=(V-E_2)/I_a-R_a #resistance applied in series with armature to reduce the speed to 500 rpm
print 'resistance applied in series with armature to reduce the speed to 500 rpm = %0.2f Ohm '%R_1
# Answer wrong in the textbook.
```

In [86]:

```
#Caption:Determine the torque in Kgm.,H.P. & efficiency of the motor.
W_1=75 #load on one side of the brake(in Kg)
W_2=5 #load on other side of the brake(in Kg)
W=W_1-W_2 #effective force(in Kg)
R=1 #radius of the brake pulley (in m)
T=W*R #torque(in Kg-m)
N=1200 #speed of the small shunt motor(in rpm)
H=(2*3.14)*(N*T)/33000 #torque in H.P.
print 'torque = %0.2f H.P. '% H
H_P=735.5 #value of one H.P.
O_p=H*H_P #output power(in Watt)
I_c=80 #input current(in Amp)
V=250 #input voltage(in V)
I_p=I_c*V #input power(in Watt)
E=(O_p/I_p)*100 #efficiency of the motor
print 'efficiency of the motor = %0.2f %%'%E
# 2nd part Answer wrong in the textbook.
```

In [88]:

```
#Caption:Determine the torque in Kgm.,output in Watts & efficiency of the motor.
W_1=40 #load on one side of the brake(in Kg)
W_2=5 #load on other side of the brake(in Kg)
W=W_1-W_2 #effective force(in Kg)
R=0.5 #radius of the brake pulley (in m)
T=W*R #torque(in Kg-m)
N=1500 #speed of the small shunt motor(in rpm)
O=(2*3.14)*(N*T)/60 #output (in Kg-m/sec)
O_p=O*9.81 #output (in watts)
print 'output = %0.2f watts'%ceil(O_p)
I_c=80 #input current(in Amp)
V=400 #input voltage(in V)
I_p=I_c*V #input power(in Watt)
E=(O_p/I_p)*100 #efficiency of the motor
print 'efficiency of the motor = %0.1f %%'%E
```

In [89]:

```
#Caption:Calculate the efficiency of the motor
W=10 #Spring reading (in Kg)
R=0.8 #brake arm length (in m)
T=W*R #torque (in kg-m)
N=1200 #speed of the small shunt motor(in rpm)
O=(2*3.14)*(N*T)/60 #output (in Kg-m/sec)
O_p=O*9.81 #output (in watts)
V=250 #input voltage(in V)
I=50 #input current(in Amp)
I_p=V*I #input power(in watts)
E=(O_p/I_p)*100 #efficiency of the motor
print 'efficiency of the motor = %0.2f %%'%E
```

In [91]:

```
#Caption:Estimate the output and efficiency of a shunt motor when the input current is 20Amp and 100Amp
V=500 #applied voltage(in V)
R_sh=500 #field resistance (in Ohm)
R_a=0.2 #armature resistance(in Ohm)
I_o=4 #no load current (in Amp)
I_sh=V/R_sh #field current(in Amp)
I_a=I_o-I_sh #armature current(in Amp)
L_cf=V*I_sh #copper losses in field(in watts)
L_ca=(I_a**2)*R_a #copper losses in armature(in watts)
L_tc=L_cf+L_ca #total copper losses
L_t=V*I_o #input power to motor on no load(in watts)
L_m=L_t-L_tc #iron & mechanical losses(in watts)
L_c=L_m+L_cf #constant losses(in watts)
#(a) when input current is 20 Amp
I_l1=20 #input current(in Amp)
I_a1=I_l1-I_sh #armature current when I_l1 input current(in Amp)
L_ca1=(I_a1**2)*R_a #copper losses in armature when I_l1 input current(in watts)
L_T1=L_c+L_ca1 #total losses at this load(in watts)
I_p=V*I_l1 #input power(in watts)
O_p1=I_p-L_T1 #output power when input current is 20 Amp(in watts)
print 'output power when input current is 20 Amp = %0.2f Watts '%O_p1
E_1=(O_p1/I_p)*100 #efficiency of the shunt motor when input current is 20 Amp
print 'efficiency of the shunt motor when input current is 20 Amp = %0.3f %%'%E_1
#(b) when input current is 100 Amp
I_l2=100 #input current(in Amp)
I_a2=I_l2-I_sh #armature current when I_l2 input current(in Amp)
L_ca2=(I_a2**2)*R_a #copper losses in armature when I_l2 input current(in watts)
L_T2=L_c+L_ca2 #total losses at this load(in watts)
I_p=V*I_l2 #input power(in watts)
O_p2=I_p-L_T2 #output power when input current is 100 Amp(in watts)
print 'output power when input current is 100 Amp = %0.2f Watts '%O_p2
E_2=(O_p2/I_p)*100 #efficiency of the shunt motor when input current is 100 Amp
print 'efficiency of the shunt motor when input current is 100 Amp = %0.2f %%'%E_2
```

In [95]:

```
#Caption:Calculate the motor output, H.P. and efficiency when the total current taken from the mains is 35 Amp
V=230 #applied voltage(in V)
R_sh=230 #field resistance (in Ohm)
R_a=0.3 #armature resistance(in Ohm)
I_o=2.5 #no load current (in Amp)
I_sh=V/R_sh #field current(in Amp)
I_a=I_o-I_sh #armature current(in Amp)
L_cf=V*I_sh #copper losses in field(in watts)
L_ca=(I_a**2)*R_a #copper losses in armature(in watts)
L_tc=L_cf+L_ca #total copper losses
L_t=V*I_o #input power to motor on no load(in watts)
L_m=L_t-L_tc #iron & mechanical losses(in watts)
L_c=L_m+L_cf #constant losses(in watts)
# when input current is 35 Amp(On load condition)
I_l=35 #input current(in Amp)
I_a1=I_l-I_sh #armature current when I_l input current(in Amp)
L_ca1=(I_a1**2)*R_a #copper losses in armature when I_l input current(in watts)
L_T1=L_c+L_ca1 #total losses at this load(in watts)
I_p=V*I_l #input power(in watts)
O_p=I_p-L_T1 #output power(in watts)
print 'output power of motor = %0.3f Watts '%O_p
Hp=O_p/746 #the shunt motor H.P
print 'the shunt motor H.P.= %0.2f'%Hp
E_1=(O_p/I_p)*100 #efficiency of the shunt motor when input current is 35 Amp
print 'efficiency of the shunt motor when input current is 35 Amp = %0.1f %%'%E_1
```

In [98]:

```
#Caption:Calculate the full load motor output and its efficiency
V=500 #applied voltage(in V)
R_sh=250 #field resistance (in Ohm)
R_a=0.2 #resistance of armature including brushes(in Ohm)
I_o=5 #no load current (in Amp)
I_sh=V/R_sh #shunt field current(in Amp)
I_a=I_o-I_sh #armature current(in Amp)
L_a=(I_a**2)*R_a #armature brush drop(in watts)
L_t=V*I_o #input to motor on no load(in watts)
L_c=L_t-L_a #constant losses(in watts)
#On full load condition
I_l=52 #input current(in Amp)
I_a1=I_l-I_sh #armature current when I_l1 input current(in Amp)
L_a1=(I_a1**2)*R_a #losses in armature when I_l1 input current(in watts)
L_T1=L_c+L_a1 #total losses at this load(in watts)
I_p=V*I_l #input power(in watts)
O_p=I_p-L_T1 #output power(in watts)
print 'output of the motor = %0.2f Watts '%O_p
Hp=O_p/735.5 #the shunt motor H.P
print 'the shunt motor H.P.= %0.2f' %Hp
E_1=(O_p/I_p)*100 #efficiency of the full load shunt motor when input current is 52 Amp
print 'efficiency of the full load shunt motor when input current is 52 Amp = %0.1f %%'%E_1
```

In [100]:

```
#Caption:Determine the input in Watts & efficiency of the generator
O_p=50 #output of a machine (in KW)
O_p1=50*(10)**3 #output (in watts)
L_i=4000 #internal losses(in watts)
I_p=O_p1+L_i #input(in watts)
print 'input = %0.f Watts '%I_p
E=(O_p1/I_p)*100 #efficiency of the generator
print 'efficiency of the generator = %0.2f %%'% E
```

In [103]:

```
#Caption:Determine the internal losses,torque & efficiency of the motor
V=240 #supply voltage(in V)
I=80 #motor taking current(in Amp)
Hp=20 #motor giving H.P.
I_p=V*I #input (in watts)
O_p=Hp*735.5 #output (in watts)
L_i=I_p-O_p #internal losses(in watts)
print 'internal losses in motor = %0.2f Watts '%L_i
N=1300 #motor speed (in rpm)
T=O_p*60/(2*3.14*N) #torque generated in motor(in Nw-m)
print 'torque generated in motor = %0.f Nw-m '% T
E=(O_p/I_p)*100 #efficiency of the motor
print 'efficiency of the motor = %0.1f %%' %E
```

In [105]:

```
#Caption:Find the copper losses,iron& friction losses and commerical efficiency.
V=250 #supply voltage(in V)
R_sh=100 #shunt field resistance(in Ohm)
R_a=0.1 #armature resistance(in Ohm)
I_sh=V/R_sh #field current(in Amp)
I_l=197.5 #motor taking current(in Amp)
I_a=I_l+I_sh #Armature current(in Amp)
E=V+I_a*R_a #E.M.F generated(in V)
Hp=80 #motor giving H.P.
P_m=Hp*735.5 #mechanical power input (in watts)
P_a=E*I_a #electrical power developed in armature(in watts)
L_i=P_m-P_a #iron & friction losses(in watts)
print 'iron & friction losses in motor = %0.2f Watts '%L_i
O_p=V*I_l #electrical power output
L_c=P_a-O_p #copper losses(in watts)
print 'copper losses in a shunt generator = %0.2f Watts '%L_c
L_t=L_i+L_c #Total losses(in Watts)
I_p=O_p+L_t #Input(in Watts)
E_f=(O_p/I_p)*100 #Commerical efficiency
print 'commerical efficiency = %0.2f %%'%E_f
# 3rd part Answer wrong in the textbook.
```

In [107]:

```
#Caption:Determine Copper losses and total losses and Output and BHP of the motor and efficiency of the motor
V=230 #supply voltage(in V)
I_l=200 #line current(in Amp)
I_p=V*I_l #input power (in watts)
R_sh=50 #shunt field resistance(in Ohm)
R_a=0.04 #armature resistance (in ohm)
I_sh=V/R_sh #shunt field currrent(in Amp)
I_a=I_l-I_sh #armature current(in Amp)
L_cf=V*I_sh #copper losses in the field(in watts)
L_ca=(I_a**2)*R_a #copper loses in armature(in watts)
L_ct=L_cf+L_ca #Total copper losses(in watts)
print 'copper losses of the motor = %0.2f Watts '%L_ct
L_s=1500 #Stray losses (in watts)
L_t=L_ct+L_s #total losses(in watts)
print 'total losses of the motor = %0.2f Watts '%L_t
O_p=I_p-L_t #output of the motor(in watts)
print 'Output of the motor = %0.2f Watts'%O_p
Bhp=O_p/735.5 #B.H.P. of the motor (in H.P.)
print 'B.H.P. of the motor = %0.3f H.P. '%Bhp
E=(O_p/I_p)*100 #efficiency of the motor(in %)
print 'efficiency of the motor = %0.2f %%'%E
```

In [111]:

```
#Caption:Calculate the speed and BHP of the motor
V=250 #applied emf(in V)
R_sh=0.05 #field resistance (in Ohm)
R_a=0.1 #armature resistance(in Ohm)
I=80 #motor current(in Amp)
A_s=240 #armature slots
C_s=4 #number of conductor per slot
Z=A_s*C_s #total number of conductor
E_b=V-I*(R_a+R_sh) #Back emf(in V)
A=2 #number of parallel paths for wave wound
P=6 #poles
F=1.75 #flux per pole (in megalines)
F_1=1.75*10**-2 #flux per pole (in Wb)
N=E_b*60*A/(F_1*Z*P) #speed of the motor (in rpm)
print 'speed of the motor = %0.f rpm '%N
I_p=V*I #input to the motor(in watts)
L_c=(I**2)*(R_a+R_sh) #copper losses(in watts)
L_i=900 #iron and friction losses(in watts)
L_t=L_c+L_i #total losses(in watts)
O_p=I_p-L_t #output(in watts)
BHP=O_p/746 #B.H.P. of the motor
print 'B.H.P. of the motor = %0.1f H.P'% BHP
```