Derivative gain in PID not having impact #673
Replies: 2 comments 1 reply
-
@ThomasKennings make use of the triple backtick ` option followed by xml and close it with triple back ticks to format the xml better in future. I've edited your comment.
Even if the error term is near 0 what counts is what is the derivative, how noisy is the error term? Plot it for the first 3s or so and inspect it and compute the derivative for each time step to see how large the derivative is. For example, assuming you're using the default 120Hz rate, then let's say 2 samples a single time step apart are say 0.1 and 0.2, then the derivative |
Beta Was this translation helpful? Give feedback.
-
Look at your input data closely, and how you calculate your input data, a PID controller is really very simple. jsbsim/src/models/flight_control/FGPID.h Lines 97 to 101 in 375f5be jsbsim/src/models/flight_control/FGPID.cpp Line 164 in 8852bf5 jsbsim/src/models/flight_control/FGPID.cpp Line 203 in 8852bf5 |
Beta Was this translation helpful? Give feedback.
-
EDIT: Solution found! I feel silly now. The issue was that the input to the PID was deliberately being clipped. Once the input value reached the clipping point, its derivative was 0 since it stayed at the clipping point all the time. Removing the clipping shows derivative gain to work. The extreme fluctuations at the beginning weren't an issue after removing the clipping as well.
I'll put the clipping back. It's good to know derivative gain is working.
Hello,
I'm writing a simplified simulation of pilot behavior using the scripting available in the aircraft .xml files. My intention is to use it to hold a given altitude, as well as to adjust to a new altitude when the target altitude variable (new) is changed in a script file. My basic control layout goes something like this:
altitude error calculation -> PID to get vertical speed ref -> vertical speed error calculation -> PID to set elevator-cmd-norm
My issue is that derivative gain in the last PID is having no impact on elevator-cmd-norm. I checked that P and I are working by setting the other two gains to 0.0, and P and I both work. However, setting P=0, I=0, D!=0 causes elevator-cmd-norm to flip between -1 and 1 at 60 Hz for the first ~3.7 seconds, then stay at 0 for the remainder of the simulation.
My derivative gain is 1.0 and my vertical speed error is near 0, so I don't understand the insane oscillation at the start. Then I don't understand why the output is 0.0 while my vertical speed is not zero (plane starts climbing). Does anybody have recommendations or things I should check?
Beta Was this translation helpful? Give feedback.
All reactions