1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
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 General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 # include <simgear/compiler.h>
48 #include "FGFCSComponent.h"
49 #include <input_output/FGXMLElement.h>
50 #include <math/FGTable.h>
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 #define ID_GAIN "$Id$"
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
70 /** Encapsulates a gain component for the flight control system.
71 The gain component merely multiplies the input by a gain. The form of the
72 gain component specification is:
74 \<component name="name" type="PURE_GAIN">
75 \<input> property \</input>
76 \<gain> value \</gain>
77 [\<output> property \</output>]
80 Note: as is the case with the Summer component, the input property name may be
81 immediately preceded by a minus sign to invert that signal.
83 The scheduled gain component multiplies the input by a variable gain that is
84 dependent on another property (such as qbar, altitude, etc.). The lookup
85 mapping is in the form of a table. This kind of component might be used, for
86 example, in a case where aerosurface deflection must only be commanded to
87 acceptable settings - i.e at higher qbar the commanded elevator setting might
88 be attenuated. The form of the scheduled gain component specification is:
90 \<COMPONENT NAME="name" TYPE="SCHEDULED_GAIN">
93 SCHEDULED_BY \<property>
94 ROWS \<number_of_rows>
95 \<lookup_value gain_value>
97 [CLIPTO \<min> \<max> 1]
101 An overall GAIN may be supplied that is multiplicative with the scheduled gain.
103 Note: as is the case with the Summer component, the input property name may
104 be immediately preceded by a minus sign to invert that signal.
106 Here is an example of a scheduled gain component specification:
108 \<COMPONENT NAME="Pitch Scheduled Gain 1" TYPE="SCHEDULED_GAIN">
109 INPUT fcs/pitch-gain-1
111 SCHEDULED_BY fcs/elevator-pos-rad
137 In the example above, we see the utility of the overall GAIN value in
138 effecting a degrees-to-radians conversion.
140 The aerosurface scale component is a modified version of the simple gain
141 component. The normal purpose
142 for this component is to take control inputs that range from -1 to +1 or
143 from 0 to +1 and scale them to match the expected inputs to a flight control
144 system. For instance, the normal and expected ability of a pilot to push or
145 pull on a control stick is about 50 pounds. The input to the pitch channelb
146 lock diagram of a flight control system is in units of pounds. Yet, the
147 joystick control input is usually in a range from -1 to +1. The form of the
148 aerosurface scaling component specification is:
150 \<COMPONENT NAME="name" TYPE="AEROSURFACE_SCALE">
158 Note: as is the case with the Summer component, the input property name may be
159 immediately preceded by a minus sign to invert that signal.
161 @author Jon S. Berndt
165 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
169 class FGGain : public FGFCSComponent
172 FGGain(FGFCS* fcs, Element* element);
179 FGPropertyManager* GainPropertyNode;
181 double InMin, InMax, OutMin, OutMax;
185 void Debug(int from);