JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGActuator.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGActuator.h
4  Author: Jon Berndt
5  Date started: 21 February 2007
6 
7  ------------- Copyright (C) 2006 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 FGACTUATOR_H
34 #define FGACTUATOR_H
35 
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39 
40 #include "FGFCSComponent.h"
41 
42 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 FORWARD DECLARATIONS
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
45 
46 namespace JSBSim {
47 
48 class FGFCS;
49 
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 CLASS DOCUMENTATION
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 
123 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 CLASS DECLARATION
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
126 
128 {
129 public:
131  FGActuator(FGFCS* fcs, Element* element);
133  ~FGActuator();
134 
138  bool Run (void) override;
139  void ResetPastStates(void) override;
140 
141  // these may need to have the bool argument replaced with a double
145  void SetFailZero(bool set) {fail_zero = set;}
146  void SetFailHardover(bool set) {fail_hardover = set;}
147  void SetFailStuck(bool set) {fail_stuck = set;}
148 
149  bool GetFailZero(void) const {return fail_zero;}
150  bool GetFailHardover(void) const {return fail_hardover;}
151  bool GetFailStuck(void) const {return fail_stuck;}
152  bool IsSaturated(void) const {return saturated;}
153 
154 private:
155  //double span;
156  double bias;
157  FGParameter* rate_limit_incr;
158  FGParameter* rate_limit_decr;
159  double hysteresis_width;
160  double deadband_width;
161  FGParameter* lag;
162  double lagVal;
163  double ca; // lag filter coefficient "a"
164  double cb; // lag filter coefficient "b"
165  double PreviousOutput;
166  double PreviousHystOutput;
167  double PreviousRateLimOutput;
168  double PreviousLagInput;
169  double PreviousLagOutput;
170  bool fail_zero;
171  bool fail_hardover;
172  bool fail_stuck;
173  bool initialized;
174  bool saturated;
175 
176  void Hysteresis(void);
177  void Lag(void);
178  void RateLimit(void);
179  void Deadband(void);
180  void Bias(void);
181 
182  void bind(Element* el) override;
183 
184  void InitializeLagCoefficients();
185 
186  void Debug(int from) override;
187 };
188 }
189 #endif
JSBSim::FGFCSComponent
Base class for JSBSim Flight Control System Components.
Definition: FGFCSComponent.h:84
JSBSim::FGActuator::Run
bool Run(void) override
This function processes the input.
Definition: FGActuator.cpp:143
JSBSim::FGActuator::SetFailZero
void SetFailZero(bool set)
This function fails the actuator to zero.
Definition: FGActuator.h:145
JSBSim::FGActuator::~FGActuator
~FGActuator()
Destructor.
Definition: FGActuator.cpp:120
JSBSim::FGActuator::FGActuator
FGActuator(FGFCS *fcs, Element *element)
Constructor.
Definition: FGActuator.cpp:53
JSBSim::FGFCS
Encapsulates the Flight Control System (FCS) functionality.
Definition: FGFCS.h:187
JSBSim::FGActuator
Encapsulates an Actuator component for the flight control system.
Definition: FGActuator.h:127
JSBSim::Element
Definition: FGXMLElement.h:143