]> git.mxchange.org Git - flightgear.git/commitdiff
Shuffling/reorganizing code.
authorcurt <curt>
Thu, 26 Sep 2002 15:34:00 +0000 (15:34 +0000)
committercurt <curt>
Thu, 26 Sep 2002 15:34:00 +0000 (15:34 +0000)
src/Cockpit/Makefile.am
src/Cockpit/dme.cxx [new file with mode: 0644]
src/Cockpit/dme.hxx [new file with mode: 0644]
src/Cockpit/navcom.cxx
src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx

index 19db9a6249d7622356175b669155e19d2b1012a1..14463061d393d5f349e61ce8f7c180ee78e9513f 100644 (file)
@@ -2,6 +2,7 @@ noinst_LIBRARIES = libCockpit.a
 
 libCockpit_a_SOURCES = \
        cockpit.cxx cockpit.hxx \
+       dme.cxx dme.hxx \
        hud.cxx hud.hxx hud_opts.hxx \
        hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \
        hud_labl.cxx hud_ladr.cxx \
diff --git a/src/Cockpit/dme.cxx b/src/Cockpit/dme.cxx
new file mode 100644 (file)
index 0000000..b6e5fbe
--- /dev/null
@@ -0,0 +1,253 @@
+// dme.cxx -- class to manage an instance of the DME
+//
+// Written by Curtis Olson, started April 2000.
+//
+// Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>     // snprintf
+
+#include <simgear/compiler.h>
+#include <simgear/math/sg_random.h>
+
+#include <Aircraft/aircraft.hxx>
+#include <Navaids/ilslist.hxx>
+#include <Navaids/mkrbeacons.hxx>
+#include <Navaids/navlist.hxx>
+#include <Time/FGEventMgr.hxx>
+
+#include "dme.hxx"
+
+#include <string>
+SG_USING_STD(string);
+
+
+/**
+ * Boy, this is ugly!  Make the VOR range vary by altitude difference.
+ */
+static double kludgeRange ( double stationElev, double aircraftElev,
+                           double nominalRange)
+{
+                               // Assume that the nominal range (usually
+                               // 50nm) applies at a 5,000 ft difference.
+                               // Just a wild guess!
+  double factor = ((aircraftElev*SG_METER_TO_FEET) - stationElev) / 5000.0;
+  double range = fabs(nominalRange * factor);
+
+                               // Clamp the range to keep it sane; for
+                               // now, never less than 25% or more than
+                               // 500% of nominal range.
+  if (range < nominalRange/4.0) {
+    range = nominalRange/4.0;
+  } else if (range > nominalRange*5.0) {
+    range = nominalRange*5.0;
+  }
+
+  return range;
+}
+
+
+// Constructor
+FGDME::FGDME() :
+    lon_node(fgGetNode("/position/longitude-deg", true)),
+    lat_node(fgGetNode("/position/latitude-deg", true)),
+    alt_node(fgGetNode("/position/altitude-ft", true)),
+    bus_power(fgGetNode("/systems/electrical/outputs/dme", true)),
+    navcom1_bus_power(fgGetNode("/systems/electrical/outputs/navcom[0]", true)),
+    navcom2_bus_power(fgGetNode("/systems/electrical/outputs/navcom[1]", true)),
+    navcom1_power_btn(fgGetNode("/radios/comm[0]/inputs/power-btn", true)),
+    navcom2_power_btn(fgGetNode("/radios/comm[1]/inputs/power-btn", true)),
+    navcom1_freq(fgGetNode("/radios/nav[0]/frequencies/selected-mhz", true)),
+    navcom2_freq(fgGetNode("/radios/nav[1]/frequencies/selected-mhz", true)),
+    need_update(true),
+    freq(0.0),
+    dist(0.0),
+    prev_dist(0.0),
+    spd(0.0),
+    ete(0.0)
+{
+    last_time.stamp();
+}
+
+
+// Destructor
+FGDME::~FGDME() 
+{
+}
+
+
+void
+FGDME::init ()
+{
+    search();
+    update(0);                 // FIXME: use dt
+}
+
+void
+FGDME::bind ()
+{
+
+                               // User inputs
+    fgTie("/radios/dme/frequencies/selected-khz", this,
+         &FGDME::get_freq, &FGDME::set_freq);
+
+                               // Radio outputs
+    fgTie("/radios/dme/in-range", this, &FGDME::get_inrange);
+
+    fgTie("/radios/dme/distance-nm", this, &FGDME::get_dist);
+
+    fgTie("/radios/dme/speed-kt", this, &FGDME::get_spd);
+
+    fgTie("/radios/dme/ete-min", this, &FGDME::get_ete);
+}
+
+void
+FGDME::unbind ()
+{
+    fgUntie("/radios/dme/frequencies/selected-khz");
+
+                               // Radio outputs
+    fgUntie("/radios/dme/in-range");
+    fgUntie("/radios/dme/distance-nm");
+    fgUntie("/radios/dme/speed-kt");
+    fgUntie("/radios/dme/ete-min");
+}
+
+
+// Update the various nav values based on position and valid tuned in navs
+void 
+FGDME::update(double dt) 
+{
+    double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+    double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+    double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
+
+    need_update = false;
+
+    Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
+    Point3D station;
+
+    if ( valid && has_power() ) {
+       station = Point3D( x, y, z );
+       dist = aircraft.distance3D( station ) * SG_METER_TO_NM;
+       effective_range = kludgeRange(elev, elev, range);
+       if (dist < effective_range * SG_NM_TO_METER) {
+            inrange = true;
+       } else if (dist < 2 * effective_range * SG_NM_TO_METER) {
+            inrange = sg_random() <
+                (2 * effective_range * SG_NM_TO_METER - dist) /
+                (effective_range * SG_NM_TO_METER);
+       } else {
+            inrange = false;
+       }
+       if ( inrange ) {
+            SGTimeStamp current_time;
+            station = Point3D( x, y, z );
+            dist = aircraft.distance3D( station ) * SG_METER_TO_NM;
+            current_time.stamp();
+            long dMs = (current_time - last_time) / 1000;
+                               // Update every second
+            if (dMs >= 1000) {
+                double dDist = dist - prev_dist;
+                spd = fabs((dDist/dMs) * 3600000);
+                               // FIXME: the panel should be able to
+                               // handle this!!!
+                if (spd > 999.0)
+                    spd = 999.0;
+                ete = fabs((dist/spd) * 60.0);
+                               // FIXME: the panel should be able to
+                               // handle this!!!
+                if (ete > 99.0)
+                    ete = 99.0;
+                prev_dist = dist;
+                last_time.stamp();
+            }
+       }
+    } else {
+        inrange = false;
+        dist = 0.0;
+        prev_dist = 0.0;
+        spd = 0.0;
+        ete = 0.0;
+    }
+}
+
+
+// Update current nav/adf radio stations based on current postition
+void FGDME::search() 
+{
+    double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+    double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+    double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
+
+                               // FIXME: the panel should handle this
+                               // don't worry about overhead for now,
+                               // since this is handled only periodically
+    switch_pos = fgGetInt("/radios/dme/switch-position", 2);
+    if ( switch_pos == 1 && has_power() && navcom1_on() ) {
+        if ( freq != navcom1_freq->getDoubleValue() ) {
+            freq = navcom1_freq->getDoubleValue();
+            need_update = true;
+        }
+    } else if ( switch_pos == 3 && has_power() && navcom2_on() ) {
+        if ( freq != navcom2_freq->getDoubleValue() ) {
+            freq = navcom2_freq->getDoubleValue();
+            need_update = true;
+        }
+    } else {
+        freq = 0;
+        inrange = false;
+    }
+
+    FGILS ils;
+    FGNav nav;
+
+    if ( current_ilslist->query( lon, lat, elev, freq, &ils ) ) {
+        if (ils.get_has_dme()) {
+            valid = true;
+            lon = ils.get_loclon();
+            lat = ils.get_loclat();
+            elev = ils.get_gselev();
+            range = FG_ILS_DEFAULT_RANGE;
+            effective_range = kludgeRange(elev, elev, range);
+            x = ils.get_dme_x();
+            y = ils.get_dme_y();
+            z = ils.get_dme_z();
+        }
+    } else if ( current_navlist->query( lon, lat, elev, freq, &nav ) ) {
+        if (nav.get_has_dme()) {
+            valid = true;
+            lon = nav.get_lon();
+            lat = nav.get_lat();
+            elev = nav.get_elev();
+            range = nav.get_range();
+            effective_range = kludgeRange(elev, elev, range);
+            x = nav.get_x();
+            y = nav.get_y();
+            z = nav.get_z();
+        }
+    } else {
+        valid = false;
+        dist = 0;
+    }
+}
diff --git a/src/Cockpit/dme.hxx b/src/Cockpit/dme.hxx
new file mode 100644 (file)
index 0000000..b8280ad
--- /dev/null
@@ -0,0 +1,117 @@
+// dme.hxx -- class to manage an instance of the DME
+//
+// Written by Curtis Olson, started April 2000.
+//
+// Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+
+#ifndef _FG_DME_HXX
+#define _FG_DME_HXX
+
+
+#include <Main/fgfs.hxx>
+#include <Main/fg_props.hxx>
+
+#include <simgear/compiler.h>
+
+// #include <simgear/math/interpolater.hxx>
+#include <simgear/timing/timestamp.hxx>
+
+#include <Navaids/ilslist.hxx>
+#include <Navaids/navlist.hxx>
+// #include <Sound/beacon.hxx>
+#include <Sound/morse.hxx>
+
+// #include "kr_87.hxx"            // ADF
+// #include "kt_70.hxx"            // Transponder
+// #include "navcom.hxx"
+
+class FGDME : public FGSubsystem
+{
+    SGPropertyNode *lon_node;
+    SGPropertyNode *lat_node;
+    SGPropertyNode *alt_node;
+    SGPropertyNode *bus_power;
+    SGPropertyNode *navcom1_bus_power, *navcom2_bus_power;
+    SGPropertyNode *navcom1_power_btn, *navcom2_power_btn;
+    SGPropertyNode *navcom1_freq, *navcom2_freq;
+
+    bool need_update;
+
+    bool valid;
+    int switch_pos;
+    bool inrange;
+    double freq;
+    double lon;
+    double lat;
+    double elev;
+    double range;
+    double effective_range;
+    double x;
+    double y;
+    double z;
+    double dist;
+    double prev_dist;
+    double spd;
+    double ete;
+    SGTimeStamp last_time;
+
+public:
+
+    FGDME();
+    ~FGDME();
+
+    void init ();
+    void bind ();
+    void unbind ();
+    void update (double dt);
+
+    // Update dme based on current postition
+    void search ();
+
+    // DME Setters
+    inline void set_freq (double freq) {
+        freq = freq; need_update = true;
+    }
+
+
+    // DME Accessors
+    inline bool has_power() const {
+        return (switch_pos == 1 || switch_pos == 3)
+            && (bus_power->getDoubleValue() > 1.0);
+    }
+    inline bool navcom1_on() const {
+        return (navcom1_bus_power->getDoubleValue() > 1.0)
+            && navcom1_power_btn->getBoolValue();
+    }
+    inline bool navcom2_on() const {
+        return (navcom2_bus_power->getDoubleValue() > 1.0)
+            && navcom2_power_btn->getBoolValue();
+    }
+    inline double get_freq () const { return freq; }
+
+    // Calculated values.
+    inline bool get_inrange () const { return inrange; }
+    inline double get_dist () const { return dist; }
+    inline double get_spd () const { return spd; }
+    inline double get_ete () const { return ete; }
+};
+
+
+#endif // _FG_DME_HXX
index 75aa78f9f2fc9e81f558c9b6d02134a4ee5497a5..98055b03a885e8f36bffd62ce5ab3ec93f5a929d 100644 (file)
@@ -100,13 +100,6 @@ FGNavCom::bind ()
 {
     char propname[256];
 
-    // we know index is valid now so lets bind to the bus property
-    // here.
-    sprintf( propname, "/systems/electrical/outputs/navcomm[%d]", index );
-    // default to true in case no electrical system defined.
-    fgSetDouble( propname, 60.0 );
-    bus_power = fgGetNode( propname, true );
-
                                // User inputs
     sprintf( propname, "/radios/comm[%d]/inputs/power-btn", index );
     fgTie( propname, this,
@@ -170,6 +163,15 @@ FGNavCom::bind ()
 
     sprintf( propname, "/radios/nav[%d]/gs-needle-deflection", index );
     fgTie( propname, this, &FGNavCom::get_nav_gs_needle_deflection );
+
+    // end of binding
+
+    // We know index is valid now so lets bind to the bus property
+    // here.
+    sprintf( propname, "/systems/electrical/outputs/navcom[%d]", index );
+    // default to true in case no electrical system defined.
+    fgSetDouble( propname, 60.0 );
+    bus_power = fgGetNode( propname, true );
 }
 
 
index 075fc6c6e20ddab3ef4ae8ff83a357cb9d9fe7d2..134a6cb763768203a786920fa847ca21c8209e99 100644 (file)
@@ -75,13 +75,7 @@ FGRadioStack::FGRadioStack() :
     lon_node(fgGetNode("/position/longitude-deg", true)),
     lat_node(fgGetNode("/position/latitude-deg", true)),
     alt_node(fgGetNode("/position/altitude-ft", true)),
-    dme_bus_power(fgGetNode("/systems/electrical/outputs/dme", true)),
     need_update(true),
-    dme_freq(0.0),
-    dme_dist(0.0),
-    dme_prev_dist(0.0),
-    dme_spd(0.0),
-    dme_ete(0.0),
     outer_blink(false),
     middle_blink(false),
     inner_blink(false)
@@ -97,7 +91,6 @@ FGRadioStack::FGRadioStack() :
     term_tbl = new SGInterpTable( term.str() );
     low_tbl = new SGInterpTable( low.str() );
     high_tbl = new SGInterpTable( high.str() );
-    dme_last_time.stamp();
 }
 
 
@@ -150,23 +143,11 @@ FGRadioStack::init ()
                            1000 );
 }
 
+
 void
 FGRadioStack::bind ()
 {
 
-                               // User inputs
-    fgTie("/radios/dme/frequencies/selected-khz", this,
-         &FGRadioStack::get_dme_freq, &FGRadioStack::set_dme_freq);
-
-                               // Radio outputs
-    fgTie("/radios/dme/in-range", this, &FGRadioStack::get_dme_inrange);
-
-    fgTie("/radios/dme/distance-nm", this, &FGRadioStack::get_dme_dist);
-
-    fgTie("/radios/dme/speed-kt", this, &FGRadioStack::get_dme_spd);
-
-    fgTie("/radios/dme/ete-min", this, &FGRadioStack::get_dme_ete);
-
     fgTie("/radios/marker-beacon/inner", this,
          &FGRadioStack::get_inner_blink);
 
@@ -176,32 +157,27 @@ FGRadioStack::bind ()
     fgTie("/radios/marker-beacon/outer", this,
          &FGRadioStack::get_outer_blink);
 
+    adf.bind();
+    dme.bind();
     navcom1.set_bind_index( 0 );
     navcom1.bind();
     navcom2.set_bind_index( 1 );
     navcom2.bind();
-    adf.bind();
     xponder.bind();
 }
 
+
 void
 FGRadioStack::unbind ()
 {
-    fgUntie("/radios/dme/frequencies/selected-khz");
-
-                               // Radio outputs
-    fgUntie("/radios/dme/in-range");
-    fgUntie("/radios/dme/distance-nm");
-    fgUntie("/radios/dme/speed-kt");
-    fgUntie("/radios/dme/ete-min");
-
     fgUntie("/radios/marker-beacon/inner");
     fgUntie("/radios/marker-beacon/middle");
     fgUntie("/radios/marker-beacon/outer");
 
+    adf.unbind();
+    dme.unbind();
     navcom1.unbind();
     navcom2.unbind();
-    adf.unbind();
     xponder.unbind();
 }
 
@@ -210,65 +186,13 @@ FGRadioStack::unbind ()
 void 
 FGRadioStack::update(double dt) 
 {
-    double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
-    double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
-    double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
-
     need_update = false;
 
-    Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
-    Point3D station;
-
+    adf.update( dt );
     navcom1.update( dt );
     navcom2.update( dt );
-
-    ////////////////////////////////////////////////////////////////////////
-    // DME.
-    ////////////////////////////////////////////////////////////////////////
-
-    if ( dme_valid && dme_has_power() ) {
-       station = Point3D( dme_x, dme_y, dme_z );
-       dme_dist = aircraft.distance3D( station ) * SG_METER_TO_NM;
-       dme_effective_range = kludgeRange(dme_elev, elev, dme_range);
-       if (dme_dist < dme_effective_range * SG_NM_TO_METER) {
-            dme_inrange = true;
-       } else if (dme_dist < 2 * dme_effective_range * SG_NM_TO_METER) {
-            dme_inrange = sg_random() <
-                (2 * dme_effective_range * SG_NM_TO_METER - dme_dist) /
-                (dme_effective_range * SG_NM_TO_METER);
-       } else {
-            dme_inrange = false;
-       }
-       if ( dme_inrange ) {
-            SGTimeStamp current_time;
-            station = Point3D( dme_x, dme_y, dme_z );
-            dme_dist = aircraft.distance3D( station ) * SG_METER_TO_NM;
-            current_time.stamp();
-            long dMs = (current_time - dme_last_time) / 1000;
-                               // Update every second
-            if (dMs >= 1000) {
-                double dDist = dme_dist - dme_prev_dist;
-                dme_spd = fabs((dDist/dMs) * 3600000);
-                               // FIXME: the panel should be able to
-                               // handle this!!!
-                if (dme_spd > 999.0)
-                    dme_spd = 999.0;
-                dme_ete = fabs((dme_dist/dme_spd) * 60.0);
-                               // FIXME: the panel should be able to
-                               // handle this!!!
-                if (dme_ete > 99.0)
-                    dme_ete = 99.0;
-                dme_prev_dist = dme_dist;
-                dme_last_time.stamp();
-            }
-       }
-    } else {
-        dme_inrange = false;
-        dme_dist = 0.0;
-        dme_prev_dist = 0.0;
-        dme_spd = 0.0;
-        dme_ete = 0.0;
-    }
+    dme.update( dt );           // dme is updated after the navcom's
+    xponder.update( dt );
 
     // marker beacon blinking
     bool light_on = ( outer_blink || middle_blink || inner_blink );
@@ -302,9 +226,6 @@ FGRadioStack::update(double dt)
     }
 
     // cout << outer_blink << " " << middle_blink << " " << inner_blink << endl;
-
-    adf.update( dt );
-    xponder.update( dt );
 }
 
 
@@ -317,64 +238,11 @@ void FGRadioStack::search()
     double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
     double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
 
-                               // FIXME: the panel should handle this
-                               // don't worry about overhead for now,
-                               // since this is handled only periodically
-    dme_switch_pos = fgGetInt("/radios/dme/switch-position", 2);
-    if ( dme_switch_pos == 1 && dme_has_power() && navcom1.has_power() ) {
-        if ( dme_freq != navcom1.get_nav_freq() ) {
-            dme_freq = navcom1.get_nav_freq();
-            need_update = true;
-        }
-    } else if ( dme_switch_pos == 3 && dme_has_power() && navcom2.has_power() ){
-        if ( dme_freq != navcom2.get_nav_freq() ) {
-            dme_freq = navcom2.get_nav_freq();
-            need_update = true;
-        }
-    } else {
-        dme_freq = 0;
-        dme_inrange = false;
-    }
-
-    FGILS ils;
-    FGNav nav;
-
+    adf.search();
     navcom1.search();
     navcom2.search();
-
-    ////////////////////////////////////////////////////////////////////////
-    // DME
-    ////////////////////////////////////////////////////////////////////////
-
-    if ( current_ilslist->query( lon, lat, elev, dme_freq, &ils ) ) {
-      if (ils.get_has_dme()) {
-       dme_valid = true;
-       dme_lon = ils.get_loclon();
-       dme_lat = ils.get_loclat();
-       dme_elev = ils.get_gselev();
-       dme_range = FG_ILS_DEFAULT_RANGE;
-       dme_effective_range = kludgeRange(dme_elev, elev, dme_range);
-       dme_x = ils.get_dme_x();
-       dme_y = ils.get_dme_y();
-       dme_z = ils.get_dme_z();
-      }
-    } else if ( current_navlist->query( lon, lat, elev, dme_freq, &nav ) ) {
-      if (nav.get_has_dme()) {
-       dme_valid = true;
-       dme_lon = nav.get_lon();
-       dme_lat = nav.get_lat();
-       dme_elev = nav.get_elev();
-       dme_range = nav.get_range();
-       dme_effective_range = kludgeRange(dme_elev, elev, dme_range);
-       dme_x = nav.get_x();
-       dme_y = nav.get_y();
-       dme_z = nav.get_z();
-      }
-    } else {
-      dme_valid = false;
-      dme_dist = 0;
-    }
-
+    dme.search();
+    xponder.search();
 
     ////////////////////////////////////////////////////////////////////////
     // Beacons.
@@ -440,7 +308,4 @@ void FGRadioStack::search()
 #endif
     }
     last_beacon = beacon_type;
-
-    adf.search();
-    xponder.search();
 }
index 35a08b59e6aec9ed03a65695c208767eeb77ed1b..17f5e60139c362153ee8cf46281c7adc6f063459 100644 (file)
 #include <Sound/beacon.hxx>
 #include <Sound/morse.hxx>
 
+#include "dme.hxx"
 #include "kr_87.hxx"            // ADF
 #include "kt_70.hxx"            // Transponder
 #include "navcom.hxx"
 
+
 class FGRadioStack : public FGSubsystem
 {
     FGBeacon beacon;
@@ -58,24 +60,6 @@ class FGRadioStack : public FGSubsystem
 
     bool need_update;
 
-    bool dme_valid;
-    int dme_switch_pos;
-    bool dme_inrange;
-    double dme_freq;
-    double dme_lon;
-    double dme_lat;
-    double dme_elev;
-    double dme_range;
-    double dme_effective_range;
-    double dme_x;
-    double dme_y;
-    double dme_z;
-    double dme_dist;
-    double dme_prev_dist;
-    double dme_spd;
-    double dme_ete;
-    SGTimeStamp dme_last_time;
-
     bool outer_marker;
     bool middle_marker;
     bool inner_marker;
@@ -85,6 +69,7 @@ class FGRadioStack : public FGSubsystem
     bool middle_blink;
     bool inner_blink;
 
+    FGDME dme;
     FGKR_87 adf;                // King KR 87 Digital ADF model
     FGKT_70 xponder;            // Bendix/King KT 70 Panel-Mounted Transponder
     FGNavCom navcom1;
@@ -106,29 +91,10 @@ public:
     inline FGNavCom *get_navcom1() { return &navcom1; }
     inline FGNavCom *get_navcom2() { return &navcom2; }
 
-    // DME Setters
-    inline void set_dme_freq (double freq) {
-        dme_freq = freq; need_update = true;
-    }
-
-
-    // DME Accessors
-    inline bool dme_has_power() const {
-        return (dme_switch_pos == 1 || dme_switch_pos == 3)
-            && (dme_bus_power->getDoubleValue() > 1.0);
-    }
-    inline double get_dme_freq () const { return dme_freq; }
-
     // Marker Beacon Accessors
     inline bool get_inner_blink () const { return inner_blink; }
     inline bool get_middle_blink () const { return middle_blink; }
     inline bool get_outer_blink () const { return outer_blink; }
-
-    // Calculated values.
-    inline bool get_dme_inrange () const { return dme_inrange; }
-    inline double get_dme_dist () const { return dme_dist; }
-    inline double get_dme_spd () const { return dme_spd; }
-    inline double get_dme_ete () const { return dme_ete; }
 };