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

VERTICAL SITUATION DISPLAY

Messages
204
Country
australia
Hi all, just working on a FSX project of my own and needed to build or incorporate a vertical situation display. Could anyone point me in the direction where I could begin? many thanks in advance

Regards, TJ
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
Much more information needed. Especially on the real world display itself.
 
Messages
204
Country
australia
Hi sorry for the delay in replying. Ok so here goes, I am a complete newbie at gauge programming with no knowledge on c++. I have a limited grasp on xml to the extent that I am able to edit xml gauges to roughly get them to do what I want.
The first image (Wishlist) is the real world vsd.

wishlist.jpg


The second (current) is what I have been able to edit an existing xml gauge to do. Its all functional etc.
current.jpg


What I now need to do is connect the dots, so to speak, ie. get the gauge to display the vertical route profile lines (magenta) active, (white) next waypoint etc. as seen in the next shot of the real instrument.
detail.jpg


Also I would like to include a trend indicator (maybe a long vsi pointer may do the trick). Would be very grateful if you could help me in any way.

Kind regards
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
Do you have altitude data for each waypoint already?
 
Messages
204
Country
australia
No, its all eye candy at the moment only. The waypoints, airplane icon and altitude line are functional though. Would be great if you could show me how to add altitude info as well then I could simulate different altitude segments as well. Thanks for the reply.
Regards TJ
 
Messages
204
Country
australia
I assume the gauge is taking that information from the flightplan loaded from the sim flightplanner. When I get home I will look at the gauge code a bit closer.
 
Messages
58
Country
netherlands
Afaik you will have to edit the fsflightplan with notepad.
The you can add altitude to any waypoint.
This will be visible in a fmc (flightplanwaypointaltitude).
Also you can make a grafh then like in the pics.
That is the way i did it, but that is very long ago.....
 
Messages
1,564
Country
thailand
Once a FSX flight plan is loaded, the fs9gps variables FlightPlanWaypointAltitude unfortunately return the ground elevation of the waypoint or 0 in case of an intersection waypoint, not the flight altitude determined by Flight Sim's Flight Planner, which is needed in this application. The A:Vars suggested by Bjoern (#9) do return the flight altitude, but, only for the Active Waypoint. To create the vertical situation graph, one needs to have all of the flight altitudes associated with the waypoints - a list of L:Vars (an array of XMLVARS come to mind) of all the altitudes in the flight plan.

One way to do that using XML is to cycle through the waypoints of the flight plan in a loop, incrementing FlightPlanActiveWaypoint by 1 and then storing the (A:GPS WP NEXT ALT, feet) value returned into an XMLVAR indexed with that waypoint. When the loop finishes (which can be checked by comparing FlightPlanActiveWaypoint to FlightPlanWaypointsNumber), FlightPlanActiveWaypoint is reset to 0.

I'll work up a code snippet if requested...


Bob

FYI - variables shown in blue are fs9gps variables.
 
Last edited:
Messages
204
Country
australia
Well Bob, where do I begin, as stated, I am an absolute newbie to gauge design so if you had the time and were able to work up a code snippet, it would be a great starting point and very much appreciated.
regards TJ
 
Messages
1,564
Country
thailand
TJ,

Diving straight into gps module variables and FMC-like gauge work for a newcomer to both FS gauge coding as well as XML is quite ambitious. Persistence and patience are pre-requisites. ;)

First, download this GPS Module Guidebook as reference. It will answer many gps module questions.

Second, download and install XMLTOOLS. I use its XMLVARS class to create the array that contains the Flight Plan altitudes.

Both the Guidebook and XMLTOOLS are free, but of course, please have a look at the copyright/use statements, especially in XMLTOOLS.

Here's an XML script snippet to get the flight altitudes from a MSFS Flight Planner created flight plan ... it assumes that the FP is already loaded.
Code:
(L:FlightPlanAltitudes, bool) 1 ==
    if{
        (C:fs9gps:FlightPlanActiveWaypoint) (>L:FPActiveWP, enum)
    <!-- CREATES XMLVARS AND THEN LOOPS THROUGH FLIGHT PLAN STORING WAYPOINT FLIGHT ALTITUDE INTO THE APPROPRIATE XMLVAR -->
        0 sp35
        :305
            l35 (>C:fs9gps:FlightPlanActiveWaypoint)
            'FlightPlan_Altitude_WP_' l35 scat (>C:XMLVARS:StoreVarName, string)             
            'FlightPlan_Altitude_WP_' l35 scat (>C:XMLVARS:SearchVarName, string) (A:GPS WP NEXT ALT, feet) (>C:XMLVARS:NumberValue, number)
            l35 ++ s35
            l35 (C:fs9gps:FlightPlanWaypointsNumber) &lt; if{ g305 }
    <!-- RESETS ACTIVE WAYPOINT TO ORIGINAL VALUE -->
            (L:FPActiveWP, enum) (>C:fs9gps:FlightPlanActiveWaypoint)
        0 (>L:FlightPlanAltitudes, bool)
    }
This is the script I use to display the flight plan in a table. The column of red numbers in the attached table were generated using the script, above.
Code:
<Element Name="F L I G H T  P L A N  D I S P L A Y  sp16,17">
   <Visible>1</Visible>
   <Position X="10" Y="110"/>
   <FormattedText X="570" Y="250" Font="Courier New" FontSize="10" LineSpacing="10" Color="#101010" BackgroundColor="gainsboro" Bright="Yes" >    
   <Color Value="blue"/>
   <Color Value="green"/>  
   <Color Value="red"/>  
   <Color Value="purple"/>    
   <Font Name="calibri bold"/>        
     <String>
     \{clr2}FLIGHT PLAN: \{clr}\{fnt1}%((@c:FlightPlanTitle))%!-s!\n\n\{fnt}\{lsp=4}
     %((@c:FlightPlanWaypointsNumber))%!2d!%\{clr3} :FlightPlanWaypointsNumber%  %\{clr}
     %((@c:FlightPlanActiveWaypoint))%!2d!%\{clr3} :FlightPlanActiveWaypoint%  %\{clr}
     %((@c:FlightPlanIsActiveWaypointLocked))%!2d!%\{clr3} :FlightPlanIsActiveWaypointLocked\n\{clr}

     %((@c:FlightPlanRouteType))%!2d!%\{clr3} :FlightPlanRouteType%  %\{clr}
     %((@c:FlightPlanFlightPlanType))%!2d!%\{clr3} :FlightPlanFlightPlanType%  %\{clr}
     %((@c:FlightPlanIsActiveWaypoint))%!2d!%\{clr3} :FlightPlanIsActiveWaypoint\n\n\{lsp=4}

     \{clr2}------------------------------------------- FlightPlanWaypoint ------------------------------------------\n
     %  ICAO  \{clr5}111\{clr2}  WP  \{clr4}XMLVAR\{clr2}  Mag  Dist  Dist  Rem  Ttl\n
     Idx  1\{clr4}23\{clr3}4567\{clr5}89012\{clr2}  Ident  Alt \{clr4}Flt Alt\{clr2} Type  Hdg  Lat  Lon  Dist  Ttl  Rem  Dist  Dist  ETE\n
       %((@c:FlightPlanWaypointsNumber) s17 0 !=)
         %{if}
           %(0 sp16)
           %{loop}
             %(l16 (>@c:FlightPlanWaypointIndex))
               \{clr}%((@c:FlightPlanWaypointIndex))%!-3d!%  %
               %((@c:FlightPlanWaypointICAO))%!12s!%  %
               %((@c:FlightPlanWaypointIdent))%!5s!
               %((@c:FlightPlanWaypointAltitude, feet))%!5d!%  %
               %('FlightPlan_Altitude_WP_' l16 scat (>C:XMLVARS:SearchVarName, string) (C:XMLVARS:NumberValue, number))\{clr4}%!5d!%  %
               %((@c:FlightPlanWaypointType))\{clr}%!2d!%  %
               %((@c:FlightPlanWaypointMagneticHeading, degrees))%!3d!% %
               %((@c:FlightPlanWaypointLatitude, degrees))%!10.5f!% %
               %((@c:FlightPlanWaypointLongitude, degrees))%!10.5f!%  %
               %((@c:FlightPlanWaypointDistance, nmiles))%!5.1f!% %
               %((@c:FlightPlanWaypointDistanceTotal, nmiles))%!5.1f!% %
               %((@c:FlightPlanWaypointDistanceRemaining, nmiles))%!5.1f!% %
               %((@c:FlightPlanWaypointRemainingDistance, nmiles))%!5.1f!% %
               %((@c:FlightPlanWaypointRemainingTotalDistance, nmiles))%!5.1f!
               %((@c:FlightPlanWaypointETE, minutes))%!5.1f!\n
               %(l16 ++ s16 l17 &lt;)
           %{next}
         %{end}
     </String>
   </FormattedText>
</Element>

upload_2016-7-11_11-38-6.png


Bob
 
Last edited:
Messages
1,564
Country
thailand
Edi,

You're welcome.

The first code snippet was explicit, or thorough, as to the XMLVAR steps. The snippet posted below does exactly the same thing, it's just slightly more succinct.
Code:
(L:FlightPlanAltitudes, bool) 1 ==
    if{
        (C:fs9gps:FlightPlanActiveWaypoint) (>L:FPActiveWP, enum)
    <!-- LOOPS THROUGH THE F.P., CREATING AN ARRAY OF XMLVARS AND STORING WAYPOINT FLIGHT ALTs INTO THE APPROPRIATE XMLVAR --> 
        0 sp35 
        :305
            l35 (>C:fs9gps:FlightPlanActiveWaypoint) 
            'FlightPlan_Altitude_WP_' l35 scat (>C:XMLVARS:StoreVarName, string) (A:GPS WP NEXT ALT, feet) (>C:XMLVARS:NumberValue, number)
            l35 ++ s35
            l35 (C:fs9gps:FlightPlanWaypointsNumber) &lt; if{ g305 }
    <!-- RESETS ACTIVE WAYPOINT TO ORIGINAL VALUE -->
            (L:FPActiveWP, enum) (>C:fs9gps:FlightPlanActiveWaypoint)
        0 (>L:FlightPlanAltitudes, bool)
    }

Bob
 
Messages
204
Country
australia
My goodnes Bob, you are right. I have a large amount of reading to do. Let me just thank you for taking the time to put the above together. Its people like yourself who help others so selflessly that bring our hobby to where it is now. Thank you again, I am off to do some reading and experimentation.
Kind regards, TJ
 
Messages
204
Country
australia
Once a FSX flight plan is loaded, the fs9gps variables FlightPlanWaypointAltitude unfortunately return the ground elevation of the waypoint or 0 in case of an intersection waypoint, not the flight altitude determined by Flight Sim's Flight Planner, which is needed in this application. The A:Vars suggested by Bjoern (#9) do return the flight altitude, but, only for the Active Waypoint. To create the vertical situation graph, one needs to have all of the flight altitudes associated with the waypoints - a list of L:Vars (an array of XMLVARS come to mind) of all the altitudes in the flight plan.

One way to do that using XML is to cycle through the waypoints of the flight plan in a loop, incrementing FlightPlanActiveWaypoint by 1 and then storing the (A:GPS WP NEXT ALT, feet) value returned into an XMLVAR indexed with that waypoint. When the loop finishes (which can be checked by comparing FlightPlanActiveWaypoint to FlightPlanWaypointsNumber), FlightPlanActiveWaypoint is reset to 0.

I'll work up a code snippet if requested...

Bob

FYI - variables shown in blue are fs9gps variables.
Hi Bob, just got back to my vertical sitiation display after 2 years of putting it in the too hard basket and now having some time to read up and understand what you were saying. If I understood the point you made above correctly, the FlighPlanWaypointAltitude reads off the .pln file which as you rightly said gives a value of 0. But if I edit the flightplan to change the elevation of the waypoint then I should be able to display a vertical profile graph. Would I be right in this assumption? Regards, TJ
PS. This is what Jan alluded to in #10
 
Last edited:
Messages
1,564
Country
thailand
Terence,

Not exactly. You could do it that way, but it is a manual process.

A much easier approach is to make use of (A:GPS WP NEXT ALT, feet) as Bjoern suggests in #9. That's what I did in the XML scripts I posted above.

Study the XML gauge below. Create a new Flight Plan using Flight Planner, or, load any saved Flight Plan, then click the square blue button in the upper left corner of the gauge display.

The cruising altitudes determined by Flight Planner will then be listed in the red column. No need to edit the .pln file*. With this, you should have all you need to create a cruising altitude profile - the XMLVAR array of cruising altitudes and the FlightPlanWaypointDistance of each leg.

Bob


The attached XML gauge is X=600 Y=400. Set it up in panel.cfg as a separate 600 x 400 window

You need XMLTOOLS installed for this to work.

* No need to edit the .pln file unless you do not like the cruising altitudes computed by Flight Planner. If that's the case, manually edit the altitdes of each waypoint in the .pln file as desired and then use FlightPlanWaypointAltitude for the altitudes.

Cruising Altitude.png


XML:
<Gauge Name="FLIGHT PLAN DISPLAY" Version="1.0">
    <Size X="600" Y="400" />

    <Macro Name="c">C:fs9gps</Macro>
    <Macro Name="C">C:fs9gps</Macro>

    <Element Name="BACKGROUND RECTANGLE"><Position X="0" Y="0"/><Rectangle Width="600" Height="400" FillColor="gainsboro" Bright="Yes" /></Element>   
    <Element Name="BLUE BUTTON = EXTRACT CRUISING ALTITUDES"><Position X="5" Y="5"/><Rectangle Width="20" Height="20" FillColor="dodgerblue" Bright="Yes" /></Element>
    <Element Name="RELOAD BUTTON"><Position X="545" Y="5"/><Element Name="Red Square"><Position X="0" Y="0"/><Rectangle Width="20" Height="20" FillColor="firebrick" Bright="Yes" /></Element><Element Name="R"><Position X="3" Y="2"/><FormattedText X="14" Y="17" Font="aero" FontSize="18" LineSpacing="20" Color="white" BackgroundColor="firebrick" Bright="Yes"><String>R</String></FormattedText></Element></Element>

    <Element Name="F L I G H T  P L A N  D I S P L A Y">
        <Position X="10" Y="40"/>
            <FormattedText X="580" Y="350" Font="Consolas" FontSize="10" LineSpacing="10" Color="#101010" BackgroundColor="gainsboro" Bright="Yes" >       
            <Color Value="blue"/><Color Value="green"/><Color Value="red"/><Color Value="purple"/>
            <Font Name="calibri bold"/>   
                <String>
                    \{clr2}FLIGHT PLAN: \{clr}\{fnt1}%((@c:FlightPlanTitle))%!-s!\n
                    %((@c:FlightPlanDepartureName))%!s!% to %((@c:FlightPlanDestinationName))%!s!\n\n\{fnt}

                    \{clr2}----------------------------------------------- FlightPlanWaypoint --------------------------------------------\n
                    %     ICAO     \{clr5}111\{clr2}         \{clr4}     Cruising\{clr2}       Mag                               Dist   Dist    Rem    Ttl\n
                    Idx  1\{clr4}23\{clr3}4567\{clr5}89012\{clr2}  Ident   Alt \{clr4}Altitude\{clr2} Type  Hdg       Lat        Lon   Dist    Ttl    Rem   Dist   Dist   ETE\n
                    %((@c:FlightPlanWaypointsNumber) s17 0 !=)
                    %{if}
                    %(0 sp16)
                        %{loop}
                            %(l16 (>@c:FlightPlanWaypointIndex))
                            \{clr}%((@c:FlightPlanWaypointIndex))%!-3d!%  %
                            %((@c:FlightPlanWaypointICAO))%!12s!% %
                            %((@c:FlightPlanWaypointIdent))%!6s!
                            %((@c:FlightPlanWaypointAltitude, feet))%!6d!%    %
                            %('FlightPlan_Altitude_WP_' l16 scat (>C:XMLVARS:SearchVarName, string) (C:XMLVARS:NumberValue, number))\{clr4}%!5d!%   %
                            %((@c:FlightPlanWaypointType))\{clr}%!2d!%  %
                            %((@c:FlightPlanWaypointMagneticHeading, degrees))%!3d!% %
                            %((@c:FlightPlanWaypointLatitude, degrees))%!9.4f!% %
                            %((@c:FlightPlanWaypointLongitude, degrees))%!10.4f!%  %
                            %((@c:FlightPlanWaypointDistance, nmiles))%!5.1f!%  %
                            %((@c:FlightPlanWaypointDistanceTotal, nmiles))%!5.1f!%  %
                            %((@c:FlightPlanWaypointDistanceRemaining, nmiles))%!5.1f!%  %
                            %((@c:FlightPlanWaypointRemainingDistance, nmiles))%!5.1f!%  %
                            %((@c:FlightPlanWaypointRemainingTotalDistance, nmiles))%!5.1f!%  %
                            %((@c:FlightPlanWaypointETE, minutes))%!4.1f!\n
                            %(l16 ++ s16 l17 &lt;)
                        %{next}
                    %{end}
                </String>
            </FormattedText>
    </Element>   
    
    <Mouse>
        <Area Name="BLUE BUTTON" Left="5" Top="5" Width="20" Height="20">
            <Cursor Type="Hand"/>
            <Click Kind="LeftSingle">
                    (C:fs9gps:FlightPlanActiveWaypoint) (>L:FPActiveWP, enum)
                <!-- LOOPS THROUGH THE F.P., CREATING AN ARRAY OF XMLVARS AND STORING WAYPOINT FLIGHT ALTs INTO THE APPROPRIATE XMLVAR -->
                    0 sp35
                    :305
                        l35 (>C:fs9gps:FlightPlanActiveWaypoint)
                        'FlightPlan_Altitude_WP_' l35 scat (>C:XMLVARS:StoreVarName, string) (A:GPS WP NEXT ALT, feet) (>C:XMLVARS:NumberValue, number)
                        l35 ++ s35
                    l35 (C:fs9gps:FlightPlanWaypointsNumber) &lt; if{ g305 }
                <!-- RESETS ACTIVE WAYPOINT TO ORIGINAL VALUE -->
                    (L:FPActiveWP, enum) (>C:fs9gps:FlightPlanActiveWaypoint)
            </Click>
        </Area>
    
        <Area Name="RELOAD BUTTON" Left="545" Top="5" Width="20" Height="20">
            <Cursor Type="Hand"/>   
                <Click>
                    (A:Fuel weight per gallon, pounds per gallon) 0 ==
                            if{ (>K:RELOAD_USER_AIRCRAFT) }  // FSX P3D
                            els{ (>K:RELOAD_PANELS) }        // FS9
                    1 (>C:XMLVARS:Reset)               
                </Click>
        </Area>
    </Mouse>

</Gauge>
 
Last edited:
Messages
204
Country
australia
Cheers Bob will give it a whirl. On another note, how do you suggest I display the values graphically, the shift command comes to mind.
Regards, TJ
 
Top