BAGS - btrettel's air gun simulation

Posted on 2008-12-29 22:35:30

Filed under fang2

Lately I've been doing a good deal of computer modeling of pneumatic guns. The winter break is good for not-so-little projects like this because I have plenty of time. It's also bad for projects like this because I'm away from UMD and can't speak to someone who can answer my questions.

The basic goal is to optimize pneumatic guns so that they are more energy efficient, more mass efficient, or somewhere in between. Which selection I make depends on the gun's intended use. If you are pumping the gun yourself, you want to reduce the amount of work you do to get a certain range so you optimize for energy efficiency. If you want to maximize the number of shots for a certain pressure chamber size, you optimize for mass efficiency. If you want some of both you try some of both.

The model's loop can be explained in a few steps:

  1. Figure out volumetric flow at STP
  2. Convert that to mass flow
  3. Find new barrel temperature
  4. Add new mass to the barrel and subtract mass from air chamber
  5. Recalculate pressures in barrel and air chamber
  6. Move projectile
  7. Calculate work done

The way everything is done is rather crude, but for the amount of work I've put in I am satisfied with the results. The main problem at the moment is that I'm not completely sure how to calculate the new barrel temperatures, but the method I'm using at the moment is somewhat close. Once that is fixed I'll move on to other things on the to-do list.

The plan in the end is to release the computer simulation here on trettel.org under an open source license with detailed explanations of how the model works so others can understand what went into it. That problem won't happen for a while if it does happen--projects of mine tend to remain works in progress.

Also, I just realized that the acronym BAGS isn't the most accurate because the model is designed to work with any gas and not just air. The acronym was forced--it doesn't really mean anything.