Advertisement
Guest User

Suicide Burn Model

a guest
Jun 24th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. model SuicideBurn
  2. final constant Real pi=2*asin(1.0); // 3.14159265358979;
  3. final constant Real g0 = 9.81;
  4.  
  5. type Mass = Real(unit="kg");
  6. type Thrust = Real(unit="N");
  7. type Length = Real(unit="m");
  8. type Velocity = Real(unit="m/s");
  9.  
  10. parameter Real g = 1.62519 "Target body gravity";
  11. parameter Real isp = 240 "Rocket engine efficiency";
  12. parameter Mass dry_mass = 1.0e4 "Payload";
  13. parameter Thrust engine_thrust = 78.0e3 * 8 "Maximum thrust";
  14.  
  15. /* Autopilot configuration */
  16. parameter Real burn_time(unit="s") = 120. "When to start the engine";
  17. parameter Velocity cutoff_x = 0.5 "Desired cutoff speed, x-axis";
  18. parameter Velocity cutoff_y = 3.0 "Desired cutoff speed, y-axis";
  19. parameter Real restart_factor = 1.5 "Restart when velocity > cutoff * restart_factor";
  20.  
  21. /* Autopilot signals */
  22. Boolean stop = abs(vx) < cutoff_x and abs(vy) < cutoff_y;
  23. Boolean restart = ((abs(vx) > cutoff_x * restart_factor) or abs(vy) > cutoff_y * restart_factor)
  24. and time > burn_time;
  25. Boolean start = time > burn_time;
  26.  
  27. discrete Real throttle;
  28. discrete Real max_thrust(start=engine_thrust, fixed=true);
  29.  
  30. /* Geometry */
  31. Length x,y;
  32. Real phi "Prograde direction";
  33.  
  34. Velocity vx,vy;
  35.  
  36. Mass m_p,m;
  37.  
  38. /* Thrust */
  39. Thrust F,Fx,Fy;
  40.  
  41. initial equation
  42. y = 15000;
  43. vx = 1000.0;
  44. m_p = 1400.0 * 8;
  45. vy = 0;
  46.  
  47. equation
  48.  
  49. /* Autopilot implementation */
  50. when start then
  51. throttle = 1.0;
  52. elsewhen stop then
  53. throttle = 0.0;
  54. elsewhen restart then
  55. throttle = 1.0;
  56. end when;
  57.  
  58. /* Propellant limitations */
  59. when m_p < 0 then max_thrust = 0.0; end when;
  60.  
  61. /* End-of-flight */
  62. when y < 0 and abs(vy) < (restart_factor * cutoff_y) and abs(vx) < (restart_factor * cutoff_x) then
  63. terminate("Landed");
  64. elsewhen y < 0 and abs(vy) >= (restart_factor * cutoff_y) then
  65. terminate("Crash: Vertical");
  66. elsewhen y < 0 and abs(vx) >= (restart_factor * cutoff_x) then
  67. terminate("Crash: Horizontal");
  68. end when;
  69.  
  70. /* Flight physics */
  71. der(x) = vx;
  72. der(y) = vy;
  73.  
  74. der(vx) = Fx / m;
  75. der(vy) = (Fy / m) - g;
  76.  
  77. m = dry_mass + m_p;
  78. F = throttle * max_thrust;
  79. der(m_p) = -F / (g0 * isp);
  80.  
  81. /* craft geometry, thrust points retrograde */
  82. phi = atan2(vx, vy);
  83. Fy = F*cos(pi + phi);
  84. Fx = F*sin(pi + phi);
  85.  
  86. annotation(experiment(StartTime=0.0, StopTime=2000.0));
  87.  
  88. end SuicideBurn;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement