Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(True):
- # starting clock to calculate delta
- start_time = time.time()
- # getting the tractive effort
- te = mod.GetTractiveEffortFirstVariant(train, train.speedkmH, 2.5)
- # getting the rolling resistance
- rr = mod.CalculateDavisFormula1970(train, hp.KMH_TO_MPH(train.speedkmH))
- # get the difference
- diff = te - rr
- # getting the acceleration in m/s
- acc = diff/train.GetTotalWeightTrain()
- # getting the delta time
- delta = time.time() - start_time
- # store the speed in mps
- train.speedMpS = train.speedMpS + acc * delta
- # convert it to kmh
- train.speedkmH = hp.MS_TO_KMH(train.speedMpS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement