1 // simulates ridge lift
3 // Written by Patrice Poly
4 // Copyright (C) 2009 Patrice Poly - p.polypa@gmail.com
7 // Entirely based on the paper :
8 // http://carrier.csi.cam.ac.uk/forsterlewis/soaring/sim/fsx/dev/sim_probe/sim_probe_paper.html
9 // by Ian Forster-Lewis, University of Cambridge, 26th December 2007
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License as
14 // published by the Free Software Foundation; either version 2 of the
15 // License, or (at your option) any later version.
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // General Public License for more details.
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #ifndef _FG_RidgeLift_HXX
29 #define _FG_RidgeLift_HXX
40 class FGRidgeLift : public SGSubsystem {
47 virtual void unbind();
48 virtual void update(double dt);
51 inline double getStrength() const { return strength; };
53 inline double get_probe_elev_m_0() const { return probe_elev_m[0]; };
54 inline double get_probe_elev_m_1() const { return probe_elev_m[1]; };
55 inline double get_probe_elev_m_2() const { return probe_elev_m[2]; };
56 inline double get_probe_elev_m_3() const { return probe_elev_m[3]; };
57 inline double get_probe_elev_m_4() const { return probe_elev_m[4]; };
59 inline double get_probe_lat_0() const { return probe_lat_deg[0]; };
60 inline double get_probe_lat_1() const { return probe_lat_deg[1]; };
61 inline double get_probe_lat_2() const { return probe_lat_deg[2]; };
62 inline double get_probe_lat_3() const { return probe_lat_deg[3]; };
63 inline double get_probe_lat_4() const { return probe_lat_deg[4]; };
65 inline double get_probe_lon_0() const { return probe_lon_deg[0]; };
66 inline double get_probe_lon_1() const { return probe_lon_deg[1]; };
67 inline double get_probe_lon_2() const { return probe_lon_deg[2]; };
68 inline double get_probe_lon_3() const { return probe_lon_deg[3]; };
69 inline double get_probe_lon_4() const { return probe_lon_deg[4]; };
71 inline double get_slope_0() const { return slope[0]; };
72 inline double get_slope_1() const { return slope[1]; };
73 inline double get_slope_2() const { return slope[2]; };
74 inline double get_slope_3() const { return slope[3]; };
80 double dist_probe_m[5];
92 double probe_lat_rad[5];
93 double probe_lon_rad[5];
95 double probe_lat_deg[5];
96 double probe_lon_deg[5];
99 double probe_elev_m[5];
104 double user_latitude_deg;
105 double user_longitude_deg;
106 //double user_altitude;
107 double user_altitude_agl_ft;
108 double user_altitude_agl_m;
110 double sign(double x);
112 SGPropertyNode_ptr _ridge_lift_fps_node;
114 SGPropertyNode_ptr _surface_wind_from_deg_node;
115 SGPropertyNode_ptr _surface_wind_speed_node;
117 SGPropertyNode_ptr _user_altitude_ft_node;
118 SGPropertyNode_ptr _user_altitude_agl_ft_node;
119 SGPropertyNode_ptr _earth_radius_node;
120 SGPropertyNode_ptr _user_longitude_node;
121 SGPropertyNode_ptr _user_latitude_node;
125 #endif // _FG_RidgeLift_HXX