• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Pitot Static System

Messages
43
Country
us-texas
I'm a new C++ gauge programmer and am stumped. As the title says this question relates to a complete pitot static system for an aircraft cockpit project. To get the airspeed indicator connected to the pitot static system to work I need to get the static pressure and the pitot pressure to calculate dynamic pressure, which would give me the position of the airspeed indication (which I assumed would be CAS/IAS).

I found the static system variable its A: AMBIENT PRESSURE for the static pressure, but I can't find a "pitot pressure" Avar, I also tried looking for a ram air pressure variable, and other combinations, I have searched all the forums. Then I find that there is an A: DYNAMIC PRESSURE! Since I had assumed I had to calculate:

AMBIENT PRESSURE ( = static pressure in Millibars)

X

PITOT PRESSURE (Nonexistent in A:Vars as far as I can tell)

= DYNAMIC PRESSURE (Dynamic pressure in Pounds per square foot)

Then apparently I need to do something with the dynamic pressure to covert it into numbers for positioning the needles and drums on the instrument to display the air speed, I figured that's what a pitot static system was for (I'm not a pilot, but a back seater). I can read the A variables all day long, but what I can't seem to figure out is what variables and formula to take those do the calculations and output a airspeed to the various L:Vars for the needles and drums on the instrument itself.

A fellow sim programmer suggested taking AMBIENT PRESSURE and DYNAMIC pressure and calculating it to get airspeed to display with your indicator Lvar. This doesn't make sense when I read the aircraft -1 or -2 about the airspeed indicator. I also understand that at some point AOA and side slip angle would also have something to do with calculating a realistic airspeed indication.

Finally, I'm getting the feeling that there is a better way to go about doing this, but I just can't seem to see it.

Any help would be greatly appreciated.
 
Why are you trying to calculate the airspeed yourself? You don't like the fact that the sim already does this?
 
Thanks for the quick reply!

I was not aware that this was all done inside P3D or FSX. So then no need to create a system to represent a pitot tube, static ports, etc. Just get these A:vars (there are others),

AIRSPEED INDICATED
AIRSPEED BARBER POLE

from the sim and then use an L:vars,

(L:drum_ias_tens, knots)
(L:needle_ias_hundreds, knots)

to set the airspeed indicator needles and drum animations?
 
Yes, that is all that needs to be done. The sim will automatically simulate pitot blockage due to ice, and responds to the pitot heat control.
 
Bill, Thank you for the insight, I wasn't aware that the sim did that either. Between you and WarpD you just made life a lot simpler! Thanks again both of you.
 
Jim, that's what we're here for; to share tips, tricks, and sometimes jokes! :laughing:
 
The only reason I would do a custom pitot system is if I were modelling a custom air data computer with specific quirks that are not to be found in FSX/P3D.
 
In FS9 there is no provision for a standby altimeter so I had to create one using XML L vars.
Here are some code snippets. The first sends a value to the precision altimeter (>L: precision_indicated_altitude, feet)
Code:
if{ (L:precision_kohlsman, millibars) (A:SEA LEVEL PRESSURE, millibars) - 29.54545 * (A:PLANE ALTITUDE, feet) + (>L:precision_indicated_altitude, feet) }
All the sims that is FS9-to-P3D calculate millibars as 29.54545 feet per millibar
Your final value for L: precision_indicated_altitude, feet should equal or be very close to (A:Indicated Altitude,feet)
Bear in mind that even precision altimeters will have a an acceptable latitude. The max being 70-80ft error above 8,000ft.
 
vololiberista,

Are you saying that if you specify two altimeters in this section of the aircraft.cfg file:

[altimeters]
altimeter.0=1
altimeter.1=1

They do not operate individually?
 
vololiberista,

Are you saying that if you specify two altimeters in this section of the aircraft.cfg file:

[altimeters]
altimeter.0=1
altimeter.1=1

They do not operate individually?
Hi Tom,
Not quite.
[altimeters]
altimeter.0=1
altimeter.1=1
Doesn't work in FS9. If you do have two altimeters they are effectively copies of each other. So the only route was to Lvar both of them

So my solution was
(L:standby_indicated_altitude, feet)
(L:standby_kohlsman, millibars)
and
(L: precision_indicated_altitude, feet)
(L: precision_kohlsman, inHg)

The conversion for both being
(L:standby_kohlsman, millibars) (A:SEA LEVEL PRESSURE, millibars) - 29.54545 * (A: PLANE ALTITUDE, feet) + (>L:standby_indicated_altitude, feet)
(L: precision_kohlsman, millibars) (A:SEA LEVEL PRESSURE, millibars) - 29.54545 * (A: PLANE ALTITUDE, feet) + (>L: precision_indicated_altitude, feet)
It works perfectly.
 
I looked into the altimeter a few years ago. I can't remember why, but I felt the FSX handling of the altimeter was not good enough. I put together some code to calculate an indicated altitude based on the standard atmospheric model, using the ambient pressure data from FSX. I don't know if it is of any use, but maybe someone is interested in this type of code as well.
Here's the snippet:
Code:
void FSAPI Altimeter::update(double static_pressure){
    double lambda = 0.002;        // in K/ft
    double N = 0.1903;
    double Tb = 288.15;            // in K
    double Pb = 29.92126;        // in inHg

    //update the kollsman setting:
    execute_calculator_code("(L:ALTIMETER SETTING,number)", &kollsman, NULL, NULL);

    //calculate the altimeter:
    calculated = (Tb / lambda) * ((pow((kollsman / Pb), N)) - (pow((static_pressure / Pb), N)));

    global.needles.altimeter = calculated + offset;
}

The offset variable in the code is a variable you can use to implement an error.
 
Vitus, thanks for the reuse! I'm actually working on the altimeter now...I really appreciate all of you guys help.
 
Doing one's own atmospheric modeling in the sim guarantees your altitude will absolutely never, ever match any online altitudes (VATSIM, IVAO, etc). Tread extremely carefully.
 
Yea, I prefer to not reinvent the wheel if you know what I mean, your post about "the fact that the sim already does this?", really helped me see that if its already there and works why was the time writing your own. Thankfully that system is done and waiting on integration. I have not found that to be true with the electrical system. I may post on that one soon. Thanks again all the advice and help.
 
Doing one's own atmospheric modeling in the sim guarantees your altitude will absolutely never, ever match any online altitudes (VATSIM, IVAO, etc). Tread extremely carefully.
I know. And that is, to a certain extend why I'm doing it. I like the idea of instruments that can be faulty. Keeps you on your toes ;)
 
You keep flying at the wrong altitude that ATC assigns... see how long they let you stick around before suspending your account. LOL
 
You keep flying at the wrong altitude that ATC assigns... see how long they let you stick around before suspending your account. LOL
Compared to the FS indicated altitude, my the error of my altimeter is well within FAA parameters :D
 
Doing one's own atmospheric modeling in the sim guarantees your altitude will absolutely never, ever match any online altitudes (VATSIM, IVAO, etc). Tread extremely carefully.

I would challenge that.
Code:
(L:standby_kohlsman, millibars) (A:SEA LEVEL PRESSURE, millibars) - 29.54545 * (A: PLANE ALTITUDE, feet) + (>L:standby_indicated_altitude, feet)
or for example

(L: precision_kohlsman, millibars) (A:SEA LEVEL PRESSURE, millibars) - 29.54545 * (A: PLANE ALTITUDE, feet) + (>L: precision_indicated_altitude, feet)
works perfectly and I even have a comparison check with A: indicated altitude. I believe the largest error I have ever encountered is 9 feet.
 
Back
Top