In [1]:

```
#A suburban train runs with an average speed of 36 km/h between two stations 2 km apart.Values of acceleration
#and retardation are 1.8 km/h/s and 3.6 km/h/s.Compute the maximum speed of the train assuming trapezoidal
#speed/time curve
################################################################################################################
import math
#Given
Va = 36.0*5/18.0 #m/s (average speed)
alpha = 1.8*5/18.0 #m/s^2 (acc.)
beta = 3.6*5/18.0 #m/s^2 (ret.)
D = 2000.0 #m (distance )
t = D/Va #s (time)
K = (alpha + beta)/(2*alpha*beta) #(constant)
Vm = (t-math.sqrt(t*t-4*K*D))/(2*K) #m/s (max speed)
Vm = Vm*18/5.0 #km/h
print "Max speed of train is = ",round(Vm,2),"km/h."
```

In [2]:

```
#A train is required to run between two stations 1.5 km apart at a schedule speed of 36 km/h,the duration of stops being
#25 seconds.The braking retardation is 3 km/h/s.Assuming a trapezoidal speed/time curve,calculate the acceleration if the
#ratio of maximum speed to average speed is to be 1.25
##########################################################################################################################
#Given
D = 1500.0 #m (distance)
Vsch = 36.0*5/18.0 #m/s (scheduled speed)
beta = 3.0*5/18.0 #km/h/s (ret.)
time = D/Vsch #s (scheduled time)
t_stop = 25.0 #s (stopping time)
t = time-t_stop #s (actual time of run)
Va = D/t #m/s (average speed)
Vm = 1.25*Va #m/s (max speed)
#The value of K is
K = (D/(Vm*Vm))*(Vm/Va-1)
#We know that K = 1/2*(1/alpha + 1/beta).Therefore,value of alpha is
alpha = beta/(2*K*beta-1) #m/s^2
alpha = alpha*18/5.0 #km/h/s
print "The acceleration is =",round(alpha,1),"km/h/s."
```

In [3]:

```
#Find the scheduled speed of an electric train for a run of 1.5km if the ratio of its maximum to average speed is
#1.25.It has a braking retardation of 3.6 km/h/s,acceleration of 1.8km/h/s and stop time of 21 seconds.Assume
#trapezoidal speed/time curve.
##################################################################################################################
import math
#Given
alpha = 1.8*5/18.0 #m/s^2 (acceleration)
beta = 3.6*5/18.0 #m/s^2 (retardation)
D = 1500.0 #m (distance)
ratio = 1.25 #(Vm/Va)
t_stop = 21 #s (stopping time)
K = 0.5*(1/alpha + 1/beta)
#Also constant K = (D/Vm^2)*(Vm/Va-1)
#Therefore Vm^2 = (D/K)*((Vm/Va)-1).
Vm = math.sqrt(D/K*(ratio-1)) #m/s (Max. speed)
Va = Vm/ratio #m/s (Avg. speed)
t = D/Va #s (travel time)
tsch = t + t_stop #s (schedule time)
Vsch = D/tsch #m/s (scheduled speed)
Vsch = Vsch*18/5.0 #km/h
print "Schedule speed of train is",round(Vsch,1),"Km/h."
```

In [19]:

```
#A train runs between two stations 1.6km apart at an average speed of 36 km/h.If the maximum speed is to be limited
#to 72km/h,acceleration to 2.7km/h/s,coasting retardation to 0.18 km/h/s and braking retardation to 3.2 km/h/s,compute
#the duration of acceleration,coasting and braking periods.Assume a simplified speed/time curve.
########################################################################################################################
from sympy import Eq,Symbol, solve
#Given
D = 1600 #m (distance)
Va = 36.0*5/18.0 #m/s (avg speed)
V1 = 72.0*5/18.0 #m/s (max speed)
alpha = 2.7*5/18.0 #m/s^2 (acceleration)
beta = 3.6*5/18.0 #m/s^2 (braking retardation)
beta_c = 0.18*5/18.0 #m/s^2 (coasting retardation)
#Duration of acceleration
t1 = V1/alpha #s
#Actual time of run
t = D/Va #s
#Let us assume V2 be the speed at start of braking.
V2 = Symbol('V2')
t3 = V2/beta #(braking period)
t2 = (V1-V2)/beta_c #(coasting period)
eq = Eq(t1+t2+t3,t)
V2 = solve(eq)
Ve2 = V2[0]
#Now we know the value of V2 that is Ve2.
t3 = Ve2/beta #(braking period)
t2 = (V1-Ve2)/beta_c #(coasting period)
print "Duration of acceleration = ",round(t1,1),"s."
print "Duration of coasting = ",round(t2,1),"s."
print "Duration of braking = ",round(t3,1),"s."
print "Total duration = ",round(t,0),"s."
```

In [4]:

```
#The peripheral speed of a railway traction motor cannot be allowed to exceed 44m/s.If gear ratio is 18/75,motor armature
#diameter 42cm and wheel diameter 91cm,calculate the limiting value of the train speed.
###########################################################################################################################
#Given
gratio = 18/75.0 #(gear ratio)
Vmot = 44.0 #m/s (speed of traction motor)
wdia = 0.91 #m (wheel diameter)
mdia = 0.42 #m (motor armature diameter)
#Maximum number of revolutions by armature (in 1s)
mrev = Vmot/(3.14*mdia) #rps
#Maximum number of revolutions by driving wheel(in 1s)
wrev = mrev*gratio #rps
#Maximum distance travelled by driving wheel (in 1s)
dist = wrev*(3.14*wdia) #m
#Therefore,limiting speed is
vel = dist*18/5.0 #km/h
print "The limiting value of train speed = ",round(vel),"km/h."
```

In [5]:

```
#A 250-tonne motor coach driven by four motors takes 20 seconds to attain a speed of 42 km/h,starting from rest on an ascending
#gradient of 1 in 80.The gear ratio is 3.5,gear efficiency 92%,wheel diameter 92cm train resistance 40N/t and rotational inertia
#10 percent of the dead weight.Find the torque developed by each motor.
##################################################################################################################################
#Given
M = 250.0 #tonne (mass of motor)
Me = 1.1*250.0 #tonne (mass of rotating motor)
Vm = 42.0 #km/h (speed)
t1 = 20.0 #s (time)
G = 1/80.0*100 # (% gradient)
r = 40.0 #N/tonne(train reistance)
D = 0.92 #m (wheel diameter)
gratio = 3.5 # (gear ratio)
geff = 0.92 # (gear efficiency)
a = Vm/t1 # (acceleration)
#Now,tractive force is given by
Ft = 277.8*Me*a + 98*M*G + M*r #N
#Now Ft = 2*gratio*geff*T/D.Therefore torque 'T' is
T = Ft*D/(2*gratio*geff) #N-m
#There are motors.so,torque by each motor is
torque = T/4 #N-m
print "Torque developed by each motor = ",round(torque),"N-m."
```

In [6]:

```
#A 250-tonne motor coach having 4 motors,each developing a torque of 8000 N-m during acceleration,starts from rest.If
#up-gradient is 30 in 1000,gear ratio 3.5,gear transmission efficiency 90%,wheel diameter 90cm,train resistance 50N/t,
#rotational inertia effect 10%,compute the time taken by the coach to attain a speed of 80km/h.
#If supply voltage is 3000V and motor efficiency 85%,calculate the current taken during the acceleration period.
#########################################################################################################################
#Given
M = 250.0 #tonne (mass of motor)
Me = 1.1*250 #tonne (mass of rotating motor)
r = 50.0 #N/t (train resistance)
G = 30.0/1000*100 # (% gradient)
torque = 8000 #N-m (torque of each motor)
D = 0.90 #m (wheel diameter)
gratio = 3.5 # (gear ratio)
geff = 0.90 # (gear efficiency)
Vm = 80 #km/h (speed)
meff = 0.85 # (Motor efficiency)
V = 3000.0 # (Voltage)
T = 4*torque # (total torque)
#Now,we Know that
Ft = 2*gratio*geff*T/D #N
#Also,we know that Ft = 277.8*Me*a + 98MG + Mr
a = (Ft-98*M*G-M*r)/(277.8*Me) #km/h/s(acceleration)
#Time taken to attain the speed
t1 = Vm/a #s
#Power taken by motor is given by
Power = Ft*(5.0/18*Vm)/meff #W
#Total current drawn is (using P = VI)
I = Power/V #A
#Current drawn/motor is
cur = I/4 #A
print "Time taken to achieve speed of 80km/h is =",round(t1,1),"s."
print "Current drawn per motor is",round(cur,1),"A."
```

In [3]:

```
#A goods train weighing 500 tonne is to be hauled by a locomotive up an ascending gradient of 2% with an
#acceleation of 1 km/h/s.If the coefficient of adhesion is 0.25,train resistance 40N/t and effect of rotational
#inertia 10%,find the weight of locomotive and number of axles if load is not to increase beyond 21 tonne/axle.
###############################################################################################################
from sympy import Eq,Symbol, solve
#Given
mass = 500.0 #tonne (mass of goods train)
a = 1 #km/h/s (acceleration)
coef_ad = 0.25 #(coefficient of adhesion)
r = 40.0 #N/t (train resistance)
G = 2.0 # (% gradient)
w_axle = 21.0 #tonne/axle (weight per axle)
#Let Ml be mass of locomotive
Ml = Symbol('Ml')
#Total mass is given by
M = mass + Ml
#Now,tractive force is given by
Ft1 = M*(277.8*1.1*a + 98*G + r) #N
#Also,Maximum tractive force is given by
Ft2 = 1000*coef_ad*Ml*9.8
#As both Ft1 and Ft2 are same, therefore equating
eq = Eq(Ft1,Ft2)
Ml = solve(eq)
#Mass of locomotive 'M_l' is
M_l = Ml[0]
#No of axles required are
no_axle = round(M_l)/w_axle
print "Weight of locomotive is =",round(M_l),"tonne."
print "Number of axles required are = ",round(no_axle)
```

In [7]:

```
#An electric locomotive weighing 100 tonne can just accelerate a train of 500 tonne(trailing weight) with an acceleration of
#1 km/h/s on an up-gradient of 0.1%.Train resistance is 45N/t and rotational inertia is 10%.If this locomotive is helped by another
#locomotive of 120 tonne,find:
#(i)the trailing weight that can now be hauled up the same gradient under the same conditions.
#(ii)the maximum gradient,if the trailing hauled load remains unchanged.
#Assume adhesive weight expressed as percentage of total dead weight as 0.8 for both locomotives.'''
#############################################################################################################################
#Given
Ml1 = 100.0 #tonne (locomotive 1)
Ml2 = Ml1 + 120.0 #tonne (locomotive 1&2)
mass = 500.0 #tonne (trailing part)
r = 45.0 #N/t (train resistance)
G = 0.1 # (% gradient)
a = 1.0 #km/h/s (acceleration)
#Total mass of train and locomotive
M = Ml1 + mass #tonne
Me = 1.1*M #tonne
#Traction Force is
Ft = 277.8*Me*a + 98*M*G + M*r #N
#Let coefficient_of_adhesion be 'ua'.Then the maximium tractive effort by locomotive 1 is Ft = 1000*ua*Ml1*9.8
ua = Ft/(1000*9.8*Ml1)
#Maximum tractive effort by locomotive 1&2 is
Ft2 = 1000*ua*Ml2*9.8 #N
#Also,Ft2 = M2*(277.8*1.1*a + G + r).Therefore,
M2 = Ft2/(277.8*1.1*a + 98*G + r) #tonne
#(i)The trailing weight that can be hauled up is
wtrail = M2-Ml2 #tonne
#(ii)Now, in this case the total weight of train & locomotive is
M3 = mass + Ml2
#Tractive force Ft2 = M3*(277.8*1.1*a + 98G2 + r).Therefore,for max gradient 'G2'
G2 = (Ft2/M3-277.8*1.1*a-r)/98
print "The trailing weight that can now be hauled up =",round(wtrail,2),"tonne."
```

In [8]:

```
#The average distance between stops on a level section of a railway is 1.25km.Motor-coach train weighing 200 tonne has a
#schedule speed of 30 km/h,the duration of stops being 30 seconds.The acceleration is 1.9 km/h/s and the braking retardation
#is 3.2 km/h/s.Train resistance to traction is 45 N/t.Allowance for rotational inertia is 10%.Calculate the specific energy
#output in Wh/t-km.Assume a trapezoidal speed/time curve.
##############################################################################################################################
import math as m
#Given
alpha = 1.9*5/18.0 #km/h/s (acceleration)
beta = 3.2*5/18.0 #km/h/s (retardation)
D = 1.25*1000.0 #m (distance)
tstop = 30.0 #s (stop time)
Vsch = 30*5/18.0 #m/s (schedule speed)
r = 45.0 #N/t (train resistance)
K = round((alpha + beta)/(2*alpha*beta),1) #(constant K)
tsch = D/Vsch #s (schedule time)
t = tsch-tstop #s (running time)
#Now,max speed is given by
Vm = (t - m.sqrt(t*t-4*K*D))/(2*K) #m/s
#Braking distance is given by(using newton's III equation of motion)
dist = Vm*Vm/(2*beta) #m
#Therefore non-braking distance
D2 = (D - dist)/1000 #km
Vm = Vm*18/5.0 #km/h
D = D/1000 #km
#Specific energy output is
spengy = 0.01072*(Vm*Vm/D)*1.1 + 0.2778*r*(D2/D)
print "Max speed = ",round(Vm,2),"km/h."
print "Specific energy output = ",round(spengy,2)," Wh/t-km."
```

In [9]:

```
#A 300-tonne EMU is started with a uniform acceleration and reaches a speed of 40 Km/h in 24 seconds on a level track.
#Assuming trapezoidal speed/time curve,find specific energy consumption if rotational inertia is 8%,retardation is 3 km/h/s,
#distance between stops is 3 km,motor efficiency is 0.9 and train resistance is 49N/tonne.
#############################################################################################################################
#Given
M = 300.0 #tonne (mass of train)
Mratio = 1.08 # (Me/M)
Vm = 40.0 #km/h (speed)
beta = 3.0 #km/h/s (retardation)
r = 49.0 #N/t (train resistance)
meff = 0.9 # (motor efficiency)
D = 3.0 #km (distance)
#Braking time is(using Newton's Ist eqn)
t3 = Vm/beta
#Distance travelled in braking time(using Newton's IInd eqn)
dist = 0.5*beta*t3*t3/3600 #km
#Non braking distance D2 is
D2 = D - dist #km
#Specific energy consumption is given by,
spengy = 0.01072*(Vm*Vm/(meff*D))*Mratio + 0.2778*r/meff*(D2/D) #Wh/t-km
print "The value of specific energy consumption is",round(spengy,1),"Wh/t-km."
```

In [10]:

```
#An electric train accelerates uniformly from rest to a speed of 50km/h in 25 seconds.It then coasts for 70 seconds
#against a constant resistance of 60N/t and is then braked to rest with uniform retardation of 3.0km/h/s in 12 seconds.
#Compute :- (i)uniform acceleration (ii)coasting retardation
#(iii)schedule speed if station stops are of 20-second duration
#Allow 10% for rotational inertia.How will the scedule speed be affected if duration of stops is reduced to 15 seconds,
#other factors remaining the same?
##########################################################################################################################
#Given
V1 = 50.0 #km/h (Max speed)
t1 = 25.0 #s (accelerating time)
t2 = 70.0 #s (coasting time)
r = 60.0 #N/t (train resistance)
beta = 3.0 #km/h/s (retardation)
t3 = 12.0 #s (braking time)
#(i) Uniform acceleration is (using Newton's 1st eqn.)
alpha = V1/t1 #km/h/s
print "acceleration = ",round(alpha,1),"km/h/s."
#Now in braking period (using Newton's 1st eqn.)-> 0 = V2 - beta*t3
V2 = beta*t3 #km/h
#(ii)Now in coasting period (using Newton's 1st eqn.)-> V2 = V1 - beta_c*t2
beta_c = (V1-V2)/t2 #km/h/s
print "coasting retardation = ",round(beta_c,1),"km/h/s."
#distance travelled in accelerating period (using Newton's 2nd eqn.)
dis1 = 0.5*alpha*t1*t1/3600 #km
#distance travelled in coasting period (using Newton's 3rd eqn.)
dis2 = -(V2*V2 - V1*V1)/(2*beta_c*3600) #km
#distance travelled in braking period (using Newton's 2nd eqn.)
dis3 = 0.5*beta*t3*t3/3600 #km
#Total distance
D = dis1 + dis2 + dis3 #km
#Total time
T = t1 + t2 + t3 + 20.0 #s
#Scheduled Speed Vsch is
Vsch = D/T*3600 #km/h
print "The schedule speed = ",round(Vsch,1),"km/h."
#New Total time
T = t1 + t2 + t3 + 15.0
#New scheduled speed is
Vsch = D/T*3600 #km/h
print "The new schedule speed = ",round(Vsch,1),"km/h."
```

In [1]:

```
#A 350-tonne electric train runs up an ascending gradient of 1% with the following speed/time curves:
# 1.uniform acceleration of 1.6km/h/s for 25 seconds 2.constant speed for 50 seconds
# 3.coasting for 30 seconds 4.braking at 2.56 km/h/s to rest.
#Compute the specific energy consumption if train resistance is 50N/t,effect of rotational inertia 10%,overall efficiency of
#transmission gear and motor,75%.
#############################################################################################################################
#Given
M = 350.0 #tonne (weight of train)
Me = 1.1*M #tonne (effect of rot. inertia)
G = 1.0 # (% gradient)
alpha = 1.6 #km/h/s (acceleration)
t1 = 25.0 #s (acceleration time)
t2 = 50 #s (constant speed time)
t3 = 30 #s (coasting time)
beta = 2.56 #km/h/s (braking retardation)
r = 50.0 #N/t (train resistance)
meff = 0.75 # (motor efficiency)
V1 = alpha*t1 #km/h (Max speed attained)
#Tractive force during coasting is
Ft = 98*M*G + M*r #N
#Also,Tractive force during coasting is given by
#Ft = 277.8*Me*beta_c . Therefore beta_c is
beta_c = Ft/(277.8*Me) #km/h/s
#During Coasting period.(Using Newton's 1st eqn.) . "V2" is given by
V2 = V1 - beta_c*t3 #km/h
t4 = V2/beta #s (braking time)
#Distance travelled during acceleration period.
dis1 = 0.5*alpha*t1*t1/3600 #km
#Distance travelled during constant speed period.
dis2 = V1*t2/3600 #km
#Distance travelled during coasting period.
dis3 = (V1+V2)/2*t3/3600 #km
#Distance travelled during braking period.
dis4 = 0.5*V2*t4/3600 #km
#Total distance between stops
D = dis1 + dis2 + dis3 + dis4 #km
#Distance travelled during acceleration and constant speed period
D2 = dis1 + dis2 #km
#Specific energy consumption is given by
spengy = (0.01072*(V1*V1/D)*(Me/M) + 27.25*G*(D2/D) + 0.2778*r*(D2/D))/meff #Wh/t-km
print "The specific energy consumption is =",round(spengy,1),"Wh/t-km."
```

In [12]:

```
#An ore-carrying train weighing 5000 tonne is to be hauled down a gradient of 1:50 at a maximum speed of 30km/h
#and started on a level track at an acceleration of 0.29 km/h/s.How many locomotives,each weighing 75 tonne,will
#have to be employed?
#Train resistance during starting = 29.4 N,Train resistance at 30km/h = 49N/t,Coefficient of adhesion = 0.3
#Rotational inertia = 10%
################################################################################################################################
#Given
M = 5000.0 #tonne (Mass of train)
Ml = 75.0 #tonne (Mass of locomotive)
G = 1.0/50 # (gradient)
Vm = 30.0 #km/h (Max speed)
a = 0.29 #km/h/s (acceleration)
r1 = 49.0 # (Train resistance at 30km/h)
r2 = 29.4 # (Train resistance at starting)
ua = 0.3 # (coefficient of adhesion)
#Downward force due to gravity
F = M*G*9.8*1000 #N
#Train resistance
Fres = r1*M #N
#Braking force required is
Fbrk = F-Fres #N
#Max. braking force which one locomotive can produce.
#F = 1000*ua*M*g
Fbrk_1 = 1000*ua*Ml*9.8 #N
#Therefore, Number of locomotives required for braking
num1 = Fbrk/Fbrk_1
num1 = round(num1)+ 1
#Considering the starting case.Tractive force required is
Ft = 277.8*a*M*1.1 + M*r2
#Therefore, Number of locomotives required for starting
num2 = Ft/Fbrk_1
#Number of locomotives required
if num1>num2:
num = num1
else:
num = num2
print "Total number of locomotives required are = ",round(num)
```

In [13]:

```
#A 200-tonne electric train runs according to the following quadrilateral speed/time curve:
# 1. uniform acceleration from rest at 2 km/h/s for 30 seconds.
# 2. coasting for 50 seconds
# 3. duration of braking:15 seconds
#If up-gradient is =1%,train resistance = 40N/t,rotational inertia effect = 10%,duration of stops = 15s and overall
#efficiency of gear and motor = 75%,find
#(i)schedule speed (ii)specific energy consumption (iii)how will the value of specific energy consumption change if
#there is a down-gradient of 1% rather than the up-gradient ?
########################################################################################################################
#Given
M = 200.0 #tonne (Mass of train)
Me = 1.1*200.0 #tonne (rotational inertia effect on mass)
alpha = 2.0 #km/h/s (acceleration)
t1 = 30.0 #s (acceleration time)
t2 = 50.0 #s (coasting time)
t3 = 15.0 #s (braking time)
G = 1.0 # (% gradient)
r = 40.0 #N/t (train resistance)
tstop = 15.0 #s (stop time)
meff = 0.75 # (motor efficiency)
V1 = alpha*t1 #km/h (Max speed)
#During coasting retardation force is
Fr = 98*M*G + M*r #N
#Also this retardation force in terms of coasting retardation beta_c is
#Fr = 277.8*Me*beta_c.Therefore,
beta_c = Fr/(277.8*Me) #km/h/s
#Using newton's Ist eqn in coasting period
V2 = V1-beta_c*t2 #km/h
#Braking retardation is
beta = V2/t3
#Distance travelled during acceleration
dist1 = 0.5*alpha*t1*t1/3600 #m
#Distance travelled during coasting
dist2 = (V1+V2)/2*t2/3600 #m
#Distance travelled during braking
dist3 = 0.5*beta*t3*t3/3600 #m
#Total distance travelled
D = dist1 + dist2 + dist3 #km
#Total schedule time
T = t1 + t2 + t3 + tstop #s
#(i)Schedule speed
Vsch = D/T*3600 #km/h
print "Scheduled speed = ",round(Vsch,1),"Km/h."
#(ii)Specific energy consumption is given by
spengy = (0.01072*(V1*V1/D)*(Me/M) + 27.25*G*(dist1/D)+ 0.2778*r*(dist1/D))/meff #Wh/t-km
print "Specific energy consumption for up-gradient is = ",round(spengy,2),"Wh/t-km."
#If there is a down gradient then during coasting accelerative force is
Fa = 98*M*(-G) + M*r
#Also this accelerative force in terms of coasting acceleration alpha_c is
#Fa = 277.8*Me*alpha_c.Therefore,
alpha_c = Fa/(277.8*Me) #km/h/s
#Using newton's Ist eqn in coasting period
V2 = V1 - alpha_c*t2 #km/h
#Braking retardation is
beta = V2/t3
#Distance travelled during acceleration
dist1 = 0.5*alpha*t1*t1/3600 #m
#Distance travelled during coasting
dist2 = (V1+V2)/2*t2/3600 #m
#Distance travelled during braking
dist3 = 0.5*beta*t3*t3/3600 #m
#Total distance travelled
D = dist1 + dist2 + dist3 #km
#(iii)Specific energy consumption is given by
spengy = (0.01072*(V1*V1/D)*(Me/M) - 27.25*G*(dist1/D)+ 0.2778*r*(dist1/D))/meff #Wh/t-km
print "Specific energy consumption for down-gradient is = ",round(spengy,2),"Wh/t-km"
```

In [4]:

```
#An electric train has an average speed of 45 kmph on a level track between stops 1500m apart.It is accelerated at
#1.8km/h/s and is braked at 3 km/h/s.Draw the speed-time curve for the run.
####################################################################################################################
import math as m
import matplotlib.pyplot as plt
%matplotlib inline
#Given
alpha = 1.8 #km/h/s (acceleration)
beta = 3.0 #km/h/s (retardation)
S = 1.5 #km (Distance of run)
Va = 45.0 #km/h (Average speed)
T = S/Va*3600 #s (Time of run)
#Constant K is given by
K = 0.5*(1/alpha + 1/beta)
#Max speed is given by
Vm = T/(2*K)-m.sqrt(T*T/(4*K*K) - 3600*S/K) #km/h
#Acceleration time
t1 = Vm/alpha #s
#Braking time
t3 = Vm/beta #s
#Free running time
t2 = T - (t1+t3) #s
#SPEED TIME CURVE
plt.plot([0,t1,t1+t2,t1+t2+t3], [0,Vm,Vm,0])
plt.ylabel('Speed(in km/h)')
plt.xlabel('Time(in seconds)')
plt.show()
```

In [2]:

```
#A train has schedule speed of 60 km per hour between the stops which are 9 km apart.Determine the crest speed over
#the run,assuming trapezoidal speed-time curve.The train accelerates at 3km/h/s and retards at 4.5 km/h/s.Duration
#of stops is 75 seconds.
#########################################################################################################################
import math as m
#Given
alpha = 3.0 #km/h/s (acceleration)
beta = 4.5 #Km/h/s (retardation)
S = 9.0 #km (distance)
Vsch = 60.0 #km/h (schedule speed)
Tsch = S/Vsch*3600 #s (schedule time)
T = Tsch - 75.0 #s (time of run)
#Constant K is
K = 0.5*(1/alpha + 1/beta)
#Maximum speed Vm is
Vm = (T/(2*K)) - m.sqrt(T*T/(4*K*K) - 3600*S/K)
print "Maximum Speed is",round(Vm,2),"Km/h."
```

In [3]:

```
#An electric train is to have acceleration and braking retardation of 1.2 km/h/s and 4.8 km/h/s respectively.If the ratio of
#maximum to average speed is 1.6 and time for stop is 35 seconds,find schedule speed for a run of 3km.Assume simplified
#trapezoidal speed-time curve.
#############################################################################################################################
import math as m
alpha = 1.2 #km/h/s (acceleration)
beta = 4.8 #km/h/s (retardation)
S = 3.0 #km (distance)
#Constant K is
K = 0.5*(1/alpha + 1/beta)
#The average speed is Va = S/T . Therefore Va*T = S*3600
Va_T = S*3600
#Now Vm/Va = 1.6 .Therefore,
Vm_T = Va_T*1.6
#Since, Vm^2*K - Vm*T + 3600*S = 0, Therefore
#Vm^2 = Vm*T - 3600*S
Vm = m.sqrt((Vm_T - 3600*S)/K) #km/h
#Average Speed is
Va = Vm/1.5 #km/h
#Actual Time of Run
T = 3600*S/Va #s
#Schedule Time
Tsch = T + 35.0 #s
#Schedule Speed
Vsch = S/Tsch*3600 #km/h
print "Schedule speed is",round(Vsch),"km/h."
```

In [3]:

```
#An electric train has a schedule speed of 25 kmph between stations 800m apart.The duration of stop is 20 seconds,the
#maximum speed is 20 percent higher than the average running speed and the braking retardation is 3 km/h/s.Calculate
#the rate of acceleration required to operate this service.
###################################################################################################################
#Given
Vsch = 25.0 #km/h (Schedule speed)
S = 0.8 #km (Distance)
beta = 3.0 #km/h/s (Retardation)
Tsch = S/Vsch*3600 #s
#Actual time of run = Tsch - (time of stop)
T = Tsch - 20.0 #s
Va = S/T*3600 #km/h (Average speed)
Vm = 1.2*Va #km/h (Maximum speed)
#Since, Vm^2*K -Vm*T + 3600*S = 0
#Constant K = (Vm*T - 3600*S)/(Vm^2)
K = (Vm*T - 3600*S)/(Vm*Vm)
#Also,K = 0.5*(1/alpha + 1/beta).Therefore,
alpha = 1/(2*K - 1/beta) #km/h/s
print "The rate of acceleration required to operate this service =",round(alpha,2),"km/h/s."
```

In [4]:

```
#A suburban electric train has a maximum speed of 80 kmph.The schedule speed including a station stop of 35 seconds is 50kmph.
#If the acceleration is 1.5 km/h/s,find the value of retardation when the average distance between stops is 5 km.
################################################################################################################################
#Given
Vsch = 50.0 #km/h (schedule speed)
S = 5.0 #km (distance)
alpha = 1.5 #km/h/s (acceleration)
Vm = 80.0 #km/h (Max speed)
tstop = 30.0 #s (Time of stop)
Tsch = S/Vsch*3600 #s (Schedule time)
T = Tsch - tstop #s (Actual time of run)
#Since, Vm^2*K -Vm*T + 3600*S = 0
#Constant K = (Vm*T - 3600*S)/(Vm^2)
K = (Vm*T - 3600*S)/(Vm*Vm)
#Also,K = 0.5*(1/alpha + 1/beta).Therefore,
beta = 1/(2*K - 1/alpha) #km/h/s
print "Retardation =",round(beta,2),"km/h/s."
```

In [11]:

```
#A train is required to run between two stations 1.6 km apart at the average speed of 40 kmph.The run is to be made to a
#simplified quadrilateral speed-time curve.If the maximum speed is to be limited to 64 kmph,accelerating to 2 km/h/s and
#coasting and braking retardation to 0.16 km/h/s and 3.2 km/h/s respectively,determine the duration of acceleration,coasting
#and braking periods.
#################################################################################################################################
from sympy import Eq,Symbol,solve
#Given
S = 1.6 #km (Distance)
Va = 40.0 #km/h (Average speed)
Vm = 64.0 #km/h (Maximum speed)
alpha = 2.0 #km/h/s (Acceleration)
beta_c = 0.16 #km/h/s (Coasting retardation)
beta = 3.2 #km/h/s (braking retardation)
T = S/Va*3600 #s (Actual time of run)
t1 = Vm/alpha #s (acceleration time)
#Let us assume the speed at starting of braking be V2
V2 = Symbol('V2')
t2 = (Vm-V2)/beta_c #s (coasting period)
t3 = V2/beta #s (braking period)
eq = Eq(t1+t2+t3,T)
V2 = solve(eq)
Ve2 = V2[0]
#Therfore coasting and braking periods are
t2 = (Vm-Ve2)/beta_c #s (coasting period)
t3 = Ve2/beta #s (braking period)
print "Duration of acceleration = ",round(t1,2),"s."
print "Duration of coasting retardation = ",round(t2,2),"s."
print "Duration of braking retardation = ",round(t3,2),"s."
```

In [9]:

```
#The torque-armature current characteristics of a series traction motor are given as:
#Armature Current(amp): 5 10 15 20 25 30 35 40
#Torque(N-m): 20 50 100 155 215 290 360 430
#The motor resistance is 0.3 ohm.If this motor is connected across 230V,deduce the speed armature current characteristics.
############################################################################################################################
import matplotlib.pyplot as plt
%matplotlib inline
#Given
V = 230 #V (Supply voltage)
r = 0.3 #ohm (Motor resistance)
#Current Data Ia
i1 = 5.0 #A
i2 = 10.0 #A
i3 = 15.0 #A
i4 = 20.0 #A
i5 = 25.0 #A
i6 = 30.0 #A
i7 = 35.0 #A
i8 = 40.0 #A
#Torque Data
tau1 = 20.0 #N-m
tau2 = 50.0 #N-m
tau3 = 100.0 #N-m
tau4 = 155.0 #N-m
tau5 = 215.0 #N-m
tau6 = 290.0 #N-m
tau7 = 360.0 #N-m
tau8 = 430.0 #N-m
#Back EMF Eb = V - Ia*r
e1 = V - i1*r #V
e2 = V - i2*r #V
e3 = V - i3*r #V
e4 = V - i4*r #V
e5 = V - i5*r #V
e6 = V - i6*r #V
e7 = V - i7*r #V
e8 = V - i8*r #V
#Speed Na = 9.55*Eb*Ia/T
N1 = 9.55*e1*i1/tau1 #rpm
N2 = 9.55*e2*i2/tau2 #rpm
N3 = 9.55*e3*i3/tau3 #rpm
N4 = 9.55*e4*i4/tau4 #rpm
N5 = 9.55*e5*i5/tau5 #rpm
N6 = 9.55*e6*i6/tau6 #rpm
N7 = 9.55*e7*i7/tau7 #rpm
N8 = 9.55*e8*i8/tau8 #rpm
print "Speed-Armature current graph"
plt.plot([i1,i2,i3,i4,i5,i6,i7,i8], [N1,N2,N3,N4,N5,N6,N7,N8])
plt.axis([0,40,0,600])
plt.ylabel('Speed(in r.p.m)')
plt.xlabel('Armature current Ia(in A)')
plt.show()
```

In [12]:

```
#The following figures give the magnetization curve of d.c. series motor when working as a seperately excited generator at 600 rpm.
#Field Current(amperes) : 20 40 60 80
#E.M.F(volts): 215 381 485 550
#The total resistance of the motor is 0.8 ohm.Deduce the speed-torque curve for this motor when operating at a constant voltage of
#600 volts.
################################################################################################################################
#Given
V = 600.0 #V (Supply voltage)
r = 0.8 #ohm (total motor resistance)
#Field Current Data(If=Ia)
i1 = 20.0 #A
i2 = 40.0 #A
i3 = 60.0 #A
i4 = 80.0 #A
#E.M.F data at 600 rpm(E)
e1 = 215.0 #V
e2 = 381.0 #V
e3 = 485.0 #V
e4 = 550.0 #V
#At constant voltage of 600V. EMF are Eb = V - Ia*Rm
eb1 = V - i1*r #V
eb2 = V - i2*r #V
eb3 = V - i3*r #V
eb4 = V - i4*r #V
#For DC series motor N1/E1 = N2/E2 . Therefore N2 = N/E*Eb
n1 = 600/e1*eb1 #rpm
n2 = 600/e2*eb2 #rpm
n3 = 600/e3*eb3 #rpm
n4 = 600/e4*eb4 #rpm
#Now, Torque T = 9.55*Eb*Ia/N2
tau1 = 9.55*eb1*i1/n1 #N-m
tau2 = 9.55*eb2*i2/n2 #N-m
tau3 = 9.55*eb3*i3/n3 #N-m
tau4 = 9.55*eb4*i4/n4 #N-m
print "Speed - Torque Curve"
plt.plot([tau1,tau2,tau3,tau4], [n1,n2,n3,n4])
#plt.axis([0,40,0,600])
plt.ylabel('Speed(in r.p.m)')
plt.xlabel('Torque T(in N-m)')
plt.show()
```

In [2]:

```
#Two d.c. traction motors run at a speed of 900 r.p.m and 950 r.p.m respectively when each takes a current of 50A from 500V mains.
#Each motor has an effective resistance of 0.3 ohm . Calculate the speed and voltage across each machine when mechanically coupled
#and electrically connected in series and taking a current of 50A from 500V mains,the resistance of each motor being unchanged.
#################################################################################################################################
from sympy import Eq,Symbol,solve
#Let the two motors be A and B .
Na = 900.0 #rpm (speed of motor A)
Nb = 950.0 #rpm (speed of motor B)
r = 0.3 #ohm (resistance of each motor)
V = 500.0 #V (applied voltage)
I = 50.0 #A (current)
#Back emf of motor A when taking current of 50A,
Eb_a = V - I*r #V
#Back emf of motor B when taking current of 50A,
Eb_b = V - I*r #V
#As the machines are mechanically coupled and are connected in series. Therefore,
#speed will be same. Say 'N'
#current will be same and equal to 50A
#summation of voltage drop is 500V
N = Symbol('N') #rpm
#Let the voltage drop across motors be Va & Vb .Therefore,for Va & Vb we will find back emf of both motors
eb_A = Eb_a*N/Na #V (using N1/N2 = E1/E2)
eb_B= Eb_b*N/Nb #V (using N1/N2 = E1/E2)
#For Va & Vb
Va = eb_A + I*r #V (using Eb = V - Ia*r)
Vb = eb_B + I*r #V (using Eb = V - Ia*r)
#We know that Va + Vb = 500 . Therefore,
eq = Eq(Va+Vb,V)
N = solve(eq)
Ne = N[0]
#As we know the speed N . Therefore, Va & Vb are
eb_A = Eb_a*Ne/Na #V (using N1/N2 = E1/E2)
eb_B= Eb_b*Ne/Nb #V (using N1/N2 = E1/E2)
Va = eb_A + I*r #V (using Eb = V - Ia*r)
Vb = eb_B + I*r #V (using Eb = V - Ia*r)
print "Speed of both motors is = ",round(Ne,2),"rpm."
print "Voltage across motor A is = ",round(Va,2),"V."
print "Voltage across motor B is = ",round(Vb,2),"V."
```

In [5]:

```
#A tram car is equipped with two motors which are operating in parallel.Calculate the current drawn from the supply main at 500 V
#when the car is running at steady speed of 50kmph and each motor is developing a tractive effort of 2100 N.The resistance of each
#motor is 0.4 ohm.The friction,windage and other losses may be assumed as 3500 watts per motor.
#################################################################################################################################
from sympy import Eq,Symbol,solve
V = 500.0 #V (applied voltage)
Vm = 50.0 #km/h (max. speed)
Ft = 2100 #N (tractive effort)
Rm = 0.4 #ohm (motor resistance)
mloss = 3500.0 #W (losses per motor)
#Power output of each motor
Pout = Ft*Vm*5.0/18 #W
#Copper loss = I^2*Rm
I = Symbol('I')
cu_loss = (I*I)*Rm #W
#Input power = Output power + constant losses + Copper losses
Pin = V*I #W
eq = Eq(Pin,Pout+mloss+cu_loss)
I = solve(eq) #A
#current drawn by motor is
Ie = I[0] #A
#Therefore,current drawn by supply mains
Ie = 2*Ie #A
print "Current drawn by supply mains is =",round(Ie,2),"A."
```

In [8]:

```
#A motor coach is being driven by two identical d.c. series motors.First motor is geared to driving wheel having diameter of 90cm and
#other motor to driving wheel having diameter of 86cm.The speed of the first motor is 500 rpm when connected in parallel with the other
#across 600V supply.Find the motor speeds when connected in series across the same supply.Assume armature current to remain same and
#armature voltage drop of 10% at this current.
###############################################################################################################################
from sympy import Eq,Symbol,solve
#Given
V = 600.0 #V (applied voltage)
d1= 0.90 #m (diameter 1)
d2 = 0.86 #m (diameter 2)
N1 = 500.0 #rpm (Speed of first motor)
Eb1 = V-0.1*V #V (Back emf)
#Let the supply voltage across motor 1 & 2 be V1 and V2 respectively
#Therefore, V1 + V2 = 600
V1 = Symbol('V1') #V
V2 = V - V1 #V
#Now , N is directly propotional to (V - IR).Therefore, ratio (N1/N2) is
Nratio1 = (V1 - 0.1*V)/(V2 - 0.1*V)
#Also, we know that N1*d1 = N2*d2 . Therefore (N1/N2) is
Nratio2 = d2/d1
#As, N1/N2 = Nratio1 = Nratio2
eq = Eq(Nratio1,Nratio2)
V1 = solve(eq)
Ve1 = V1[0] #V
Ve2 = V - Ve1 #V
#Now , for the speed of motor 1, we know that for N1 ,back emf is Eb1 and for Ne1 ,back emf is (Ve1-0.1*Ve1)
Ne1 = N1*(Ve1 - 0.1*V)/Eb1 #rpm (using N1/N2 = E1/E2)
#Nratio is Ne1/Ne2 .Therefore,
Ne2 = Ne1/Nratio2 #rpm
print "Speed of first motor is =",round(Ne1,2),"rpm."
print "Speed of second motor is =",round(Ne2,2),"rpm."
```

In [7]:

```
#Two similar series type motors are used to drive a locomotive.The supply fed to their parallel connection is 650V.If the first
#motor 'A' is geared to drive wheels of radius 45 cms and other motor 'B' to 43 cms.And if the speed of first motor 'A' when
#connected in parallel to 2nd motor 'B' across the main supply lines is 400 rpm,find voltages and speeds of motors when connected
#in series.Assume Ia to be constant and armature voltage drop of 10% at this current.
################################################################################################################################
from sympy import Eq,Symbol,solve
#Given
V = 650.0 #V (applied voltage)
r1 = 0.45 #m (radius 1)
r2 = 0.43 #m (radius 2)
Na = 400.0 #rpm (Speed of first motor)
Eb_a = V-0.1*V #V (Back emf)
#Let the supply voltage across motor A & B be Va and Vb respectively
#Therefore, Va + Vb = 650.0 V
Va = Symbol('Va') #V
Vb = V - Va #V
#Now , N is directly propotional to (V - IR).Therefore, ratio (N1/N2) is
Nratio1 = (Va - 0.1*V)/(Vb - 0.1*V)
#Also, we know that N1*r1 = N2*r2 . Therefore (N1/N2) is
Nratio2 = r2/r1
#As, N1/N2 = Nratio1 = Nratio2
eq = Eq(Nratio1,Nratio2)
Va = solve(eq)
Vea = Va[0] #V
Veb = V - Vea #V
#Now , for the speed of motor A, we know that for Na ,back emf is Eb_a and for Nea ,back emf is (Vea-0.1*Vea)
Nea = Na*(Vea - 0.1*V)/Eb_a #rpm (using N1/N2 = E1/E2)
#Nratio is Ne1/Ne2 .Therefore,
Neb = Nea/Nratio2 #rpm
print "Speed of first motor is =",round(Nea,2),"rpm."
print "Speed of second motor is =",round(Neb,2),"rpm."
```

In [9]:

```
#Two motors of a motor coach are started on series-parallel system,the current per motor being 350A during the starting period
#which is 18 sec.If the acceleration during starting period is uniform,the line voltage is 600V and resistance of each motor is
#0.1W.Find (a)the time during which the motors are operated in series. (b)the energy loss in the rheostat during starting period.
#####################################################################################################################################
#Given
V = 600.0 #V (line voltage)
I = 350.0 #A (current)
R = 0.1 #ohm (resistance)
T = 18.0 #s (starting period)
#time for which motors are in series
ts = 0.5*(V-2*I*R)/(V-I*R)*T #s
#time for which motors are in parallel
tp = T - ts #s
#back emf of 1 motor during series operation
Eb_s = V/2 - I*R #V
#total back emf
Eb_s = 2*Eb_s #V
#Emf during parallel operation
Eb_p = V - I*R #V
#Energy lost during series connection
enrgy_s = 0.5*(Eb_s)*I*ts/3600 #W-h
#Energy lost during parallel connection
enrgy_p = 0.5*(Eb_p/2)*(2*I)*tp/3600 #W-h
#Total energy lost
enrgy_t = enrgy_s + enrgy_p #W-h
print "Time for which motors are operated in series = ",round(ts,2),"s."
print "Energy loss during starting period = ",round(enrgy_t,2),"W-h."
```

In [1]:

```
#Two 750V D.C. series motors each having a resistance of 0.1 ohm are started on series-parallel system.Mean current through-out
#the starting period is 300A.Starting period is 15 sec. and train speed at the end of this period is 25 km/hr.Calculate
#(i)Rheostatic losses during series and parallel combination of motors
#(ii)Energy lost in motor
#(iii)Motor output
#(iv)Starting eff
#(v)Train speed at which transition from series to parallel must be made.
##############################################################################################################################
V = 750.0 #V (applied voltage)
R = 0.1 #ohm (resistance)
I = 300.0 #A (current)
T = 15.0 #s (starting time)
S = 25.0 #km/h(speed after staring period)
#Time when motors are in series
ts = 0.5*(V-2*I*R)/(V-I*R)*T #s
#Time when motors are in parallel
tp = T - ts #s
#(i)Energy lost in rheostat
enrgy_lostr = 0.5*(2*(V/2-I*R))*I*ts + 0.5*(V-I*R)/2*2*I*tp #W-s
enrgy_lostr = enrgy_lostr/3600 #W-h
#(ii)Total energy supplied
enrgy_supp = V*I*ts + 2*V*I*tp #W-s
enrgy_supp = enrgy_supp/3600 #W-h
#Energy lost in armature of 2 motors
enrgy_losta = 2*(I*I*R)*T
enrgy_losta = enrgy_losta/3600 #W-h
#Motor output is
outp = enrgy_supp - enrgy_lostr - enrgy_losta #W-h
#Efficiency at starting
eff_s = (enrgy_supp-enrgy_lostr)/(enrgy_supp)*100
#Acceleraton is uniform during starting period .Therefore,
speed = S/T*ts #km/h
print "Energy lost in rheostat = ",round(enrgy_lostr,2),"W-h."
print "Energy lost in motor = ",round(enrgy_losta,2),"W-h."
print "Motor output =",round(outp,2),"W-h."
print "Efficiency at starting =",round(eff_s,2),"%."
print "Train speed at which transition from series to parallel = ",round(speed,2),"km/h."
```

In [2]:

```
#Two 600V motors each having a resistance of 0.1 ohm are started on the series-parallel system,the mean current per motor throughout
#the starting period being 300A.The starting period is 20 seconds and the train speed at the end of this period is 30km per hour.
Calculate
#(i)the rheostatic losses during (a)the series and (b) the parallel combination of motors
#(ii)the train speed at which transition from series to parallel must be made.
###############################################################################################################################
num_m = 2 # (number of motors)
V = 600.0 #V (line voltage)
I = 300.0 #A (current per motor)
Ts = 20.0 #s (starting period)
R = 0.1 #ohm (motor resistance)
Vm = 30.0 #km/h (maximum speed)
#Back emf of each motor in series position,
Eb_s = V/2 - I*R #V
#Back emf of each motor in parallel position,
Eb_p = V - I*R #V
#time for which motors were in series
ts = Ts*Eb_s/Eb_p #s
#time for which motors are in parallel
tp = Ts - ts #s
#(a) Voltage drop in the starting rheostat in series combination
V_s = V - 2*I*R #V
#Energy loss in series is
enrgy_s = (V_s/2)*I*(ts/3600) #W-h
#(b) Voltage drop in the starting rheostat in parallel combination
V_p = V/2 #V
#Energy loss in parallel is
enrgy_p = (V_p/2)*(2*I)*(tp/3600)
#Acceleration is
acc = Vm/Ts #km/h/s
#Speed at the end of series period
speed = acc*ts #km/h
print "Energy loss in series =",round(enrgy_s,2),"W-h."
print "Energy loss in parallel =",round(enrgy_p,2),"W-h."
print "The transition speed = ",round(speed,2),"km/h."
```

In [3]:

```
#Two d.c. series motors of a motor coach have resistance of 0.1ohm each.These motors draw a current of 500A from 600V mains during
#series-parallel starting period of 25 seconds.If the acceleration during starting period remains uniform,determine:
#(i)time during which the motors operate in (a)series (b)parallel.
#(ii)the speed at which the series connections are to be changed if the speed just after starting period is 80kmph.
####################################################################################################################################
num_m = 2 # (number of motors)
V = 600.0 #V (line voltage)
I = 500.0 #A (current per motor)
Ts = 25.0 #s (starting period)
R = 0.1 #ohm (motor resistance)
Vm = 80.0 #km/h (maximum speed)
#Back emf of each motor in series position,
Eb_s = V/2 - I*R #V
#Back emf of each motor in parallel position,
Eb_p = V - I*R #V
#time for which motors were in series
ts = Ts*Eb_s/Eb_p #s
#time for which motors are in parallel
tp = Ts - ts #s
#(ii) Speed at which series connection are to be changed = acc*ts and acc = Vm/Ts.Therefore,
speed = Vm/Ts*ts #km/h
print "Period of series operation = ",round(ts,2),"s."
print "Period of parallel operation = ",round(tp,2),"s."
print "Speed at which series connection are to be changed = ",round(speed,2),"km/h."
```

In [6]:

```
#The following figures refer to the speed-current and torque-current characteristics of a 600V d.c. series traction motor.
#Current(A) : 50 100 150 200 250
#Speed(Kmph): 73.6 48 41.1 37.3 35.2
#Torque(N-m): 150 525 930 1335 1750
#Determine the braking torque at a speed of 48kmph when operating as self excited d.c. generator.Assume resistance of motor and
#braking rheostat to be 0.6 ohm and 3.0 ohm respectively.
#############################################################################################################################
Rm = 0.6 #ohm(resistance of motor)
Rrh = 3.0 #ohm(braking rheostat)
#As a motor
V = 600.0 #V (terminal voltage)
#From speed-current characteristics . For a speed of 48kmph,
I = 100.0 #A (current)
Eb = V - I*Rm #V (back emf)
#As a generator
#At instant of applying rheostatic braking ,the terminal voltage will be equal to emf developed by machine i.e
V2 = Eb #V
Rt = Rm + Rrh #ohm (total resistance)
#Using V=IR
I2 = V2/Rt #A (current)
if (I2==50):
tau = 150.0 #N-m
elif (I2==100):
tau = 525.0 #N-m
elif (I2==150):
tau = 930.0 #N-m
elif (I2==200):
tau = 1335.0 #N-m
elif (I2==250):
tau = 1750.0 #N-m
print "Braking torque = ",round(tau,2),"N-m."
```