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

FS2004 Autopilot Will Not Smoothly Acquire Altitude

Messages
205
Country
us-kentucky
Hi all,

Working on the 747 again, I have resigned myself to forcing it to work with the default autopilot instead of my own (for now at least, just to get the dang thing flying...).

I am attempting to use the default autopilot variables with some XML trickery to make the gauges on the panel behave accurately while making the system functional.

However, during testing, I could not get the aircraft to smoothly capture an altitude. If I use the default 747 panel, the autopilot behaves perfectly: it begins capturing a given altitude about 300 feet out from it given a climb/descent rate of 2000 fpm. However, on my panel, altitude acquiring does not begin until 100 feet for some reason, causing the autopilot to overshoot, and instead of trying to acquire the correct altitude, it simply remains at whatever altitude it overshot to. I cannot for the life of me figure out what is conflicting and causing the problem.

Here is the relevant portion of gauge code:

XML:
            <!--Vertical Speed Mode-->
            (L:AP Vertical Mode Knob, number) 1 !=
            if{
            (A:VERTICAL SPEED, feet per minute) (>L:VS Wheel Setting, number)
            }
         
            (L:AP Vertical Mode Knob, number) 1 == (L:Autopilot Altitude Select Switch, number) 0 == (A:AUTOPILOT VERTICAL HOLD VAR, feet/minute) 0 &gt; and and
            if{ 99999 (>K:AP_ALT_VAR_SET_ENGLISH) }
         
            (L:AP Vertical Mode Knob, number) 1 == (L:Autopilot Altitude Select Switch, number) 0 == (A:AUTOPILOT VERTICAL HOLD VAR, feet/minute) 0 &lt; and and
            if{ -5000 (>K:AP_ALT_VAR_SET_ENGLISH) }

            <!--Altitude Modes-->
            (A:AUTOPILOT MASTER, bool) 1 ==
            if{
       
            (L:Autopilot Altitude Select Switch, number) 1 ==
            if{
            (L:AltHoldDoOnce, bool) 0 ==
            if{
            (L:Altitude Filtered, number) (>K:AP_ALT_VAR_SET_ENGLISH)
            1 (>L:AltHoldDoOnce, bool)
            }
            (>K:AP_PANEL_ALTITUDE_ON)
            (>K:AP_ATT_HOLD_OFF)
            0 (>L:AP Vertical Mode Knob, number)
            }
            els{ 0 (>L:AltHoldDoOnce, bool) }
         
            (L:AP Vertical Mode Knob, number) 0 == (L:Autopilot Altitude Select Switch, number) -1 == and
            if{
            (L:AP Altitude Setting, number) (>K:AP_ALT_VAR_SET_ENGLISH)
            (>K:AP_PANEL_ALTITUDE_ON)
            (>K:AP_ATT_HOLD_OFF)
            }
         
            (L:AP Vertical Mode Knob, number) 1 == (L:Autopilot Altitude Select Switch, number) -1 == and
            if{
            (>K:AP_PANEL_ALTITUDE_ON)
            (>K:AP_ATT_HOLD_OFF)
            (L:VS Wheel Setting, number) (>K:AP_VS_VAR_SET_ENGLISH)
            (L:AP Altitude Setting, number) (>K:AP_ALT_VAR_SET_ENGLISH)
            }
         
            (L:AP Vertical Mode Knob, number) 0 == (L:Autopilot Altitude Select Switch, number) 0 == and
            if{
            (>K:AP_PANEL_ALTITUDE_OFF)
            (>K:AP_ATT_HOLD_ON)
            (>K:AP_WING_LEVELER_OFF)
            }
         
            (L:AP Vertical Mode Knob, number) 1 == (L:Autopilot Altitude Select Switch, number) 0 == and
            if{
            (>K:AP_PANEL_ALTITUDE_ON)
            (>K:AP_ATT_HOLD_OFF)
            (L:VS Wheel Setting, number) (>K:AP_VS_VAR_SET_ENGLISH)
            }
         
            }
 
Last edited:

tgibson

Resource contributor
Messages
10,770
Country
us-california
is this using the exact same aircraft in both cases? There are AP variables in the aircraft.cfg file as well.
 
Messages
205
Country
us-kentucky
is this using the exact same aircraft in both cases? There are AP variables in the aircraft.cfg file as well.
Yes, exact same aircraft and flight model, only different panels. With the default 747-400 panel, all works as intended, but switching in mine causes wierdness.
 
Messages
205
Country
us-kentucky
I think I might have solved it, but I couldn't explain why this fixes it. Removing this section of the code causes everything to work correctly:

XML:
(L:AP Vertical Mode Knob, number) 0 == (L:Autopilot Altitude Select Switch, number) -1 == and
if{
(L:AP Altitude Setting, number) (>K:AP_ALT_VAR_SET_ENGLISH)
(>K:AP_PANEL_ALTITUDE_ON)
(>K:AP_ATT_HOLD_OFF)
}
 

tgibson

Resource contributor
Messages
10,770
Country
us-california
One thing is that it appears you are flooding FS with commands in this section. If the knob is 0 and the switch is -1 then you send those 3 commands to FS 18 times a second. This will really clog things up. There should be another test in the first line that checks (for example) for the altitude hold being turned off . If it is turned on from the AP_PANEL_ALTITUDE_ON command, then these commands should not be called again.
 

DragonflightDesign

Resource contributor
Messages
936
Country
northernireland
Although I don't do XML as a general rule, from reading your code above it appears that you may have a lot of code flooding going on which, as Tom says, will clog the system up badly. Each time you use a K: var, before you send the same command again, run a check on the event to see if it has been actioned before sending the command again. Depending on how quickly the code reacts (the more code, the slower it is likely to action) you may even need to add a short timer that fires at the point you send the command, prevents the same command from being sent again while the timer is active and then check for the command result when the timer expires.
 
Top