]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp
Fixes to jsbsim.
[flightgear.git] / src / FDM / JSBSim / filtersjb / FGFCSComponent.cpp
1 /*******************************************************************************
2
3  Module:       FGFCSComponent.cpp
4  Author:       
5  Date started: 
6  
7  ------------- Copyright (C) 2000 -------------
8
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
12  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 General Public License for more
17  details.
18
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.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 --------------------------------------------------------------------------------
28
29 HISTORY
30 --------------------------------------------------------------------------------
31
32 ********************************************************************************
33 COMMENTS, REFERENCES,  and NOTES
34 ********************************************************************************
35
36 ********************************************************************************
37 INCLUDES
38 *******************************************************************************/
39
40 #include "FGFCSComponent.h"                             
41
42 /*******************************************************************************
43 ************************************ CODE **************************************
44 *******************************************************************************/
45
46 // *****************************************************************************
47 //  Function:   Constructor
48 //  Purpose:
49 //  Parameters: void
50 //  Comments:
51
52 FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
53 {
54   Type       = "";
55   ID         = 0;
56   Input      = 0.0;
57   InputIdx   = 0;
58   Output     = 0.0;
59   sOutputIdx  = "";
60   OutputIdx   = 0;
61   IsOutput   = false;
62 }
63
64
65 void FGFCSComponent::SetOutput(void)
66 {
67   fcs->GetState()->SetParameter(OutputIdx, Output);
68 }
69
70
71 bool FGFCSComponent::Run(void)
72 {
73   switch(InputType) {
74   case itPilotAC:
75     Input = fcs->GetState()->GetParameter(InputIdx);
76     break;
77   case itFCS:
78     Input = fcs->GetComponentOutput(InputIdx);
79     break;
80   case itAP:
81     // implement autopilot input mechanism
82     break;
83   }
84
85   return true;
86 }