Sign in to follow this  
Guest Mathias

Programming a realistic yaw damper

Recommended Posts

Have any of the designers here considered the feasibility of programming a working yaw damper? I have yet to see a yaw damper which actually deflects the rudder in turns. Even the YDs on complex addons such as the F1 ATR72, PMDG 737NG, DF727, etc. are lifeless. It seems like a pretty straightforward thing to program .. use the autopilot to apply rudder until the ball is centered. What are your thoughts?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Should be pretty easy to do, I would think. I programmed a helicopter pitch trim gauge that way. Use the KEY_AXIS_RUDDER_SET event.I assume it is easier to use the default yaw damper in AP programming.In real life it could well be that yaw damping is done only by rudder trimming so you might see more action from the rudder trim tab than from the rudder itself.With some knowledge in the art of controller programming it should be pretty easy to make a real rudder-moving yaw damper. However the actuation would have to be done outside the FS KEY_YAW_DAMPER_TOGGLE event...

Share this post


Link to post
Share on other sites

Interesting .. it makes me wonder why this hasn't been done in a payware product like the F1 ATR or LDS 767. With all of these clever FS programmers, I'm sure it has crossed someone's mind ..

Share this post


Link to post
Share on other sites

Mathias has the right idea with a controller. A simple PD would be enough. Our project will use PD and PID controllers for emulating a flight control system, including a YD.Controllers can also be used to enhance or replace the default AP.It can be done in XML or C and output can control either the trim or the full deflections of any surface.If you're interested in writing a controller, just Google it and you'll see lots of algorithms. You can even look at the source code for FlightGear PID to get started.--Jon

Share this post


Link to post
Share on other sites

Modern commercial jet aircraft need large rudders and fins to be able to cope with the "engine-out" situation. At high altitude this can cause a minor degree of lareral instability with the aircraft executing a dutch-roll. My understanding is that yaw dampers are fitted to counteract this - not to co-ordinate turns.I haven't flown anything other the the stock airliners so i don't know if the flight dynamics of add-ons represent dutch-roll.

Share this post


Link to post
Share on other sites

At least on the 737NG, they do provide turn coordination (although the PMDG rendition of the 737NG has defective YDs). Here is an excerpt from the real 737NG flight ops manual:"Either yaw damper is capable of providing dutch roll prevention, gust damping and turn coordination. Yaw damper operation does not result in rudder pedal movement. Only main yaw damper inputs are shown on the yaw damper indicator. The pilot can override either main or standby yaw damper inputs using either the rudder pedals or trim inputs."

Share this post


Link to post
Share on other sites

Hi,PID requires some calculations!How to do that in xml?Example?There are some PID values in the autopilot section of the aircraft.cfg.Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

>learn RPN. here is a link to a nice>explanation/example/how-to. http://en.wikipedia.org/wiki/RPN>LOL, I'm not even going there. Jan taught me a sizeable chunk of what I know in RPN, and he's still humble enough to be asking questions at over 1000 posts.I replied via email.--Jon

Share this post


Link to post
Share on other sites

No disrespect here,(lets not a start a flame here, cuz it's the coolest forum at AVSIM :-) )Well anyway, I also looked into this with many, many, many, ????s ... RPN is not the problem.. Maybe the thing is,,,,, is the interpretation of it.http://www.flightgear.org/Docs/XMLAutopilot/img14.pngThe above pic is from the link Matthias originally posted, BTW it is very good reading,,,,, start here: http://www.flightgear.org/Docs/XMLAutopilot/I'm still looking at it, with testing I can get parts of it but cannot get the whole recipe...The best way I can implement this would be to use a to call when needed.ARNE ?? You are "THE" math/programming dude :-) can you please interperete this into maybe a something some of the XML folks could understand?Boy would I like to rip apart the servo controller for a '99 Ford whatever to see how the electronics did it. Regards,Roman

Share this post


Link to post
Share on other sites

Roman,You probably want to be looking at the C source code: www.spiderbark.com/fgfs/xmlauto.cxx rather than trying to decipher that. If you look at the section with the comments by Roy Vegard Ovesen, you'll see an explaination of the pseudo variables. A but further down is the actual code.You'll want to have a look at FGPIDController::FGPIDController and FGPIDController::update. You can pretty much concentrate on that if you want to convert it (or something similar) to XML.You'll have to establish a time constant, and then filter the control surface [you're interested in controlling] changes to get a rate of change over said time constant for that surface. That will be you're measured "process value", or input for PID."y" is the input variable (see above)"r" is the reference set point. This is what you want to surface to maintain (i.e. 0)."u" is your output.P.S.Not trying to start a flame war by any means. Certainly didn't mean for my last post to be taken as an insult, just pointing out that Jan knows his stuff.--Jon

Share this post


Link to post
Share on other sites

Hmm, I don't want to discourage anyone, but from my own experience I can say that PID controllers are all but simple or straightforward. The basics look simple, a P(roportional) an I(ntegral) and an D(erivate) are summed together with weighing factors. The weighing factors are the crucial point. You can spend days and days to find aprobriate values, that are fast enough AND stable.As in the mentioned document stated:"As you can see, the actual math involved in a PID controller (while rooted in some deep theory) is actually quite simple to implement. The real trick for creating a well behaved PID controller and a well behaved autopilot is tuning the relative weights of each of the P, I, and D components."It can be quite hard, belive me.To the above formula:OK I think I recognize the parts, not fully by now. The right part has the usual look of a numerical second derivate, left is a first order derivate, the middle is a proportional factor. It's more or less the derivate of the function at the bottom of "Control Theory 101", since it's integrated to the previous value this should level out.I have to think about it a bit.BTW using a D part in FS can be pretty hazardous: the simulation values are quite choppy, they change only at about three times per second in steps, not smoothly, so any derivate is very "spiky" and more or less useless, until you don't apply some time filtering, which the above formula has (the hidden "alpha" value). So there are already more then only three independent params, so much fun on trying out.Just my personal opinion.Arne Bartels

Share this post


Link to post
Share on other sites

It is true, the secret of a good PID controller is the parameters involved. We have a #### of time trying to get a well working controller for our electrical EGR-valves at work. Over the last two years we have actually used Mathlab and Simulink to be able to simulate our various valve types and thus be able to create working controllers much more quickly than in the trial-and-error work between the lab and actual in-vehicle testing.Not being a mathematical crack I haven't been able to completely understand how a PID controller really works, so here just the basic stuff I have come to understand until now:The proportional part takes the input value (for example a range of 0 to 100) and multiplies it with a parameter to create an output signal.The integral part adds up the difference between the desired position and the actual position in predefined increments and adds the result to the output signal in case the proportinal part cannot get to the desired position on its own. The integral part tends to overshoot if overdone.So there is the differential part that works out the differnce between desired and actual position and bascially counter-acts the integral part. It serves as the brake to curb the overshoots of the integral part. Using too much of that though will slow the controller down.The hard thing then is to correctly set the proportianl values and balance the integral and differential parts to get a fast controller with a minimum of overshoot. All of these parameters can even be arranged in tables depending on the difference between desired and actual position.These are only the basics...

Share this post


Link to post
Share on other sites

In understanding PID Feedback systems it helps to know a bit about Feedback Control Theory. 'Bode Plots' (pronounced 'Boda') were invented to make this relatively simple. I try to relate the P, I, and D gains to Bode plots. Search Google for 'Bode Plot' and one finds they are used everwhere. Including AC flight dynamics. Jon programmed a pitch controller in XML/RPN. While I don't think it's just right, I found bandwidth is high enough so one can augment FS pitch stability quite well (much better than the FS autopilot). The 18.2 per second iteration rate adds phase shift (which generally makes FB systems less stable), but for 1 Hz componenents thats only 10 degrees. Further, a 'lead block' can compensate for that sampler lag to a fair extent. I'd like to make the P, I, and D functions in XML macros. At least some simplification should be possible. Then, one could combine various combinations of P, I, and D in appropriate ways. One might want to change the P, I, and/or D gains in an ILS/GS to make them decrease as one approaches the threashold. Fortunately, 'DME Distance' is usally available; something old, real ILS systems didn't have. Adding limiters is also valuable. JSBSimn/FlightGear lets one configure 'autopilot' blocks in a general way. About the best that can be done in FS is to combine macros in hard coding. ----------- Incidently, a Yaw Damper generally feeds back Yaw Rate to the rudder. According to Roskam, basic YD FB is quite simple. One might only need P(osition) and D(erivative) of Beta applied to 'Rudder Deflection' to do a good job. With a good YD, Yaw Damping (Cn_r) could be set low and realistic. Most FS Jets have it set about 10X higher than real. Automatic Turn Co-ordination is usually another result of a real Yaw Damper. Ron

Share this post


Link to post
Share on other sites

> Automatic Turn Co-ordination is usually another result of a>real Yaw Damper.> > RonTrue, the real Dornier 128-6 of which I am currently developing a version for FS9 has a Dornier-specific autopilot that incorporates a yaw damper as soon as the AP is turned on, and it auto-coordinates a turn that can be entered into the AP via a dial.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this