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

FSX XML: PFD Trend Vectors

Messages
204
Country
portugal
Anyone ever tried to implement airspeed and altitude trend vectors on a PFD?

Theoretically we have

for airspeed:

v=v0+a.t

so for t=10s (assuming a 10 seconds prediction), we have

Code:
(A:ACCELERATION BODY Z, Feet per second squared) 0.592484 * 10 * 
(A:AIRSPEED INDICATED, Knots) + 
(>L:PREDICTED AIRSPEED, Knots)
The 0.592484 constant was added to convert feet per second squared to knots per second, so the result is an airspeed in knots.

and for altitude:

s=s0+v.t+1/2.a.t^2

So for t=6s (assuming a 6 seconds prediction), we have

Code:
(A:ACCELERATION BODY Y, Feet per second squared) 0.5 * 6 * 6 *  
(A:VERTICAL SPEED, Feet per second) 6 * + 
(A:INDICATED ALTITUDE, Feet) + 
(>L:PREDICTED ALTITUDE, Feet)

I remember I made some testing in the past, but couldn't test the results, and I suspect the ACCELERATION variables are related to east/west and north/south rather than longitudinal, lateral... anyway the BODY variables seem the way to go.

(Corrections already made to the code according to SkippyBing post below)
(Correction made to add missing units conversion on speed trend calculation)
(Correction made to add acceleration component to altitude trend calculation)
(Correction made to use VERTICAL SPEED on the altitude trend calculation)
 
Last edited:
You want the Acceleration Body variables, these should be in the format

(A:ACCELERATION BODY Z, Feet per second squared), your example is missing the A: to identify it as an aircraft variable. Acceleration Body references the acceleration to the aircraft's axis whereas Acceleration World references them to N/S/E/W.

You want to write the end result of your calculation to a Local variable e.g.

(>L:PREDICTED AIRSPEED, feet per second)

Note local variables are prefixed with L: not K: which is for key events and are hard coded, and you need to set units for the Local variable (technically all local variables are of type Number irrespective of what you set, i.e. you can call them bools and set them to any value you want, but it's helpful to keep track of what you're using them for).
 
You want the Acceleration Body variables, these should be in the format

(A:ACCELERATION BODY Z, Feet per second squared), your example is missing the A: to identify it as an aircraft variable. Acceleration Body references the acceleration to the aircraft's axis whereas Acceleration World references them to N/S/E/W.

You want to write the end result of your calculation to a Local variable e.g.

(>L:PREDICTED AIRSPEED, feet per second)

Note local variables are prefixed with L: not K: which is for key events and are hard coded, and you need to set units for the Local variable (technically all local variables are of type Number irrespective of what you set, i.e. you can call them bools and set them to any value you want, but it's helpful to keep track of what you're using them for).

Of course you're right about the L:vars, I mistakenly wrote K on both of them, and the A: missing is a typo. No problem, that's not real code pasted there, that's just the written idea from memory.

I'd still like to know if this is the way to go for trend vectors. Notice I intentionaly choose Velocity World for the altitude vector, but I'm not sure about it. I believe its got to be world rather than body...
 
Hi ,
this is my code for a positive speed trend bar in my HUD. The code is ACE/FSX :

Code:
<?xml version="1.0" encoding="UTF-16"?>

<SimGauge.Element id="Positive trend bar">
    <FloatPosition>41.000,27.000</FloatPosition>
    <Visibility>(A:Partial Panel Airspeed:2, bool) !
(A:ACCELERATION BODY Z, feet per second squared) 0 &gt; 
and</Visibility>
    <Image id="Speed_Up_trend_bar.bmp" Name="Speed_Up_trend_bar.bmp">
        <Transparent>True</Transparent>
        <Bright>True</Bright>
    </Image>
    <MaskImage id="Speed_Up_trend_bar_mask.bmp" Name="Speed_Up_trend_bar_mask.bmp">
        <Axis>0.000,10.000</Axis>
    </MaskImage>
    <Shift id="Shift">
        <Scale>0.000,1.000</Scale>
        <Expression id="Expression">
            <Minimum>0.000</Minimum>
            <Script>(A:ACCELERATION BODY Z, feet per second squared) 50 * 133 - /-/</Script>
        </Expression>
    </Shift>
</SimGauge.Element>

Dietmar
 
Hi ,
this is my code for a positive speed trend bar in my HUD. The code is ACE/FSX :

Code:
<?xml version="1.0" encoding="UTF-16"?>

<SimGauge.Element id="Positive trend bar">
    <FloatPosition>41.000,27.000</FloatPosition>
    <Visibility>(A:Partial Panel Airspeed:2, bool) !
(A:ACCELERATION BODY Z, feet per second squared) 0 &gt; 
and</Visibility>
    <Image id="Speed_Up_trend_bar.bmp" Name="Speed_Up_trend_bar.bmp">
        <Transparent>True</Transparent>
        <Bright>True</Bright>
    </Image>
    <MaskImage id="Speed_Up_trend_bar_mask.bmp" Name="Speed_Up_trend_bar_mask.bmp">
        <Axis>0.000,10.000</Axis>
    </MaskImage>
    <Shift id="Shift">
        <Scale>0.000,1.000</Scale>
        <Expression id="Expression">
            <Minimum>0.000</Minimum>
            <Script>(A:ACCELERATION BODY Z, feet per second squared) 50 * 133 - /-/</Script>
        </Expression>
    </Shift>
</SimGauge.Element>

Dietmar

You must keep in mind that speed trend bars usualy display the predicted airspeed of the aircraft in 10 seconds. In other words it tell us what the aircraft speed will be 10 seconds later, if the acceleration keeps constant.

You can't achieve that with an acceleration only based equation.
You got to consider the actual airspeed and the time interval - it’s a simple physics law.

Try this in your code:

Code:
<Expression id="Expression">
     <Minimum>0.000</Minimum>
     <Script>
          (A:ACCELERATION BODY Z, feet per second squared) 0.592484 * 10 *  
          (A:AIRSPEED INDICATED, knots) +
     </Script>
</Expression>

The 0.592484 constant is to convert feet per second squared to knots per second, so the result is an airspeed prediction in knots.

You still have to adjust your trend bitmaps so they match the airspeed scale and point to the right spot on the airspeed tape, if that is the case.
 
OK, good idea. I will try it and see how it works.

Thanks
Dietmar
 
Here is my trend vectors code for the default FSX Lear 45, tested and working just fine.

First the airspeed trend bars:

Code:
<?xml version="1.0" encoding="UTF-16"?>

<SimGauge.Element id="Airspeed Trend">
    <FloatPosition>0.000,0.000</FloatPosition>
    <Visibility>(A:SIM ON GROUND, bool) !</Visibility>
    <Element id="Airspeed Trend Decrease Bar">
        <FloatPosition>53.000,114.000</FloatPosition>
        <Image id="pfd_airspeed_decrease_trend_bar.bmp" Name="pfd_airspeed_decrease_trend_bar.bmp">
            <Transparent>True</Transparent>
        </Image>
        <ClipRect id="ClipRect">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>3,65</Size>
        </ClipRect>
    </Element>
    <Element id="Airspeed Trend Decrease Bar Mask">
        <FloatPosition>53.000,114.000</FloatPosition>
        <Image id="pfd_airspeed_decrease_trend_bar_mask.bmp" Name="pfd_airspeed_decrease_trend_bar_mask.bmp">
            <Transparent>True</Transparent>
        </Image>
        <Shift id="Shift">
            <Expression id="Expression">
                <Minimum>-50.000</Minimum>
                <Maximum>0.000</Maximum>
                <Script>(A:ACCELERATION BODY Z, Feet per second squared) 0.592484 * 10 *</Script>
            </Expression>
            <NonlinearityTable id="NonlinearityTable">
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>0.000</ExpressionResult>
                    <FloatPosition>53.000,114.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-20.000</ExpressionResult>
                    <FloatPosition>53.000,145.000</FloatPosition>
                </NonlinearityEntry>
            </NonlinearityTable>
        </Shift>
    </Element>
    <Element id="Airspeed Increase Trend Bar">
        <FloatPosition>53.000,44.000</FloatPosition>
        <Image id="pfd_airspeed_increase_trend_bar.bmp" Name="pfd_airspeed_increase_trend_bar.bmp">
            <Transparent>True</Transparent>
        </Image>
        <ClipRect id="ClipRect">
            <FloatPosition>0.000,3.000</FloatPosition>
            <Size>3,65</Size>
        </ClipRect>
    </Element>
    <Element id="Airspeed Increase Trend Bar mask">
        <FloatPosition>53.000,47.000</FloatPosition>
        <Image id="pfd_airspeed_increase_trend_bar_mask.bmp" Name="pfd_airspeed_increase_trend_bar_mask.bmp">
            <Transparent>True</Transparent>
        </Image>
        <Shift id="Shift">
            <Expression id="Expression">
                <Minimum>0.000</Minimum>
                <Maximum>50.000</Maximum>
                <Script>(A:ACCELERATION BODY Z, Feet per second squared) 0.592484 * 10 *</Script>
            </Expression>
            <NonlinearityTable id="NonlinearityTable">
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>0.000</ExpressionResult>
                    <FloatPosition>53.000,47.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>20.000</ExpressionResult>
                    <FloatPosition>53.000,12.500</FloatPosition>
                </NonlinearityEntry>
            </NonlinearityTable>
        </Shift>
    </Element>
</SimGauge.Element>

Then the altitude trend bars:

Code:
<?xml version="1.0" encoding="UTF-16"?>

<SimGauge.Element id="Altitude Trend Bars">
    <FloatPosition>0.000,0.000</FloatPosition>
    <Element id="Altitude Trend Decrease Bar">
        <FloatPosition>198.500,114.000</FloatPosition>
        <Image id="pfd_altitude_decrease_trend_bar.bmp" Name="pfd_altitude_decrease_trend_bar.bmp">
            <Transparent>True</Transparent>
        </Image>
        <ClipRect id="ClipRect">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>3,65</Size>
        </ClipRect>
    </Element>
    <Element id="Altitude Trend Decrease Bar Mask">
        <FloatPosition>198.500,114.000</FloatPosition>
        <Image id="pfd_altitude_decrease_trend_bar_mask.bmp" Name="pfd_altitude_decrease_trend_bar_mask.bmp">
            <Transparent>True</Transparent>
        </Image>
        <Shift id="Shift">
            <Expression id="Expression">
                <Minimum>-600.000</Minimum>
                <Maximum>0.000</Maximum>
                <Script>(A:ACCELERATION BODY Y, Feet per second squared) 0.5 * 6 * 6 * (A:VERTICAL SPEED, Feet per second) 6 * +</Script>
            </Expression>
            <NonlinearityTable id="NonlinearityTable">
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>0.000</ExpressionResult>
                    <FloatPosition>198.500,114.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-100.000</ExpressionResult>
                    <FloatPosition>198.500,124.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-200.000</ExpressionResult>
                    <FloatPosition>198.500,136.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-300.000</ExpressionResult>
                    <FloatPosition>198.500,148.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-400.000</ExpressionResult>
                    <FloatPosition>198.500,160.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>-500.000</ExpressionResult>
                    <FloatPosition>198.500,172.000</FloatPosition>
                </NonlinearityEntry>
            </NonlinearityTable>
        </Shift>
    </Element>
    <Element id="Altitude Increase Trend Bar">
        <FloatPosition>198.500,44.000</FloatPosition>
        <Image id="pfd_altitude_increase_trend_bar.bmp" Name="pfd_altitude_increase_trend_bar.bmp">
            <Transparent>True</Transparent>
        </Image>
        <ClipRect id="ClipRect">
            <FloatPosition>0.000,3.000</FloatPosition>
            <Size>3,65</Size>
        </ClipRect>
    </Element>
    <Element id="Altitude Increase Trend Bar mask">
        <FloatPosition>198.500,47.000</FloatPosition>
        <Image id="pfd_altitude_increase_trend_bar_mask.bmp" Name="pfd_altitude_increase_trend_bar_mask.bmp">
            <Transparent>True</Transparent>
        </Image>
        <Shift id="Shift">
            <Expression id="Expression">
                <Minimum>0.000</Minimum>
                <Maximum>600.000</Maximum>
                <Script>(A:ACCELERATION BODY Y, Feet per second squared) 0.5 * 6 * 6 * (A:VERTICAL SPEED, Feet per second) 6 * +</Script>
            </Expression>
            <NonlinearityTable id="NonlinearityTable">
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>0.000</ExpressionResult>
                    <FloatPosition>198.500,47.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>100.000</ExpressionResult>
                    <FloatPosition>198.500,32.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>200.000</ExpressionResult>
                    <FloatPosition>198.500,20.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>300.000</ExpressionResult>
                    <FloatPosition>198.500,8.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>400.000</ExpressionResult>
                    <FloatPosition>198.500,-4.000</FloatPosition>
                </NonlinearityEntry>
                <NonlinearityEntry id="NonlinearityEntry">
                    <ExpressionResult>500.000</ExpressionResult>
                    <FloatPosition>198.500,-16.000</FloatPosition>
                </NonlinearityEntry>
            </NonlinearityTable>
        </Shift>
    </Element>
</SimGauge.Element>

Easier than it seemed...
 
Last edited:
Back
Top