1
0
Fork 0

Some xml-autopilot tuning

- Add update-interval-secs to the entire autopilot
- cache min/max values in InputValue
- a little more relaxed "equals zero" checking in the NoiseSpikeFilter
This commit is contained in:
Torsten Dreyer 2012-02-15 14:59:10 +01:00
parent d141beee0f
commit ed934c1999
3 changed files with 9 additions and 4 deletions

View file

@ -65,7 +65,9 @@ void FGXMLAutopilotGroupImplementation::addAutopilot( const std::string & name,
}
FGXMLAutopilot::Autopilot * ap = new FGXMLAutopilot::Autopilot( apNode, config );
ap->set_name( name );
set_subsystem( name, ap );
double updateInterval = config->getDoubleValue( "update-interval-secs", 0.0 );
set_subsystem( name, ap, updateInterval );
_autopilotNames.push_back( name );
}

View file

@ -251,7 +251,7 @@ void NoiseSpikeFilterImplementation::initialize( double output )
double NoiseSpikeFilterImplementation::compute( double dt, double input )
{
double delta = input - _output_1;
if( delta == 0.0 ) return input; // trivial
if( fabs(delta) <= SGLimitsd::min() ) return input; // trivial
double maxChange = _rateOfChangeInput.get_value() * dt;
const PeriodicalValue * periodical = _digitalFilter->getPeriodicalValue();

View file

@ -41,8 +41,11 @@ double PeriodicalValue::normalize( double value ) const
double PeriodicalValue::normalizeSymmetric( double value ) const
{
value = SGMiscd::normalizePeriodic( minPeriod->get_value(), maxPeriod->get_value(), value );
double width_2 = (maxPeriod->get_value() - minPeriod->get_value())/2;
double minValue = minPeriod->get_value();
double maxValue = maxPeriod->get_value();
value = SGMiscd::normalizePeriodic( minValue, maxValue, value );
double width_2 = (maxValue - minValue)/2;
return value > width_2 ? width_2 - value : value;
}