]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/adf.hxx
Make the AI models a bit more intelligent. The Gear should be extended and retracted...
[flightgear.git] / src / Instrumentation / adf.hxx
1 // adf.hxx - automatic direction finder.
2 // Written by David Megginson, started 2003.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6
7 #ifndef __INSTRUMENTS_ADF_HXX
8 #define __INSTRUMENTS_ADF_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <string>
15
16 #include <simgear/math/point3d.hxx>
17 #include <simgear/props/props.hxx>
18
19 #include <simgear/structure/subsystem_mgr.hxx>
20
21 SG_USING_STD(string);
22
23
24 /**
25  * Model an ADF radio.
26  *
27  * Input properties:
28  *
29  * /position/longitude-deg
30  * /position/latitude-deg
31  * /position/altitude-ft
32  * /orientation/heading-deg
33  * /systems/electrical/outputs/adf
34  * /instrumentation/adf/serviceable
35  * /instrumentation/adf/error-deg
36  * /instrumentation/adf/frequencies/selected-khz
37  * /instrumentation/adf/mode
38  *
39  * Output properties:
40  *
41  * /instrumentation/adf/in-range
42  * /instrumentation/adf/indicated-bearing-deg
43  * /instrumentation/adf/ident
44  */
45 class ADF : public SGSubsystem
46 {
47
48 public:
49
50     ADF ();
51     virtual ~ADF ();
52
53     virtual void init ();
54     virtual void update (double delta_time_sec);
55
56 private:
57
58     void set_bearing (double delta_time_sec, double bearing);
59
60     void search (double frequency, double longitude_rad,
61                  double latitude_rad, double altitude_m);
62
63     SGPropertyNode_ptr _longitude_node;
64     SGPropertyNode_ptr _latitude_node;
65     SGPropertyNode_ptr _altitude_node;
66     SGPropertyNode_ptr _heading_node;
67     SGPropertyNode_ptr _serviceable_node;
68     SGPropertyNode_ptr _error_node;
69     SGPropertyNode_ptr _electrical_node;
70     SGPropertyNode_ptr _frequency_node;
71     SGPropertyNode_ptr _mode_node;
72
73     SGPropertyNode_ptr _in_range_node;
74     SGPropertyNode_ptr _bearing_node;
75     SGPropertyNode_ptr _ident_node;
76
77     double _time_before_search_sec;
78
79     int _last_frequency_khz;
80     bool _transmitter_valid;
81     string _last_ident;
82     Point3D _transmitter;
83     double _transmitter_lon_deg;
84     double _transmitter_lat_deg;
85     double _transmitter_elevation_ft;
86     double _transmitter_range_nm;
87
88 };
89
90
91 #endif // __INSTRUMENTS_ADF_HXX