1
0
Fork 0

Merge branch 'next' of git://gitorious.org/fg/flightgear into next

This commit is contained in:
Frederic Bouvier 2011-06-18 21:24:31 +02:00
commit a302cdc1cb

View file

@ -43,7 +43,7 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGActuator.cpp,v 1.18 2011/05/13 17:14:47 bcoconni Exp $";
static const char *IdSrc = "$Id: FGActuator.cpp,v 1.19 2011/06/18 13:30:27 bcoconni Exp $";
static const char *IdHdr = ID_ACTUATOR;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -114,24 +114,15 @@ bool FGActuator::Run(void )
// the Input will be further processed and the eventual Output
// will be overwritten from this perfect value.
if (!fcs->GetTrimStatus()) {
if (lag != 0.0) Lag(); // models actuator lag
if (rate_limit != 0) RateLimit(); // limit the actuator rate
}
if (deadband_width != 0.0) Deadband();
if (!fcs->GetTrimStatus() && hysteresis_width != 0.0) Hysteresis();
if (hysteresis_width != 0.0) Hysteresis();
if (bias != 0.0) Bias(); // models a finite bias
if (fail_stuck) Output = PreviousOutput;
PreviousOutput = Output; // previous value needed for "stuck" malfunction
if (fcs->GetTrimStatus()) {
PreviousHystOutput = Output;
PreviousRateLimOutput = Output;
PreviousLagInput = Output;
PreviousLagOutput = Output;
}
Clip();
if (IsOutput) SetOutput();
@ -152,7 +143,10 @@ void FGActuator::Lag(void)
// "Output" on the right side of the "=" is the current frame input
// for this Lag filter
double input = Output;
if (!fcs->GetTrimStatus())
Output = ca * (input + PreviousLagInput) + PreviousLagOutput * cb;
PreviousLagInput = input;
PreviousLagOutput = Output;
}
@ -166,9 +160,10 @@ void FGActuator::Hysteresis(void)
// method.
double input = Output;
if (input > PreviousHystOutput) {
if (!fcs->GetTrimStatus()) {
if (input > PreviousHystOutput)
Output = max(PreviousHystOutput, input-0.5*hysteresis_width);
} else if (input < PreviousHystOutput) {
else if (input < PreviousHystOutput)
Output = min(PreviousHystOutput, input+0.5*hysteresis_width);
}
@ -183,7 +178,7 @@ void FGActuator::RateLimit(void)
// is - for the purposes of this RateLimit method - really the input to the
// method.
double input = Output;
if (dt > 0.0) {
if (!fcs->GetTrimStatus()) {
double rate = (input - PreviousRateLimOutput)/dt;
if (fabs(rate) > rate_limit) {
Output = PreviousRateLimOutput + (rate_limit*fabs(rate)/rate)*dt;