]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_controlInput.cpp
- catch exception from readProperties and exit
[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 <simgear/compiler.h>
69
70 #include "uiuc_controlInput.h"
71
72 #include STL_IOSTREAM
73
74 void uiuc_controlInput()
75 {
76   // elevator step input
77   if (elevator_step)
78     {
79       if (Simtime >= elevator_step_startTime)
80         {
81           elevator = elevator + elevator_step_angle;
82         }
83     }
84
85   // elevator singlet input
86   if (elevator_singlet)
87     {
88       if (Simtime >= elevator_singlet_startTime && 
89           Simtime <= (elevator_singlet_startTime + elevator_singlet_duration))
90         {
91           elevator = elevator + elevator_singlet_angle;
92         }
93     }
94
95   // elevator doublet input
96   if (elevator_doublet)
97     {
98       if (Simtime >= elevator_doublet_startTime && 
99           Simtime <= (elevator_doublet_startTime + elevator_doublet_duration/2))
100         {
101           elevator = elevator + elevator_doublet_angle;
102         }
103       else if (Simtime >= (elevator_doublet_startTime + elevator_doublet_duration/2) && 
104                Simtime <= (elevator_doublet_startTime + elevator_doublet_duration))
105         {
106           elevator = elevator - elevator_doublet_angle;
107         }
108     }
109
110   // elevator input
111   if (elevator_input)
112     {
113       double elevator_input_endTime = elevator_input_timeArray[elevator_input_ntime];
114       if (Simtime >= elevator_input_startTime && 
115           Simtime <= (elevator_input_startTime + elevator_input_endTime))
116         {
117           double time = Simtime - elevator_input_startTime;
118           elevator = elevator + 
119             uiuc_1Dinterpolation(elevator_input_timeArray,
120                                  elevator_input_deArray,
121                                  elevator_input_ntime,
122                                  time);
123         }
124     }
125   return;
126 }
127
128 // end uiuc_controlInput.cpp