Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. while(True):
  2.  
  3. # starting clock to calculate delta
  4. start_time = time.time()
  5.  
  6.  
  7. # getting the tractive effort
  8. te = mod.GetTractiveEffortFirstVariant(train, train.speedkmH, 2.5)
  9. # getting the rolling resistance
  10. rr = mod.CalculateDavisFormula1970(train, hp.KMH_TO_MPH(train.speedkmH))
  11.  
  12. # get the difference
  13. diff = te - rr
  14.  
  15. # getting the acceleration in m/s
  16. acc = diff/train.GetTotalWeightTrain()
  17.  
  18. # getting the delta time
  19. delta = time.time() - start_time
  20.  
  21. # store the speed in mps
  22. train.speedMpS = train.speedMpS + acc * delta
  23. # convert it to kmh
  24. train.speedkmH = hp.MS_TO_KMH(train.speedMpS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement