--- /dev/null
+
+/*******************************************************************************
+
+ Module: FGDeadBand.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGDeadBand.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGDeadBand::FGDeadBand(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+ AC_cfg->GetNextConfigLine();
+ string token;
+
+ while ((token = AC_cfg->GetValue()) != "/COMPONENT") {
+ *AC_cfg >> token;
+ if (token == "ID") {
+ *AC_cfg >> ID;
+ } else if (token == "INPUT") {
+ *AC_cfg >> InputIdx;
+ } else {
+ *AC_cfg >> token;
+ }
+ }
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGDeadBand::Run(void )
+{
+ FGFCSComponent::Run(); // call the base class for initialization of Input
+
+ return true;
+}
+
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGDeadBand.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGDEADBAND_H
+#define FGDEADBAND_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+class FGFCS;
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGDeadBand : public FGFCSComponent
+{
+ FGConfigFile* AC_cfg;
+
+public:
+ FGDeadBand(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~ FGDeadBand ( ) { } //Destructor
+
+ bool Run (void ) ;
+};
+
+#endif
--- /dev/null
+
+/*******************************************************************************
+
+ Module: FGFCSComponent.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFCSComponent.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: Constructor
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
+{
+ Type = "";
+ ID = 0;
+ Input = 0.0;
+ InputIdx = 0;
+ Output = 0.0;
+ sOutputIdx = "";
+ OutputIdx = 0;
+ IsOutput = false;
+}
+
+
+void FGFCSComponent::SetOutput(void)
+{
+ fcs->GetState()->SetParameter(OutputIdx, Output);
+}
+
+
+bool FGFCSComponent::Run(void)
+{
+ switch(InputType) {
+ case itPilotAC:
+ Input = fcs->GetState()->GetParameter(InputIdx);
+ break;
+ case itFCS:
+ Input = fcs->GetComponentOutput(InputIdx);
+ break;
+ case itAP:
+ // implement autopilot input mechanism
+ break;
+ }
+
+ return true;
+}
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGFCSComponent.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGFCSCOMPONENT_H
+#define FGFCSCOMPONENT_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#ifdef FGFS
+# include <simgear/compiler.h>
+# include STL_STRING
+ FG_USING_STD(string);
+#else
+# include <string>
+#endif
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+class FGFCS;
+
+using namespace std;
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGFCSComponent
+{
+private:
+
+protected:
+ FGFCS* fcs;
+ string Type;
+ string Name;
+ enum {itPilotAC, itFCS, itAP} InputType; // Pilot/Aircraft, FCS, Autopilot inputs
+ int ID;
+ int InputIdx;
+ float Input;
+ string sOutputIdx;
+ int OutputIdx;
+ float Output;
+ bool IsOutput;
+
+public:
+ FGFCSComponent(FGFCS*);
+ ~FGFCSComponent ( ) { } //Destructor
+
+ virtual bool Run (void);
+ virtual void SetOutput(void);
+ inline float GetOutput (void) {return Output;}
+ inline string GetName(void) {return Name;}
+};
+
+#include <FDM/JSBsim/FGFCS.h>
+
+#endif
+
--- /dev/null
+/*******************************************************************************
+
+ Module: FGFilter.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFilter.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: constructor
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ string token;
+
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+ AC_cfg->GetNextConfigLine();
+
+ C1 = C2 = C3 = C4 = C5 = C6 = 0.0;
+
+ if (Type == "LAG_FILTER") FilterType = eLag ;
+ else if (Type == "RECT_LAG_FILTER") FilterType = eRectLag ;
+ else if (Type == "LEAD_LAG_FILTER") FilterType = eLeadLag ;
+ else if (Type == "SECOND_ORDER_FILTER") FilterType = eOrder2 ;
+ else if (Type == "WASHOUT_FILTER") FilterType = eWashout ;
+ else if (Type == "INTEGRATOR") FilterType = eIntegrator ;
+ else FilterType = eUnknown ;
+
+ while ((token = AC_cfg->GetValue()) != "/COMPONENT") {
+ *AC_cfg >> token;
+ if (token == "ID") {
+ *AC_cfg >> ID;
+ } else if (token == "INPUT") {
+ token = AC_cfg->GetValue("INPUT");
+ if (token.find("FG_") != token.npos) {
+ *AC_cfg >> token;
+ InputIdx = fcs->GetState()->GetParameterIndex(token);
+ InputType = itPilotAC;
+ } else {
+ *AC_cfg >> InputIdx;
+ InputType = itFCS;
+ }
+ } else if (token == "C1") {
+ *AC_cfg >> C1;
+ } else if (token == "C2") {
+ *AC_cfg >> C2;
+ } else if (token == "C3") {
+ *AC_cfg >> C3;
+ } else if (token == "C4") {
+ *AC_cfg >> C4;
+ } else if (token == "C5") {
+ *AC_cfg >> C5;
+ } else if (token == "C6") {
+ *AC_cfg >> C6;
+ }
+ }
+
+ switch (FilterType) {
+ case eLag:
+ ca = dt*C1 / (2.00 + dt*C1);
+ cb = (2.00 - dt*C1) / (2.00 + dt*C1);
+ break;
+ case eRectLag:
+ break;
+ case eLeadLag:
+ break;
+ case eOrder2:
+ break;
+ case eWashout:
+ break;
+ case eIntegrator:
+ break;
+ }
+
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGFilter::Run(void)
+{
+ FGFCSComponent::Run(); // call the base class for initialization of Input
+
+ switch (FilterType) {
+ case eLag:
+ break;
+ case eRectLag:
+ break;
+ case eLeadLag:
+ break;
+ case eOrder2:
+ break;
+ case eWashout:
+ break;
+ case eIntegrator:
+ break;
+ }
+
+ PreviousOutput2 = PreviousOutput1;
+ PreviousOutput1 = Output;
+ PreviousInput2 = PreviousInput1;
+ PreviousInput1 = Input;
+
+ return true;
+}
+
--- /dev/null
+/*******************************************************************************
+
+ Header: FGFilter.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGFILTER_H
+#define FGFILTER_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGFilter : public FGFCSComponent
+{
+ float dt;
+ float ca;
+ float cb;
+ float cc;
+ float cd;
+ float C1;
+ float C2;
+ float C3;
+ float C4;
+ float C5;
+ float C6;
+ float PreviousInput1;
+ float PreviousInput2;
+ float PreviousOutput1;
+ float PreviousOutput2;
+ FGConfigFile* AC_cfg;
+
+protected:
+ enum {eLag, eRectLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;
+
+public:
+ FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~FGFilter ( ) { } //Destructor
+
+ bool Run (void);
+};
+
+#endif
--- /dev/null
+/*******************************************************************************
+
+ Module: FGGain.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGGain.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: Constructor
+// Purpose: Builds a Gain-type of FCS component.
+// Parameters: void
+// Comments: Types are PURE_GAIN, SCHEDULED_GAIN, and AEROSURFACE_SCALE
+
+FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ string token;
+
+ lookup = NULL;
+ Schedule.clear();
+ Gain = 1.000;
+ Min = Max = 0;
+ ScheduledBy = 0;
+
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+ AC_cfg->GetNextConfigLine();
+
+ while ((token = AC_cfg->GetValue()) != "/COMPONENT") {
+ *AC_cfg >> token;
+ if (token == "ID") {
+ *AC_cfg >> ID;
+ } else if (token == "INPUT") {
+ token = AC_cfg->GetValue("INPUT");
+ if (token.find("FG_") != token.npos) {
+ *AC_cfg >> token;
+ InputIdx = fcs->GetState()->GetParameterIndex(token);
+ InputType = itPilotAC;
+ } else {
+ *AC_cfg >> InputIdx;
+ InputType = itFCS;
+ }
+ } else if (token == "GAIN") {
+ *AC_cfg >> Gain;
+ } else if (token == "MIN") {
+ *AC_cfg >> Min;
+ } else if (token == "MAX") {
+ *AC_cfg >> Max;
+ } else if (token == "SCHEDULED_BY") {
+ *AC_cfg >> ScheduledBy;
+ } else {
+ AC_cfg->ResetLineIndexToZero();
+ lookup = new float[2];
+ *AC_cfg >> lookup[0] >> lookup[1];
+ Schedule.push_back(lookup);
+ }
+ }
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGGain::Run(void )
+{
+ float SchedGain = 1.0;
+
+ FGFCSComponent::Run(); // call the base class for initialization of Input
+
+ if (Type == "PURE_GAIN") {
+
+ Output = Gain * Input;
+
+ } else if (Type == "SCHEDULED_GAIN") {
+
+ float LookupVal = fcs->GetState()->GetParameter(ScheduledBy);
+ unsigned int last = Schedule.size()-1;
+ float lowVal = Schedule[0][0], hiVal = Schedule[last][0];
+ float factor = 1.0;
+
+ if (LookupVal <= lowVal) Output = Gain * Schedule[0][1];
+ else if (LookupVal >= hiVal) Output = Gain * Schedule[last][1];
+ else {
+ for (unsigned int ctr = 1; ctr < last; ctr++) {
+ if (LookupVal < Schedule[ctr][0]) {
+ hiVal = Schedule[ctr][0];
+ lowVal = Schedule[ctr-1][0];
+ factor = (LookupVal - lowVal) / (hiVal - lowVal);
+ SchedGain = Schedule[ctr-1][1] + factor*(Schedule[ctr][1] - Schedule[ctr-1][1]);
+ Output = Gain * SchedGain * Input;
+ break;
+ }
+ }
+ }
+
+ } else if (Type == "AEROSURFACE_SCALE") {
+
+ if (Output >= 0.0) Output = Input * Max;
+ else Output = Input * (-Min);
+ }
+
+ return true;
+}
+
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGGain.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGGAIN_H
+#define FGGAIN_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#ifdef FGFS
+# include <simgear/compiler.h>
+# include STL_STRING
+ FG_USING_STD(string);
+# ifdef FG_HAVE_STD_INCLUDES
+# include <vector>
+# else
+# include <vector.h>
+# endif
+#else
+# include <vector>
+# include <string>
+#endif
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+class FGFCS;
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGGain : public FGFCSComponent
+{
+ FGConfigFile* AC_cfg;
+ float Gain;
+ float* lookup;
+ vector< float* > Schedule;
+ float Min, Max;
+ int ScheduledBy;
+
+public:
+ FGGain(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~FGGain ( ) { } //Destructor
+
+ bool Run (void);
+};
+
+#endif
--- /dev/null
+
+/*******************************************************************************
+
+ Module: FGGradient.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGGradient.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGGradient::FGGradient(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGGradient::Run(void )
+{
+ FGFCSComponent::Run(); // call the base class for initialization of Input
+
+ return true;
+}
+
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGGradient.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGGRADIENT_H
+#define FGGRADIENT_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+class FGFCS;
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGGradient : public FGFCSComponent
+{
+ FGConfigFile* AC_cfg;
+
+public:
+ FGGradient(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~ FGGradient ( ) { } //Destructor
+
+ bool Run (void ) ;
+};
+
+#endif
--- /dev/null
+
+/*******************************************************************************
+
+ Module: FGSummer.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGSummer.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: Constructor
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ string token;
+ int tmpInputIndex;
+
+ InputIndices.clear();
+ InputTypes.clear();
+
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+ AC_cfg->GetNextConfigLine();
+
+ while ((token = AC_cfg->GetValue()) != "/COMPONENT") {
+ *AC_cfg >> token;
+ if (token == "ID") {
+ *AC_cfg >> ID;
+ } else if (token == "INPUT") {
+ token = AC_cfg->GetValue("INPUT");
+ if (token.find("FG_") != token.npos) {
+ *AC_cfg >> token;
+ tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
+ InputIndices.push_back(tmpInputIndex);
+ InputTypes.push_back(itPilotAC);
+ } else {
+ *AC_cfg >> tmpInputIndex;
+ InputIndices.push_back(tmpInputIndex);
+ InputTypes.push_back(itFCS);
+ }
+ } else if (token == "OUTPUT") {
+ IsOutput = true;
+ *AC_cfg >> sOutputIdx;
+ OutputIdx = fcs->GetState()->GetParameterIndex(sOutputIdx);
+ }
+ }
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGSummer::Run(void )
+{
+ unsigned int idx;
+
+ // The Summer takes several inputs, so do not call the base class Run()
+ // FGFCSComponent::Run();
+
+ Output = 0.0;
+ for (idx=0; idx<InputIndices.size(); idx++) {
+ switch (InputTypes[idx]) {
+ case itPilotAC:
+ Output += fcs->GetState()->GetParameter(InputIndices[idx]);
+ break;
+ case itFCS:
+ Output += fcs->GetComponentOutput(InputIndices[idx]);
+ break;
+ }
+ }
+
+ if (IsOutput) SetOutput();
+
+ return true;
+}
+
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGSummer.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGSUMMER_H
+#define FGSUMMER_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#ifdef FGFS
+# include <simgear/compiler.h>
+# include STL_STRING
+ FG_USING_STD(string);
+# ifdef FG_HAVE_STD_INCLUDES
+# include <vector>
+# else
+# include <vector.h>
+# endif
+#else
+# include <vector>
+# include <string>
+#endif
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGSummer : public FGFCSComponent
+{
+ FGConfigFile* AC_cfg;
+ vector<int> InputIndices;
+ vector<int> InputTypes;
+
+public:
+ FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~FGSummer ( ) { } //Destructor
+
+ bool Run (void );
+};
+
+#endif
--- /dev/null
+
+/*******************************************************************************
+
+ Module: FGSwitch.cpp
+ Author:
+ Date started:
+
+ ------------- Copyright (C) 2000 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGSwitch.h"
+
+/*******************************************************************************
+************************************ CODE **************************************
+*******************************************************************************/
+
+// *****************************************************************************
+// Function: constructor
+// Purpose:
+// Parameters: void
+// Comments:
+
+FGSwitch::FGSwitch(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
+ AC_cfg(AC_cfg)
+{
+ Type = AC_cfg->GetValue("TYPE");
+ Name = AC_cfg->GetValue("NAME");
+}
+
+// *****************************************************************************
+// Function: Run
+// Purpose:
+// Parameters: void
+// Comments:
+
+bool FGSwitch::Run(void )
+{
+ FGFCSComponent::Run(); // call the base class for initialization of Input
+
+ return true;
+}
+
--- /dev/null
+
+/*******************************************************************************
+
+ Header: FGSwitch.h
+ Author:
+ Date started:
+
+ ------------- Copyright (C) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+
+********************************************************************************
+COMMENTS, REFERENCES, and NOTES
+********************************************************************************
+
+********************************************************************************
+SENTRY
+*******************************************************************************/
+
+#ifndef FGSWITCH_H
+#define FGSWITCH_H
+
+/*******************************************************************************
+INCLUDES
+*******************************************************************************/
+
+#include "FGFCSComponent.h"
+#include "../FGConfigFile.h"
+
+/*******************************************************************************
+DEFINES
+*******************************************************************************/
+
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
+class FGSwitch : public FGFCSComponent
+{
+ FGFCS* fcs;
+ FGConfigFile* AC_cfg;
+
+public:
+ FGSwitch(FGFCS* fcs, FGConfigFile* AC_cfg);
+ ~ FGSwitch ( ) { } //Destructor
+
+ bool Run (void ) ;
+};
+
+#endif
--- /dev/null
+EXTRA_DIST = Makefile.solo
+
+noinst_LIBRARIES = libfiltersjb.a
+
+libfiltersjb_a_SOURCES = \
+ FGDeadBand.cpp FGDeadBand.h \
+ FGFCSComponent.cpp FGFCSComponent.h \
+ FGFilter.cpp FGFilter.h \
+ FGGain.cpp FGGain.h \
+ FGGradient.cpp FGGradient.h \
+ FGSummer.cpp FGSummer.h \
+ FGSwitch.cpp FGSwitch.h
+
+INCLUDES += -I$(top_builddir)/src
+
+DEFS += -DFGFS