Merge branch 'next' of git://gitorious.org/fg/flightgear into next
This commit is contained in:
commit
a302cdc1cb
1 changed files with 14 additions and 19 deletions
|
@ -43,7 +43,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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;
|
static const char *IdHdr = ID_ACTUATOR;
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -114,24 +114,15 @@ bool FGActuator::Run(void )
|
||||||
// the Input will be further processed and the eventual Output
|
// the Input will be further processed and the eventual Output
|
||||||
// will be overwritten from this perfect value.
|
// will be overwritten from this perfect value.
|
||||||
|
|
||||||
if (!fcs->GetTrimStatus()) {
|
if (lag != 0.0) Lag(); // models actuator lag
|
||||||
if (lag != 0.0) Lag(); // models actuator lag
|
if (rate_limit != 0) RateLimit(); // limit the actuator rate
|
||||||
if (rate_limit != 0) RateLimit(); // limit the actuator rate
|
|
||||||
}
|
|
||||||
if (deadband_width != 0.0) Deadband();
|
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 (bias != 0.0) Bias(); // models a finite bias
|
||||||
|
|
||||||
if (fail_stuck) Output = PreviousOutput;
|
if (fail_stuck) Output = PreviousOutput;
|
||||||
PreviousOutput = Output; // previous value needed for "stuck" malfunction
|
PreviousOutput = Output; // previous value needed for "stuck" malfunction
|
||||||
|
|
||||||
if (fcs->GetTrimStatus()) {
|
|
||||||
PreviousHystOutput = Output;
|
|
||||||
PreviousRateLimOutput = Output;
|
|
||||||
PreviousLagInput = Output;
|
|
||||||
PreviousLagOutput = Output;
|
|
||||||
}
|
|
||||||
|
|
||||||
Clip();
|
Clip();
|
||||||
if (IsOutput) SetOutput();
|
if (IsOutput) SetOutput();
|
||||||
|
|
||||||
|
@ -152,7 +143,10 @@ void FGActuator::Lag(void)
|
||||||
// "Output" on the right side of the "=" is the current frame input
|
// "Output" on the right side of the "=" is the current frame input
|
||||||
// for this Lag filter
|
// for this Lag filter
|
||||||
double input = Output;
|
double input = Output;
|
||||||
Output = ca * (input + PreviousLagInput) + PreviousLagOutput * cb;
|
|
||||||
|
if (!fcs->GetTrimStatus())
|
||||||
|
Output = ca * (input + PreviousLagInput) + PreviousLagOutput * cb;
|
||||||
|
|
||||||
PreviousLagInput = input;
|
PreviousLagInput = input;
|
||||||
PreviousLagOutput = Output;
|
PreviousLagOutput = Output;
|
||||||
}
|
}
|
||||||
|
@ -166,10 +160,11 @@ void FGActuator::Hysteresis(void)
|
||||||
// method.
|
// method.
|
||||||
double input = Output;
|
double input = Output;
|
||||||
|
|
||||||
if (input > PreviousHystOutput) {
|
if (!fcs->GetTrimStatus()) {
|
||||||
Output = max(PreviousHystOutput, input-0.5*hysteresis_width);
|
if (input > PreviousHystOutput)
|
||||||
} else if (input < PreviousHystOutput) {
|
Output = max(PreviousHystOutput, input-0.5*hysteresis_width);
|
||||||
Output = min(PreviousHystOutput, input+0.5*hysteresis_width);
|
else if (input < PreviousHystOutput)
|
||||||
|
Output = min(PreviousHystOutput, input+0.5*hysteresis_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreviousHystOutput = Output;
|
PreviousHystOutput = Output;
|
||||||
|
@ -183,7 +178,7 @@ void FGActuator::RateLimit(void)
|
||||||
// is - for the purposes of this RateLimit method - really the input to the
|
// is - for the purposes of this RateLimit method - really the input to the
|
||||||
// method.
|
// method.
|
||||||
double input = Output;
|
double input = Output;
|
||||||
if (dt > 0.0) {
|
if (!fcs->GetTrimStatus()) {
|
||||||
double rate = (input - PreviousRateLimOutput)/dt;
|
double rate = (input - PreviousRateLimOutput)/dt;
|
||||||
if (fabs(rate) > rate_limit) {
|
if (fabs(rate) > rate_limit) {
|
||||||
Output = PreviousRateLimOutput + (rate_limit*fabs(rate)/rate)*dt;
|
Output = PreviousRateLimOutput + (rate_limit*fabs(rate)/rate)*dt;
|
||||||
|
|
Loading…
Reference in a new issue