]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_betaprobe.cpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / FDM / UIUCModel / uiuc_betaprobe.cpp
1 /********************************************************************** 
2  
3  FILENAME:     uiuc_betaprobe.cpp 
4
5 ---------------------------------------------------------------------- 
6
7  DESCRIPTION:  Computes flow angle, beta, for use in ice detection 
8                scheme
9
10 ----------------------------------------------------------------------
11  
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15  
16  REFERENCES:   
17  
18 ----------------------------------------------------------------------
19
20  HISTORY:      05/15/2000   initial release
21  
22 ----------------------------------------------------------------------
23  
24  AUTHOR(S):    Jeff Scott         <jscott@mail.com>
25
26 ----------------------------------------------------------------------
27
28  VARIABLES:
29
30 ----------------------------------------------------------------------
31
32  INPUTS:       CLclean_wing
33                CLiced_wing
34                CLclean_tail
35                CLiced_tail
36
37 ----------------------------------------------------------------------
38
39  OUTPUTS:      Dbeta_flow_wing
40                Dbeta_flow_tail
41
42 ----------------------------------------------------------------------
43  
44  CALLED BY:    uiuc_wrapper
45  
46 ----------------------------------------------------------------------
47  
48  CALLS TO:     none
49  
50 ----------------------------------------------------------------------
51  
52  COPYRIGHT:    (C) 2000 by Michael Selig
53  
54  This program is free software; you can redistribute it and/or
55  modify it under the terms of the GNU General Public License
56  as published by the Free Software Foundation.
57  
58  This program is distributed in the hope that it will be useful,
59  but WITHOUT ANY WARRANTY; without even the implied warranty of
60  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
61  GNU General Public License for more details.
62
63  You should have received a copy of the GNU General Public License
64  along with this program; if not, write to the Free Software
65  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
66
67 **********************************************************************/
68
69 #include "uiuc_betaprobe.h"
70
71
72 void uiuc_betaprobe()
73 {
74   if (CX && CZ)
75     {
76       CLclean_wing = CXclean_wing * sin(Std_Alpha) - CZclean_wing * cos(Std_Alpha);
77       CLiced_wing  = CXiced_wing * sin(Std_Alpha) - CZiced_wing * cos(Std_Alpha);
78       CLclean_tail = CXclean_tail * sin(Std_Alpha) - CZclean_tail * cos(Std_Alpha);
79       CLiced_tail  = CXiced_tail * sin(Std_Alpha) - CZiced_tail * cos(Std_Alpha);
80     }
81
82   /* calculate lift per unit span*/
83   Lift_clean_wing = CLclean_wing * Dynamic_pressure * Sw / bw;
84   Lift_iced_wing = CLiced_wing * Dynamic_pressure * Sw / bw;
85   Lift_clean_tail = CLclean_tail * Dynamic_pressure * Sh / bh;
86   Lift_iced_tail = CLiced_tail * Dynamic_pressure * Sh / bh;
87
88   Gamma_clean_wing = Lift_clean_wing / (Density * V_rel_wind);
89   Gamma_iced_wing = Lift_iced_wing / (Density * V_rel_wind);
90   Gamma_clean_tail = Lift_clean_tail / (Density * V_rel_wind);
91   Gamma_iced_tail = Lift_iced_tail / (Density * V_rel_wind);
92
93   w_clean_wing = Gamma_clean_wing / (2 * LS_PI * x_probe_wing);
94   w_iced_wing = Gamma_iced_wing / (2 * LS_PI * x_probe_wing);
95   w_clean_tail = Gamma_clean_tail / (2 * LS_PI * x_probe_tail);
96   w_iced_tail = Gamma_iced_tail / (2 * LS_PI * x_probe_tail);
97
98   V_total_clean_wing = sqrt(w_clean_wing*w_clean_wing + 
99                             V_rel_wind*V_rel_wind - 
100                             2*w_clean_wing*V_rel_wind * 
101                             cos(LS_PI/2 + Std_Alpha));
102   V_total_iced_wing = sqrt(w_iced_wing*w_iced_wing + 
103                            V_rel_wind*V_rel_wind - 
104                            2*w_iced_wing*V_rel_wind * 
105                            cos(LS_PI/2 + Std_Alpha));
106   V_total_clean_tail = sqrt(w_clean_tail*w_clean_tail + 
107                             V_rel_wind*V_rel_wind - 
108                             2*w_clean_tail*V_rel_wind * 
109                             cos(LS_PI/2 + Std_Alpha));
110   V_total_iced_tail = sqrt(w_iced_tail*w_iced_tail + 
111                            V_rel_wind*V_rel_wind - 
112                            2*w_iced_tail*V_rel_wind * 
113                            cos(LS_PI/2 + Std_Alpha));
114
115   beta_flow_clean_wing = asin((w_clean_wing / V_total_clean_wing) * 
116                               sin (LS_PI/2 + Std_Alpha));
117   beta_flow_iced_wing = asin((w_iced_wing / V_total_iced_wing) * 
118                              sin (LS_PI/2 + Std_Alpha));
119   beta_flow_clean_tail = asin((w_clean_tail / V_total_clean_tail) * 
120                               sin (LS_PI/2 + Std_Alpha));
121   beta_flow_iced_tail = asin((w_iced_tail / V_total_iced_tail) * 
122                              sin (LS_PI/2 + Std_Alpha));
123
124   Dbeta_flow_wing = fabs(beta_flow_clean_wing - beta_flow_iced_wing);
125   Dbeta_flow_tail = fabs(beta_flow_clean_tail - beta_flow_iced_tail);
126
127   pct_beta_flow_wing = beta_flow_iced_wing / beta_flow_clean_wing;
128   pct_beta_flow_tail = beta_flow_iced_tail / beta_flow_clean_tail;
129 }
130
131 //end uiuc_betaprobe.cpp