![]() |
JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++
|
00001 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00002 00003 Header: FGFilter.h 00004 Author: Jon S. Berndt 00005 Date started: 4/2000 00006 00007 ------------- Copyright (C) 2000 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 FGFILTER_H 00034 #define FGFILTER_H 00035 00036 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00037 INCLUDES 00038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 00039 00040 #include "FGFCSComponent.h" 00041 00042 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00043 DEFINITIONS 00044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 00045 00046 #define ID_FILTER "$Id: FGFilter.h,v 1.13 2013/01/26 17:06:50 bcoconni Exp $" 00047 00048 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00049 FORWARD DECLARATIONS 00050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 00051 00052 namespace JSBSim { 00053 00054 class Element; 00055 class FGPropertyManager; 00056 class FGFCS; 00057 00058 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00059 CLASS DOCUMENTATION 00060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 00061 00235 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00236 CLASS DECLARATION 00237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 00238 00239 class FGFilter : public FGFCSComponent 00240 { 00241 public: 00242 FGFilter(FGFCS* fcs, Element* element); 00243 ~FGFilter(); 00244 00245 bool Run (void); 00246 00249 bool Initialize; 00250 void ResetPastStates(void) {Input = 0.0; Initialize = true;} 00251 00252 enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType; 00253 00254 private: 00255 double ca; 00256 double cb; 00257 double cc; 00258 double cd; 00259 double ce; 00260 double C[7]; // There are 6 coefficients, indexing is "1" based. 00261 double PropertySign[7]; 00262 double PreviousInput1; 00263 double PreviousInput2; 00264 double PreviousOutput1; 00265 double PreviousOutput2; 00266 FGPropertyNode_ptr Trigger; 00267 FGPropertyNode_ptr PropertyNode[7]; 00268 void CalculateDynamicFilters(void); 00269 void ReadFilterCoefficients(Element* el, int index); 00270 bool DynamicFilter; 00271 void Debug(int from); 00272 }; 00273 } 00274 #endif 00275