1
0
Fork 0

fix self initialized of average variable in FGPredictor

This commit is contained in:
torsten 2009-06-27 09:29:31 +00:00 committed by Tim Moore
parent 219be77f1e
commit 786c10a69e
2 changed files with 4 additions and 2 deletions

View file

@ -573,7 +573,8 @@ void FGPISimpleController::update( double dt ) {
FGPredictor::FGPredictor ( SGPropertyNode *node ):
FGXMLAutoComponent( node )
FGXMLAutoComponent( node ),
average(0.0)
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
@ -618,7 +619,7 @@ void FGPredictor::update( double dt ) {
if ( dt > 0.0 ) {
double current = (ivalue - last_value)/dt; // calculate current error change (per second)
double average = dt < 1.0 ? ((1.0 - dt) * average + current * dt) : current;
average = dt < 1.0 ? ((1.0 - dt) * average + current * dt) : current;
// calculate output with filter gain adjustment
double output = ivalue +

View file

@ -297,6 +297,7 @@ class FGPredictor : public FGXMLAutoComponent {
private:
double last_value;
double average;
FGXMLAutoInputList seconds;
FGXMLAutoInputList filter_gain;