Space Shuttle Launch Simulation

The shuttle rises to 380 km and has a velocity of 7.68 km/sec at the final state.


! APMonitor Modeling Language
! http://www.apmonitor.com

! Endeavor shuttle launch simulation
! The shuttle rises to 380 km and has a 
!   velocity of 7.68 km/sec at the final state
Model endeavor

  Parameters
      ! cross-sectional area of shuttle
      ! solid rocket booster (srb)
      !   cross-sectional area 10.8 m^2
      !   diameter 3.71 m 
      ! 1st stage
      !   cross-sectional area 55.4 m^2
      !   diameter 8.4 m  
      ! orbiter
      !   cross-sectional area ~ 20 m^2                  
      d0 = 100.0       ! 1st drag constant (N/(m/s)^2)
      e0 = 1.0         ! 2nd drag constant (dimensionless)
      g0 = 9.8         ! gravity at launch (m/s^2)
      m0 = 2029203     ! mass of shuttle at launch
      h0 = 1000        ! initial height from earth's center (m)
      c  = 1.5e7       ! impulse of rocket fuel (N/(kg/sec))
      t_srb = 12.5e6   ! 2 solid rocket boosters (HMX) 
                       ! each have 12.5e6 N of thrust at lift-off
                       ! they burn for 124 sec to height of 45.7 km
                       ! they are released at 126 sec
      t_1st = 5.25e6   ! 1st stage fuel tank (liq H2/O2) has 
                       !  5.25e6 N of thrust at lift-off
                       !  it fires for 480 sec when it is released
      t_orb = 53.0e3   ! orbiter (MMH/N2O4) has 53e3 N of 
                       !  thrust at lift-off
                       ! it fires for 1250 sec
      n_srb = 2        ! number of solid rocket boosters
      n_1st = 1        ! number of 1st stage thrusters
      n_orb = 1        ! number of orbiter thrusters
  End Parameters

  Variables
      t                ! thrust force (N)
                       !  0 < t < t_max
      m = m0           ! mass of shuttle and fuel (kg)
                       !  m_shuttle < m < m_full
      g = g0           ! gravitational force
      h = h0           ! altitude from earth's center (m)
                       !  h > h0
      d = 1            ! drag force (N)    
      v = 0            ! velocity (m/s)
      a = 0            ! acceleration (m/s^2)                    
  End Variables

  Equations
      ! thrust
      t = n_srb * t_srb + n_1st * t_1st + n_orb * t_orb

      ! gravitational variation with height
      g = g0 * (h0/h)^2

      ! velocity
      $h = v

      ! acceleration
      $v = a

      ! force balance
      ! inertial + gravitational + drag = thrust
      m*a + m*g + d = t

      ! aerodynamic drag force 
      d = d0 * v^2 * exp(-e0*(h-h0)/h0)

      ! mass loss due to burn-off of fuel
      c * $m = -t + 0*m
  End Equations

End Model