diff --git a/src/FDM/JSBSim/models/flight_control/FGActuator.cpp b/src/FDM/JSBSim/models/flight_control/FGActuator.cpp index e7ab6aa65..52faac0fb 100644 --- a/src/FDM/JSBSim/models/flight_control/FGActuator.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGActuator.cpp @@ -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 (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; - Output = ca * (input + PreviousLagInput) + PreviousLagOutput * cb; + + if (!fcs->GetTrimStatus()) + Output = ca * (input + PreviousLagInput) + PreviousLagOutput * cb; + PreviousLagInput = input; PreviousLagOutput = Output; } @@ -166,10 +160,11 @@ void FGActuator::Hysteresis(void) // method. double input = Output; - if (input > PreviousHystOutput) { - Output = max(PreviousHystOutput, input-0.5*hysteresis_width); - } else if (input < PreviousHystOutput) { - Output = min(PreviousHystOutput, input+0.5*hysteresis_width); + if (!fcs->GetTrimStatus()) { + if (input > PreviousHystOutput) + Output = max(PreviousHystOutput, input-0.5*hysteresis_width); + else if (input < PreviousHystOutput) + Output = min(PreviousHystOutput, input+0.5*hysteresis_width); } PreviousHystOutput = Output; @@ -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;