plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


Idea

N6722C avatar image
N6722C suggested N6722C edited

Please Zero Autopilot Internal "Integral" values when AP is in OFF state

Currently, when the AP is turned off, any accumulated Integrated Errors remain in the AP Pid, and take effect when the AP is next turned on, (often with disastrous effects on the plane's flight)

Since Devs do not have access to these internal values, to do it ourselves, please will Asobo code to reset ALL integral values within the AP Pids to zero, when the AP is in the OFF state . (or when power is not applied)

This is standard practice in PID systems (and defiantly in any aircraft AP Pid)

gauges
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

10 Comments

·
N6722C avatar image
N6722C commented

Is there any chance this request can be given some consideration.

Currently, the AP system can get into a mode where the Integal rises to such a high value, that if the AP is later switched on, the PID cannot come out of limit, and this results in the AP driving the plane to an unusual attitude, with resulting disaster.


What is need is either the AP is programmed to clear the Integral, when turned off, or some Event added, where the AP Integral can be cleared programmatically.


The first option would appear to be the easiest to implement, and the most foolproof, as it would clear the AP Integral automatically.


In an idea world, there would be an AP API, with full exposure to the internals of the AP Pids




1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Simbol avatar image Simbol commented ·
This! it goes like a rocket up or down!. I second this request please.


Many thanks.
Raul

0 Likes 0 ·
FlyingRaccoon avatar image
FlyingRaccoon commented

Hello @N6722C

There is many different PIDs in the AP system. Some require the integral to be set to zero; some don't. In theory this is managed correctly, but depending on the aircraft, and AP mode, there may be issues.
The problem occurs when a PID is being computed while not having an effective action, this will cause the integral to drift. We have fixed a few ones already but maybe not all.
Do you have a precise example of which PID requires an integral reset, for which aircraft and in which situation?

As an example of PID integral we don't want to reset to 0, there's the pitch hold one. If we reset the integral to 0 every time it's switched on and off, this would cause oscillation instead of a smooth transition. Do you agree on that?

Regards,
Sylvain


12 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image N6722C commented ·

One good example is the KAP140 AP, as used in many GA planes.

If one picks a non DRM plane (ie jt the c172 Steam), , one can see the AP pids display in the Dev Console.


The issue is that on both the Pitch & Bank Pids, if the AP is run where it accumulates error, ie On the Ground ( say during an On Ground AP test), you can clearly see that the Integral builds up to a max limit, but thereafter, can never be reduced, even if the AP is attemped to be driven in the reverse direction. Even if the AP is switched off, (either turned to OFF, or its Power removed), that limited Integral value is stuck at a limited max value, so when the AP is next turned on, it drives the servo to limit, with no possibility of recovery (Unless the plane is re-loaded).


If the AP is turned off, and then later turned on, any Historical Intergrated Error in the AP is historic, and no longer relevant, therefore the AP should initialize to Zero Integral value, and from there, if appropriate, start accumulating Integrated error,


What is also strange, is how once that Integral has built up to 100% (as shown in the Dev Console), it is virtually impossible to drive it back from than limited state, no matter what Input is presented to the PID.


I cannot picture any AP Pid, not being required to reset, and zero it integral accumulated value, when it is turned off, and the current conditions where it drives to limit and stay there, and therfore will always result in not being able to use the AP again, (without a reload)., or the result will be an AP that always forces the plane into an unusual attitude.


In answer to your question,my question would be --- Is there ever a reason or justification why you would NOT want the Integrated error l to be zeroed, when the AP is turned off, so it starts off with zero Integrated error ?








0 Likes 0 ·
N6722C avatar image N6722C commented ·

As an example of PID integral we don't want to reset to 0, there's the pitch hold one. If we reset the integral to 0 every time it's switched on and off, this would cause oscillation instead of a smooth transition. Do you agree on that?


I don't think I agree, as I really do not understand where "oscillation" can come from" in that example. I would say, that the Pitch Integral SHOULD be set to zero, if the AP is turned off, so when turned back on again, the INITIAL integrated error is zero.

Note: The KAP140 is meant to Capture the current VS, when turned on.


The systems.cfg "Default_Pitch_Mode" ( 0, 1 ,2 or 3) will determine what the Pitch mode is when the AP is turned on. For the KAP140, it should be set to 3=VS mode -- ie captures current VS, but most devs are setting it to 0, so it always tries to set the VS to ZERO, when the AP is turned on, (which is incorrect for the KAP140).

Even worse, when set to 0, if the AP is turned off with a VS set, when it is next turned on, it will initialize to that old VS !!! This is not the correct operation for the KAP140.


So, if one has VS when turning on the AP, the AP will try to force the plane to zero VS, and that may well cause some oscillation, if the PID is not tuned correctly (which so many devs fail to do).


In answer to your question then, (for the KAP140),

(a) "Default_Pitch_Mode" should be set to 3
(b) Accumulated Integrated error should be set to zero, when the AP is OFF, so when turned on,the AP initially has ZERO Integrated error.


Note: It would be MORE CORRECT if the C172 Steam (Premium -Deluxe) DRM encode plane could have its "Default_Pitch_Mode" set to 3 - but as its encoded, this again, only Asobo can do that, (unless users creates and introduces a MOD file copy of systems.cfg )







0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ N6722C commented ·

The devs are having a look at your answer so I'll come back later with a better feedback.

In the meantime, here's what work is planned at the moment on the PIDs:

- Go through all PIDs (most are legacy) and replace them with new ones that are "correcly plugged". (Optional for retro compatibility of cours).

- Add a new integral limit to the PID system in a way that makes it actually useful.

- Give the option to "run PIDs in the background" or to "warmup" PIDs to avoid oscillation when they are "switched ON". Option to reset to zero can also be added as some real world AP systems may actually reset integrals to zero (completely agree with that).

0 Likes 0 ·
N6722C avatar image N6722C FlyingRaccoon ♦♦ commented ·

FlyingRaccoon :
Option to reset to zero can also be added as some real world AP systems may actually reset integrals to zero (completely agree with that).


FANTASTIC !! The ability for the Developer to programmatically Clear (zero) the Pids (typically when the AP is turned off, ) --- is all that I was hoping for, and should eliminate the issues caused by both testing the AP on the Ground, as well as the AP sometimes getting locked up with Integral Runaway when in the air..

Hopefully this can occur on individual specified PIDs ..


Any Idea when we might see this in and update .. and in the SDK - Su10 maybe at least for the Integral Clear.

0 Likes 0 ·
Show more comments
N6722C avatar image N6722C commented ·

@

FlyingRaccoon avatar image

FlyingRaccoon


Have you and Asobo come around to the thinking that for the AP Pids, the Integral term should be zeroed, when the AP is turned off ...

If not, I have done a bad job in explaining and trying to convince you that this is required, and would like the opportunity to try to convince you
(Or have you, or someone else here, convince me otherwise)


0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ N6722C commented ·
Hello @N6722C

The developer in charge of this is very busy at the moment so I didn't find the time to review your answers with him. Feel free to add any explanations you want :)

0 Likes 0 ·
N6722C avatar image N6722C FlyingRaccoon ♦♦ commented ·

Thanks Sylvain ,

I appreciate that everyone at Asobo is very busy, and I thank you for the speedy reply.

The fact that you are going to discuss this with the relevant Developer is more than a sufficient reply.

I feel confident that when this is brought to their attention, they will address this issue in a satisfactory way.


Obviously, if they want more input from me, I can be contacted here...but I think the problem and its solution will be pretty clear to whoever has the design responsible for the Autopilot systems.




0 Likes 0 ·
Show more comments
N6722C avatar image N6722C commented ·
@FlyingRaccoon
Thanks -- Additions in SU11 are perfect to Reset the AP PIDS ..as needed ..
0 Likes 0 ·
CodenameJack447 avatar image
CodenameJack447 commented

I have one that could be directly or indirectly related.


We are trying to transition fighters to FBW as part of AFCS. While with AP deactivated there are no problems and it behaves as we want, when activating AP there is a significant delay until it starts working.


Suppose that after several aerobatic maneuvers I decide to activate the AP and activate HDG, the plane does not obey until after a few seconds, and when it does, the bank turn is brutal. The same happens if you activate NAV. And the same thing happens if you want to intercept star manually and then disable GPS DRIVES NAV1, and activate AP + APPROACH for an ILS landing with a valid frequency, it doesn't always capture the GS and ignore it. That is, it effectively looks like a saturation with AP + FBW, which does not occur if the aircraft is defined as non-FBW in flightmodel.cfg (we have this behaviour in concorde often despite not being a fighter). Likewise, having GPS disabled to capture a GS in VOR mode does not always guarantee that the aircraft captures the GS or pursues an LOC, it is as if GPS was still enabled (again this happens in concorde but is also more noticeable with a fighter).

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

CodenameJack447 avatar image
CodenameJack447 commented

What I mean is that it feels like sometimes the autopilot operation or an autopilot function doesn't kick in instantly, sometimes it takes a while to kick in, and sometimes it doesn't kick in unless you move the plane manually so that "something" internally "resets" and it happens more with FBW planes than non FBW.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image
N6722C commented

I am sure you have a valid issue, but I would be very surprised if it had anything to do with this issue about zeroing the Integral error, when the AP is in an Off state.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image
N6722C commented N6722C edited

@FlyingRaccoon

Any progress in providing a way to ZERO the AP PID Integrals, when the AP is turned OFF ?
Either always by Asobo, or allowing the Plane developers access to those Integral parameters, as readable/writable Variables, or a Reset Event, that resets them all ?


It is a continual source of frustartion, that if the AP is turned on on the ground by the pilot (say on a AP testing checklist), it drives the AP into an unrecoverable maxed out limit state, with a "maxed out extremely high Integral Error", that cannot be reset, apart from by reloading the plane !!

(Adding "RELOAD THE PLANE" at the end of the Checklist, is not a very good Solution :) )

I have literally lost count of the number of times "MY AP has Crashed my Plane" because of this and it should be such a simple, and NECESSARY fix, and inclusion in the SDK.

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image N6722C commented ·

@FlyingRaccoon

Any progress with this, within the SU10 update period.

At he moment, is there ANY way a Dev can force the PID Integral error to zero ?

Its the height of frustration, to see those Integral Values displayed graphically in the "Aircraft-AP" Dev Mode screen, but not be able to access them or directly control them.

A thought:

Currently the PID values are constants in the .cfg file.
Some more advanced RL Autopilots will dynamically change those values, deepening on other criteria,

If those 5 PID values could be made read/writable, then a lot more could be accomplished to provide a close simulation of these more advanced Autopilots, and the ability to zero the Integral Error might even become a side effect of being able to control those 5 values Dynamically .


But at the moment, a great step forward would be just being able to programmatically ZERO that Integral Error :)



0 Likes 0 ·
N6722C avatar image
N6722C commented N6722C edited

Disappointing to not seeing this PID Integral accumulation addressed in SU10.

At a Minimum, it would be useful to see a new K-event added, to clear PID Integrals, with an index, for the various standard Asobo Pids.


This would not change the current operation of the Pids, (so would be 100% backward compatible with all previous uses of the Pids), but would allow for Dev to decide where and when they want to program a reset of the excessively built up Integral.


Ability to read and write those Indexed Integral values would be even more flexible !!

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

MrTommymxr avatar image
MrTommymxr commented

honestly if we could just go back to the autopilot we had 2 years ago where integral was not used id be happy.


currently the only solution is to have such a high Integral value that it acts like a proportional controller

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image
N6722C commented N6722C edited

Why is this being made so difficult ? The PIDs often need an Integral term, so that should NOT be removed.

What is required (as in any standard, Real World PID) is

(1) The Integral Error should have a controllable min/max limit value (LIMITING)
(2) The Integral Error should be reset to Zero, when the PID s turned off.

It's really that simple.

If Devs were given Read/write access to that Integral error term, all could be resolved by the Devs who chose to do so, and be 100% backward compatible with anything already developed.


Note: In an Ideal (Real ) World, the basic PID settings of GAIN, Integral Gain & Proportional Gain would be made to allow their values to be changed in real time, when the PID is running, to simulate the more complex PID systems, used in modern aircraft control systems. (as opposed to being Constants, set in a .cfg file)


While open for a very long time, hopefully the Position of "Autopilot Programmer" will be soon filled..
https://www.asobostudio.com/careers/autopilot-programmer-flight-sim-252



10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image
N6722C commented N6722C edited

Going to BUMP this one again, this time with a positive SUGGESTION.

Please consider adding ONE new H Event


Set_PID_Integral_Error:index, number


Index being defined as (say)

1: Pid AP Roll
2: PID AP Pitch
3: etc etc

Typically, one would call this event (for the AP), when the AP is turned on, or off, setting any past accumuated Integral errorr to Zero, but it could also be used to set the Integral value to some other value, say to simulate a fault in the AP system, Gyro Topple etc etc.

It would then be up to the Developer, if they chose to call this event, and under what circumstances, the introduction of this new H event, then being 100% back compatible with the current state of MSFS.


==

Hopefully, sometime in the future, all the PID internals will be made available in an full PID API, but in the meanwhile, just being able to set the Integral Error Value (Typically to Zero it), will make the AP so much more usable..

ie

AP Checklist testing when on the Ground
The end to the spiral of death, if the AP was earlier turned on when the Ground, and running to an Integral limit.


4 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

N6722C avatar image N6722C commented ·

BIG THANKS to Asobo ( especialy @FlyingRaccoon ) for adding the option to RESET the Elevator & Aileron AP Pids in SU11


AP can now be "tested on the Ground" and now the AP cannot get locked up, and "crash the plane" when turned on, due to old Integrated data.

====================================

Do you have any news or updates on when "Battery Internal Resistance" will be added to the battery Simulation .When it brought up a few months ago, and you said it was "Planned", but no timescale yet . Hopefully it will be an A:var that is both Readable & Writable, so 3rd party Devs can make it vary as complexly as they want with Temperature, Charge level, Battery age, Battery type etc etc.




0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ N6722C commented ·
I'm just the messenger here but I'll let our devs know the change was appreciated.

@N6722C As for the battery request, ping me in the dedicated post and I'll check if we have some news.

0 Likes 0 ·
N6722C avatar image N6722C FlyingRaccoon ♦♦ commented ·

@FlyingRaccoon

The request to add simulation of Battery Internal resistance was discussed in the following post.

https://devsupport.flightsimulator.com/idea/6429/add-battery-cga-and-then-simulate-battery-internal.html

At that time, (about 6 months ago) you said it was on the roadmap, but no ETA.


0 Likes 0 ·
Simbol avatar image Simbol N6722C commented ·
A very good new addition indeed.. thanks Asobo and team..


Best,

Raul

-1 Like -1 ·

Write a Comment

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.