Advertisement
reubencf

Untitled

Mar 21st, 2023
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import math
  2.  
  3. # Constants and parameters
  4. P_max = 6500 # kW
  5. eta = 0.9
  6. rho = 1.2 # kg/m^3
  7. A = 13 # m^2
  8. Cd = 0.3
  9. m_train = 860000 # kg
  10. m_loc = 20.5 # tonnes
  11. m_coach = 35 # tonnes
  12. n_coaches = 24
  13. m = m_train + m_loc + n_coaches * m_coach # Total mass of the train
  14. g = 9.81 # m/s^2
  15. Crr = 0.002
  16. k = 0.01 # constant for curvature resistance
  17. r = 1000 # radius of curvature for a typical railway curve
  18.  
  19. # Calculate maximum speed using the equation from before
  20. v_max = math.sqrt((2 * P_max * eta / (rho * A * Cd)) - (2 * m * g * math.sin(0) / (rho * A * Cd)) - (Crr * g * math.cos(0)) - (m * v_max**2 * k) / (r * g))
  21. v = 0
  22. while v < v_max:
  23.     F_res = (0.5 * rho * A * Cd * v**2) + (Crr * m * g * math.cos(0)) + (m * v**2 * k) / r
  24.     F_grade = m * g * math.sin(0)
  25.     a = (P_max * eta - F_res - F_grade) / m
  26.     v += a * 0.01 # Use a small time step of 0.01 seconds for numerical integration
  27.     print(f"Velocity: {v:.2f} m/s, Acceleration: {a:.2f} m/s^2")
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement