• 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.

RPN Syntax help

Messages
87
Country
egypt
Hello Gents,


I am trying to put this equation in RPN:
Code:
   Sqrt((A:Ambient pressure,inHg) / 29.92) * sqrt( 1 + (A:AIRSPEED MACH,Mach)^2/4 + (A:AIRSPEED MACH,Mach)^4/40 ) * (A:AIRSPEED MACH,Mach) * 661.5

My guess:

Code:
(A:Ambient pressure,inHg) 29.92 / sqrt (A:AIRSPEED MACH,Mach) 2 4 / pow (A:AIRSPEED MACH,Mach) 4 40 / pow 1 + + + *  (A:AIRSPEED MACH,Mach) *  661.5 *

I want to use this equation to calculate IAS for a given mach to use in driving an "IAS set point bug" for mach hold mode, Where the speed bug will always point to the actual IAS required in the speed tape to achieve target mach, Could you help me out with the above syntax. Or do you have a smarter idea to achieve what I am trying to do?

Note: Source of the equation is https://www.flightsim.com/vbfs/showthread.php?224097-Is-IAS-indicated-wrongly-by-FS

Thanks Guys,
 
I'm against overriding the default CAS/TAS calculation since it invariably lead to questions from users regarding a discrepancy in displayed values between cockpit and GPS/external map apps.

Apart from forgetting the second "sqrt", your equation looks good to me.

Here's what I came up with (with my preferred handling of terms).
Code:
(A:Ambient pressure,inHg) 29.92 / sqrt 1 (A:AIRSPEED MACH,Mach) 2 4 / pow + (A:AIRSPEED MACH,Mach) 4 40 / pow + sqrt * (A:AIRSPEED MACH,Mach) * 661.5 *
 
Um, shouldn't this be:

(A:AIRSPEED MACH,Mach) 2 pow 4 /

In other words Airspeed Mach squared divided by 4?
 
Um, shouldn't this be:

(A:AIRSPEED MACH,Mach) 2 pow 4 /

In other words Airspeed Mach squared divided by 4?

Yes, this actually makes more sense!
The original formula u am trying to follow is :
Code:
sqrt(Pa/Pssl) * sqrt(1+M^2/4+M^4/40) * M * Assl

Here's a second stab at it, assigning this to an LVAR it is as intended completely in sync with fs IAS, Thanks bill !

(A:Ambient pressure,inHg) 29.92 / sqrt (A:AIRSPEED MACH,Mach) 2 pow 4 / (A:AIRSPEED MACH,Mach) 4 pow 40 / 1 + + sqrt * (A:AIRSPEED MACH,Mach) * 661.5 *
 
I'm against overriding the default CAS/TAS calculation since it invariably lead to questions from users regarding a discrepancy in displayed values between cockpit and GPS/external map apps.

Apart from forgetting the second "sqrt", your equation looks good to me.

Here's what I came up with (with my preferred handling of terms).
Code:
(A:Ambient pressure,inHg) 29.92 / sqrt 1 (A:AIRSPEED MACH,Mach) 2 4 / pow + (A:AIRSPEED MACH,Mach) 4 40 / pow + sqrt * (A:AIRSPEED MACH,Mach) * 661.5 *

Thanks a lot Bjoern!
Worked beautifully,
I am actually using this for cosmetic display of the mach hold speed bug in a g1000 style speed tape. In default airplanes if you set mach hold for autothrottles to 0.52 for example at 20,000 ft ; the bug holds a value of 230 kts all the way to operating ceiling even though obviously 230 kts is no longer 0.5 machs at 40,000 feet. What I am trying to do to variably drive this bug to show the correct ias for the commanded mach at any altitude.
 
If that's what you want, I've got something from a similar application case.

Code:
(L:AP_Mach_Target, number) (A:AIRSPEED TRUE, knots) / (A:AMBIENT TEMPERATURE, kelvin) 287.05 * 1.4 * sqrt 0.5144 / * (A:AIRSPEED INDICATED, knots) * (>L:ASI_SPD_Target, number)

Don't ask me for specifics and where, how and why, it's been too long. All I know is that
Code:
(A:AMBIENT TEMPERATURE, kelvin) 287.05 * 1.4 * sqrt 0.5144 /
returns the current speed of sound in knots.

A quick calculator rodeo with plausible values returns a sensible value for SPD_Target as well.
 
Nice code Bjorn but... I don't understand XML notation! Any chance of converting it to normal maths so I can then convert it further to C?
 
Dai, the Infix2Postfix.exe utility in the SDK is sometimes useful:
Code:
 (L:ASI_SPD_Target , number) = ( ( ( (L:AP_Mach_Target , number) / (A:AIRSPEED TRUE , knots) ) * ( sqrt( ( ( (A:AMBIENT TEMPERATURE , kelvin) * 287.05 ) * 1.4 ) ) / 0.5144 ) ) * (A:AIRSPEED INDICATED , knots) ) ;
 
This is how I've always done it:
Code:
targetIAS = ((sqrt(273.15 + ambientTemperature) * 38.967854) * targetMach) - (currentTAS- currentIAS);
 
Back
Top