]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_getwind.cpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
62
63 **********************************************************************/
64
65
66 /* 
67         UIUC wind gradient test code v0.1
68         
69         Returns wind vector as a function of altitude for a simple
70         parabolic gradient profile
71
72         Glen Dimock
73         Last update: 020227
74 */
75
76 #include "uiuc_getwind.h"
77 #include "uiuc_aircraft.h"
78
79 void uiuc_getwind()
80 {
81         /* Wind parameters */
82         double zref = 300.; //Reference height (ft)
83         double uref = 0; //Horizontal wind velocity at ref. height (ft/sec)
84         //      double uref = 11; //Horizontal wind velocity at ref. height (ft/sec)
85         //      double uref = 13; //Horizontal wind velocity at ref. height (ft/sec)
86         //      double uref = 20; //Horizontal wind velocity at ref. height (ft/sec), 13.63 mph
87         //      double uref = 22.5; //Horizontal wind velocity at ref. height (ft/sec), 15 mph
88         //      double uref = 60.; //Horizontal wind velocity at ref. height (ft/sec), 40 mph
89         double ordref =-64.; //Horizontal wind ordinal from north (degrees)
90         double zoff = 300.; //Z offset (ft) - wind is zero at and below this point
91         double zcomp = 0.; //Vertical component (down is positive)
92
93 /*      double zref = 300.; //Reference height (ft) */
94 /*      double uref = 0.; //Horizontal wind velocity at ref. height (ft/sec) */
95 /*      double ordref = 0.; //Horizontal wind ordinal from north (degrees) */
96 /*      double zoff = 15.; //Z offset (ft) - wind is zero at and below this point */
97 /*      double zcomp = 0.; //Vertical component (down is positive) */
98
99
100         /* Get wind vector */
101         double windmag = 0; //Wind magnitude
102         double a = 0; //Parabola: Altitude = a*windmag^2 + zoff
103         
104         a = zref/pow(uref,2.);
105         if (Altitude >= zoff)
106                 windmag = sqrt(Altitude/a);
107         else
108                 windmag = 0.;
109
110         V_north_airmass = windmag * cos(ordref*3.14159/180.); //North component
111         V_east_airmass  = windmag * sin(ordref*3.14159/180.); //East component
112         V_down_airmass  = zcomp;
113
114         return;
115 }
116