| 1 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 | |
| 3 | Header: FGSummer.h |
| 4 | Author: |
| 5 | Date started: |
| 6 | |
| 7 | ------------- Copyright (C) ------------- |
| 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 FGSUMMER_H |
| 34 | #define FGSUMMER_H |
| 35 | |
| 36 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 37 | INCLUDES |
| 38 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 39 | |
| 40 | #include "FGFCSComponent.h" |
| 41 | |
| 42 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 43 | FORWARD DECLARATIONS |
| 44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 45 | |
| 46 | namespace JSBSim { |
| 47 | |
| 48 | class Element; |
| 49 | |
| 50 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 51 | CLASS DOCUMENTATION |
| 52 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 53 | |
| 54 | /** Models a flight control system summing component. |
| 55 | The Summer component sums two or more inputs. These can be pilot control |
| 56 | inputs or state variables, and a bias can also be added in using the BIAS |
| 57 | keyword. The form of the summer component specification is: |
| 58 | @code |
| 59 | <summer name="{string}"> |
| 60 | <input> {string} </input> |
| 61 | <input> {string} </input> |
| 62 | <bias> {number} </bias> |
| 63 | <clipto> |
| 64 | <min> {number} </min> |
| 65 | <max> {number} </max> |
| 66 | </clipto> |
| 67 | <output> {string} </output> |
| 68 | </summer> |
| 69 | @endcode |
| 70 | |
| 71 | Note that in the case of an input property the property name may be |
| 72 | immediately preceded by a minus sign. Here's an example of a summer |
| 73 | component specification: |
| 74 | |
| 75 | @code |
| 76 | <summer name="Roll A/P Error summer"> |
| 77 | <input> velocities/p-rad_sec </input> |
| 78 | <input> -fcs/roll-ap-wing-leveler </input> |
| 79 | <input> fcs/roll-ap-error-integrator </input> |
| 80 | <clipto> |
| 81 | <min> -1 </min> |
| 82 | <max> 1 </max> |
| 83 | </clipto> |
| 84 | </summer> |
| 85 | @endcode |
| 86 | |
| 87 | <pre> |
| 88 | Notes: |
| 89 | |
| 90 | There can be only one BIAS statement per component. |
| 91 | |
| 92 | There may be any number of inputs. |
| 93 | </pre> |
| 94 | |
| 95 | @author Jon S. Berndt |
| 96 | */ |
| 97 | |
| 98 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 99 | CLASS DECLARATION |
| 100 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 101 | |
| 102 | class FGSummer : public FGFCSComponent |
| 103 | { |
| 104 | public: |
| 105 | /** Constructor. |
| 106 | @param fcs a pointer to the parent FGFCS object. |
| 107 | @param element a pointer to the configuration file node. */ |
| 108 | FGSummer(FGFCS* fcs, Element* element); |
| 109 | /// Destructor |
| 110 | ~FGSummer(); |
| 111 | |
| 112 | /// The execution method for this FCS component. |
| 113 | bool Run(void) override; |
| 114 | |
| 115 | private: |
| 116 | double Bias; |
| 117 | void Debug(int from) override; |
| 118 | }; |
| 119 | } |
| 120 | #endif |