]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/dme.hxx
Move FGEventMgr and FGSubsystemMgr over to SimGear, add SGEventMgr to FlightGear...
[flightgear.git] / src / Instrumentation / dme.hxx
1 // dme.hxx - distance-measuring equipment.
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_DME_HXX
8 #define __INSTRUMENTS_DME_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <simgear/math/point3d.hxx>
15 #include <simgear/props/props.hxx>
16 #include <simgear/structure/subsystem_mgr.hxx>
17
18
19 /**
20  * Model a DME radio.
21  *
22  * Input properties:
23  *
24  * /position/longitude-deg
25  * /position/latitude-deg
26  * /position/altitude-ft
27  * /systems/electrical/outputs/dme
28  * /instrumentation/dme/serviceable
29  * /instrumentation/dme/frequencies/source
30  * /instrumentation/dme/frequencies/selected-mhz
31  *
32  * Output properties:
33  *
34  * /instrumentation/dme/in-range
35  * /instrumentation/dme/indicated-distance-nm
36  * /instrumentation/dme/indicated-ground-speed-kt
37  * /instrumentation/dme/indicated-time-kt
38  */
39 class DME : public SGSubsystem
40 {
41
42 public:
43
44     DME ();
45     virtual ~DME ();
46
47     virtual void init ();
48     virtual void update (double delta_time_sec);
49
50 private:
51
52     void search (double frequency, double longitude_rad,
53                  double latitude_rad, double altitude_m);
54
55     SGPropertyNode_ptr _longitude_node;
56     SGPropertyNode_ptr _latitude_node;
57     SGPropertyNode_ptr _altitude_node;
58     SGPropertyNode_ptr _serviceable_node;
59     SGPropertyNode_ptr _electrical_node;
60     SGPropertyNode_ptr _source_node;
61     SGPropertyNode_ptr _frequency_node;
62
63     SGPropertyNode_ptr _in_range_node;
64     SGPropertyNode_ptr _distance_node;
65     SGPropertyNode_ptr _speed_node;
66     SGPropertyNode_ptr _time_node;
67
68     double _last_distance_nm;
69     double _last_frequency_mhz;
70     double _time_before_search_sec;
71
72     bool _transmitter_valid;
73     Point3D _transmitter;
74     double _transmitter_elevation_ft;
75     double _transmitter_range_nm;
76
77 };
78
79
80 #endif // __INSTRUMENTS_DME_HXX