1 /**********************************************************************
2
3 FILENAME: uiuc_icing_demo.cpp
4
5 ----------------------------------------------------------------------
6
7 DESCRIPTION:
8
9 ----------------------------------------------------------------------
10
11 STATUS: alpha version
12
13 ----------------------------------------------------------------------
14
15 REFERENCES:
16
17 ----------------------------------------------------------------------
18
19 HISTORY: 12/02/2002 initial release - originally in
20 uiuc_coefficients()
21
22 ----------------------------------------------------------------------
23
24 AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
25
26 ----------------------------------------------------------------------
27
28 VARIABLES:
29
30 ----------------------------------------------------------------------
31
32 INPUTS:
33
34 ----------------------------------------------------------------------
35
36 OUTPUTS:
37
38 ----------------------------------------------------------------------
39
40 CALLED BY: uiuc_coefficients
41
42 ----------------------------------------------------------------------
43
44 CALLS TO:
45
46 ----------------------------------------------------------------------
47
48 COPYRIGHT: (C) 2002 by Michael Selig
49
50 This program is free software; you can redistribute it and/or
51 modify it under the terms of the GNU General Public License
52 as published by the Free Software Foundation.
53
54 This program is distributed in the hope that it will be useful,
55 but WITHOUT ANY WARRANTY; without even the implied warranty of
56 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57 GNU General Public License for more details.
58
59 You should have received a copy of the GNU General Public License
60 along with this program; if not, write to the Free Software
61 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
62
63 **********************************************************************/
64
65 #include "uiuc_icing_demo.h"
66
uiuc_icing_demo()67 void uiuc_icing_demo()
68 {
69 // Envelope protection values
70 if (demo_eps_alpha_max) {
71 double time = Simtime - demo_eps_alpha_max_startTime;
72 eps_alpha_max = uiuc_1Dinterpolation(demo_eps_alpha_max_timeArray,
73 demo_eps_alpha_max_daArray,
74 demo_eps_alpha_max_ntime,
75 time);
76 }
77 if (demo_eps_pitch_max) {
78 double time = Simtime - demo_eps_pitch_max_startTime;
79 eps_pitch_max = uiuc_1Dinterpolation(demo_eps_pitch_max_timeArray,
80 demo_eps_pitch_max_daArray,
81 demo_eps_pitch_max_ntime,
82 time);
83 }
84 if (demo_eps_pitch_min) {
85 double time = Simtime - demo_eps_pitch_min_startTime;
86 eps_pitch_min = uiuc_1Dinterpolation(demo_eps_pitch_min_timeArray,
87 demo_eps_pitch_min_daArray,
88 demo_eps_pitch_min_ntime,
89 time);
90 }
91 if (demo_eps_roll_max) {
92 double time = Simtime - demo_eps_roll_max_startTime;
93 eps_roll_max = uiuc_1Dinterpolation(demo_eps_roll_max_timeArray,
94 demo_eps_roll_max_daArray,
95 demo_eps_roll_max_ntime,
96 time);
97 }
98 if (demo_eps_thrust_min) {
99 double time = Simtime - demo_eps_thrust_min_startTime;
100 eps_thrust_min = uiuc_1Dinterpolation(demo_eps_thrust_min_timeArray,
101 demo_eps_thrust_min_daArray,
102 demo_eps_thrust_min_ntime,
103 time);
104 }
105 if (demo_eps_airspeed_max) {
106 double time = Simtime - demo_eps_airspeed_max_startTime;
107 eps_airspeed_max = uiuc_1Dinterpolation(demo_eps_airspeed_max_timeArray,
108 demo_eps_airspeed_max_daArray,
109 demo_eps_airspeed_max_ntime,
110 time);
111 }
112 if (demo_eps_airspeed_min) {
113 double time = Simtime - demo_eps_airspeed_min_startTime;
114 eps_airspeed_min = uiuc_1Dinterpolation(demo_eps_airspeed_min_timeArray,
115 demo_eps_airspeed_min_daArray,
116 demo_eps_airspeed_min_ntime,
117 time);
118 }
119 if (demo_eps_flap_max) {
120 double time = Simtime - demo_eps_flap_max_startTime;
121 eps_flap_max = uiuc_1Dinterpolation(demo_eps_flap_max_timeArray,
122 demo_eps_flap_max_daArray,
123 demo_eps_flap_max_ntime,
124 time);
125 }
126 if (demo_eps_pitch_input) {
127 double time = Simtime - demo_eps_pitch_input_startTime;
128 eps_pitch_input = uiuc_1Dinterpolation(demo_eps_pitch_input_timeArray,
129 demo_eps_pitch_input_daArray,
130 demo_eps_pitch_input_ntime,
131 time);
132 }
133
134 // Boot cycle values
135 if (demo_boot_cycle_tail) {
136 double time = Simtime - demo_boot_cycle_tail_startTime;
137 boot_cycle_tail = uiuc_1Dinterpolation(demo_boot_cycle_tail_timeArray,
138 demo_boot_cycle_tail_daArray,
139 demo_boot_cycle_tail_ntime,
140 time);
141 }
142 if (demo_boot_cycle_wing_left) {
143 double time = Simtime - demo_boot_cycle_wing_left_startTime;
144 boot_cycle_wing_left = uiuc_1Dinterpolation(demo_boot_cycle_wing_left_timeArray,
145 demo_boot_cycle_wing_left_daArray,
146 demo_boot_cycle_wing_left_ntime,
147 time);
148 }
149 if (demo_boot_cycle_wing_right) {
150 double time = Simtime - demo_boot_cycle_wing_right_startTime;
151 boot_cycle_wing_right = uiuc_1Dinterpolation(demo_boot_cycle_wing_right_timeArray,
152 demo_boot_cycle_wing_right_daArray,
153 demo_boot_cycle_wing_right_ntime,
154 time);
155 }
156
157 // Ice values
158 if (demo_ice_tail) {
159 double time = Simtime - demo_ice_tail_startTime;
160 ice_tail = uiuc_1Dinterpolation(demo_ice_tail_timeArray,
161 demo_ice_tail_daArray,
162 demo_ice_tail_ntime,
163 time);
164 }
165 if (demo_ice_left) {
166 double time = Simtime - demo_ice_left_startTime;
167 ice_left = uiuc_1Dinterpolation(demo_ice_left_timeArray,
168 demo_ice_left_daArray,
169 demo_ice_left_ntime,
170 time);
171 }
172 if (demo_ice_right) {
173 double time = Simtime - demo_ice_right_startTime;
174 ice_right = uiuc_1Dinterpolation(demo_ice_right_timeArray,
175 demo_ice_right_daArray,
176 demo_ice_right_ntime,
177 time);
178 }
179
180 // Autopilot
181 if (demo_ap_pah_on){
182 double time = Simtime - demo_ap_pah_on_startTime;
183 ap_pah_on = uiuc_1Dinterpolation(demo_ap_pah_on_timeArray,
184 demo_ap_pah_on_daArray,
185 demo_ap_pah_on_ntime,
186 time);
187 }
188 if (demo_ap_alh_on){
189 double time = Simtime - demo_ap_alh_on_startTime;
190 ap_alh_on = uiuc_1Dinterpolation(demo_ap_alh_on_timeArray,
191 demo_ap_alh_on_daArray,
192 demo_ap_alh_on_ntime,
193 time);
194 }
195 if (demo_ap_rah_on){
196 double time = Simtime - demo_ap_rah_on_startTime;
197 ap_rah_on = uiuc_1Dinterpolation(demo_ap_rah_on_timeArray,
198 demo_ap_rah_on_daArray,
199 demo_ap_rah_on_ntime,
200 time);
201 }
202 if (demo_ap_hh_on){
203 double time = Simtime - demo_ap_hh_on_startTime;
204 ap_hh_on = uiuc_1Dinterpolation(demo_ap_hh_on_timeArray,
205 demo_ap_hh_on_daArray,
206 demo_ap_hh_on_ntime,
207 time);
208 }
209 if (demo_ap_Theta_ref){
210 double time = Simtime - demo_ap_Theta_ref_startTime;
211 ap_Theta_ref_rad = uiuc_1Dinterpolation(demo_ap_Theta_ref_timeArray,
212 demo_ap_Theta_ref_daArray,
213 demo_ap_Theta_ref_ntime,
214 time);
215 }
216 if (demo_ap_alt_ref){
217 double time = Simtime - demo_ap_alt_ref_startTime;
218 ap_alt_ref_ft = uiuc_1Dinterpolation(demo_ap_alt_ref_timeArray,
219 demo_ap_alt_ref_daArray,
220 demo_ap_alt_ref_ntime,
221 time);
222 }
223 if (demo_ap_Phi_ref){
224 double time = Simtime - demo_ap_Phi_ref_startTime;
225 ap_Phi_ref_rad = uiuc_1Dinterpolation(demo_ap_Phi_ref_timeArray,
226 demo_ap_Phi_ref_daArray,
227 demo_ap_Phi_ref_ntime,
228 time);
229 }
230 if (demo_ap_Psi_ref){
231 double time = Simtime - demo_ap_Psi_ref_startTime;
232 ap_Psi_ref_rad = uiuc_1Dinterpolation(demo_ap_Psi_ref_timeArray,
233 demo_ap_Psi_ref_daArray,
234 demo_ap_Psi_ref_ntime,
235 time);
236 }
237
238 return;
239 }
240