]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_controlInput.cpp
f4b22682b448674b2e2ea778a774afeba744bb14
[flightgear.git] / src / FDM / UIUCModel / uiuc_controlInput.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_controlInput.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  sets control surface deflections for specified input 
8                modes
9
10 ----------------------------------------------------------------------
11
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15
16  REFERENCES:   
17
18 ----------------------------------------------------------------------
19
20  HISTORY:      04/08/2000   initial release
21
22 ----------------------------------------------------------------------
23
24  AUTHOR(S):    Jeff Scott         <jscott@mail.com>
25
26 ----------------------------------------------------------------------
27
28  VARIABLES:
29
30 ----------------------------------------------------------------------
31
32  INPUTS:       -Simtime
33                -deflection times
34                -deflection angles
35
36 ----------------------------------------------------------------------
37
38  OUTPUTS:      -elevator deflection
39
40 ----------------------------------------------------------------------
41
42  CALLED BY:    uiuc_coefficients.cpp
43
44 ----------------------------------------------------------------------
45
46  CALLS TO:     none
47
48 ----------------------------------------------------------------------
49
50  COPYRIGHT:    (C) 2000 by Michael Selig
51
52  This program is free software; you can redistribute it and/or
53  modify it under the terms of the GNU General Public License
54  as published by the Free Software Foundation.
55
56  This program is distributed in the hope that it will be useful,
57  but WITHOUT ANY WARRANTY; without even the implied warranty of
58  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59  GNU General Public License for more details.
60
61  You should have received a copy of the GNU General Public License
62  along with this program; if not, write to the Free Software
63  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
64  USA or view http://www.gnu.org/copyleft/gpl.html.
65
66 **********************************************************************/
67
68 #include "uiuc_controlInput.h"
69 #include <iostream.h>
70
71 void uiuc_controlInput()
72 {
73   // elevator step input
74   if (elevator_step)
75     {
76       if (Simtime >= elevator_step_startTime)
77         {
78           elevator = elevator + elevator_step_angle;
79         }
80     }
81
82   // elevator singlet input
83   if (elevator_singlet)
84     {
85       if (Simtime >= elevator_singlet_startTime && 
86           Simtime <= (elevator_singlet_startTime + elevator_singlet_duration))
87         {
88           elevator = elevator + elevator_singlet_angle;
89         }
90     }
91
92   // elevator doublet input
93   if (elevator_doublet)
94     {
95       if (Simtime >= elevator_doublet_startTime && 
96           Simtime <= (elevator_doublet_startTime + elevator_doublet_duration/2))
97         {
98           elevator = elevator + elevator_doublet_angle;
99         }
100       else if (Simtime >= (elevator_doublet_startTime + elevator_doublet_duration/2) && 
101                Simtime <= (elevator_doublet_startTime + elevator_doublet_duration))
102         {
103           elevator = elevator - elevator_doublet_angle;
104         }
105     }
106
107   // elevator input
108   if (elevator_input)
109     {
110       double elevator_input_endTime = elevator_input_timeArray[elevator_input_ntime];
111       if (Simtime >= elevator_input_startTime && 
112           Simtime <= (elevator_input_startTime + elevator_input_endTime))
113         {
114           double time = Simtime - elevator_input_startTime;
115           elevator = elevator + 
116             uiuc_1Dinterpolation(elevator_input_timeArray,
117                                  elevator_input_deArray,
118                                  elevator_input_ntime,
119                                  time);
120         }
121     }
122   return;
123 }
124
125 // end uiuc_controlInput.cpp