JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++

FGActuator.h

00001 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00002 
00003  Header:       FGActuator.h
00004  Author:       Jon Berndt
00005  Date started: 21 February 2007
00006 
00007  ------------- Copyright (C) 2006 Jon S. Berndt (jon@jsbsim.org) -------------
00008 
00009  This program is free software; you can redistribute it and/or modify it under
00010  the terms of the GNU Lesser General Public License as published by the Free Software
00011  Foundation; either version 2 of the License, or (at your option) any later
00012  version.
00013 
00014  This program is distributed in the hope that it will be useful, but WITHOUT
00015  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00016  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00017  details.
00018 
00019  You should have received a copy of the GNU Lesser General Public License along with
00020  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021  Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00023  Further information about the GNU Lesser General Public License can also be found on
00024  the world wide web at http://www.gnu.org.
00025 
00026 HISTORY
00027 --------------------------------------------------------------------------------
00028 
00029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00030 SENTRY
00031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00032 
00033 #ifndef FGACTUATOR_H
00034 #define FGACTUATOR_H
00035 
00036 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00037 INCLUDES
00038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00039 
00040 #include "FGFCSComponent.h"
00041 #include "input_output/FGXMLElement.h"
00042 
00043 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00044 DEFINITIONS
00045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00046 
00047 #define ID_ACTUATOR "$Id: FGActuator.h,v 1.15 2013/01/26 17:06:50 bcoconni Exp $"
00048 
00049 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00050 FORWARD DECLARATIONS
00051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00052 
00053 namespace JSBSim {
00054 
00055 class FGFCS;
00056 
00057 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00058 CLASS DOCUMENTATION
00059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00060 
00126 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00127 CLASS DECLARATION
00128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
00129 
00130 class FGActuator  : public FGFCSComponent
00131 {
00132 public:
00134   FGActuator(FGFCS* fcs, Element* element);
00136   ~FGActuator();
00137 
00141   bool Run (void);
00142 
00143   // these may need to have the bool argument replaced with a double
00147   void SetFailZero(bool set) {fail_zero = set;}
00148   void SetFailHardover(bool set) {fail_hardover = set;}
00149   void SetFailStuck(bool set) {fail_stuck = set;}
00150 
00151   bool GetFailZero(void) const {return fail_zero;}
00152   bool GetFailHardover(void) const {return fail_hardover;}
00153   bool GetFailStuck(void) const {return fail_stuck;}
00154   bool IsSaturated(void) const {return saturated;}
00155   
00156 private:
00157   double span;
00158   double bias;
00159   bool rate_limited;
00160   double rate_limit;
00161   double rate_limit_incr;
00162   double rate_limit_decr;
00163   FGPropertyNode_ptr rate_limit_incr_prop;
00164   FGPropertyNode_ptr rate_limit_decr_prop;
00165   double hysteresis_width;
00166   double deadband_width;
00167   double lag;
00168   double ca; // lag filter coefficient "a"
00169   double cb; // lag filter coefficient "b"
00170   double PreviousOutput;
00171   double PreviousHystOutput;
00172   double PreviousRateLimOutput;
00173   double PreviousLagInput;
00174   double PreviousLagOutput;
00175   bool fail_zero;
00176   bool fail_hardover;
00177   bool fail_stuck;
00178   bool initialized;
00179   bool saturated;
00180 
00181   void Hysteresis(void);
00182   void Lag(void);
00183   void RateLimit(void);
00184   void Deadband(void);
00185   void Bias(void);
00186 
00187   void bind(void);
00188 
00189   void Debug(int from);
00190 };
00191 }
00192 #endif