In [1]:

```
import math
# Variables
Pole = 6.
V = 500.
A = 2. #because of wave wound armature
Z = 1200. #number of armature conductors
phi = 20.*10**-3 #useful flux per pole
Ra = 0.5
Rsh = 250. #armature and field resistance
Il = 20. #current drawn from supply
mechanical_losses = 900.
Ish = V/Rsh
Ia = Il-Ish
Eb = V-Ia*Ra #because V = Eb+Ia*Ra
N = Eb*60*A/(phi*Pole*Z) #Eb = phi*Pole*N*Z/(60*A)
# Calculations
P_m = Eb*Ia #Electrical equivalent of mechanical power
omega = 2*math.pi*N/60
Tg = P_m/omega
P_out = P_m-mechanical_losses
T_sh = P_out/omega #Useful torque
P_in = V*Il
percentage_efficiency = 100*P_out/P_in
# Results
print 'Speed developed is %.3f r.p.m \
\nTorque developed is %.2f N-m \
\nUseful torque is %.2f N-m \
\nEfficiency is %.2f percent'%(N,Tg,T_sh,percentage_efficiency)
```

In [2]:

```
import math
# Variables
#no load
I_noload = 2.5 #No load current
V = 440.
R_a = 1.2
R_sh = 550. #resistance of armature and shunt field windings
no_load_input = V*I_noload
# Calculations
I_sh = V/R_sh
I_a_noload = I_noload-I_sh
no_load_armature_copper = (I_a_noload**2)*R_a
constant_losses = no_load_input-no_load_armature_copper
#full load
I_fullload = 32
I_a_fullload = I_fullload-I_sh
full_load_armature_coppe = (I_a_fullload**2)*R_a
total_losses = full_load_armature_coppe+constant_losses
full_load_motor_input = V*I_fullload
full_load_motor_output = full_load_motor_input-total_losses
efficiency_at_full_load = full_load_motor_output*100/full_load_motor_input
# Results
print 'Full load motor output is %.2f W \
\nEfficiency of motor at full-load is %.2f percent'%(full_load_motor_output,efficiency_at_full_load)
```

In [1]:

```
import math
from numpy import roots
# Variables
#no load
I = 14. #input current
V = 230.
power_output_FL = 45.*10**3
power_input = V*I
I_sh = 2.55 #field current
R_a = 0.032 #armature resistance
I_a = I-I_sh
cu_loss_NL = I_a**2*R_a #no load copper loss
brush_loss = 2*I_a
constant_loss = power_input - cu_loss_NL - brush_loss
# Calculations and Results
#full load
#I = I_a+ 2.55
#Motor input = Motor output + constant loss + brush loss + cu loss
# solving for I_a I_a**2 - 7125 I_a + 1487700.3 = 0
p = [1, -7125, 1487700.3]
ans = roots(p)
I_a = ans[1] #ignoring second root as its too large
I = I_a+I_sh
print 'Full load current is %.2f A'%(I)
power_input = V*I
eta = 100*(power_output_FL/power_input)
print 'Efficiency at full load is %.2f percent'%(eta)
```

In [4]:

```
import math
# Variables
W1 = 9.1 #Tension on tight side
W2 = 0.8 #Tension on slack side
I = 10. #Total_current
V = 110. #Supply voltage
R = 7.5/100 #Radius of p-ulley in metres
N = 1320. #speed in r.p.m
# Calculations
T_sh = (W1-W2)*9.81*R #9.81 is the accelration due to gravity
omega = (2*math.pi*N/60)
P_out = T_sh*omega
P_in = V*I
efficiency = 100*P_out/P_in
# Results
print 'Full load Efficiency is %.2f percent'%(efficiency)
```

In [5]:

```
import math
# Variables
V = 250.
I_av = 10.
V_av = (240.+220)/2 #average voltage across load
W_dash = V_av*I_av #Power absorbed
t1 = 25.
t2 = 6.
R_sh = 200.
R_a = 0.3 #resistance of field winding and armature
# Calculations
W = W_dash*t2/(t1-t2) #Stray Losses
I_l = 25 #Input current
I_sh = V/R_sh #current through field winding
I_a = I_l-I_sh #Armature current
arm_cu_loss = R_a*I_a**2 #Armature copper losses
sh_cu_loss = R_sh*I_sh**2 # Shunt copper loss
Total_losses = arm_cu_loss + sh_cu_loss + W
Motor_input = V*I_l
Output = Motor_input- Total_losses
efficiency = Output*100/Motor_input
# Results
print 'Efficiency as motor at 25 A and 250 V is %.2f percent'%(efficiency)
```

In [6]:

```
# Variables
I_a = 37.
I_sh = 0.85 #armature and field current for motor
V = 230.
R_a = 0.33 #armature resistance
I_a_g = 30.
I_sh_g = 0.8 #armature and field current for generator
# Calculations and Results
#for motor
arm_cu_loss = I_a**2* R_a #armature copper losses
field_cu_loss = V*I_sh #field copper loss
total_cu_loss = field_cu_loss + arm_cu_loss #total copper loss
#for generator
arm_cu_loss_g = I_a_g**2* R_a #armature copper losses
field_cu_loss_g = V*I_sh_g #field copper loss
total_cu_loss_g = field_cu_loss_g + arm_cu_loss_g #total copper loss
#for motor-generator set
total_cu_loss_set = total_cu_loss_g + total_cu_loss
P_supply = V*(I_a - I_a_g + I_sh+ I_sh_g ) #power taken from supply
stray_loss = P_supply - (total_cu_loss_g + total_cu_loss)
stray_loss_each = stray_loss/2 #stray loss for each machine
#efficiency of motor
motor_input = V*(I_a+I_sh)
motor_output = motor_input - (stray_loss_each + total_cu_loss)
eta_m = 100* motor_output/motor_input #efficiency of motor
print 'Efficiency of motor is %.2f percent '%(eta_m)
#efficiency of generator
generator_input = motor_output #output of motor is input of generator
generator_output = generator_input - (stray_loss_each + total_cu_loss_g)
eta_g = 100* generator_output/generator_input #efficiency of generator
print 'Efficiency of generator is %.2f percent '%(eta_g)
```

In [7]:

```
import math
# Variables
I_1 = 400. #motor input current
V = 200. #voltage across armature
I_2 = 32. #load current
V_2 = 160. #voltage across generator
V_f = 15. #voltage drop across field windings
total_input = (V+V_f)*I_1
Output = V_2*I_2
total_losses = total_input-Output #total losses in 2 machines
# Calculations and Results
R_se = V_f/I_1 #series field resistance
R_a = 0.4 # armature field resistance
total_cu_loss = (R_a + 2*R_se) * I_1**2 + I_2**2*R_a #total copper loss
stray_losses = total_losses - total_cu_loss
stray_losses_each = stray_losses /2 #stray losses for each machine
#for motor
motor_input = V*I_1
arm_cu_loss = (R_a + R_se)*I_1*I_1 #armature copper loss
total_losses_motor = arm_cu_loss + stray_losses_each
motor_output = motor_input- total_losses_motor
eta_m = 100*motor_output/motor_input #efficiency of motor
print 'Efficiency of motor is %.2f percent '%(eta_m)
#for generator
arm_cu_loss_gen = R_a*I_2**2 #armature copper loss
series_field_cu_loss = V_f*I_1 #series field copper loss
total_losses_gen = arm_cu_loss_gen + series_field_cu_loss + stray_losses_each
generator_input = total_losses_gen+ Output
eta_gen = 100*Output/generator_input #efficiency of generator
print 'Efficiency of generator is %.2f percent'%(eta_gen)
#Note : 'Answer dont match because Output-of-generator is taken as 5220 for calculation while its should have been 5120'
```

In [8]:

```
# Variables
V = 500.
Io = 5. #no load current
R_a = 0.5
R_sh = 250. #resistance of armature and field circuits
I = 100. #current at unknown efficiency
# Calculations
P_in_NL = V*Io #no load input
I_sh = V/R_sh
Iao = Io-I_sh
arm_cu_loss_no_load = R_a*Iao**2 #No load armature copper loss
constant_losses = P_in_NL- arm_cu_loss_no_load
I_a = I-I_sh
arm_cu_loss = R_a*I_a**2 #New armature copper loss
Total_loss = arm_cu_loss + constant_losses
P_in = V*I
efficiency = (P_in-Total_loss)*100/P_in #required efficiency
# Results
print 'Efficiency is %.3f percent when motor takes %.0f A current'%(efficiency,I)
```

In [9]:

```
import math
# Variables
V = 500.
I_NL = 5. #no load current
P_in_NL = V* I_NL #no load input
R_a = 0.22
R_sh = 250. #resistance of armature and shunt field winding
I_sh = V/R_sh
I_a_NL = I_NL-I_sh #armature current no load
arm_cu_loss_NL = R_a*I_a_NL**2 #No-load armature copper loss
constant_loss = P_in_NL - arm_cu_loss_NL
# Calculations and Results
#at 100 A current
I = 100.
I_a = I - I_sh
arm_cu_loss = R_a*I_a**2 #armature copper loss
total_loss = arm_cu_loss + constant_loss
motor_input = V*I
motor_output = motor_input- total_loss
eta_m = 100*motor_output/motor_input #motor efficiency
print 'Parta)Efficiency of motor when it takes 100 A current and loaded is %.2f percent'%(eta_m)
#part(b)
E_b_NL = V - I_a_NL*R_a #back emf at no load
E_b = V- I_a*R_a #back EMF at 100 A current
#Since E_b is proportional to N and using componendo dividendo
delta_speed = 100*((E_b_NL-E_b)/E_b)
print 'Partb)Percentage speed in speed is %.3f percent'%(delta_speed)
print 'Note that the following were assumptions made'
print 'i) Due to heating %( resistance of shunt field winding will be increased which will reduce the shunt field current.This will decrease the flux which is neglected'
print 'ii) Though the motor speed is changing from no load to given load , the mechanical losses are assumed to be cosnstant'
print 'iiiThe effect of armature reaction aon main pole flux and its effect on iron loss is neglected'
```

In [10]:

```
import math
# Variables
motor_output_FL = 15000. #full load motor output
V = 250.
R_sh = 100.
# Calculations
#at 80 % of full load
motor_output_FL_dash = (80./100)*motor_output_FL #80 percent of full load output
eta = 90./100 #efficiency
motor_input = motor_output_FL_dash/eta
total_losses = motor_input - motor_output_FL_dash #at 80 % of full load
#at maximum efficiency variable losses = constant losses
constant_losses = total_losses/2
variable_losses = constant_losses
I = motor_input/V #line current at 80% load
I_sh = V/ R_sh
I_a = I- I_sh
#math.since armature copper loss = R_a*I_a**2
R_a = variable_losses/I_a**2
E_b1 = V-I_a*R_a #motor back EMF at 80% of full load
N_1 = 750. # corresponding speed is given as 750 rpm
#When motor current is 80 A
I = 80.
I_a = I-I_sh
arm_cu_losses = R_a*I_a**2 #armature copper loss
total_losses = arm_cu_losses + constant_losses
motor_input = V*I
motor_output = motor_input- total_losses
eta = 100*motor_output/motor_input #efficiency of motor
E_b2 = V-I_a*R_a #motor back EMF at 80% of full load
N_2 = N_1*(E_b2/E_b1) #because E_b is proportional to N
# Results
print 'Efficiency of motor is %.2f percent when motor draws 80A current'%(eta)
print 'and Speed is %.2f r.p.m'%(N_2)
```

In [11]:

```
import math
# Variables
V = 250.
R_sh = 166.67
R_a = 0.15 #resistance of shunt field winding and armature
N_0 = 1280. #in rpm
I_L1 = 67. #current drawn on full load
I_sh = V/ R_sh
I_a1 = I_L1 - I_sh
E_b1 = V-I_a1*R_a
#on no load
I_L0 = 6.5
I_a0 = I_L0 - I_sh
E_b0 = V-I_a0*R_a
# Calculations and Results
#part (i)
#using speed equation N is proportional to E_b
N_1 = N_0*(E_b1/E_b0)
print 'i)Full load speed is %.3f r.p.m'%(N_1)
#part (ii)
speed_regulation = 100*((N_0-N_1)/N_1)
print 'ii)Speed regulation is %.2f percent '%(speed_regulation)
#part (iii)
stray_losses = E_b0*I_a0 #mechanical power developed on no load
power_developed_FL = E_b1*I_a1
shaft_output_FL = power_developed_FL - stray_losses
hp_rating = shaft_output_FL/746 #in horse power
print 'iii)H.P rating of the machine Is %.2f H.P'%(hp_rating)
#part (iv)
power_input = V*I_L1
eta = 100*(shaft_output_FL/power_input) #efficiency at full load
print 'iv)Efficiency at full load is %.2f percent'%(eta)
```

In [12]:

```
import math
# Variables
V = 200.
R_sh = 240.
R_a = 0.1 #resistance of shunt field winding and armature
rotational_loss = 236.
I_L_FL = 9.8 #full load line current
N = 1450.
I_sh = V/R_sh
I_a_FL = I_L_FL - I_sh
E_b = V- I_a_FL * R_a
# Calculations and Results
#part(i)
gross_mech_P_dev = E_b*I_a_FL #gross mechanical power developed
mech_P_dev = gross_mech_P_dev - rotational_loss #mechanical power developed
print 'i)Gross mechanical power developed is %.2f W'%(gross_mech_P_dev )
print ' Mechanical power developed is %.2f W'%(mech_P_dev )
#part(ii)
P_out = mech_P_dev
print 'ii)The power output is %.2f W'%(P_out)
#part(iii)
T_sh = P_out*60/(2*math.pi*N)
T_L = T_sh
print 'iii)Load torque is %.2f N-m'%(T_L)
#part(iv)
P_in = V*I_L_FL
eta = 100*P_out/P_in
print 'iv)Efficiency at full load is %.2f percent'%(eta)
```

In [13]:

```
import math
# Variables
V = 240.
P_out = 25*735.5 #output power in watts
R_a = 0.14
R_sh = 80. #resistance of armature and shunt field winding
brush_drop = 1. #voltage drop across brush
I_L_FL = 95. #input current at full load
I_sh = V/R_sh
I_a_FL = I_L_FL - I_sh #armature current at full load
# Calculations and Results
arm_cu_loss_FL = R_a*I_a_FL**2 #full load armature copper loss
field_cu_loss = R_sh*I_sh**2 #field copper loss
print 'i)Armature and field copper losses are %.2f W and %.0f W respectively'%(arm_cu_loss_FL,field_cu_loss)
brush_cu_loss = 2*brush_drop*I_a_FL #brush contact copper loss
print 'ii)Brush contact copper loss is %.0f W'%(brush_cu_loss)
E_b = V-I_a_FL*R_a - 2*brush_drop #back emf
gross_mech_P_dev = E_b*I_a_FL #gross mechanical power developed
IFW_losses = gross_mech_P_dev - P_out #iron friction and windage losses
print 'iii)Core plus mechanical losses = %.1f W'%(IFW_losses+field_cu_loss+arm_cu_loss_FL)
eta = 100*(P_out/(P_out + IFW_losses+ brush_cu_loss+field_cu_loss+arm_cu_loss_FL ))
print 'iv)Efficiency is %.2f percent'%(eta)
```

In [14]:

```
import math
# Variables
I = 5. #no load current
V = 500.
R_sh = 250.
R_a = 0.5 #resistance of shunt field winding and armature
motor_input_NL = V*I
I_sh = V/R_sh
I_a = I-I_sh
arm_cu_loss_NL = R_a*I_a**2 #no load armature copper loss
constant_loss = motor_input_NL - arm_cu_loss_NL
I_FL = 50.
I_a_FL = I_FL - I_sh #currents at full load
arm_cu_loss_FL = R_a*I_a_FL**2 #full load armature copper loss
# Calculations and Results
total_loss = constant_loss + arm_cu_loss_FL
motor_input = V*I_FL
motor_output_FL = motor_input - total_loss
print 'Required output power is %.3f kW'%(motor_output_FL/1000)
eta = 100*(motor_output_FL/motor_input) #full load efficiency
print 'Full load efficiency of motor with 50A current is %.2f percent '%(eta)
```

In [15]:

```
import math
# Variables
V = 250.
R_sh = 275.
R_a = 0.8 #resistance of shunt field and amature
I_L0 = 3.91 #load current
I_sh = V/R_sh
I_a0 = I_L0 - I_sh
constant_losses = V*I_L0 -R_a*(I_a0)**2
# Calculations and Results
#as a generator
P_out = 10*10**3
I_L = P_out/V
I_a = I_L + I_sh
field_cu_loss = R_sh*(I_sh)**2 #field copper loss
arm_cu_loss = R_a*(I_a)**2 #armature copper loss
eta_gen = 100 *(P_out/(P_out+constant_losses + field_cu_loss+ arm_cu_loss)) #efficiency as generator
print 'Efficiency as a generator = %.2f percent'%(eta_gen)
#as a motor
P_in = 10*10**3 #at V = 250
I_L = P_in/V
I_a = I_L - I_sh
field_cu_loss = R_sh*(I_sh)**2 #field copper loss
arm_cu_loss = R_a*(I_a)**2 #armature copper loss
eta_m = 100 *((P_in-(constant_losses + field_cu_loss+ arm_cu_loss))/(P_in)) #efficiency as motor
print 'Efficiency as a motor = %.2f percent'%(eta_m)
```

In [16]:

```
import math
# Variables
I = 4. #no load current in amperes
V = 500.
motor_input_no_load = I*V #no load motor input
R_a = 0.5
R_sh = 250. #resistance of armature and shunt field resistnace
I_sh = V/R_sh
I_a = I-I_sh
arm_cu_loss_noload = R_a*I_a**2 #No-load armature copper losses
constant_loss = motor_input_no_load - arm_cu_loss_noload
I_FL = 40.
I_aFL = I_FL- I_a #full load currents
arm_cu_loss_fulload = R_a*I_aFL**2 #Full-load armature copper losses
Total_loss = arm_cu_loss_fulload + constant_loss
# Calculations and Results
motor_input = V*I_FL
motor_output_fullload = motor_input - Total_loss
print 'Output power at full-load is %.0f W'%(motor_output_fullload)
efficiency = motor_output_fullload*100/motor_input #motor efficiency
print 'Efficiency at full-load is %.1f percent'%(efficiency)
E_bNL = V-I_a*R_a
E_bFL = V-I_FL*R_a
#E_b = N*phi
#E_bNL/E_bFL = N_NL/N_FL
#applying rules of componendo and dividendo
#change_in _speed = (N_NL - N_FL)/N_FL = (E_bNL - E_bFL)/E_bFl
change_in_speed = 100*(E_bNL - E_bFL)/E_bFL
print 'percentage change in speed from no load to full load is %.3f percent'%(change_in_speed)
```

In [17]:

```
import math
# Variables
V = 500.
R_a = 0.22
R_sh = 250. #armature resistance and shunt field resistance
I = 5. #no load current
motor_input_NL = V*I #no load motor input
I_sh = V/R_sh
I_a_NL = I- I_sh #no load armature current
arm_cu_loss_NL = R_a*I_a_NL**2 #no load armature copper loss
constant_loss = motor_input_NL - arm_cu_loss_NL
# Calculations and Results
#When motor draws 100 A current
I = 100
I_a = I - I_sh
arm_cu_loss = R_a* I_a**2 #armature copper loss
total_losses = arm_cu_loss + constant_loss
motor_input = V*I
motor_output = motor_input -total_losses
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'i)Efficiency of motor at 100 A current is %.2f percent '%(eta_m)
#part(b)
E_b_NL = V- I_a_NL*R_a #back emf at no load
E_b = V- I_a*R_a #back emf at 100 A
#E_b is proportional to N.. and using componendo dividendo
speed_change = 100*((E_b_NL - E_b)/E_b)
print 'ii)Percentage change in speed = %.3f percent'%(speed_change)
print 'Note that the following were assumptions made'
print 'i) Due to heating resistance of shunt field winding will be increased which will reduce the shunt field current.This will decrease the flux which is neglected'
print 'ii) Though the motor speed is changing from no load to given load %( the mechanical losses are assumed to be cosnstant'
print 'iiiThe effect of armature reaction aon main pole flux and its effect on iron loss is neglected'
```

In [20]:

```
import math
# Variables
V = 200.
I_L = 40.
R_sh = 200.
R_a = 0.2 #shunt field winding and armature resistance
# Calculations and Results
#case(a) : As a generator
P_out_g = V*I_L #output poewr as generator
I_sh = V/R_sh
I_a = I_L + I_sh
E = V + I_a*R_a
P_a_g = E*I_a #power developed in armature
P_cu_g = R_a*I_a**2 + R_sh*I_sh**2 #copper loss as genrator
print 'i)Output as generator is %.f kW'%(P_out_g/1000)
#case(b) : As a motor
P_in_m = V*I_L #input power as motor
I_sh = V/R_sh
I_a = I_L - I_sh
E_b = V - I_a*R_a
P_a_m = E_b*I_a #power developed in armature
P_cu_m = R_a*I_a**2 + R_sh*I_sh**2 #copper loss as motor
print 'ii)Input as motor is %.0f kW'%( P_in_m/1000)
print 'iii)Power developed in Armature:%.4f kW for generator%.4f kW for motor'%(P_a_g/1000,P_a_m/1000)
print 'iv)Copper losses:%.1f W for generator%.1f W for motor'%(P_cu_g,P_cu_m)
```

In [21]:

```
import math
# Variables
V = 219.
I = 10.
dN = 1030. - 970 #given
t_1 = 36. #time with no excitation
t_2 = 9. # time with full excitation and armature supporting an extra load of 10 A at 219 V
t_3 = 15. #time with full exciation
W_dash = V*I #additioanl loss when armature is suddenly connected to loads
W_s = W_dash *(t_2/(t_3-t_2)) #total stray losses
N = 1000. #speed in rpm
# Calculations
#using W_s = (2*pi/60)**2 * I *N *dN / t_3 where W_s is stray losses
I = W_s*(t_3/dN)*(30/math.pi)**2/N #moment of inertia
W_m = W_s*(t_3/t_1) #mechanical losses
iron_losses = W_s - W_m
# Results
print 'i)The moment of inertia of armature is %.2f kg-m**2'%(I)
print 'ii)Iron loss = %.2f W'%(iron_losses)
print 'iii)Mechanical losses at 1000 rpm mean speed is %.2f W'%(W_m)
print 'Noteworthy points:1)When armature is slowing down and there is no excitation,then kinetic energy is used to overcome mechanical losses only.Iron losses are absent as excitation is absent2)When excitation is given%( kinetic energy is used to overcome both mechanical as well as iron losses.Total called stray losses.3)If moment of inertia is in kg-m**2,then loss of energy is in watts'
```

In [22]:

```
import math
# Variables
V = 225.
I = 10.
dN = 1030. - 970 #given
t_1 = 40. #time with no excitation
t_2 = 9. # time with full excitation and armature supporting an extra load of 10 A at 219 V
t_3 = 20. #time with full exciation
# Calculations
W_dash = V*I #additional loss
W_s = W_dash *(t_2/(t_3-t_2)) #total stray losses
N = 1000 #Speed in rpm
#using W_s = (2*pi/60)**2 * I *N *dN / t_3 where W_s is stray losses
I = W_s*(t_3/dN)*(30/math.pi)**2/N #moment of inertia
W_m = W_s*(t_3/t_1) #mechanical losses
iron_losses = W_s - W_m
# Results
print 'i)The moment of inertia of armature is %.2f kg-m**2'%(I)
print 'ii)Iron loss = %.2f W'%(iron_losses)
print 'iii)Mechanical losses at 1000 rpm mean speed is %.2f W'%(W_m)
print 'Noteworthy points:1)When there is no excitation and armature is slowed down , its K.E. is used to overcome mechanical mechanical losses only math.since there will be no iron loss as there is no flux.2)When there is excitation provided then K.E. is used to supply mechanical as well as iron losses together called stray losses '
```

In [23]:

```
import math
# Variables
V_avg = (220.+190)/2 #average voltage across load
I_avg = 12.
R_a = 0.5
R_sh = 250.
W_dash = V_avg*I_avg #power absorbed
t_1 = 30.
t_2 = 5.
W = W_dash*(t_2/(t_1-t_2))
V = 250.
I = 22. #input current
# Calculations
I_sh = V/R_sh
I_a = I - I_sh
arm_cu_loss = R_a*I_a**2 #armature copper loss
shunt_field_cu_loss = V*I_sh #shunt field copper loss
total_losses = shunt_field_cu_loss + arm_cu_loss + W
machine_input = V*I
machine_output = machine_input - total_losses
eta_m = 100*(machine_output /machine_input ) #efficiency when running as motor
# Results
print 'Efficiency of machine when opeating as motor taking current of 22A on 250V supply is %.1f percent'%(eta_m)
```

In [24]:

```
import math
# Variables
I_avg = 10.
V_avg = (220.+190)/2 #average voltage across load
W_dash = V_avg*I_avg #power absorbed
t_1 = 30.
t_2 = 20.
# Calculations
W = W_dash * (t_2/(t_1-t_2)) #stray losses
# Results
print 'Stray losses of motor is %.1f kW'%(W/1000)
print 'Answers mismatch because V_average is 205 volts but it is taken as 220 volts in Power absorbed calculation'
```

In [25]:

```
import math
# Variables
I_a_g = 330.
I_a_m = 380.
R_a = 0.02 #armature resistance
V = 250.
I = 50.
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for generator
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
power_drawn = V*I
stray_losses = power_drawn - (arm_cu_loss_m + arm_cu_loss_g)
stray_losses_each = stray_losses/2 #stray losses for each machine
# Calculations and Results
#for motor
I_sh_m = 4.2 #Shunt current in case of motor
field_cu_loss_m = V*I_sh_m #field copper loss in case of motor
total_loss = field_cu_loss_m + stray_losses_each + arm_cu_loss_m
motor_input = V*(I_a_m+I_sh_m)
motor_output = motor_input - total_loss
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
#for generator
I_sh_g = 5 #Shunt current in case of generator
field_cu_loss_g = V*I_sh_g #field copper loss in case of generator
total_loss = field_cu_loss_g + stray_losses_each + arm_cu_loss_g
generator_output = V*I_a_g
generator_input = generator_output + total_loss
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
```

In [26]:

```
import math
# Variables
R_a = 0.02 #armature resistance
V = 250. #line voltage
I = 50. #current taken from supply
# Calculations and Results
#for generator
I_a_g = 330.
I_sh_g = 5. #armature current and current through shunt field
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for generator
field_cu_loss_g = V*I_sh_g #field copper loss for generator
#for motor
I_a_m = 380
I_sh_m = 4.2 #armature current and current through shunt field
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
field_cu_loss_m = V*I_sh_m #field copper loss for motor
power_drawn = V*I
IFW_losses = power_drawn - (arm_cu_loss_g + arm_cu_loss_m) #Iron friction and windage losses
IFW_losses_each = IFW_losses /2 # Iron friction and windage losses for each machine
#for generator
total_loss_g = field_cu_loss_g + arm_cu_loss_g + IFW_losses_each
generator_output = V*I_a_g
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
#for motor
total_loss_m = field_cu_loss_m + IFW_losses_each + arm_cu_loss_m
motor_input = V*(I_a_m+I_sh_m)
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
```

In [27]:

```
import math
# Variables
V = 220.
I = 40.
I_a_g = 160.
I_a_m = 200. #armature currents for generator and motor
I_sh_g = 7.
I_sh_m = 6. #current through shunt field for generator and motor
R_a = 0.015 #armature resistance
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for motor
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
power_drawn = V*I
IFW_losses = power_drawn - (arm_cu_loss_g + arm_cu_loss_m) #Iron friction and windage losses
IFW_losses_each = IFW_losses /2 # Iron friction and windage losses for each machine
# Calculations and Results
#for motor
field_cu_loss_m = V*I_sh_m #field copper loss for motor
total_loss_m = field_cu_loss_m + IFW_losses_each + arm_cu_loss_m #total losses in motor
motor_input = V * I_a_m
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
#for generator
field_cu_loss_g = V*I_sh_g #field copper loss for generator
total_loss_g = field_cu_loss_g + arm_cu_loss_g + IFW_losses_each #total losses in generator
generator_output = V*I_a_g
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
```

In [28]:

```
import math
# Variables
R_a = 0.2 #armature resistance
V = 240.
I = 16.
I_a_g = 60.
I_a_m = 71. #armature currents for generator and motor
I_sh_g = 3.
I_sh_m = 2. #field current for generator and motor
#for generator
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for generator
field_cu_loss_g = V*I_sh_g #field copper loss for generator
#for motor
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
field_cu_loss_m = V*I_sh_m #field copper loss for motor
power_drawn = V*I
field_loss_total_g_m = field_cu_loss_m + field_cu_loss_g
arm_cu_loss_total_g_m = arm_cu_loss_m + arm_cu_loss_g
IFW_losses = power_drawn - (arm_cu_loss_total_g_m + field_loss_total_g_m) #Iron friction and windage losses
IFW_losses_each = IFW_losses /2 # Iron friction and windage losses for each machine
# Calculations and Results
#for generator
total_loss_g = field_cu_loss_g + arm_cu_loss_g + IFW_losses_each #total loss in generator
generator_output = V*I_a_g
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
#for motor
total_loss_m = field_cu_loss_m + IFW_losses_each + arm_cu_loss_m #total loss in motor
motor_input = V*(I_a_m+I_sh_m)
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
```

In [29]:

```
import math
# Variables
R_a = 0.015
V = 250. #line voltage
I = 45. #line current
I_a_m = 385.
I_sh_m = 4. #armature and field currents for motor
I_a_g = 340.
I_sh_g = 5. #armature and field currents for generator
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
field_cu_loss_m = V*I_sh_m #field copper loss for motor
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for generator
field_cu_loss_g = V*I_sh_g #field copper loss for motor
total_cu_loss = field_cu_loss_g + arm_cu_loss_g + field_cu_loss_m + arm_cu_loss_m #total copper loss for both machines
P_aux = V*I #power taken from auxillary supply
stray_loss = P_aux - total_cu_loss
stray_loss_each = stray_loss/2 #stray loss for each machine
# Calculations and Results
total_loss_g = stray_loss_each + arm_cu_loss_g + field_cu_loss_g #total losses in generator
generator_output = V* I_a_g
eta_g = 100*(generator_output/(generator_output + total_loss_g)) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
total_loss_m = stray_loss_each + arm_cu_loss_m + field_cu_loss_m #total losses in motor
motor_input = V*(I_a_m+I_sh_m)
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
```

In [31]:

```
import math
# Variables
V = 500.
P = 1000.*10**3
I = 30.
I_a_m = 200. + 30
I_a_g = 200. #armature current for motor and generator
I_sh_m = 1.8
I_sh_g = 3.5 #field current for motor and generator
brush_drop = 230.
R_a = 0.075 #armature resimath.tance
# Calculations
arm_cu_loss_m = R_a*I_a_m**2 + 2*brush_drop #motor armature copper loss
field_cu_loss_m = V*I_sh_m # motor field copper loss
arm_cu_loss_g = R_a*I_a_g**2 + 2*brush_drop #generator armature copper loss
field_cu_loss_g = V*I_sh_g #field copper loss generator
total_cu_loss = field_cu_loss_g + arm_cu_loss_g + field_cu_loss_m + arm_cu_loss_m #total copper loss for both machines
P_aux = V*I #power taken from auxillary supply
stray_loss = P_aux - total_cu_loss
stray_loss_each = stray_loss/2 #stray loss for each machine
total_loss_g = stray_loss_each + arm_cu_loss_g + field_cu_loss_g #total loss in generator
generator_output = V* I_a_g
eta_g = 100*(generator_output/(generator_output + total_loss_g)) #generator efficiency
# Results
print 'Efficiency of generator is %.0f percent'%(eta_g)
```

In [32]:

```
import math
# Variables
V = 220.
I = 10.
R_a = 0.05 #artmature resistance
I_a_m = 73.
I_sh_m = 2. #armature and field current for motor
I_a_g = 67.5
I_sh_g = 2.5 #armature and field current for generator
arm_cu_loss_m = R_a*I_a_m**2 #motor armature copper loss
field_cu_loss_m = V*I_sh_m # motor field copper loss
arm_cu_loss_g = R_a*I_a_g**2 #generator armature copper loss
field_cu_loss_g = V*I_sh_g #field copper loss generator
total_cu_loss = field_cu_loss_g + arm_cu_loss_g + field_cu_loss_m + arm_cu_loss_m #total copper loss for both machines
power_input = V*I
stray_loss = power_input - total_cu_loss
stray_loss_each = stray_loss/2 #stray loss for each machine
# Calculations and Results
#motor efficiency
total_loss_m = field_cu_loss_m + stray_loss_each + arm_cu_loss_m #total motor losses
motor_input = V*(I_a_m + I_sh_m )
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
#generator efficiency
total_loss_g = field_cu_loss_g + stray_loss_each + arm_cu_loss_g #total generator losses
generator_output = V*I_a_g
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #motor efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
```

In [33]:

```
import math
# Variables
V = 400.
I = 50.
I_a_g = 250.
I_a_m = 300. #armature current for generator and motor
I_sh_g = 2.5
I_sh_m = 2.4 #field current for generator and motor
R_a = 0.1 #armature resistance
arm_cu_loss_g = R_a*I_a_g**2 #armature copper loss for generator
arm_cu_loss_m = R_a*I_a_m**2 #armature copper loss for motor
power_drawn = V*I
IFW_losses = power_drawn - (arm_cu_loss_g + arm_cu_loss_m) #Iron friction and windage losses
IFW_losses_each = IFW_losses /2 # Iron friction and windage losses for each machine
# Calculations and Results
#for motor
field_cu_loss_m = V*I_sh_m #field copper loss for motor
total_loss_m = field_cu_loss_m + IFW_losses_each + arm_cu_loss_m
motor_input = V * I_a_m
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.2f percent'%(eta_m)
#for generator
field_cu_loss_g = V*I_sh_g #field copper loss for generator
total_loss_g = field_cu_loss_g + arm_cu_loss_g + IFW_losses_each
generator_output = V*I_a_g
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.2f percent'%(eta_g)
```

In [34]:

```
import math
# Variables
I_1 = 56. #motor input current
V = 590. #voltage across armature
I_2 = 44. # load current
V_2 = 400. # voltage across generator
V_field = 40. #voltage drop across field winding
R_a = 0.3
R_se = 0.7142 #armature and series field resistance for each machine
total_input = (V+V_field)*I_1
output = V_2*I_2
total_loss_g_m = total_input - output #total losses of 2 machines
R_se = V_field/I_1 #series field resistance for both windings
total_cu_loss = (R_a+ 2*R_se)*I_1**2 + R_a*I_2**2 #total copper loss
stray_loss = total_loss_g_m - total_cu_loss
stray_loss_each = stray_loss/2 #stray loss for each machine
# Calculations and Results
# for motor
motor_input = V*I_1
arm_cu_loss_m = (R_a+ R_se)*I_1**2 #armature coper losses of motor
total_loss_m = arm_cu_loss_m + stray_loss_each
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
# for generator
arm_cu_loss_g = R_a*I_2**2 #armature coper losses of generator
series_field_cu_loss_g = V_field*I_1 #series field copper loss
total_loss_g = arm_cu_loss_g + series_field_cu_loss_g + stray_loss_each
generator_output = V_2*I_2
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
```

In [35]:

```
import math
# Variables
I_1 = 56. #motor input current
V = 590. #voltage across armature
I_2 = 44. # load current
V_2 = 400. # voltage across generator
V_field = 40. #voltage drop across field winding
R_a = 0.3
R_se = 0.7142 #armature and series field resismath.tane for each machine
total_input = (V+V_field)*I_1
output = V_2*I_2
total_loss_g_m = total_input - output #total losses of 2 machines
R_se = V_field/I_1 #series field resistance for both windings
total_cu_loss = (R_a+ 2*R_se)*I_1**2 + R_a*I_2**2 #total copper loss
stray_loss = total_loss_g_m - total_cu_loss
stray_loss_each = stray_loss/2 #stray loss for each machine
# Calculations and Results
# for motor
motor_input = V*I_1
arm_cu_loss_m = (R_a+ R_se)*I_1**2 #armature coper losses of motor
total_loss_m = arm_cu_loss_m + stray_loss_each
motor_output = motor_input - total_loss_m
eta_m = 100*(motor_output/motor_input) #motor efficiency
print 'Efficiency of motor is %.4f percent'%(eta_m)
# for generator
arm_cu_loss_g = R_a*I_2**2 #armature coper losses of generator
series_field_cu_loss_g = V_field*I_1 #series field copper loss
total_loss_g = arm_cu_loss_g + series_field_cu_loss_g + stray_loss_each
generator_output = V_2*I_2
generator_input = generator_output + total_loss_g
eta_g = 100*(generator_output/generator_input) #generator efficiency
print 'Efficiency of generator is %.4f percent'%(eta_g)
```