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 "../FGConfigFile.h"
50 #include "../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">
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>
100 An overall GAIN may be supplied that is multiplicative with the scheduled gain.
102 Note: as is the case with the Summer component, the input property name may
103 be immediately preceded by a minus sign to invert that signal.
105 Here is an example of a scheduled gain component specification:
107 \<COMPONENT NAME="Pitch Scheduled Gain 1" TYPE="SCHEDULED_GAIN">
108 INPUT fcs/pitch-gain-1
110 SCHEDULED_BY fcs/elevator-pos-rad
136 In the example above, we see the utility of the overall GAIN value in
137 effecting a degrees-to-radians conversion.
139 The aerosurface scale component is a modified version of the simple gain
140 component. The normal purpose
141 for this component is to take control inputs that range from -1 to +1 or
142 from 0 to +1 and scale them to match the expected inputs to a flight control
143 system. For instance, the normal and expected ability of a pilot to push or
144 pull on a control stick is about 50 pounds. The input to the pitch channelb
145 lock diagram of a flight control system is in units of pounds. Yet, the
146 joystick control input is usually in a range from -1 to +1. The form of the
147 aerosurface scaling component specification is:
149 \<COMPONENT NAME="name" TYPE="AEROSURFACE_SCALE">
157 Note: as is the case with the Summer component, the input property name may be
158 immediately preceded by a minus sign to invert that signal.
160 @author Jon S. Berndt
164 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
168 class FGGain : public FGFCSComponent
171 FGGain(FGFCS* fcs, FGConfigFile* AC_cfg);
174 double GetOutputPct() const { return OutputPct; }
179 FGConfigFile* AC_cfg;
187 FGPropertyManager* ScheduledBy;
189 void Debug(int from);