Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > Technical threads > FM/DM threads

FM/DM threads Everything about FM/DM in CoD

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2012, 04:24 PM
ACE-OF-ACES's Avatar
ACE-OF-ACES ACE-OF-ACES is offline
Approved Member
 
Join Date: May 2010
Location: NM
Posts: 2,248
Default

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.
Reply With Quote
  #2  
Old 08-05-2012, 02:37 PM
ACE-OF-ACES's Avatar
ACE-OF-ACES ACE-OF-ACES is offline
Approved Member
 
Join Date: May 2010
Location: NM
Posts: 2,248
Default

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));
I you have not used matlab, know that it does some things under the hood. The big thing being arrays, if you have an array, and you want to do stuff with it, you don't have to do the indexing for example, say we have an array called 'dog' that I want to apply an offset to, and create a new array called 'cat'. In matlab all you have to do is the following:

Code:
cat = dog + 100;
Where as in most other languages you would have to do the indexing yourself, i.e.

Code:
for (ii=0; ii<dog.Lenght-1;ii++)
{
    cat(ii) = dog(ii) + 100;
}
Same goes for mul or div

Code:
cat = dog .* 100;
cat = dog ./ 100;
The period before the * and / means apply this to each value (each index), instead of the sum of the array

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 04:41 PM.
Reply With Quote
  #3  
Old 08-06-2012, 12:32 PM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Post

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:34 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.