Jump to content

Air Intake Equations and Tests


Recommended Posts

I tried to do some air intake / jet engine testing, and have reached a dead end and could use some community input. My measured intake air rates are not the same as what I am calculating they should be. Below I will explain my method and describe the problem in more detail.

 

I started by obtained atmospheric data. From an atmospheric rocket test I pulled the barometric pressure (at noon from KSC). I tried to record temperature in several locations, but it is too affected by the part heating from air resistance so had to stick with the wiki's modified USSA equations (https://wiki.kerbalspaceprogram.com/wiki/Kerbin#Atmosphere, note on the wiki it states the kerbin (z) to earth height (h) is h = 7963.75*z / ( 6371+1.25*z) that this is in km, not m). Using a base temperature of 15C, i got these readings:

QaKwqwL.png

And converted them into speed of sound and scale height, for interest's sake:

9VYR3wl.png

 

With these I could then calculate air density at any given time (while adjusting the mean temperature profile to a measured base temperature):

ρ = P/(R T)

where R is the specific gas constant for Kerbin air. Using the wiki, I found that to be 0.2408 kJ/kg/k

Next I dug into the cfg files to get the data for the engines and air intakes. For simplicity I started with the J-20 Juno and Small Circular Intake. For the jet engine the cfg files give a nominal thrust, ISP curve (constant for ksp jet engines), A/F ratio, mach curve, and ATM curve. The curves are given in spline format (X, Y, back tangent, forward tangent), and here are the 2 for the Juno:

X5CjwhF.png

HSxaeUI.png

With these I whip up a couple of reference charts for thrust and required air. The thrust equation is simply the nominal thrust multiplied by the mach factor and the density factor. Mach and density can be obtained from current altitude and airspeed.

For required air I used the following:

dm_req = F_thrust / (I_sp g)  *  AFR / (AFR + 1)

Where the first quotient gives the total mass rate ejected from the engine, while the second adjusts that amount to just the quantity of air.

sO1Lc5o.png

iKo3WLi.png

The air required numbers seem suspiciously low, as will be seen later are dwarfed by the air intake values. Is my reasoning and formulae correct?

 

The cfg files for the intakes give an intake area, nominal intake velocity, and a mach curve. Here is the mach curve for the Small Circular Intake:

fp3lYkz.png

An air flowrate reference chart was made in similar fashion, using the following air intake equation:

dm_air = K_mach * ρ_air * A_intake * ( M * c + v0_intake )

where K_mach is the intake factor based on mach number, rho air is given from current atmospheric conditions, A_intake is a constant for the intake, M is current mach number, c is current speed of sound, and v0_intake is the constant intake nominal speed. Note that angle of attack (AoA) is assumed to be 0 deg at this point for simplicity.

SMZhrF7.png

 

Finally, putting all these to the test, I built a small intake-probe-fuel-engine+wings machine to fly around and sample data. Here are the test points I recorded (note I took a lot more data than this, but these two show the span of the testing):

YSCkXfc.png

Given the altitude and the initial zero-speed temperature reading, I calculated the temperature, density and speed of sound for each test point based on the atmospheric model above. Temperatures were adjusted to match the initial reading and biased accordingly through the altitude range. I also calculated angle of attack based on indicated air intake speed and actual airspeed:

AoA = ArcCos( (v_intake - v0_intake)/v_air ) * 180 / pi

With these values, the calculated intake mass flowrate can be calculated as before but now with AoA:

dm_air = K_mach * ρ_air * A_intake * ( Cos( AoA * pi/180 ) * v_air + v0_intake )

This calculated value is then compared to the test's measured value (converting U to kg/s with 1:1, THIS SEEMS TO BE COUNTER TO WHAT THE WIKI STATES AS THE CONVERSION)

B33QOa6.png

Notice that there is about a 1.25 factor of error between measured and calculated points. Creating a new variable called ErrorFactor = (Calc/Meas - 1) and checking its relation to different inputs, I found that density had the strongest correlation:

jyI2Tzf.png

If I modify the above dm_air equation with an extra factor of 1 / ( 0.24 ρ_air + 1 ) I then get the correct Measured vs Calculated values. Is there something I am missing in the equations I've outlined, or is there just this sneaky factor added into the coding to make things more difficult to the kerbal engineer?

 

Thanks in advance,

Alex

Link to comment
Share on other sites

If I understand,  you used the air-intake rates reported in the right-click menu on the air-intake parts, and found those reported intakes to be lower than  (true_airspeed + v0_intake) × ρ × area.

Everything you write makes sense (although I don't see where on the wiki you are referring to with U being not in kg/s) and I don't know of anything that KSP does that you left out.   Realistically, we would expect a little less intake than that formula gives, as the bow wave of the craft pushes some air away before it is compressed into the air intake, but I don't think KSP simulates in that much detail.

There is an option alt-F12  :: Physics :: Aero :: aero-GUI  that shows you what numbers KSP is using for the craft in flight.  Maybe that display will show where KSP is computing differently than you ?  Maybe the local density ?

Link to comment
Share on other sites

13 hours ago, OHara said:

If I understand,  you used the air-intake rates reported in the right-click menu on the air-intake parts, and found those reported intakes to be lower than  (true_airspeed + v0_intake) × ρ × area.

Everything you write makes sense (although I don't see where on the wiki you are referring to with U being not in kg/s) and I don't know of anything that KSP does that you left out.   Realistically, we would expect a little less intake than that formula gives, as the bow wave of the craft pushes some air away before it is compressed into the air intake, but I don't think KSP simulates in that much detail.

There is an option alt-F12  :: Physics :: Aero :: aero-GUI  that shows you what numbers KSP is using for the craft in flight.  Maybe that display will show where KSP is computing differently than you ?  Maybe the local density ?

Yes the effective intake speed I'm using is from the right click menu.

https://wiki.kerbalspaceprogram.com/wiki/Intake_air is where it lists a 5 kg/unit density for intake air.

I checked the AeroGUI from the debug menu (did not know about this, very helpful data in there! Thank you) and my density and temperature estimates are within about 0.04%, so negligible. My angle of attack estimate is over a degree off, but that results in a cosine error of less than 0.1% as well.

This shouldn't be this complicated! (Intake speed from right click menu) * (Intake area given in part description) * (Air density from AeroGUI) * 1.0 (factor for M<1) and I'm not getting the right result! Maybe the resource density is something like 1.25 kg/unit? But that wouldn't make sense since my error is changing with air density/altitude.

Link to comment
Share on other sites

On 6/23/2020 at 1:50 PM, Schramm said:

dm_req = F_thrust / (I_sp g)  *  AFR / (AFR + 1)

I thought AFR was air-to-fuel ratio, so would appear as a simple ×AFR  factor here, without the /(AFR+1).

bQKsIhq.jpg

I see the cfg files have small numbers like area = 0.006 for the intake area, and that both you and the player who wrote the wiki figured this must be scaled by 100 to get a reasonable 0.6m² area.

If I use this convention for area, and use the alt-F12 aero-GUI to find the density, I consistently figure the intake should provide 125% the airflow that the right-click menu says.  Maybe that factor of 100 is supposed to be 80 ?

For me, the discrepancy is a constant factor regardless of air density (see the image at right, for example).  Maybe KSP does not figure density exactly the way you inferred from the wiki?  It is possible that KSP adjusted the atmosphere-curves and nobody updated the wiki.

Link to comment
Share on other sites

7 hours ago, OHara said:

I thought AFR was air-to-fuel ratio, so would appear as a simple ×AFR  factor here, without the /(AFR+1).

 

I see the cfg files have small numbers like area = 0.006 for the intake area, and that both you and the player who wrote the wiki figured this must be scaled by 100 to get a reasonable 0.6m² area.

If I use this convention for area, and use the alt-F12 aero-GUI to find the density, I consistently figure the intake should provide 125% the airflow that the right-click menu says.  Maybe that factor of 100 is supposed to be 80 ?

For me, the discrepancy is a constant factor regardless of air density (see the image at right, for example).  Maybe KSP does not figure density exactly the way you inferred from the wiki?  It is possible that KSP adjusted the atmosphere-curves and nobody updated the wiki.

AFR is air-fuel-ratio, but the F_thrust to I_sp relation (I assume) works on total ejected mass, which is air and fuel. So to convert from total mass to air mass using AFR:

dm_air = ( m_air / m_total ) * dm_total

dm_air = ( m_air / (m_air + mf) ) * dm_total

dm_air = ( (m_air/m_f) / ( (m_air/m_f) + 1) ) * dm_total

dm_air = ( AFR / ( AFR + 1) ) * dm_total

It's the similar situation in internal combustion engines, and depends on what ratio you decide to use (AFR, Phi, Lambda, etc). KSP could be using fuel flow rate instead for their ISP calculations? That would explain the massive differences between intakes and engine requirements.

I did notice the 100x too small area values in the cfg files, and just chose to ignore that fact and take the values from the parts info in-game. Not sure why they are downsize by 100 in the coding?

I've only cross checked my numbers with the AeroGUI numbers at about sea level, I will have to run some high-altitude tests and get back to you on the error vs density I am seeing. Is there a good way of measuring air temperature in this game without the effects of part heating (short of the debug/AeroGUI menu)? I haven't found anything that works at usable speeds.

Link to comment
Share on other sites

10 hours ago, Schramm said:

the F_thrust to I_sp relation (I assume) works on total ejected mass, which is air and fuel.

Not for air breathing engines, by convention.  Not all the air is burned, and the proportion of unburned air that contributes as useful ejected propellant varies a lot.  Isp is specified per mass (or weight) of stored fuel only, excluding the components from the atmosphere.  You notice the Isp values are very large for high-bypass jet engines.

I thought [edit: wrongly] that the Thermometer part ignored its own part-temperature, sensing instead ambient temperature (as if the sensing element was cleverly mounted like we mount static pressure sensors on aircraft)

Edited by OHara
Disabused of the notion that the "measure the temperature on the surface of the Mun at ..." contracts were measuring the temperature of the Mun.
Link to comment
Share on other sites

5 hours ago, OHara said:

Not for air breathing engines, by convention.  Not all the air is burned, and the proportion of unburned air that contributes as useful ejected propellant varies a lot.  Isp is specified per mass (or weight) of stored fuel only, excluding the components from the atmosphere.  You notice the Isp values are very large for high-bypass jet engines.

I thought the Thermometer part ignored its own part-temperature, sensing instead ambient temperature (as if the sensing element was cleverly mounted like we mount static pressure sensors on aircraft)

Good point, thanks for the correction. I'll fix my charts.

Here is the temperature readings from the pressure rocket I sent up, notice the increasing heat due to airspeed, I assume:

TxnXZif.png

I also notice drastic thermometer increases when flying at sonic speeds. I will run the high altitude density tests with AeroGUI and double check these temperatures as well.

Link to comment
Share on other sites

Okay, I ran another set of tests, this time taking data from AeroGUI. This showed me that the temperature model isn't correct. If AeroGUI temperatures are truly what are being used in KSP, then the model is close but not exactly the USSA model. I made a piecewise cubic fit of the model containing 9 sections, here is the update atmospheric model, with a base temperature of 313.5 K.

QpFTRPr.png

oeuqOh9.png

And with these temperatures, I am now also getting a constant 1.25x error on all my data points:

il4se6i.png

So, maybe there is a fudge factor in the code somewhere?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...