56 CheckInputNodes(1, 1, element);
59 auto PropertyManager = fcs->GetPropertyManager();
63 if (ptrSet && ptrSet->IsConstant()) {
64 set = ptrSet->GetValue() >= 0.5;
72 if (ptrReset && ptrReset->IsConstant()) {
73 reset = ptrReset->GetValue() >= 0.5;
81 if (ptrVersus && ptrVersus->IsConstant()) {
82 versus = ptrVersus->GetValue();
90 if (ptrBias && ptrBias->IsConstant()) {
91 bias = ptrBias->GetValue();
96 module = element->FindElementValueAsNumber("module");
99 log <<
"FGLinearActuator::Run " << InputNodes[0]->GetNameWithSign()
100 <<
" <module> parameter is forced from " << fixed <<
module
101 << " value to 1.0 value\n";
108 if (hysteresis < 0) {
110 log <<
"FGLinearActuator::Run " << InputNodes[0]->GetNameWithSign()
111 <<
" <hysteresis> parameter is forced from " << fixed << hysteresis
112 <<
" value to 0.0 value\n";
120 double denom = 2.00 + dt*lag;
121 ca = dt * lag / denom;
122 cb = (2.00 - dt * lag) / denom;
123 previousLagInput = previousLagOutput = 0.0;
127 log <<
"FGLinearActuator::Run " << InputNodes[0]->GetNameWithSign()
128 <<
" <lag> parameter is forced from " << fixed << lag
129 <<
" value to 0.0 value\n";
137 if (rate <= 0 || rate > 1.0) {
139 log <<
"FGLinearActuator::Run " << InputNodes[0]->GetNameWithSign()
140 <<
" <rate> parameter is forced from " << fixed << rate
141 <<
" value to 0.5 value\n";
149 bind(element, PropertyManager.get());
165 if (ptrSet && !ptrSet->IsConstant()) set = ptrSet->GetValue() >= 0.5;
166 if (ptrReset && !ptrReset->IsConstant()) reset = ptrReset->GetValue() >= 0.5;
176 Input = InputNodes[0]->getDoubleValue() - inputLast;
177 double inputDelta = Input - inputMem;
178 if (abs(inputDelta) >= hysteresis) {
179 if (ptrVersus && !ptrVersus->IsConstant()) {
180 versus = ptrVersus->GetValue();
183 }
else if (versus <= -0.5) {
187 if (abs(inputDelta) <= (module * rate)) {
188 if (inputDelta > 0.0) {
190 }
else if (inputDelta < 0.0) {
194 if ((versus == 0) || (versus == direction)) {
196 if (abs(inputDelta) >= (module*rate)) {
202 }
else if ((versus != 0) && (direction != 0) && (versus != direction)) {
203 inputLast += inputDelta;
207 if (ptrBias && !ptrBias->IsConstant()) {
208 bias = ptrBias->GetValue();
210 Output = gain * (bias + inputMem +
module*countSpin);
214 double input = Output;
215 Output = ca * (input + previousLagInput) + previousLagOutput * cb;
216 previousLagInput = input;
217 previousLagOutput = Output;