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;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// 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();
// "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;
}
// 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;
// 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;