Quote:
Originally Posted by klem
Am I missing something?
|
I think so.. In that I found and error in your Density Altitude calculation
See the following REVIEW of your Java code.
Before we do that, I took the liberty of re-wording the formulas you used from Williams site, i.e.
http://williams.best.vwh.net/avform.htm#Altimetry
I also added more detailed definitions all in all with the goal of making them easier to read and follow
Quote:
ISA Standard Temperature Lapse Rate
Code:
TLR = 0.0065°C/m = 0.0019812°C/ft
Relationship between pressure and indicated altitude
Code:
Alt_corr = (T_o/TLR) × [1 - (Altimeter_set/P_o)^0.190261]
Alt_corr = 145442.16 × [1 - (Altimeter_set/P_o)^0.190261] <-- in feet
Alt_corr = 44330.77 × [1 - (Altimeter_set/P_o)^0.190261] <-- in meters
Alt_pressure = Alt_ind + Alt_corr
Where:
Code:
Alt_ind = Altimeter Indicated Altitude with corresponding Altimeter Setting
Altimeter_set = Altimeter Setting
P_o = ISA Standard Pressure @ SL
T_o = ISA Standard Temperature @ SL
TLR = ISA Standard Temperature Lapse Rate
Relationship between pressure and density altitude
Code:
Alt_density = Alt_pressure + (T_std/TLR) × [1 - (T_std/OAT)^0.2349690]
Where:
Code:
T_std = T_o - Alt_ind × TLR = Standard Temperature in Kelvin
T_o = ISA Standard Temperature @ SL
TLR = ISA Standard Temperature Lapse Rate
OAT = Outside Temperature in Kelvin
|
Now lets review your Java implementation of Williams formulas
Quote:
Pressure Altitude
Code:
//Pressure Alt = P_alt = Ind_Alt + 145442.2*(1 - (alt_set/1013.25)^0.190261)
Pressure_Alt = I_Altitude + 145442.2 * (1 - Math.Pow((C_AltimeterPinion/1013.25),0.190261));
Everything looks fine here, but keep in mind this is only valid when I_Altitude is in feet, which will be the case when testing RAF planes, but it will switch to meters when testing LW planes.
Density Altitude
Code:
//Density Alt = P_Alt +(StdTemp0/.0019812)*(1-(StdTemp0/OAT)^0.2349690);
//Density Alt = P_Alt +( 273.15 /.0019812)*(1-( 273.15 /OAT)^0.2349690);
Density_Alt = Pressure_Alt + 137870.9872804361 * (1 - Math.Pow((273.15 / Z_AmbientAirTemperature),0.2349690));
Here you made a Standard Temperature calculation error..
It is not a constant!
It varries with Alt_ind (see above)
Which causes several problems..
1) You created a constant (137870.9872804361) when it should not be a constant!
2) You subtracted the wrong value from 1
|
Here is the Java code you want to use
Code:
Density_Alt = Pressure_Alt + (T_std/TLR) * (1 - Math.Pow((T_std / Z_AmbientAirTemperature),0.2349690));
Where:
Code:
T_std = 288.15 - Alt_ind × TLR
TLR = 0.0065
If you plan on doing any testing above 36Kft than you will want to adjust T_std as follows
Code:
if ( height < tropopause ) then
T_std = T_o - Alt_ind × TLR
else
T_std = T_tropopause
Where:
Code:
tropopause starts at 11.0km (36089.24ft) and ends at 20km (65,616.78ft)
TLR = 6.49(°C/1,000m) = 1.98(°C/1,000ft) = 3.56(°F)/1,000ft
T_Topopause = -56.5(°C) = 216.65(°K)
Thus no need to check for height above 65kft in that I don't think the X-15 is in the game.. Yet! Or if the sequal includes the Bf-109K-4 with the
uber FM you might have to add that check!
SUMMARY
I don't know if I would use Williams formulas.. I have some concerns with how he handles some of the units, but since you were using his formulas I thought it best to review those formulas. Also not sure if you can use Z_AmbientAirTemperature directly in that it is not realitve to I_Altitude.. And as you know small temp differences can have a big effect on Density Altitude calculations, so hopefully these are small differences. Might be better of using the ISA Standard Temp formulas adjusted for temp.
Hope this helps! S!
PS see attached where I did a quick ROC test and ploted the different altitudes