In [1]:

```
from __future__ import division
from sympy import symbols, solve
from numpy import array
#To determine the Acceleration and Coasting Period
D=1.92
Ts=20 #Duration of stops
Vsch=40
V1=60.8
#Retardation
B=3.2
Bc=0.16
SchTime=D*3600/Vsch # Schedule time in seconds
T=SchTime-Ts #Time of Travel
a=symbols('a') # Acceleration Unknown Value
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
X=((V1+V2)*T-(V1*V2*((1/B)+(1/a))))-(7200*D) #Polynomial Equation to find a
a=solve(X, a) #Roots of the Characteristic Equation
#To Determine the positive roots
Y=array([abs(a[0])+a[0], abs(a[1])+a[1] ])
if Y[0]==0:
a=a[1]
else:
a=a[0]
Ta=V1/a #Duration of acceleration
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
Tcs=(V1-V2)/Bc #Coasting Time Period
print 'The Acceleration of the Train is %0.2f Kmphp '%a
print 'The Coasting Period is %0.2f seconds'%Tcs
```

In [2]:

```
#To determine the duration of acceleration and others
D=1.6
Vav=40
Bc=0.16
B=3.2
a=2 #Acceleration
T=D*3600/Vav #Time of travel
V1=symbols('V1') #Variable Value
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
#Formula #7200*D = (V1+V2)*T-V1*V2(1/B+1/alfa)
X=((V1+V2)*T-(V1*V2*((1/B)+(1/a))))-(7200*D) #Polynomial Equation to find V1
V1=solve(X, V1) #Numerical Values for V1
V1=V1[0] #Train Considered have speed close to this value
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
Ta=V1/a #Acceleration Time
Tc=(V1-V2)/Bc #Coasting Time
Tb=V2/B #Braking time
#Distance are calculated according to the area under their respective curves
Da=(Ta*V1/2)/3600 #Distance during acceleration
Dc=(((V1-V2)*Tc/2)+(V2*Tc))/3600 #Distance during coasting
Db=(Tb*V2/2)/3600 #Distance during braking
print 'The Time periods and the distance covered for:'
print 'Acceleration : %.2f seconds and %0.3f km '%(Ta,Da)
print 'Coasting : %0.2f seconds and %0.3f km '%(Tc,Dc)
print 'Braking : %0.2f seconds and %0.3f km '%(Tb,Db)
```

In [3]:

```
#To determine the acceleration required to run the service
D=1
Ts=20 #Stopping Time
B=3
Vsh=30
ShT=D*3600/Vsh #Schedule time
T=ShT-Ts #Actual Run Time
Vav=D*3600/T #Average Speed
Vm=1.25*Vav
a=symbols('a') #Acceleration Variable
X=((2*Vm*T)-((Vm**2)*((1/a)+(1/B))))-(7200*D) #Polynomial Equation to find 'a'
a=solve(X, a)[0] #Numerical Value of the Acceleration
print 'The Accleration required to run the service is %g Kmphps'%a
```

In [4]:

```
#To determine the time taken by the train to attain a particular speed
M=200 #Mass of train
g=9.81 #Acceleration due to gravity
W=M*g
RI=10/100 #Rotational Inertia
We=W*(1+RI)
motor=4 #Number of Motors
Tm=5000 #Torque per motor
T=Tm*motor
V=40 #Speed to be Attained
N=0.9 #Gear Efficiency
Y=3.6/1 #Gear Ratio
R=91.5*(10**-2)/2
Ft=N*T*Y/R
r=40
G=(1/200)*100 #Gradient in Percentage
a=symbols('a') #Acceleration
X=((28.3*We*a)+(10*W*G)+(M*r))-Ft #Polynomial Equation to find acceleration
a=solve(X)[0] #Numerical Value of Acceleration
Time=V/a #Time Taken to attain the required the necessary speed
print 'The Time Taken by the Train to attain 40 Kmphs is %0.2f seconds'%Time
```

In [5]:

```
#To determine the Factors affeting the mechanics of the Train
D=1.92
Ts=20 #Duration of stops
Vsch=40
V1=60.8
#Retardation
B=3.2
Bc=0.16
SchTime=D*3600/Vsch # Schedule time in seconds
T=SchTime-Ts #Time of Travel
a=symbols('a') # Acceleration Unknown Value
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
X=((V1+V2)*T-(V1*V2*((1/B)+(1/a))))-(7200*D) #Polynomial Equation to find a
a=solve(X,a)[1] #taking +ve root
Ta=V1/a #Duration of acceleration
V2=(V1-Bc*(T-(V1/a)))/(1-(Bc/B)) # From the Speed Time Curve
Tc=(V1-V2)/Bc #Coasting Time
Tb=V2/B #Braking time
#Distance are calculated according to the area under their respective curves
Da=(Ta*V1/2)/3600 #Distance during acceleration
Dc=(((V1-V2)*Tc/2)+(V2*Tc))/3600 #Distance during coasting
Db=(Tb*V2/2)/3600 #Distance during braking
r=4.53*9.81 #Train Resistance in N per tonne
M=200 #Mass of Train
AWF=1.1 #Accelerating Weight Factor
SEOA=0.010726*(V1**2)*(AWF)/D #Specific Energy Output during acceleration
SEOAr=0.2778*r*Da/D #Specific Energy Output during acceleration against train resistance
SEO=SEOA+SEOAr #Specific Energy for the run
SEOB=0.010726*(V2**2)*(AWF)/D #Specific Energy Output during braking
SEOC=SEOA-SEOB #energy utilized during coasting
rc=SEOC*D/(0.2778*Dc)#Mean Train Resistance during coasting
print '\ni)The Specific Energy Output for the Run is %0.3f Whr/Tonne-km\n'%SEO
print 'ii) The Energy Dissipated by the brakes is %0.3f Whr/Tonne-km\n'%SEOB
print 'iii)The Energy Utilized during coasting is %0.3f Whr/Tonne-km\n'%SEOC
print 'iv) The Mean Train Resistance during coasting is %0.2f N/tonne\n'%rc
```

In [6]:

```
#To determine the Specific Energy Output Runs for Both the Cases
from sympy import symbols, solve
G=(1/80)*100
W=210
We=1.1*W
Vm=symbols('Vm') #Variable Value of The Max Velocity
D=1.6 #Distance between Stations
Ftg=10*W*G #Tractive Effort due to Gradient
Fta=13050 #Total Tractive Effort for Acceleration
Ftb=20445 #Total Tractive Effort for Retardation
ron=5.43 #Train Resistance when power on
rc=6.525 #Train Resistance when coasting
#Level Track
al=2
Bl=3.2
#Up Gradient
Vavu=40 #Average Speed
Tu=D*3600/Vavu #Total Time Taken
au=(Fta-Ftg)/(28.3*We) #Acceleration
Bu=(Ftb+Ftg)/(28.3*We) #Retardation
Xu=((2*Vm*Tu)-((Vm**2)*((1/au)+(1/Bu))))-(7200*D) #Polynomial Equation to Find Vm
Vmu=solve(Xu, Vm)[0] #Numerical Value of Vm
Tua=Vmu/au #Accelerating Period
Tub=Vmu/Bu #Braking Period
Tucs=Tu-Tua-Tub #Constant Speed Duration
Dua=Vmu*Tua/(2*3600) #Distance Travelled During Accleration in km
Dub=Vmu*Tub/(2*3600) #Distance Travelled During Braking in km
Duon=D-Dub #Distance run with power on
SEOua=0.010726*(Vmu**2)*(We/W)/D #Specific Energy Output during Acceleration
SEOug=27.25*G*Duon/D #Specific Energy Output for Gradient
SEOur=0.2778*ron*9.81*Duon/D #Specific Energy Output for resitance
TSEOu=SEOua+SEOug+SEOur #Total Specific Output
#Down Gradient
Vavd=44 #Average Speed
Td=D*3600/Vavd #Total Time Taken
ad=(Fta+Ftg)/(28.3*We) #Acceleration
Bd=(Ftb-Ftg)/(28.3*We) #Retardation
Xd=((2*Vm*Td)-((Vm**2)*((1/ad)+(1/Bd))))-(7200*D) #Polynomial Equation to Find Vm
Vmd=solve(Xd, Vm)[0] #Numerical Value of Vm
Tda=Vmd/ad #Accelerating Period
Tdb=Vmd/Bd #Braking Period
Tdcs=Td-Tda-Tdb #Constant Speed Duration
Dda=Vmd*Tda/(2*3600) #Distance Travelled During Accleration in km
Ddb=Vmd*Tdb/(2*3600) #Distance Travelled During Braking in km
Ddon=D-Ddb #Distance run with power on
SEOda=0.010726*(Vmd**2)*(We/W)/D #Specific Energy Output during Acceleration
#Net Force Acting Downward due to gradient and resistance
Fnet=W*((10*G)-rc)
#Since Fnet is Postive, To run the train at constant speed brakes will have to applied therefore they cannot supply electric energy
TSEOd=SEOda #Total Sepcific Enegy Consumption
print 'The Total Specific Energy:'
print 'Up Gradient : %0.2f Whr/Tonne km'%TSEOu
print 'Down Gradient : %0.2f Whr/Tonne km '%TSEOd
```

In [7]:

```
#To determine the specific energy consumption
from __future__ import division
W=400
G=1
a=1.5 #Acceleration
Ta=30 #Acceleration Time
Tf=36 #Free running Period
Tc=25 #Coasting Period
B=2.6
r=45
RI=10/100 #Rotational Inertia Effect
Eff=75/100 # Overall Efficieny
g=9.81 #Accleration due to gravity
Vm=Ta*a
We=W*(1+RI)
#Distance Covered is equal to the area under the speed time curve
Da=Vm*Ta/(2*3600) #Acceleration
Df=Vm*Tf/3600 #Free Run
Ftf=W*(r+(10*g*G)) #Tractive effort during free run period
Fta=We*277.8 #Tractive effort due to acceleration
#During Coasting, The Accelrating force is equal to Tractive effort during free run
#Retardation due to coasting is
Bc=Ftf/Fta
V2=Vm-(Bc*Tc) #Speed of train after the coasting period
Tb=V2/B # Braking period
Dc=((((Vm-V2)*Tc)/2)+(V2*Tc))/3600 #Distance covered during coasting
Db=V2*Tb/(2*3600) #Distance covered during braking
D=Da+Df+Dc+Db #Total Distance
D1=Da+Df #Distance for which the energy is being spent
SEO=(0.010726*(Vm**2)*We/(W*D))+(27.25*G*D1/D)+(0.2778*r*D1/D) #Specific Energy Output
#Note the Calculated Specific Energy Output during accleration is wrong.
SEOa=SEO/Eff #Actual Specific Energy Output with 75% efficieny
print 'The Specific Energy Consumption is %0.2f Whr/Tonne Km'%SEOa
```

In [8]:

```
#To determine the weight of the locomotive
from math import ceil
Wg=300 #Weight of the train to be hauled
RI=10/100 #Rotation inertia
Ma=20/100 #Co-Efficient of adhesion
Wa=20 #Permissible Weight of axle load
r=45
G=2
a=1 #Acceleration
Wl=symbols('Wl') #Variable Weight of locmotive
W=Wg+Wl #Total Weight of the train
We=W*(1+RI)
Ft=((277.8*a*We/W)+(98.1*G)+r)*W
Fmax=(9.81*1000*Ma*Wl)
X=Ft-Fmax #Polynomial Equation to find Wl
Wl=solve(X, Wl)[0] #Numerical Value of the Weight of the locomotive
NoA=Wl/Wa #Number of axles
print 'The weight of the locomotive and the number of axles is %0.1f tonnes and %g axles respectively\n'%(Wl,ceil(NoA))
```

In [9]:

```
#To deduce the speed current characteristic of the motor
from numpy import array
Ia=array([10,20,30,40,50,60,70] ) #Current
T=array([45,130,230,350,470,610,765]) #Torque
V=440 #operating voltage
r=0.5 #Armature Circuit Resistance
N=9.55*(V-(Ia*r))/(T/Ia) #Speed
print 'For the Given Current: '
for ia in Ia:
print "%0.f "%ia,
print '\nThe Speeds tabulated are:'
for n in N:
print "%0.f "%n,
# Answer in the textbook are not accurate.
```

In [10]:

```
#To determine the speed torque curve for the series motor
from numpy import linalg
I=array([50,100,150,200,250,300]) #Field Current
Eb1=array([230,360,440,500,530,580]) #Armature Volts
Ra=0.07 #Armature Winding Resistance
Rf=0.05 #Field Resistance
Rt=Rf+Ra #Total Resistance
P=4 #Poles of the machine
N1=600 #Series Motor Speed
Vc=600 #Constant Operating Voltage
# Note that the Suffix 1 and 2 have given according the question 1 stands for the case where the magnetisation curve has been given and 2 stands for the case where we have to find the speed torque curve
Eb2=Vc-(I*(Rt))
N2=N1*Eb2/Eb1 #Speed
T=9.55*Eb2*I/N2 #Torque
print 'The Tabulated Speeds for 600V are:\n'
for n2 in N2:
print "%0.f "%n2,
print '\n\nAnd their corresponding torques are:\n'
for t in T:
print "%0.f "%t,
# Answer in the textbook are not accurate.
```

In [11]:

```
#To determine the horse power delivered by the locomotive
from math import sqrt
Ftl=35000 #Tractive Effort on a level surface
Ftg=55000 #Tractive Effort on a gradient
V=50 #Speed of the train
HP=735.5 #One Horse Power
Pl=Ftl*V*1000/(3600*HP) #Power Output(in HP) of the Locomotive on the level track
#CASE 1:
#D.C Series Motor, Power is directly proportional to the root of the Trative Effort
HP1=Pl*sqrt(Ftg/Ftl)
#CASE 2:
#3 Phase Induction Motor, Power is directly proportional to the Trative Effort
HP2=Pl*(Ftg/Ftl)
print 'The Horse Power delivered by the locmotive when the motors used are:'
print 'i) D.C Series Motor is %0.1f H.P '%HP1
print 'ii) 3 Phase Induction Motor is %0.1f H.P '%HP2
#Note the Calculation Mistake in TextBook for case 2
```

In [12]:

```
#To Determine the tractive effort shared by the two locomotives
Da=1.27 #Loco A wheel diameter
Db=1.244 #Loco B wheel diameter
S=5 #Slip of both the Locomotives in Case 1
Sa=S #Slip of Loco A in Case 2
Sb=4 #Slip of Loco B in Case 2
Ftta=11325 #Total Tractive Effort in Case 1
Fttb=1309 #Total Tractive Effort in Case 2
Ft=5227 #Full Load Tractive Effort of Loco
x=symbols('x') #Variable for Tractive Effort Exerted by Loco A
#Slips are same
#For 11325 kg
#% Speed
NA=100-(S*x/Ft)
NB=100-(S*(Ftta-x)/Ft)
Rna=NB/NA #Speed Ratio
Y1=Rna-(Da/Db) #Polynomial to find out 'x'
x=solve(Y1, x)[0] #Numerical Value of Tractive Effort shared by A
#Tractive Efforts Shared by A Loco and B Loco
FtAas=x
FtBas=Ftta-x
#For 1309 kg
#% Speed
x=symbols('x') #Variable for Tractive Effort Exerted by Loco A
NA=100-(S*x/Ft)
NB=100-(S*(Fttb-x)/Ft)
Rn1=NB/NA #Speed Ratio
Y2=Rn1-(Da/Db) #Polynomial to find out 'x'
x=solve(Y2, x)[0] #Numerical Value of Tractive Effort shared by A
#Tractive Efforts Shared by A Loco and B Loco
FtAbs=x
FtBbs=Fttb-x
#Different Slips
#For 11325 kg
#% Speed
x=symbols('x') #Variable for Tractive Effort Exerted by Loco A
NA=100-(Sa*x/Ft)
NB=100-(Sb*(Ftta-x)/Ft)
Rna=NB/NA #Speed Ratio
Y3=Rna-(Da/Db) #Polynomial to find out 'x'
x=solve(Y3,x)[0] #Numerical Value of Tractive Effort shared by A
#Tractive Efforts Shared by A Loco and B Loco
FtAad=x
FtBad=Ftta-x
#For 1309 kg
#% Speed
x=symbols('x') #Variable for Tractive Effort Exerted by Loco A
NA=100-(Sa*x/Ft)
NB=100-(Sb*(Fttb-x)/Ft)
Rn2=NB/NA #Speed Ratio
Y4=Rn2-(Da/Db) #Polynomial to find out 'x'
x=solve(Y4, x)[0] #Numerical Value of Tractive Effort shared by A
#Tractive Efforts Shared by A Loco and B Loco
FtAbd=x
FtBbd=Fttb-x
print 'The Tractive Effort shared A and B for:'
print 'i) Slips are %d percent for both the Locomotives for a Tractive effort of:'%S
print 'a) %d kg : %d kg by A and %d kg by B respectively'%(Ftta,FtAas,FtBas)
print 'b) %d kg : %d kg by A and %d kg by B respectively'%(Fttb,FtAbs,FtBbs)
print 'i) Slips are %d percent for A and %d percent for B for a Tractive effort of:'%(Sa,Sb)
print 'a) %d kg : %d kg by A and %d kg by B respectively'%(Ftta,FtAad,FtBad)
print 'b) %d kg : %d kg by A and %d kg by B respectively'%(Fttb,FtAbd,FtBbd)
#Please Note there is caluculation mistake calculation in the TextBook for the First Case
```

In [13]:

```
#To determine the traction control of 2 motors rated at 1500V
NoM=2 #Number of motors
V=1500 #Rated Voltage
I=500 #Starting Current
R=0.15 #Armature Resistance
r=50 #Specific Resistance
W=120
We=140
Ft=38000 # Tractive Effort Per motor
Vs=40 #Speed at the end of starting period
#Note the question is asked for 50 Kmph, But the answer is calculated for 40Kmph
#Therefore it is calculated for 40 Kmph
#By Changing the value of Vs to 50 Kmph, The Specific Parameters can also be obtained
a=symbols('a') #Accleration Variable
X=(2*Ft)-((277.8*We*a)+(W*r)) #Polynomial To find 'a'
a=solve(X)[0] #To find the Numerical Value of the Acceleration
t=Vs/a #Starting Time
Vd=I*R #Resistance drop per motor
ts=t*(V-(2*Vd))/(2*(V-Vd)) #Starting Series Time Period
tp=t-ts #Starting Parallel Time Period
Vt=a*ts #Speed at Transition
#Loss can be found out by the computing the area under the of the given figure in the text book for different period
#In series, the Voltage reduces, Hence 675
Rhel=((((V/2)-Vd)*I*ts)+((V/2)*I*tp))/(2*3600*1000) #Loss per motor in kWhr
Rhe=NoM*Rhel #Total Rheostatic Loss
print 'i) The Duration of starting period is %0.1f seconds'%t
print 'ii)The Speed of Train at Transition is %0.2f Kmph'%Vt
print 'iii) The Rheostatic Loss is %0.3f kWhr'%Rhe
```

In [14]:

```
#To determine the speed of motors when connected in series
V=650 #Rating of motor and Supply Voltage when connected in parallel
IR=10*650/100 #Armature Drop
N1p=1000 #Speed of the first motor in parallel operation
D1=88 #Motor 1 wheels diameter
D2=86 #Motor 2 wheels diameter
#Current Remains Constant during the start
r=D1/D2 #Ratio of the first motor wheel diameter to the second motor wheel diameter
#N1/N2 = 1/r
V1=((V-IR)/(1+(r)))+((IR)/(1+(1/r))) #Voltage of Motor 1 in series operation
V2=V-V1 #Voltage of Motor 2 in series operation
N1=N1p*(V1-IR)/(V-IR) #Speed of motor 1 in series configuration
N2=N1*r #Speed of motor 2 in series configuration
print 'The Speed of Motor 1 in series Configuration is %d rpm'%N1
print 'The Speed of Motor 2 in series Configuration is %d rpm'%N2
```

In [15]:

```
from __future__ import division
from numpy import array, nditer
#To determine the characteristics gear ratio and wheels are replaced
D1=86 #Diameter of wheels in Case 1
Y1=71/21 #Gear Ratio in Case 1
D2=88 # Diameter of wheels in Case 2
Y2=74/19 #Gear Ratio in case 2
I=array([50,100,150,200,250,300] ) #Current
L1=array([80,50,45,40,36,32] ) #Speed in Kmph
Ft1=array([2000,6000,12000,16000,18000,22000]) #Tractive Effort
# V = pi*D*N*60/(100*100*Y)
#According to the above equation, V is directly proportional to D*N/Y
#Angular Frequency And Torque remains the same irrespective of the gear ratio or change in diameter
#Hence the V is directly proportional to D/Y
#V id directly proportional to N
# N directly proportional to Linear speed
#Hence relating the above terms
#We get linear speed directly proportional to D/Y
def fun1(L1):
it = nditer([L1, None])
for x,y in it:
y[...] = x*D2*Y1/(D1*Y2)
return it.operands[1]
L2 = fun1(L1) #Linear Speed in Case two
#Similarly T = Ft * D/(200)
#Dividing by Y (T/Y) = Ft*D/(200*Y)
#Taking two cases where we find Torque per gear ratio of one case
# And multiply the Torque to Gear ratio to the other gear ratio to get Torque
# From this process we T1*Y2/Y1 =T2
# We Get Ft is directly proportional to Y/D
def fun2(Ft1):
it = nditer([Ft1, None])
for x,y in it:
y[...] = x*D1*Y2/(D2*Y1)
return it.operands[1]
Ft2=fun2(Ft1) #Tractive Effort in Second Case
print 'The New Characteristics are - \nCurrent in Amperes'
for i in I:
print "%d "%i,
print '\n\nSpeed in Kmph'
for l2 in L2:
print "%0.2f "%l2,
print '\n\nTractive Effort in N'
for ft2 in Ft2:
print "%0.f "%ft2,
# Answers are not accurate in the textbook.
```

In [16]:

```
from __future__ import division
#To Determine the Resistance of the Various Steps in a Series Motor
P=20*735.5 #Watt # Power Rating
V=500 #Rated Voltage
Eff=80/100 #Efficiency
Raw=1 #Resistance of Armature and Windings
Iflux=10/100 #Increase in Flux
I=P/(V*Eff) #Full load Current
#VAriation in Current
Imin=1.5*I
Imax=2*I
fi_maxBYfi_min = 1+Iflux
FluxRatio=1+(Iflux) #Flux raises by 10% for every step
# eqn : fimax/fi_min = (V-Imax*R2)/(V-*Imin*R1)
from sympy import symbols, solve
Is=V/Raw
M=Imax-Is
for i in range(1,5):
if((abs(M)+M)==0):
c=i #Number of steps + 1
R=symbols('R') #Variable Resitance
X=((V-(Imax*Raw))/(V-(Imin*R)))-FluxRatio #Polynomial To Find The Next Resistance
Rs =solve(X, R)[0] #Total Next Resistance
Rg=Rs-Raw #Resistance of the ith Step
print "Resistance of %d step = %0.2f ohm"%(i,Rg)
Raw=Rs
Is=V/Raw
M=Imax-Is
print "Reqired steps = %d" %i
```

In [17]:

```
from numpy import array
#To detemine the characteristics for tapping of 30 percent of the turns
I=array([50,100,150,200,250]) #Current
N1=array([73.5,48,41,37,35]) #Speed
Ft1=array([131,457,810,1163,1525]) #Tractive Effort in Kg
Fl=70/100 #Effective Tapping of the Turns (30% reduction)
#Consider flux corresponding to 250A as 100%, that is for 35 Kmph
Flux=(35*100)/N1 #Flux Percent for Current Value
#Reduction by 30% of turns is same as reducing the Ampere Turns by 30% which is same as reducing the Current by 30%
RI=Fl*I #Reduced Current
RFlux=array([32,57,74,83,90]) #Reduced flux determined From the Graph of %Flux and Current in the TextBook
N2=(N1*Flux)/RFlux #Speed for the new case
#Tractive Effort is directly proportional to the product of flux and current
Ft2=RFlux*Ft1/Flux #Tractive Effort of the Second Case
print 'The Current in Amperes:'
for i in I:
print i,'\t',
print ''
print '\nThe Speed in Kmph:'
for n2 in N2:
print '%0.2f'%n2,'\t',
print ''
print '\nThe Tractive Effort in Kg :'
for ft2 in Ft2:
print '%0.1f'%ft2,'\t',
```

In [18]:

```
#To determine the power fed into the supply system
W=200
RI=10/100 #Rotational Intertia
Eff=75/100 #Effeciency of Conversion
G=2
V1=60
V2=20
D=4000 #Distance covered during the speed change in m
r=40
We=(1+RI)*W
Ftb=W*((98.1*G)-r) #Tractive Effort during Retardation
KE=0.01072*(We/W)*200*((V1**2)-(V2**2))/1000 #K.E(in kWhr) Available due to change in speed
EquiEE=Ftb*D/(3600*1000) #Equivalent Electrical Energy
TE=KE+EquiEE #Total Energy Regenarated
ERS=Eff*TE #Energy Returned to the Supply
B=((V1**2)-(V2**2))/(2*D*3600) #Retardation
Tb=V1-V2/B #time taken during retardation
PRS=ERS*3600/Tb #Power Returned due to Retardation
#If there is no change in speed, Net Reactive force is Tractive Effort due to retardation
Vm=V1 #Maximum Speed
#Power that Can be fed into the system
PFS=0.278*Ftb*Vm/1000 #In Kilowatts
APFS=Eff*PFS #Actual Power Fed Back into the supply system
print 'The Power Fed Back into the supply system is %0.1f kW'%APFS
```

In [19]:

```
from __future__ import division
from math import pi
from numpy import array, arange
#To determine the value of resistance to be connected in the motor circuit
#Page 411
N1=600; #Intial Speed
E1=array([252,522,750,900,951]); # Voltages At 600 RPM
Ia=array([20,40,60,80,100]); # Field Current
N2=400; #Changed Speed
E2=E1*(N2/N1); # Voltages at 400 RPM
T=350;
Raw = 0.05; #Armature and Winding Resistance
print 'Field Current in A:\n'
for ia in Ia:
print ia,'\t',
print '\n'
print 'The Respective Voltages at 400 rpm (V):\n'
for e2 in E2:
print e2,'\t',
print ''
P=E2*Ia #To find the value of E and Ia for the Required Speed
PI=2*pi*N2*T/60 #Power Input
i=0
for p in P:
i+=1
X = p-PI
if (X)<0:
L = i-1
H = i
else:
continue
Ip=Ia[H]-Ia[L] #To find the Current Period
Im=Ia[L] #Starting Value of Current in the Particular Portion of the Curve
I=Im+(((PI-P[L])/(P[H]-P[L]))*Ip) #Current Required for 400 rpm
R=PI/(I**2) #Total Resistance required in the circuit
Re=R-Raw #External Resistance
print '\n\nThe External Circuit that needs to connected in the motor circuit to limit the speed to 400 rpm is %0.1f Ohm\n'%Re
```