1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header:       FGFCSComponent.h
4  Author:       Jon S. Berndt
5  Date started: 05/01/2000
6 
7  ------------- Copyright (C) 2000 Jon S. Berndt (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free
11  Software Foundation; either version 2 of the License, or (at your option) any
12  later version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc., 59
21  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be
24  found on the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 SENTRY
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32 
33 #ifndef FGFCSCOMPONENT_H
34 #define FGFCSCOMPONENT_H
35 
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39 
40 #include "FGJSBBase.h"
41 #include "math/FGPropertyValue.h"
42 
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 FORWARD DECLARATIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 
47 namespace JSBSim {
48 
49 class FGFCS;
50 class Element;
51 
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 CLASS DOCUMENTATION
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 
56 /** Base class for JSBSim Flight Control System Components.
57     The Flight Control System (FCS) for JSBSim consists of the FCS container
58     class (see FGFCS), the FGFCSComponent base class, and the
59     component classes from which can be constructed a string, or channel. See:
60 
61     - FGSwitch
62     - FGGain
63     - FGKinemat
64     - FGFilter
65     - FGDeadBand
66     - FGSummer
67     - FGSensor
68     - FGFCSFunction
69     - FGPID
70     - FGAccelerometer
71     - FGGyro
72     - FGActuator
73     - FGWwaypoint
74     - FGAngle
75 
76     @author Jon S. Berndt
77     @see Documentation for the FGFCS class, and for the configuration file class
78 */
79 
80 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 CLASS DECLARATION
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
83 
84 class FGFCSComponent : public FGJSBBase
85 {
86 public:
87   /// Constructor
88   FGFCSComponent(FGFCS* fcs, Element* el);
89   /// Destructor
90   virtual ~FGFCSComponent();
91 
Run(void)92   virtual bool Run(void) { return true; }
93   virtual void SetOutput(void);
GetOutput(void)94   double GetOutput (void) const {return Output;}
GetName(void)95   std::string GetName(void) const {return Name;}
GetType(void)96   std::string GetType(void) const { return Type; }
GetOutputPct(void)97   virtual double GetOutputPct(void) const { return 0; }
98   virtual void ResetPastStates(void);
99 
100 protected:
101   FGFCS* fcs;
102   FGPropertyManager* PropertyManager;
103   std::vector <FGPropertyNode_ptr> OutputNodes;
104   FGParameter_ptr ClipMin, ClipMax;
105   std::vector <FGPropertyValue_ptr> InitNodes;
106   std::vector <FGPropertyValue_ptr> InputNodes;
107   std::vector <double> output_array;
108   std::string Type;
109   std::string Name;
110   double Input;
111   double Output;
112   double delay_time;
113   unsigned int delay;
114   int index;
115   double dt;
116   bool clip, cyclic_clip;
117 
118   void Delay(void);
119   void Clip(void);
120   virtual void bind(Element* el);
121   virtual void Debug(int from);
122 };
123 
124 } //namespace JSBSim
125 
126 #endif
127