In [5]:

```
import math
from __future__ import division
#variable declaration
Ma=480 #mass of each motor armature in kg 0.48tonne=480kg
Da=0.5 #average diameter of each motor in m
m=450 #mass of each wheel in kg
R=0.54 #radius of each wheel tread in m
M=40 #combine wight of one motor and one trailer coach in ton
alpha=5 #accelaration
N=4 #number of DC motors
a=0.4 #gear ratio
r=20 #train resistance
#calculation
Jw=1/2*m*R**2 #inertia of the each wheel
nw=2*(N*2) #total number of wheels
J1=nw*Jw #total inertia of all the wheels
Jm=N*(1/2*Ma*(Da/2)**2) #approximate inertia of all the motors
J2=Jm/a**2 #approximate innertia of the motor referred to the wheels
Fa2=(J1+J2)*alpha*1000/3600/R #Tractive efforts for driving rorating parts
Fa1=277.8*M*alpha #tractive efforts to accelerate the train mass horizontally
Fr=r*M #Tractive efforts required to overcome train resistance
Ft=Fa1+Fa2+Fr #Tractive efforts required to move the train
Tm=a*R*Ft/N #torque per motor
#results
print"\nTorque per motor:Tm=",round(Tm,1),"N-m"
```

In [6]:

```
import math
from __future__ import division
#variable declaration
M=100 #mass of each motor armature in tonne
Me=100
Tm=5000 #torque of each motor in N-m
Da=0.5 #average diameter of each motor in m
m=450 #mass of each wheel in kg
R=0.54 #radius of each wheel tread in m
N=4 #number of DC motors
r=25 #train resistance N/tonne
a=0.25 #gear ratio
nt=0.98 #gear transmission efficiency
G=50 #up gradient
Vm=100 #speed in kmph
#calculation
Ft=nt*Tm*N/a/R #Tractive efforts required to move the train
alpha=(Ft-(9.81*M*G+M*r))/(277.8*1.1*Me) #accelaration
t=Vm/alpha #time taken to attain speed of Vm
#results
print"\n time taken to reach a speed of 100kmph is :t=",round(t,1),"sec"
```

In [12]:

```
import math
from __future__ import division
#variable declaration
G=8 #up gradient
r=25 #train resistance N/tonne
M=500 #mass of the electric train in tonne
n=0.8 #combine effiency of transmission and motor
#speed time curve characteristics
t1=60 #characteristic for uniform accelaration at v1 in sec
alpha=2.5 #given accelaration in km/hr/sec at t1
t2=5*60 #characteristic for constant speed in sec
t3=3*60 #characteristic for coasting in sec
B=3 #dynamic braking deceleration in km/hr/sec
#calculation
Vm=alpha*t1 #peak voltage
Fg=9.81*M*G #tractive effort required to overcome the force of gravity
Fr=M*r #tractive effort required to overcome the train resistance
F_bc=Fg+Fr #retarding force during coasting
Me=1.1*M
B_c=F_bc/(277.8*Me) #deceleration during coasting
V=Vm-B_c*t3 #speed after coasting
t4=V/B #characteristic for a dynamic braking of 3km/hr/sec
d1=1/2*Vm*t1/3600 #distance covered during accelaration
d2=Vm*t2/3600 #distance covered during constant speed
d3=1/2*(Vm+V)*t3/3600 #distance covered coasting
d4=1/2*V*t4/3600 #distance covered during braking
D=d1+d2+d3+d4 #distance during stops
D1=d1+d2
x=D1/D
y=1-x
E=(0.01072*Vm**2/D)*(Me/M)+2.725*G*x+0.2778*r*x #specific energy output
Eo=E/n #specific energy consumption
#results
print"\n Specific energy consumption is :Eo=",round(Eo,1),"Whptpkm"
```

In [11]:

```
import math
from __future__ import division
#variable declaration
G=20 #up gradient
r=25 #train resistance N/tonne
M=500 #mass of the electric train in tonne
n=0.8 #combine effiency of transmission and motor
#speed time curve characteristics
t1=50 #characteristic for uniform accelaration at v1 in sec
alpha=3 #given accelaration in km/hr/sec at t1
t2=10*60 #characteristic for constant speed in sec
B=2.5 #uniform braking deceleration in kmphs to rest
#calculation
Vm=alpha*t1 #peak voltage
t3=Vm/B #characteristic for a uniform braking of B=2.5 kmphs
#(i)during accelaration total tractive effort
Me=1.1*M
Fta=277.8*Me*alpha-9.81*M*G+M*r #total tractive effort during accelaration
Da=1/2*Vm*t1/3600 #distance covered during accelaration ,and t1 is in seconds
Ea=Fta*Da*1000/3600 #energy output during accleration in Wh
#(ii)during uniform speed net tractive effort
Ftu=-9.81*M*G+M*r #total tractive effort during uniform speed
#the answer for Ftu in the book is -105220 N which is wrong which leads to the other incorrect answers in the book
Du=Vm*t2/3600 #distance traveled,and t2 is in seconds
Eu=Ftu*Du*1000/3600 #energy output in Wh
#(iii)during braking net tractive effort
Ftb=-277.8*Me*B-9.81*M*G+M*r #total tractive effort for the net braking
Db=1/2*Vm*t3/3600 #distance covered during braking
Eb=Ftb*Db*1000/3600 #energy output during braking in Wh
E=Ea/n+n*(Eu+Eb) #net energy consumption
D=Da+Du+Db #total distance traveled
Eo=E/(M*D) #specific energy consumption
#results
print"(i)Energy consumption during accelaration is :Ea :",round(Ea),"Wh"
print" There is a slight difference in the answer due to the number of decimal place"
print"\n(ii)Energy consumption during uniform speed is :Eu :",round(Eu),"Wh"
print"\n(iii)Energy consumption during braking is :Eb :",round(Eb,1),"Wh"
print"\n Net Energy consumption is E :",round(E,1),"Wh"
print"\n Total Distance traveled is D :",round(D,4),"km"
print"\n Specific Energy consumption is Eo :",round(Eo,2),"Whptpkm"
#answers in the book are incorrect
```

In [3]:

```
import math
from __future__ import division
#variable declaration
Mm=40 #weight of the motor coach in tonne
Mt=35 #weight of the trailer in tonne
u=0.2 #co-efficient of adhesion
r=30 #train resistance N/tonne
#calculation
#(a)when the motor to trailer ratio is 1:2
M=Mm+2*Mt #weight of one unit
Me=1.1*M
Md=40 #weight on the driving wheels
Fm=9810*u*Md #total tractive effort without the wheel
Ft=Fm #at maximum accelaration
alpha=(Ft-M*r)/(277.8*Me) #required accelaration since Ft=277.8*u*alpha*M*r
#(b)when the motor to trailer ratio is 1:1
M=Mm+Mt #weight of one unit
Me=1.1*M
Md=40 #weight on the driving wheels
Fm=9810*u*Md #total tractive effort wihout the wheel
Ft=Fm #at maximum accelaration
alpha1=(Ft-M*r)/(277.8*Me) #required accelaration since Ft=277.8*u*alpha*M*r
#results
print"(a)maximum accelaration on a level track is alpha :",round(alpha,4),"kmphps"
print"\n(b)maximum accelaration when motor to trailer coaches ratio is 1:1 is alpha :",round(alpha1,3),"kmphps"
```

In [16]:

```
import math
from __future__ import division
#variable declaration
G=10 #up gradient of the locomotive
Ml=110 #weight of the locomotive coach in tonne
Mt=500 #weight of the train in tonne
r=35 #train resistance N/tonne
n=0.8 #80% of the locomotive weight is carried by the driving wheels
alpha=1 #acelaration in kmphps
#calculation
#when only the 110 tonne locomotive is present
Md=Ml*n #weight of the motor
M=Mt+Ml #total mass of the train
Me=1.1*M
Ft=277.8*Me*alpha+9.81*M*G+M*r #total tractive effort required to move the train
Fm=Ft
u=Fm/(9810*Md) #co-efficient of adhesion ,since Fm=9810*u*Md
#when another locomotive of 70 is added together
Md=Ml*n+70 # mass of the motor
M_=Mt+Ml+70 # mass of the train
Fm=9810*u*Md
Ft=Fm
M=Ft/(277.8*1.1*alpha+9.81*G+r) #total mass of the train, since Ft=277.8*Me*alpha+9.81*M*G+M*r
W=M-M_ #weight of additional bogies to be attached
#results
print"\n Given co-efficient of adhesion is:",round(u,2)
print"\n Weight of additional bogies to be attached is:",round(W,1),"T"
```

In [18]:

```
import math
from sympy import Symbol
from __future__ import division
#variable declaration
Ml=1000 #weight of the empty train in tonne
Mt=5000 #weight of the fully loaded train in tonne
G=15 #gradient of the track
V=30 #maximum speed of the train
r=40 #train resistance in N/tonne
u=0.25 #co-efficient of adhesion
alpha=0.3 #acelaration in kmphps
n = Symbol('n') #number of locomotive required
W=100 #weight of each locomotive
#calculation
Md=W*n
Fm=9810*u*Md
Fb=9.81*(Mt+W*n)*G-(Mt+W*n)*r
print"\nFm=",Fm
print"\nFb=",Fb
print"\nequating Fb and Fm we get"
n=535750/(245250-10715)
if (n>2) :
n=3
print"\nThe number of locomotives is n:",n
Md=W*n
M=Ml+W*n
Ft=277.8*1.1*M*alpha+9.81*M*G+M*r
Fm=9810*0.3*Md
if (Fm>Ft) :
print"\nThe train can be accelarated with ",n,"locomotives"
```