![]() |
|
|||||||
| FM/DM threads Everything about FM/DM in CoD |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Hey klem..
Have not had a chance to work on it yet, got home friday night and the girl friend had 'other ideas' as to how I was going to spend my time this weekend! I am hoping to get some time tonight to work on it! S!
__________________
Theres a reason for instrumenting a plane for test..
That being a pilots's 'perception' of what is going on can be very different from what is 'actually' going on. |
|
#2
|
||||
|
||||
|
Hey klem
Sorry this reply took so long.. I have been busy with some of my own stuff.. On that note I still have not writen the C# code for you yet, but wanted to share with you my matlab code, i.e. Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ISA Standard
Alt_Tropopause_m = 11000.0; % ISA Altitude of Tropopause in meters
Tmp_Tropopause_K = 216.65; % ISA Temperature of Tropopause in Kelvin
To_K = 288.15; % ISA Temperature @ SL in Kelvin [288.15(°K) = 15(°C) = 59(°F)]
Po_mB = 1013.25; % ISA Pressure @ SL in millibar [1013.250(mB) = 29.92126("Hg) = 101325.0(Pa) = 2116.2166(lbs/ft^2) = 760.0(mmHg) = 14.69595(psi) = 1.0(atm)]
Po_Hg = 29.92126; % ISA Pressure @ SL in inch of mercury [1013.250(mB) = 29.92126("Hg) = 101325.0(Pa) = 2116.2166(lbs/ft^2) = 760.0(mmHg) = 14.69595(psi) = 1.0(atm)]
TLR_Cpm = 0.0019812; % ISA Temperature Lapse Rate in Celsius/meter [6.5(°C)/1,000(m) = 1.9812(°C)/1,000(ft)]
TLR_Kpm = 0.0019812; % ISA Temperature Lapse Rate in Celsius/meter [6.5(°K)/1,000(m) = 1.9812(°K)/1,000(ft)]
PLR_ftpHg = 1000; % ISA Pressure Lapse Rate in feet/inch of mercury [1,000ft/"Hg]
% Where
% 29.92000 "Hg = 1013.207489 millibar
% 29.92126 "Hg = 1013.250158 millibar
if (units_si == 1)
To = To_K;
Po = Po_mB;
PLR = 1;
TLR = TLR_Cpm;
else
Po = Po_Hg;
To = To_K;
PLR = PLR_ftpHg;
TLR = TLR_Cpm;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 1) Find the PRESSURE DIFFERENCE
%
% Pdif = Po - Altimeter_Set
Pdif = Po - Altimeter_Set;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 2) Find the ALTITUDE CORRECTION due to the PRESSURE DIFFERENCE @ SL
%
% Alt_pcorr = (To/TLR) × [1 - (Altimeter_Set/Po)^0.190261]
%
% Or you can use the following simple approximation
%
% Alt_pcorr = Pdif × PLR
%
% Where:
% Altimeter_Set = Is the altimeter set/offset (CoD: Altimeter Pinion)
Alt_pcorr = (To./TLR) .* (1 - power((Altimeter_Set./Po),0.190261));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 3) Find the PRESSURE ALTITUDE due to the ALTITUDE CORRECTION
%
% Alt_pressure = Alt_ind + Alt_pcorr
%
% Where:
% Alt_ind = The Indicated Altitude
% To/TLR = 44330.77(m) = 145442.15(ft)
Alt_pressure = Alt_indicated + Alt_pcorr;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 4) Find STANDARD TEMPERATURE due to the TEMPERATURE DIFFERENCE @ SL
%
% Tstd = To - TLR × Alt_pressure
%
% Tstd = 15(°C) - 0.0019812(°C/ft) × 8,000(ft)
% Tstd = 15(°C) - 15.8496(°C)
% Tstd = -0.8496(°C) = 272.30(°K)
%
% or in Kelvin
%
% Tstd = 288.15(°K) - 0.0019812(°K/ft) × 8,000(ft)
% Tstd = 288.15(°K) - 15.8496(°C)
% Tstd = 272.30(°K)
Tstd = To - TLR .* Alt_pressure;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 5) Find DENSITY ALTITUDE
%
% NOTE: TLR, Tstd, and OAT must be in units of Kelvin for this formula to work!!
%
% Alt_denisty = Alt_pressure + (Tstd/TLR) × [1 - (Tstd/OAT)^0.2349690]
Alt_density = Alt_pressure + (Tstd. / TLR) .* (1 - power((Tstd ./ Temp_indicated),0.2349690));
Code:
cat = dog + 100; Code:
for (ii=0; ii<dog.Lenght-1;ii++)
{
cat(ii) = dog(ii) + 100;
}
Code:
cat = dog .* 100; cat = dog ./ 100; Feel free to contact me if you have any questions PS still debating on wether we can use the ingame temp, or not, ill keep you posted
__________________
Theres a reason for instrumenting a plane for test..
That being a pilots's 'perception' of what is going on can be very different from what is 'actually' going on. Last edited by ACE-OF-ACES; 08-05-2012 at 05:41 PM. |
|
#3
|
||||
|
||||
|
You'll understand if I don't take up matlab, C# is enough of a challenge!
Those formulas are generally what I am using. btw I assume our TLR_Cpm is for altitude in feet not metres (TLR_Cpf?). The problem we have for calculating Density Altitude is that there is no OAT indicator. Then there is the question of whether Z_AmbientTemp relates to the cockpit altitude. I did calculate a lapse rate from Z_Temp and Z_AltMSL and assuming 288.15 at SL but that gave daft results. So I have assumed Z_AmbientTemp as OAT. I crashed at SL and it returned 290.1K or ~17C. At 15000ft it gave 260.2, a lapse rate of 0.0019933 for the CoD environment so I guess its OK for our purposes.
__________________
klem 56 Squadron RAF "Firebirds" http://firebirds.2ndtaf.org.uk/ ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders |
![]() |
|
|