Welcome Guest, you are in: Login

FUBAR Labs Hackerspace Wiki



Search the wiki

Back to the Main Rocket Page


In order to control an engine I need to be able to deliver fuel and oxidizer fluids at measurable and repeatable rates. This article discusses a methodology I used to control and measure the flow of fluids (one compressible and one incompressible).

It also briefly discusses a further research topic into more accurately controlling the output pressure by controlling how open or closed a valve is (eg. the further open the higher the flow). This technique is needed in order to throttle the engine. Further details can be found in the additional work section at the end of this article.


The design of the valve, servo and mounting were all done by Rocket Moonlighting (RM). Details are here. RM also has references to where the mounting hardware can be 3D printed by Shapeways (see aforementioned link).

In order to control the servo I purchased Pololu a Micro 6-channel USB Servo Controller. Then I wrote a simple software serial library for Arduino to control it. You can find the code on GitHub.

Finally I used a 1000psi pressure transducer from SSI for all pressure measurements.

Measuring Flow

Devices called flow-meters can be used to measure the volume of flow of a liquid through a pipe. While these are perfectly valid tools, I decided that I would try to avoid using them in favor of pressure transducers. The reason for this is that flow-meters, which deal with higher pressures and/or oxygen environments tend to be expensive as well as add an additional layer of complexity to a system. I’m already comfortable using pressure transducers and since it is possible to measure flow as a factor of pressure I decided to try this approach.

In order to calculate flow using pressure there are 2 sets of equations to consider. The first is for dealing with liquids and the second is for gasses

The equations for choked and non-choked conditions can be found on Wikipedia here and here respectively. I also found a nice write up from a University of Texas lab course that describes compressible flows for both choked and non-choked conditions. This had some good discussion of theory and was helpful for me to get an understanding of the process. Whereas the Wikipedia article mainly just had the equations. If you aren't familiar with this process I'd recommend referencing the aforementioned links as they have some good content that covers a lot of the background on this subject.

Finally, I also wrote a spreadsheet in excel that can be used to calculate these numbers. A copy can be found Here.

Liquid Calculation

Liquids are incompressible fluids meaning they don’t get smaller (ie. compress) when pressure is applied to them. This makes calculating mass flow relatively straightforward. It is calculated as a function of upstream/downstream pressure, coefficient of discharge, density of the liquid, and orifice area.

Incompressible (Liquid) Mass Flow Rate (m) = ρ1*Q = Cd*A2*√(2*p1*(p1 - p2))

The above is for the non-choked condition for liquids. Since my engine will not deal with choked incompressible flows it will not be discussed further.

Gas Calculation

Gasses are compressible, which means they take up less space the more pressure is applied to them. There are 2 primary equations for measuring compressible flows depending on whether the flow is choked (velocity limited to the speed of sound) or not. In order to determine whether a particular flow is choked or not one needs to consider the specific heat ratio as well as upstream and downstream pressures.

Choked or Non-Choked Conditions for a Compressible Gas p*/p1 = (2 / (k + 1)) (k / (k - 1))

The above equation can be used to determine the critical pressure ratio. Once this is know the downstream critical pressure (p*) can be calculated by multiplying the just determine value by the upstream pressure. p* represents the minimum downstream pressure that will result in choked flow.

The importance of whether a flow is choked or not has an impact on the orifice diameter needed in the propellent feed system. Generally speaking an equivalent orifice diameter for a non-choked compressible gas can be smaller than that of a choked. The choked and non-choked mass flow equations have some similarities, however, the prior is not dependent on the downstream pressure.

Compressible (Gas) Choked Mass Flow Rate (m) = ρ1*Q = Cd*A2*√ (k * p1 * (2 / (k + 1)) ((k + 1) / (k - 1)))

Compressible (Gas) Non-Choked Mass Flow Rate (m) = ρ1*Q = Cd*A2*√((2*M*g)/(Z*R*t) * (k / (k - 1)) * ((p2 / p1)2/k - (p2 / p1)(k+1)/k))

Cd = Coefficient of Discharge (dimensionless)
g = Gravity Constant (9.80665 m/sec2
k = Gas Specific Heat Ratio (dimensionless)
R = Universal Gas Constant (8,314.4621 J/kg mol-K)
Z = Gas Compressibility Factor (dimensionless)
t = Gas Temperature(Kelvin)
M = Gas Molecular Mass (mol)
p1 = Inlet Pressure (kg/(m•s2))
p1 = Outlet Pressure (kg/(m•s2))
p* = Downstream Pressure Critical Value (kg/(m•s2))
A2 = Orifice Cross Sectional Area (m2)
ρ = Fluid Density (kg/m3)
Q =Volumetric Flow Rate (m3/sec)
m = Mass Flow Rate (kg/sec)

*Caveat: If you look at the aforementioned links you may notice that the equations use a value called Orifice Flow Coefficient (C) rather than Coefficient of Discharge (Cd). C is derived from Cd) plus another variable, however, I noticed during testing these values were typically quite close to each other. So in order to simplify things I only used Cd.

Testing Methodology

Flow Test Configuration

Flow Test Configuration

In order to test I needed a way to measure the mass of the fluid being expelled to compare it with the calculated values. For liquids the fluid would be expelled into a container at the end of the circuit and then weighed. For gasses I measured the tank (a small paintball tank) before and after the tests. The difference equals the amount of gas that was expelled.

Next I wrote a simple Arduino sketch to read the pressure and calculate the corresponding flow every few milliseconds. The reason I can use only the pressure to calculate the flow is because the rest of the input variables to the equations are essentially static. Output pressure will always be ambient (eg. 14.696 psia) and temp is roughly constant too. The same holds for compressibility factors, molar mass, etc... So by measuring the pressure in the pipe at any point in time I can figure out the flow (at least this is the theory).

After a test is complete I integrate the mass-flows calculated using the pressure at a few millisecond intervals and compare it with the results of the actual measured mass of propellant expelled.

Test Results

Below are the results of tests for liquid and gas outputs. The testing process basically consisted of inputting a guess compressibility factor and then refining it based on the measured results. This was repeated until the measured and calculated results were fairly close to each other.

Liquid Results

Pre-Test Mass:0.0kg
Post-Test Mass:0.059kg
Test Duration7.0 secs
Avg Mass Flow0.08429kg/sec
Calc. Mass Expelled 0.059676kg
Diff Btwn Calc/Actual1.3% 


Gas Results

Pre-Test Mass:1.7425kg
Post-Test Mass:1.735kg
Test Duration7.0 secs
Avg Mass Flow0.001071kg/sec
Calc. Mass Expelled 0.00838kg
Diff Btwn Calc/Actual11.7% 



By tuning Cd I was able to fairly easily calculate flow as a function of pressure in a repeatable fashion.

A few more comments on the results...

The liquid flows were very accurate (~1%) whereas the gas-flows were a bit further off (~12%). I believe the reason for this is that the smallest unit on the scale I used was 1 gram. This in addition to the fact that the gas flow tests did not displace a large mass means that a single gram (+/-) could have a significant bearing on the accuracy of the results. This made tuning the Cd factor more difficult as the measurements would tend to oscillate 10-20% for each test. I decided that if I could keep results within 20% I would be happy with the output and I am confident that if I displaced a larger mass I could do a better job calculating results.

When looking at the above graphs notice that flow rate is essentially dependent on pressure. This is as expected as it is the only parameter this is being varied. I could perhaps be more accurate and measure temperature as well. I will consider this for future tests.

Additional Projects

More Flow Testing (Oct 2014)

After running into some considerable difficulty testing my GOX / Ethanol Igniter v2 I decided to do some more thorough flow testing over a wider range of flow orifices, pressures and configurations.

One of the challenges I’ve been facing is that I’m using a paintball regulator for propellant flow testing. A paintball regulator works ok when the orifice diameter is small but there is a large and somewhat un-predictable pressure drop when dealing with bigger orifice diameters.

Graph showing pressure drop when using larger orifices with a paintball regulator

Graph showing pressure drop when using larger orifices with a paintball regulator

For example, referencing the chart above one can see that the paintball regulator starts at a very high pressure and then quickly decreases to a much lower pressure. This makes flow testing a challenge because both CD and compressibility factor (the latter only applies to gasses) change along with the pressure. With this many variables in play it makes it difficult to dynamically estimate flow rates. Addiionally, the paintball regulator I'm using is configurable only in increments of 50psi between 500 and 800psi. This is somewhat impractical when compared to a standard welding regulator that can be finely tuned.

For these reasons I decided to invest in a proper nitrogen welding regulator. The regulator I chose is a TPR250-500-580, which has a range of 0 to 500 psi output. It is the same type of regulator I have been using for my Oxygen line. This regulator has some pressure drop for higher orifice diameters but it is much more tolerable then the paintball regulator.

Testing Methodology

The methodology I used for testing was to choose a variety of orifice diameters and configure them in similar manners to the way they would be run on my engine or igniter. I then tested each orifice with a liquid, gas, or both to get the actual flow rate and CD. I used this data to compile a series of graphs showing the CD and flow rates.

Image showing how liquid (right) and gas (left) measurements were taken

Image showing how liquid (right) and gas (left) measurements were taken

For liquid tests I used H2O, which would dispense into a coffee tin. The tin had a small hole cut in the top to feed the orifice through but keep any fluid from splashing out. I would weigh the tin before and after each test on a digital kitchen scale with gram resolution to determine the mass flow rate. Then I would use this to calculate the CD.

For the gas tests I used either compressed air or nitrogen gas. These tests were a bit more of a challenge because the gas could not easily be dispensed into a container. I therefore used a small paintball tank to hold the gas and then weighed the tank before and after to determine the mass flow and CD. Another challenge with gas testing is it takes a much longer run time to get a mass difference that is high enough to weed out measurement errors. I could have used more gas but this would have required lots of trips to the welding gas supply store and was therefore not logistically convenient. Also, some tests only produced a before and after mass difference of about 15 grams. In such a small mass slight differences in rounding have a big effect on mass flow and CD.

The types of orifices and configurations I used are as follows:
  • Straight: This means there is an orifice attached to the end of a stainless steel braided hose.
  • Elbow: This means there was a 90o bend directly before the orifice. I did this to see if there was a meaningful difference in CD when adjusting the flow geometry.
  • Solenoid: The flow was routed through my test stand solenoid valves, which have an orifice diameter of 3/64.
  • Servo: the orifice was connected to my 3D printed injector. Also, the injector lines on my test stands used a Swagelok Plug Valve with a much larger orifice diameter than the solenoids. Therefore I should be able to test with higher flow rates than the solenoids.

Flow Testing Configurations

Flow Testing Configurations

Finally, I should also note that the results below should not be considered scientifically accurate as in many cases I only tested once. Only in cases where I thought the results looked a bit off would I go back, double check and potentially test a few more times to validate results. A proper testing effort would have involved multiple tests for each orifice/psi combination.

Results and Analysis

The following graphs represent the results of my tests. These will be discussed below.


The test results primarily show that the CD and flow rates behave as expected. CD decreases with pressure drop and flow rate increases. This is all to be expected but it gave me some confidence that at least I was getting the results I expected.

I found that the CD values for the solenoid tests were slightly lower than those for the servo tests. I believe this is likely due to the 3/64" flow restriction through the solenoid valves. There is no restriction through the servos. Also, I found that regardless of whether I used a straight or an elbow tubing configuration the CD was basically identical. This was helpful to confirm as I suspected at one point the elbow configuration may be reducing the CD values and thus the flow. Thankfully this was not the case.

When looking at the tests for 3/64" straight solenoid H20 notice that the flow rate and CD dips quite a bit for pressure drops greater than 150 psia. I believe this is because for this test I did not put any orifice on the end of the stainless steel hose feeding off the solenoid valve. I'm guessing that because the hose was completely open to ambient pressure and had a fairly wide diameter of 3/16" it ended up having an abnormally low CD value. This is backed up by the fact that the liquid tests of the same orifice diameter but for the servo valve do not show any abnormal flow or CD drops. Further testing would be needed to confirm this finding.

Some of the more interesting things I found were around the maximum flow rates achievable...

One of the big problems I was having with my igniterV2 is that some of the tests had resulted in a rapid popping sound that sounded somewhat like a machine gun firing. What I hadn’t realized is that the orifice diameters I was using were larger than the 3/64” diameter of the solenoid valves. For example, in test4 from 2014-05-18 the oxidizer orifice diameter is listed as 0.063" when in actuality the orifice diameter was restricted to the 3/64" (~0.047") of the solenoid valve. Therefore the documented mixture ratio of 1.5 to 1 was incorrect. It was more likely about .9 O/F, which is a bit too low for good combustion.

This was a major mistake on my part but I hadn’t noticed it primarily because I would measure flow rates and CD only for lower orifice diameters and then calculate flow rates for different sizes assuming the CD was still correct. In hindsight this approach was obviously incorrect and drove home the point that flow rates and CD should always be measured with the actual orifice diameters, pressure drops and configurations I intend to use.

Another interesting tidbit in the same vein I found is that the maximum flow rate I could achieve with my injector was about 0.015 kg/sec O2 with a 300psia upstream pressure. In comparison, my calculations gave me a much higher (but incorrect) 0.04. I believe this is due to either the regulator’s max flow rate or some flow restriction in the pipes themselves. This needs to be investigated further as it somewhat limits the thrust of the engine. Again, this was a big mistake on my part to assume that just because I could accurately calculate CD and flow at lower orifice diameters that this would automatically scale to higher values.

Flow Rate Changes at Different Downstream Pressures

Another somewhat analogous topic I started looking at are flow rates at different pressures...

An engine will always start with an ambient chamber pressure and must build up to operating pressure. Typically rocket calculations look only at the operating pressure but I thought it would be interesting to look specifically at the mixture ratios building up to operating pressure. For example, if an engine is designed to run at an operating pressure of 100 psia then what is the mixture ratio at 25, 50, and 75 psia.

The reason I performed this analysis is because an earlier calculation I had put together assumed that the gas flow would be non-choked, which in that case provided a much higher flow rate for a given orifice size. However, upon analyzing further I noticed that the non-choked condition only occurred at operating pressure. Below that the flow was choked and thus too low to actually obtain the desired propellant flow. This meant my design condition was actually unobtainable during a "real" test.

After doing the math on this for a bit I determined that it was impractical to run a gas at non-choked conditions.

The below graph (it can also be downloaded as an .xlsx here) depicts flow rates and mixture ratios for various downstream pressures on my 3D Printed igniter. The values are based off of manually inputting actual orifice diameters rather than using the theoretical calculated orifice diameter. For example, my design orifice diameter is 0.36264”. However, I could only purchase an orifice diameter of 0.37”. So I input 0.037” as the actual orifice diameter. This creates slightly different flow conditions then the initial design.

A graph showing the difference between design and actual mass flow rates

A graph showing the difference between design and actual mass flow rates

From looking at the graph notice that the oxidizer gas flow remains constant. This is because the flow is choked through the operating pressure range. This is a nice feature of choked compressible gas flow that can be used to create a fairly reliable flow rate when the downstream pressure varies.

Conversely notice that the liquid flow actually decreases as the pressure builds. This is because the liquid flow is greater with a higher pressure drop (when the engine just starts) and lower when the engine builds up to operating pressure.

This in turn means that the mixture ratio is more fuel rich when the engine is just started. For example, my igniter is designed to run at a 1.3 O/F fuel/ox ratio, however, at startup it would run closer to 1.15 O/F.

I’m wondering if that last point could potentially contribute to combustion instability? So in order to be a bit more conservative I designed my (actual) initial flow rate to be around 1.3, which then increased to around 1.58 at operating pressure. This is also why the actual mass flow rate is slightly lower than the design (ie. I used less fuel).

I would like to research this point a bit further.

Precise Flow Control

Now that I have a way to measure flow I’ve moved my focus to controlling the output pressure produced by the valve. Specifically, I’m interested in throttling via sending precise amounts of propellants to the engine. I would like to achieve this by writing a PID controller to control the pressure and thus the flow rate (eg. as we saw above). Note that the pressure would be controlled by the amount the valve is open or closed.

After a few attempts at doing this I’ve found this to be harder than I had originally expected. As an example of this the graph below depicts a run where I attempt to set the pressure at 200 psia for 2 seconds and then 300 psia for another 2 seconds. As can be seen the pressure overshoots by about 50 psia in both instances. This was actually one of the better tests I did and if I could repeat this regularly I would probably have accepted the results for the time being. Unfortunately, the results are only reproducible about 60% of the time and there are some outlier conditions where the controller has trouble correcting itself.

A not-so-great test run of the PID controller

A not-so-great test run of the PID controller

Below is a list of challenges I’ve run into and some thoughts on my attempts so far.


The first challenge is that there is a very small range of positions that have an outsize effect on the output pressure. As the position of the valve starts to move from fully closed to the point where flow begins (eg. barely open) no pressure is released until there is a small opening for the fluid to escape. Then very rapidly pressure builds for each further increase in valve position. Soon after, opening the valve further has little effect on the output pressure. Put another way 25% open does not equal 25% of full pressure. Same for 50%, 75%, etc... I believe this is because my downstream orifice is relatively small compared to upstream; however, I have not explored this further.

This means that in order to precisely control pressure I have to programmatically find the small "maximum control" region and ensure that any changes to valve position made within this region are done extremely carefully so as not to overcompensate. This has proven to be an elusive task.

The second challenge has been quite confounding as I do not have an explanation for it yet (although I do have some theories). As I open the valve I notice that position ‘x’ does not match with pressure ‘y’ in any manner that is reliably repeatable. The only correlation I’ve found so far is that opening the valve slower tends to produce lower pressures for a given position ‘x’ then when opening the valve faster.

Further to this I’ve noticed that a different control strategy is needed for opening versus closing the valve. For example, when opening the valve one has to be very careful not to do so too quickly. As noted above small changes in position can lead to large changes in pressure. However, when closing the valve larger changes in position seem to be needed to effect a similar pressure change. For example when opening the valve the position needs to be ‘x’ to obtain pressure ‘y’. However when closing the valve the position needs to be “x - z” to obtain pressure ‘y’


This leads me to believe that the flow may be pushing against the servo controller making it hard for the servo to move to its specified position. Even if the servo is is only a slight distance from the position it should be at this compounds due to the small region where most control is found.

Additionally, I notice a moderate amount of torsional movement on the valve bracket when the valve is opened. Presumably this is from the force of the servo acting on the bracket. Some of this movement could be due to the bracket not being made of an extremely rigid material or possibly that I have not mounted it firmly enough. Either way this movement could be distorting the position of the servo, which is leading to the strange results.

Closing Thoughts...

The current results are not predictable or repeatable enough to be safely used on an engine. Clearly there are still issues here that need to be fleshed out. Unfortunately, it is not clear whether the issues are in the hardware, software (or both). I plan to spend more time studying this further as producing a throttling mechanism is an important goal.

ScrewTurn Wiki version Some of the icons created by FamFamFam.