]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/flight_control/FGFilter.h
Sync. with JSBSim (CVS) again
[flightgear.git] / src / FDM / JSBSim / models / flight_control / FGFilter.h
index 5ff57e7cf215fcc39758ed97d0c4093276880389..c7c0a4143b2933d523f06bbffb6c461a7cc706e0 100644 (file)
@@ -4,23 +4,23 @@
  Author:       Jon S. Berndt
  Date started: 4/2000
 
- ------------- Copyright (C) 2000 Jon S. Berndt jsb@hal-pc.org -------------
+ ------------- Copyright (C) 2000 Jon S. Berndt jon@jsbsim.org -------------
 
  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
+ the terms of the GNU Lesser 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
+ FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
  details.
 
- You should have received a copy of the GNU General Public License along with
+ You should have received a copy of the GNU Lesser 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
+ Further information about the GNU Lesser General Public License can also be found on
  the world wide web at http://www.gnu.org.
 
 HISTORY
@@ -64,12 +64,12 @@ time domain. The general format for a filter specification is:
 @code
 <typename name="name">
   <input> property </input>
-  <c1> value </c1>
-  [<c2> value </c2>]
-  [<c3> value </c3>]
-  [<c4> value </c4>]
-  [<c5> value </c5>]
-  [<c6> value </c6>]
+  <c1> value|property </c1>
+  [<c2> value|property </c2>]
+  [<c3> value|property </c3>]
+  [<c4> value|property </c4>]
+  [<c5> value|property </c5>]
+  [<c6> value|property </c6>]
   [<clipto>
     <min> {[-]property name | value} </min>
     <max> {[-]property name | value} </max>
@@ -91,7 +91,7 @@ the corresponding filter definition is:
 @code
 <lag_filter name="name">
   <input> property </input>
-  <c1> value </c1>
+  <c1> value|property </c1>
   [<clipto>
     <min> {[-]property name | value} </min>
     <max> {[-]property name | value} </max>
@@ -130,10 +130,10 @@ The corresponding filter definition is:
 @code
 <lead_lag_filter name="name">
   <input> property </input>
-  <c1> value <c/1>
-  <c2> value <c/2>
-  <c3> value <c/3>
-  <c4> value <c/4>
+  <c1> value|property <c/1>
+  <c2> value|property <c/2>
+  <c3> value|property <c/3>
+  <c4> value|property <c/4>
   [<clipto>
     <min> {[-]property name | value} </min>
     <max> {[-]property name | value} </max>
@@ -177,12 +177,12 @@ The corresponding filter definition is:
 @code
 <second_order_filter name="name">
   <input> property </input>
-  <c1> value </c1>
-  <c2> value </c2>
-  <c3> value </c3>
-  <c4> value </c4>
-  <c5> value </c5>
-  <c6> value </c6>
+  <c1> value|property </c1>
+  <c2> value|property </c2>
+  <c3> value|property </c3>
+  <c4> value|property </c4>
+  <c5> value|property </c5>
+  <c6> value|property </c6>
   [<clipto>
     <min> {[-]property name | value} </min>
     <max> {[-]property name | value} </max>
@@ -204,7 +204,7 @@ The corresponding filter definition is:
 @code
 <integrator name="name">
   <input> property </input>
-  <c1> value </c1>
+  <c1> value|property </c1>
   [<trigger> property </trigger>]
   [<clipto>
     <min> {[-]property name | value} </min>
@@ -244,7 +244,8 @@ public:
   /** When true, causes previous values to be set to current values. This
       is particularly useful for first pass. */
   bool Initialize;
-
+  void ResetPastStates(void) {Input = 0.0; Initialize = true;}
+  
   enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;
 
 private:
@@ -254,17 +255,17 @@ private:
   double cc;
   double cd;
   double ce;
-  double C1;
-  double C2;
-  double C3;
-  double C4;
-  double C5;
-  double C6;
+  double C[7]; // There are 6 coefficients, indexing is "1" based.
+  double PropertySign[7];
   double PreviousInput1;
   double PreviousInput2;
   double PreviousOutput1;
   double PreviousOutput2;
   FGPropertyManager* Trigger;
+  FGPropertyManager* PropertyNode[7];
+  void CalculateDynamicFilters(void);
+  void ReadFilterCoefficients(Element* el, int index);
+  bool DynamicFilter;
   void Debug(int from);
 };
 }