]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_getwind.cpp
Harald JOHNSEN:
[flightgear.git] / src / FDM / UIUCModel / uiuc_getwind.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_getwind.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  sets V_airmass_north, _east, _down for use in LaRCsim
8
9 ----------------------------------------------------------------------
10
11  STATUS:       alpha version
12
13 ----------------------------------------------------------------------
14
15  REFERENCES:   
16
17 ----------------------------------------------------------------------
18
19  HISTORY:      03/26/2003   initial release
20                
21 ----------------------------------------------------------------------
22
23  AUTHOR(S):    Glen Dimock         <dimock@uiuc.edu>
24                Michael Selig       <m-selig@uiuc.edu>
25
26 ----------------------------------------------------------------------
27
28  VARIABLES:
29
30 ----------------------------------------------------------------------
31
32  INPUTS:
33       
34 ----------------------------------------------------------------------
35
36  OUTPUTS:
37
38 ----------------------------------------------------------------------
39
40  CALLED BY:    uiuc_wrapper
41               
42 ----------------------------------------------------------------------
43
44  CALLS TO:     none
45
46 ----------------------------------------------------------------------
47
48  COPYRIGHT:    (C) 2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
62  USA or view http://www.gnu.org/copyleft/gpl.html.
63
64 **********************************************************************/
65
66
67 /* 
68         UIUC wind gradient test code v0.1
69         
70         Returns wind vector as a function of altitude for a simple
71         parabolic gradient profile
72
73         Glen Dimock
74         Last update: 020227
75 */
76
77 #include "uiuc_getwind.h"
78 #include "uiuc_aircraft.h"
79
80 void uiuc_getwind()
81 {
82         /* Wind parameters */
83         double zref = 300.; //Reference height (ft)
84         double uref = 0; //Horizontal wind velocity at ref. height (ft/sec)
85         //      double uref = 11; //Horizontal wind velocity at ref. height (ft/sec)
86         //      double uref = 13; //Horizontal wind velocity at ref. height (ft/sec)
87         //      double uref = 20; //Horizontal wind velocity at ref. height (ft/sec), 13.63 mph
88         //      double uref = 22.5; //Horizontal wind velocity at ref. height (ft/sec), 15 mph
89         //      double uref = 60.; //Horizontal wind velocity at ref. height (ft/sec), 40 mph
90         double ordref =-64.; //Horizontal wind ordinal from north (degrees)
91         double zoff = 300.; //Z offset (ft) - wind is zero at and below this point
92         double zcomp = 0.; //Vertical component (down is positive)
93
94 /*      double zref = 300.; //Reference height (ft) */
95 /*      double uref = 0.; //Horizontal wind velocity at ref. height (ft/sec) */
96 /*      double ordref = 0.; //Horizontal wind ordinal from north (degrees) */
97 /*      double zoff = 15.; //Z offset (ft) - wind is zero at and below this point */
98 /*      double zcomp = 0.; //Vertical component (down is positive) */
99
100
101         /* Get wind vector */
102         double windmag = 0; //Wind magnitude
103         double a = 0; //Parabola: Altitude = a*windmag^2 + zoff
104         
105         a = zref/pow(uref,2.);
106         if (Altitude >= zoff)
107                 windmag = sqrt(Altitude/a);
108         else
109                 windmag = 0.;
110
111         V_north_airmass = windmag * cos(ordref*3.14159/180.); //North component
112         V_east_airmass  = windmag * sin(ordref*3.14159/180.); //East component
113         V_down_airmass  = zcomp;
114
115         return;
116 }
117