HABSim

Posted on June 29, 2017 by Jimmy Carter

Starting work and discussion of an open source high altitude balloon flight path physics simulator. HABSim can be found on github at github.com/kg4sgp/habsim

asent rate graph

Proof of concept simulation with NOAA wind data.

Beginning work

Around a two months ago I started playing with the idea of making a high altitude balloon flight simulator. I was a little bored at the time and wanted to hack on something new. I threw together some rather simplistic C code and had a very very rudimentary vertical ascent rate model working. Over the next few days I added things here and there making it more realistic and including more variables of the balloon system and flight.

My friend Ricky and I passed around ideas of including this in the telemetry program we, the North east Ohio Experimenters Club (NOEXC), uses for our telemetry downlinks and tracking. A few of our ideas were:

  • Use this for flight prediction and launch site verification.
  • Produce real time updated flight path and landing predictions during a flight.
  • Use this with “lookangle” code I’ve previously written to produce sky maps of the balloon from receive locations.

Move to Haskell

I have been meaning to learn the Haskell programming language for a while and Ricky mentioned this was a simple enough project (at least when it started!) that I could use it as a good way to get used to Haskell. I reproduced a simple version of the simulator in Haskell with a lot of help with syntax and similar items from Ricky. His help has been invaluable on this front.

At this time we also decided to have HABSim be a simulation engine producing data which other programs could use to create other products. We figure a modular design will simplify things and encourage its reuse and contribution.

Flight Model

Our work on the project went in a few main steps:

  • Produce a vertical ascent rate model to predict burst altitude and flight time to burst
  • Produce a descent rate model to predict time from burst to landing.
  • Produce a wind look up method
  • Produce lateral physics model for balloon wind interaction producing the actual flight path

In my work on this project I’ve made an effort to try and not have super simplifying assumptions and produce models even, if they’re rather simple, to get close to the physics actually experienced by the balloon.

Vertical Ascent Rate Model

Quite often predictions use a constant vertical ascent rate model. While this model can produce a good estimate of flight time, I find it slightly lazy for actual simulators. I’ve been reviewing past flight data from the NBP3 flight. You can read my blog post about that here. An example of the ascent rate is seen below.

asent rate graph

The big take away from this graph are these facts:

  1. The ascent rate is not constant
  2. The ascent rate drops in the tropopause
  3. The ascent rate generally increases with altitude

I have been using a simple model based on the combined gas law, which produces all but number 2 on this list. I’m working to produce a model which includes the decrease in ascent rate through the tropopause. A graph of the ascent rate from the model is shown below

simulated asent rate graph

Descent Rate Model

As with the vertical ascent rate model, often a constant speed descent is used for making estimates of descent location and time. In my simulator I wanted to calculate the physics with the parachute and atmosphere to produce a somewhat realistic descent rate graph.

I think that even if we get relatively close we will have a pretty decent flight path simulation. A graph of a simulated descent vs altitude is show below

simulated descent rate graph

Both ascent and descent produce an altitude vs time graph of the following.

simulated altitude vs time

I do note that the balloon is traveling pretty vast vertically both on ascent and descent for these simulations. A tweak of the parameters should bring them in more agreement with actual flight data.

Wind Lookup and Lateral Physics

Currently we use data from the NOAA Global Forecast System. It comes packaged up as a GRIB2 file. We produce a CSV file using wgrib2 and use this with our simulator.

Our lateral physics model does not assume that the balloon is moving at the same velocity as the wind. Currently, it uses the force of drag from the balloon to determine the lateral velocity.

Full Model Overview

The actual calculations go like this:

For ascent:

  1. Based on our location find the pressure of the surrounding atmosphere, which is assumed to be the same as the balloon pressure, and pressure using the International Standard Atmosphere. Make sure the balloon hasn’t burst.
  2. Calculate the new volume and cross-sectional area of the balloon.
  3. Calculate the vertical force due to drag on the balloon.
  4. Calculate the density of the gas in the balloon.
  5. Calculate the buoyant force of the balloon.
  6. Calculate net forces in vertical direction.
  7. Calculate the force due to drag on the balloon in both x and y (u and v respectively) wind directions.
  8. Calculate kinematics to find acceleration, velocity, and displacement.
  9. Use kinematics to update location of the balloon.
  10. Increment time and return to the first step.

If the balloon has burst in the check on step one we move to descent physics:

  1. Based on our location find the pressure and density of the surrounding atmosphere. Make sure we are above ground level.
  2. Calculate force of drag from parachute.
  3. Calculate net forces in vertical direction.
  4. Calculate the force due to drag on the balloon in both x and y (u and v respectively) wind directions.
  5. Calculate kinematics to find acceleration, velocity, and displacement.
  6. Use kinematics to update location of the balloon.
  7. Increment time and return to the first step.

After we have finished with the simulation we output the data as a CSV (with plans for KML output) file and let other programs use the data as they wish.

Further Work

We plan to integrate this simulation engine with several of our projects to produce multiple products including flight path prediction maps and sky map pass predictions for ground stations. As of this writing, Ricky and I are producing a web interface that will be announced later.

As we launch more balloons and compare our simulation results to actual data we intend to review our flight model and update the simulation engine as we find better ways to simulate the balloon flight.

Enjoy, KG4SGP - Jimmy Carter