40 #include "FGDeadBand.h"
41 #include "math/FGParameterValue.h"
53 FGDeadBand::FGDeadBand(FGFCS* fcs, Element* element)
54 : FGFCSComponent(fcs, element)
59 CheckInputNodes(1, 1, element);
61 Element* width_element = element->FindElement(
"width");
63 Width =
new FGParameterValue(width_element, PropertyManager);
65 Width =
new FGRealValue(0.0);
67 if (element->FindElement(
"gain"))
68 gain = element->FindElementValueAsNumber(
"gain");
76 FGDeadBand::~FGDeadBand()
83 bool FGDeadBand::Run(
void)
85 Input = InputNodes[0]->getDoubleValue();
87 double HalfWidth = 0.5*Width;
89 if (Input < -HalfWidth) {
90 Output = (Input + HalfWidth)*gain;
91 }
else if (Input > HalfWidth) {
92 Output = (Input - HalfWidth)*gain;
122 void FGDeadBand::Debug(
int from)
124 if (debug_lvl <= 0)
return;
128 cout <<
" INPUT: " << InputNodes[0]->GetName() << endl;
129 cout <<
" DEADBAND WIDTH: " << Width->GetName() << endl;
130 cout <<
" GAIN: " << gain << endl;
132 for (
auto node: OutputNodes)
133 cout <<
" OUTPUT: " << node->getNameString() << endl;
136 if (debug_lvl & 2 ) {
137 if (from == 0) cout <<
"Instantiated: FGDeadBand" << endl;
138 if (from == 1) cout <<
"Destroyed: FGDeadBand" << endl;
140 if (debug_lvl & 4 ) {
142 if (debug_lvl & 8 ) {
144 if (debug_lvl & 16) {
146 if (debug_lvl & 64) {