In [1]:

```
#Variable declaration
speed = 45.0 #Scheduled speed(kmph)
D = 1.5 #Distance between 2 stops(km)
t = 20.0 #Time of stop(sec)
alpha = 2.4 #Acceleration(km phps)
beta = 3.2 #Retardation(km phps)
#Calculation
t_total = D*3600/speed #Total time(sec)
T = t_total-t #Actual time for run(sec)
k = (alpha+beta)/(alpha*beta) #Constant
V_m = (T/k)-((T/k)**2-(7200*D/k))**0.5 #Maximum speed over the run(kmph)
#Result
print('Maximum speed over the run, V_m = %.f kmph' %V_m)
```

In [1]:

```
#Variable declaration
V_m = 65.0 #Maximum speed(kmph)
t = 30.0 #Time of stop(sec)
speed = 43.5 #Scheduled speed(kmph)
alpha = 1.3 #Acceleration(km phps)
D = 3.0 #Distance between 2 stops(km)
#Calculation
t_total = D*3600/speed #Total time of run including stop(sec)
T = t_total-t #Actual time for run(sec)
V_a = D/T*3600 #Average speed(kmph)
beta = 1/((7200.0*D/V_m**2*((V_m/V_a)-1))-(1/alpha)) #Value of retardation(km phps)
#Result
print('Value of retardation, β = %.3f km phps' %beta)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here')
print(' ERROR: β unit is km phps & not km phps as mentioned in textbook solution')
```

In [1]:

```
#Variable declaration
speed = 25.0 #Scheduled speed(kmph)
D = 800.0/1000 #Distance between 2 stations(km)
t = 20.0 #Time of stop(sec)
V_m_per = 20.0 #Maximum speed higher than(%)
beta = 3.0 #Retardation(km phps)
#Calculation
t_total = D*3600/speed #Total time of run including stop(sec)
T = t_total-t #Actual time for run(sec)
V_a = D/T*3600 #Average speed(kmph)
V_m = (100+V_m_per)*V_a/100 #Maximum speed(kmph)
alpha = 1/((7200.0*D/V_m**2*((V_m/V_a)-1))-(1/beta)) #Value of acceleration(km phps)
#Result
print('Rate of acceleration required to operate this service, α = %.2f km phps' %alpha)
```

In [1]:

```
#Variable declaration
D = 2.0 #Distance between 2 stations(km)
V_a = 40.0 #Average speed(kmph)
V_1 = 60.0 #Maximum speed limitation(kph)
alpha = 2.0 #Acceleration(km phps)
beta_c = 0.15 #Coasting retardation(km phps)
beta = 3.0 #Braking retardation(km phps)
#Calculation
t_1 = V_1/alpha #Time for acceleration(sec)
T = 3600*D/V_a #Actual time of run(sec)
V_2 = (T-t_1-(V_1/beta_c))*beta*beta_c/(beta_c-beta) #Speed at the end of coasting period(kmph)
t_2 = (V_1-V_2)/beta_c #Coasting period(sec)
t_3 = V_2/beta #Braking period(sec)
#Result
print('Duration of acceleration, t_1 = %.f sec' %t_1)
print('Duration of coasting, t_2 = %.f sec' %t_2)
print('Duration of braking, t_3 = %.f sec' %t_3)
```

In [1]:

```
#Variable declaration
r = 1.0 #Tractive resistance(N/tonne)
#Calculation
tractive_res_i = 0.278*r #Tractive resistance(N/tonne) = Energy consumption(Wh/tonne-km)
beta = 1/277.8 #Tractive resistance(N/tonne) = Retardation(km kmps/tonne)
energy = 98.1*1000/3600 #1% gradient = energy(Wh per tonne km)
#Result
print('Case(i) : Tractive resistance of 1 N per tonne = %.3f Wh per tonne-km' %tractive_res_i)
print('Case(ii) : Tractive resistance of 1 N per tonne = %.5f km phps per tonne' %beta)
print('Case(iii): 1 percent gradient = %.2f Wh per tonne km' %energy)
print('\nNOTE: Slight change in the obtained answer from that of textbook is due to more precision here')
```

In [1]:

```
#Variable declaration
W = 254.0 #Weight of motor-coach train(tonne)
no = 4.0 #Number of motor
t_1 = 20.0 #Time(sec)
V_m = 40.25 #Maximum speed(kmph)
G = 1.0 #Gradient(%)
gamma = 3.5 #Gear ratio
n = 0.95 #Gear efficiency
D = 91.5/100 #Wheel diameter(m)
r = 44.0 #Train resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
#Calculation
W_e = W*(100+I)/100 #Accelerating weight of train(tonne)
alpha = V_m/t_1 #Acceleration(km phps)
F_t = 277.8*W_e*alpha+W*r+98.1*W*G #Tractive effort(N)
T = F_t*D/(2*n*gamma) #Torque developed(N-m)
T_each = T/no #Torque developed by each motor(N-m)
#Result
print('Torque developed by each motor = %.f N-m' %T_each)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here & more approximation in textbook')
print(' ERROR: W = 254 tonne, not 256 tonne as mentioned in textbook problem statement')
```

In [1]:

```
#Variable declaration
W = 203.0 #Weight of motor-coach train(tonne)
no = 4.0 #Number of motors
T = 5130.0 #Shaft torque(N-m)
V_m = 42.0 #Maximum speed(kmph)
G = 100.0/250 #Gradient
gamma = 3.5 #Gear ratio
n = 0.93 #Gear efficiency
D = 91.5/100 #Wheel diameter(m)
r = 45.0 #Train resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
#Calculation
W_e = W*(100+I)/100 #Accelerating weight of train(tonne)
F_t = n*4*T*2*gamma/D #Tractive effort(N)
alpha = (F_t-W*r-98.1*W*G)/(277.8*W_e) #Acceleration(km phps)
t_1 = V_m/alpha #Time taken by train to attain speed(sec)
#Result
print('Time taken by train to attain speed, t_1 = %.1f sec' %t_1)
```

In [1]:

```
import matplotlib.pyplot as plt
#Variable declaration
V_a = 42.0 #Average speed of train(kmph)
D = 1400.0/1000 #Distance(km)
alpha = 1.7 #Acceleration(km phps)
beta = 3.3 #Retardation(km phps)
r = 50.0 #Tractive resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
#Calculation
T = D*3600/V_a #Time for run(sec)
k = (alpha+beta)/(alpha*beta) #Constant
V_m = (T/k)-((T/k)**2-(7200*D/k))**0.5 #Maximum speed over the run(kmph)
t_1 = V_m/alpha #Time of acceleration(sec)
t_3 = V_m/beta #Time(sec)
t_2 = T-(t_1+t_3) #Time(sec)
D_1 = D-(V_a*t_1/(2*3600)) #Distance(km)
We_W = (100+I)/100 #W_e/W
energy = (0.0107*V_m**2*We_W/D)+(0.278*r*D_1/D) #Energy consumption(Wh per tonne-km)
fig = plt.figure(1)
plt.plot(
[0,t_1,t_1,(t_1+t_2),(t_1+t_2),(t_1+t_2+t_3)],
[0,V_m,V_m,V_m,V_m,0],
color='b'
) #Plotting speed-time curve
plt.plot(
[t_1,t_1],
[0,V_m],
color='r',ls='--'
)
plt.plot(
[t_1+t_2,t_1+t_2],
[0,V_m],
color='r',ls='--'
)
plt.axis([0,125,0,54])
plt.xlabel('Time(seconds)')
plt.ylabel('Speed (km/h)')
plt.show()
#Result
print('Speed-time curve for the run is shown in figure 1')
print('Energy consumption at the axles of train = %.1f Wh per tonne-km' %energy)
```

In [1]:

```
#Variable declaration
V_A = 48.0 #Speed(kmph)
t_1 = 24.0 #Time taken to accelerate from rest to speed(sec)
t_2 = 69.0 #Coasting time(sec)
r = 58.0 #Constant resistance(N/tonne)
beta = 3.3 #Retardation(km phps)
t_3 = 11.0 #Retardation time(sec)
t_iii_a = 20.0 #Station stop time(sec)
t_iii_b = 15.0 #Station stop time(sec)
I = 10.0 #Rotational inertia(%)
#Calculation
alpha = V_A/t_1 #Acceleration(km phps)
V_B = beta*t_3 #Speed at B(km phps)
beta_c = (V_A-V_B)/t_2 #Retardation during coasting(km phps)
distance_acc = 1.0/2*t_1*V_A/3600 #Distance covered during acceleration(km)
distance_coasting = (V_A**2-V_B**2)/(2*beta_c*3600) #Distance covered during coasting(km)
distance_braking = t_3*V_B/(3600*2) #Distance covered during braking(km)
distance_total = distance_acc+distance_coasting+distance_braking #Total distance(km)
speed_iii_a = distance_total*3600/(t_1+t_2+t_3+t_iii_a) #Scheduled speed with a stop of 20 sec(kmph)
speed_iii_b = distance_total*3600/(t_1+t_2+t_3+t_iii_b) #Scheduled speed with a stop of 15 sec(kmph)
#Result
print('Case(i) : Acceleration, α = %.f km phps' %alpha)
print('Case(ii) : Coasting retardation, β_c = %.2f km phps' %beta_c)
print('Case(iii): Scheduled speed with a stop of 20 seconds = %.2f kmph' %speed_iii_a)
print(' Scheduled speed with a stop of 15 seconds = %.2f kmph' %speed_iii_b)
print('\nNOTE: ERROR: Calculation mistakes in the textbook solution')
```

In [1]:

```
#Variable declaration
W = 350.0 #Weight of train(tonne)
G = 1.0 #Gradient
alpha = 0.8 #Acceleration(km phps)
u = 0.25 #Co-efficient of adhesion
r = 44.5 #Train resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
#Calculation
W_e = W*(100+I)/100 #Accelerating weight of train(tonne)
F_t = 277.8*W_e*alpha+W*r+98.1*W*G #Tractive effort(N)
adhesive_weight = F_t/(u*9.81*1000) #Adhesive weight(tonnes)
#Result
print('Minimum adhesive weight of the locomotive = %.1f tonnes' %adhesive_weight)
print('\nNOTE: ERROR: Train resistance is 44.5 N per tonne & not 45 N per tonne as mentioned in textbook problem statement')
```

In [1]:

```
#Variable declaration
W = 400.0 #Weight of train(tonne)
G = 100.0/75 #Gradient
alpha = 1.6 #Acceleration(km phps)
r = 66.75 #Train resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
V = 48.0 #Speed(kmph)
n = 0.7 #Overall efficiency of equipment
#Calculation
W_e = W*(100+I)/100 #Accelerating weight of train(tonne)
F_t = 277.8*W_e*alpha+W*r+98.1*W*G #Tractive effort(N)
t = V/alpha #Time(sec)
energy_a = F_t*V*t/(2*3600**2) #Energy usefully employed(kWh)
G_r = 98.1*G+r #Force(N)
work_tonne_km = G_r*1000 #Work done per tonne per km(Nw-m)
energy_b = work_tonne_km/(n*3600) #Energy consumption(Wh per tonne-km)
#Result
print('Case(a): Energy usefully employed in attaining speed = %.2f kWh' %energy_a)
print('Case(b): Specific energy consumption at steady state speed = %.1f Wh per tonne-km' %energy_b)
```

In [1]:

```
#Variable declaration
W = 200.0 #Trailing weight(tonne)
G = 1.0 #Gradient(%)
alpha = 1.0 #Acceleration(km phps)
u = 0.2 #Co-efficient of adhesion
r = 50.0 #Train resistance(N/tonne)
I = 10.0 #Rotational inertia(%)
#Calculation
W_L = ((277.8*(100+I)/100*alpha)+98.1*G+r)*W/(u*9.81*1000-((277.8*(100+I)/100*alpha)+98.1*G+r)) #Weight of locomotive(tonnes)
#Result
print('Minimum adhesive weight of a locomotive, W_L = %.1f tonnes' %W_L)
print('\nNOTE: ERROR: Calculation mistake in textbook solution in calculating W_L')
```