[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flightgear-cvs
Subject:    [Flightgear-cvslogs] CVS: FlightGear/src/Instrumentation
From:       Melchior Franz <mfranz () flightgear ! org>
Date:       2007-03-31 9:36:18
Message-ID: E1HXa0Q-0001So-00 () baron ! me ! umn ! edu
[Download RAW message or body]

Update of /var/cvs/FlightGear-0.9/FlightGear/src/Instrumentation
In directory baron:/tmp/cvs-serv4866/Instrumentation

Modified Files:
      Tag: PRE_OSG_PLIB_20061029
	Makefile.am altimeter.cxx altimeter.hxx instrument_mgr.cxx 
Log Message:
John DENKER:

"This altimetry method is valid to above 100,000 feet, and
correctly handles Kollsman settings"


Index: Makefile.am
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Instrumentation/Makefile.am,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -C 2 -r1.25.2.1 -r1.25.2.2
*** Makefile.am	29 Jan 2007 22:36:31 -0000	1.25.2.1
--- Makefile.am	31 Mar 2007 09:36:16 -0000	1.25.2.2
***************
*** 11,15 ****
          clock.cxx clock.hxx \
          dme.cxx dme.hxx \
- 	encoder.cxx encoder.hxx \
          gps.cxx gps.hxx \
          gsdi.cxx gsdi.hxx \
--- 11,14 ----

Index: altimeter.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Instrumentation/altimeter.cxx,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C 2 -r1.10.2.1 -r1.10.2.2
*** altimeter.cxx	6 Dec 2006 22:11:43 -0000	1.10.2.1
--- altimeter.cxx	31 Mar 2007 09:36:16 -0000	1.10.2.2
***************
*** 1,64 ****
  // altimeter.cxx - an altimeter tied to the static port.
  // Written by David Megginson, started 2002.
  //
  // This file is in the Public Domain and comes with no warranty.
  
  #include <simgear/math/interpolater.hxx>
  
- #include "altimeter.hxx"
  #include <Main/fg_props.hxx>
  #include <Main/util.hxx>
  
  
! // A higher number means more responsive
! #define RESPONSIVENESS 10.0
! 
! 
! // Altitude based on pressure difference from sea level.
! // pressure difference inHG, altitude ft
! static double altitude_data[][2] = {
!  { -8.41, -8858.27 },
!  { 0.00, 0.00 },
!  { 3.05, 2952.76 },
!  { 5.86, 5905.51 },
!  { 8.41, 8858.27 },
!  { 10.74, 11811.02 },
!  { 12.87, 14763.78 },
!  { 14.78, 17716.54 },
!  { 16.55, 20669.29 },
!  { 18.13, 23622.05 },
!  { 19.62, 26574.80 },
!  { 20.82, 29527.56 },
!  { 21.96, 32480.31 },
!  { 23.01, 35433.07 },
!  { 23.91, 38385.83 },
!  { 24.71, 41338.58 },
!  { 25.40, 44291.34 },
!  { 26.00, 47244.09 },
!  { 26.51, 50196.85 },
!  { 26.96, 53149.61 },
!  { 27.35, 56102.36 },
!  { 27.68, 59055.12 },
!  { 27.98, 62007.87 },
!  { 29.62, 100000.00 },            // just to fill it in
!  { -1, -1 }
! };
! 
! 
! Altimeter::Altimeter ( SGPropertyNode *node )
      : _name(node->getStringValue("name", "altimeter")),
        _num(node->getIntValue("number", 0)),
        _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
!       _altitude_table(new SGInterpTable)
! {
!     int i;
!     for (i = 0; altitude_data[i][0] != -1; i++)
!         _altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
! }
  
  Altimeter::~Altimeter ()
! {
!     delete _altitude_table;
! }
  
  void
--- 1,37 ----
  // altimeter.cxx - an altimeter tied to the static port.
  // Written by David Megginson, started 2002.
+ // Modified by John Denker in 2007 to use a two layer atmosphere
+ // model in src/Environment/atmosphere.?xx
  //
  // This file is in the Public Domain and comes with no warranty.
  
+ // Example invocation, in the instrumentation.xml file:
+ //      <altimeter>
+ //        <name>encoder</name>
+ //        <number>0</number>
+ //        <static-pressure>/systems/static/pressure-inhg</static-pressure>
+ //        <quantum>10</quantum>
+ //        <tau>0</tau>
+ //      </altimeter>
+ // Note non-default name, quantum, and tau values.
+ 
  #include <simgear/math/interpolater.hxx>
  
  #include <Main/fg_props.hxx>
  #include <Main/util.hxx>
+ #include <Environment/atmosphere.hxx>
  
+ #include "altimeter.hxx"
  
! Altimeter::Altimeter ( SGPropertyNode *node, double quantum )
      : _name(node->getStringValue("name", "altimeter")),
        _num(node->getIntValue("number", 0)),
        _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
!       _tau(node->getDoubleValue("tau", 0.1)),
!       _quantum(node->getDoubleValue("quantum", quantum))
! {}
  
  Altimeter::~Altimeter ()
! {}
  
  void
***************
*** 69,77 ****
  
      SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
  
!     _serviceable_node = node->getChild("serviceable", 0, true);
!     _setting_node = node->getChild("setting-inhg", 0, true);
!     _pressure_node = fgGetNode(_static_pressure.c_str(), true);
!     _altitude_node = node->getChild("indicated-altitude-ft", 0, true);
  }
  
--- 42,55 ----
  
      SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
+     raw_PA = 0.0;
+     _pressure_node     = fgGetNode(_static_pressure.c_str(), true);
+     _serviceable_node  = node->getChild("serviceable", 0, true);
+     _setting_node      = node->getChild("setting-inhg", 0, true);
+     _press_alt_node    = node->getChild("pressure-alt-ft", 0, true);
+     _mode_c_node       = node->getChild("mode-c-alt-ft", 0, true);
+     _altitude_node     = node->getChild("indicated-altitude-ft", 0, true);
  
!     if (_setting_node->getDoubleValue() == 0)
!         _setting_node->setDoubleValue(29.921260);
  }
  
***************
*** 80,93 ****
  {
      if (_serviceable_node->getBoolValue()) {
          double pressure = _pressure_node->getDoubleValue();
          double setting = _setting_node->getDoubleValue();
! 
!                                 // Move towards the current setting
!         double last_altitude = _altitude_node->getDoubleValue();
!         double current_altitude =
!             _altitude_table->interpolate(setting - pressure);
!         _altitude_node->setDoubleValue(fgGetLowPass(last_altitude,
!                                                     current_altitude,
!                                                     dt * RESPONSIVENESS));
      }
  }
--- 58,75 ----
  {
      if (_serviceable_node->getBoolValue()) {
+         double trat = _tau > 0 ? dt/_tau : 100;
          double pressure = _pressure_node->getDoubleValue();
          double setting = _setting_node->getDoubleValue();
!         double press_alt = _press_alt_node->getDoubleValue();
!         // The mechanism settles slowly toward new pressure altitude:
!         raw_PA = fgGetLowPass(raw_PA, _altimeter.press_alt_ft(pressure), trat);
!         _mode_c_node->setDoubleValue(100 * round(raw_PA/100));
!         _kollsman = fgGetLowPass(_kollsman, _altimeter.kollsman_ft(setting), trat);
!         if (_quantum)
!             press_alt = _quantum*round(raw_PA/_quantum);
!         else
!             press_alt = raw_PA;
!         _press_alt_node->setDoubleValue(press_alt);
!         _altitude_node->setDoubleValue(press_alt - _kollsman);
      }
  }

Index: altimeter.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Instrumentation/altimeter.hxx,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C 2 -r1.6.2.1 -r1.6.2.2
*** altimeter.hxx	6 Dec 2006 22:11:43 -0000	1.6.2.1
--- altimeter.hxx	31 Mar 2007 09:36:16 -0000	1.6.2.2
***************
*** 1,4 ****
--- 1,5 ----
  // altimeter.hxx - an altimeter tied to the static port.
  // Written by David Megginson, started 2002.
+ // Updated by John Denker to match changes in altimeter.cxx in 2007
  //
  // This file is in the Public Domain and comes with no warranty.
***************
*** 8,20 ****
  #define __INSTRUMENTS_ALTIMETER_HXX 1
  
- #ifndef __cplusplus
- # error This library requires C++
- #endif
- 
  #include <simgear/props/props.hxx>
  #include <simgear/structure/subsystem_mgr.hxx>
! 
! 
! class SGInterpTable;
  
  
--- 9,15 ----
  #define __INSTRUMENTS_ALTIMETER_HXX 1
  
  #include <simgear/props/props.hxx>
  #include <simgear/structure/subsystem_mgr.hxx>
! #include <Environment/atmosphere.hxx>
  
  
***************
*** 37,41 ****
  public:
  
!     Altimeter (SGPropertyNode *node);
      virtual ~Altimeter ();
  
--- 32,36 ----
  public:
  
!     Altimeter (SGPropertyNode *node, double quantum = 0);
      virtual ~Altimeter ();
  
***************
*** 48,59 ****
      int _num;
      string _static_pressure;
  
      SGPropertyNode_ptr _serviceable_node;
      SGPropertyNode_ptr _setting_node;
      SGPropertyNode_ptr _pressure_node;
      SGPropertyNode_ptr _altitude_node;
  
!     SGInterpTable * _altitude_table;
!     
  };
  
--- 43,59 ----
      int _num;
      string _static_pressure;
+     double _tau;
+     double _quantum;
+     double _kollsman;
+     double raw_PA;
  
      SGPropertyNode_ptr _serviceable_node;
      SGPropertyNode_ptr _setting_node;
      SGPropertyNode_ptr _pressure_node;
+     SGPropertyNode_ptr _press_alt_node;
+     SGPropertyNode_ptr _mode_c_node;
      SGPropertyNode_ptr _altitude_node;
  
!     FGAltimeter _altimeter;
  };
  

Index: instrument_mgr.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Instrumentation/instrument_mgr.cxx,v
retrieving revision 1.29.2.1
retrieving revision 1.29.2.2
diff -C 2 -r1.29.2.1 -r1.29.2.2
*** instrument_mgr.cxx	29 Jan 2007 22:36:32 -0000	1.29.2.1
--- instrument_mgr.cxx	31 Mar 2007 09:36:16 -0000	1.29.2.2
***************
*** 28,32 ****
  #include "clock.hxx"
  #include "dme.hxx"
- #include "encoder.hxx"
  #include "gps.hxx"
  #include "gsdi.hxx"
--- 28,31 ----
***************
*** 122,126 ****
          } else if ( name == "encoder" ) {
              set_subsystem( "instrument" + temp.str(), 
!                            new Encoder( node ) );
          } else if ( name == "gps" ) {
              set_subsystem( "instrument" + temp.str(), 
--- 121,125 ----
          } else if ( name == "encoder" ) {
              set_subsystem( "instrument" + temp.str(), 
!                            new Altimeter( node ) );
          } else if ( name == "gps" ) {
              set_subsystem( "instrument" + temp.str(), 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-cvslogs mailing list
Flightgear-cvslogs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-cvslogs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic