Hello ,
Since I've had to add a nasal inHG to Kpa conversion to most
altimeters I've added , I decided maybe its something altimeter.cxx
should do , so here is a small patch to do that. Could someone check and
commit please ?
Thanks .
Index: altimeter.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/altimeter.cxx,v
retrieving revision 1.15
diff -U 3 -r1.15 altimeter.cxx
--- altimeter.cxx 3 Apr 2007 11:36:47 -0000 1.15
+++ altimeter.cxx 27 Nov 2008 19:16:20 -0000
@@ -28,6 +28,9 @@
#include "altimeter.hxx"
+#define STD_INHG 29.921260
+#define KPA_FACTOR 3.386389
+
Altimeter::Altimeter ( SGPropertyNode *node, double quantum )
: _name(node->getStringValue("name", "altimeter")),
_num(node->getIntValue("number", 0)),
@@ -50,12 +53,14 @@
_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_serviceable_node = node->getChild("serviceable", 0, true);
_setting_node = node->getChild("setting-inhg", 0, true);
+ _kpa_node = node->getChild("setting-kpa", 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);
+ _setting_node->setDoubleValue(STD_INHG);
+ _kpa_node->setDoubleValue(STD_INHG * KPA_FACTOR);
}
void
@@ -65,6 +70,7 @@
double trat = _tau > 0 ? dt/_tau : 100;
double pressure = _pressure_node->getDoubleValue();
double setting = _setting_node->getDoubleValue();
+ _kpa_node->setDoubleValue(setting * KPA_FACTOR);
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);
Index: altimeter.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/altimeter.hxx,v
retrieving revision 1.8
diff -U 3 -r1.8 altimeter.hxx
--- altimeter.hxx 31 Mar 2007 09:36:20 -0000 1.8
+++ altimeter.hxx 27 Nov 2008 19:16:20 -0000
@@ -49,6 +49,7 @@
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _setting_node;
+ SGPropertyNode_ptr _kpa_node;
SGPropertyNode_ptr _pressure_node;
SGPropertyNode_ptr _press_alt_node;
SGPropertyNode_ptr _mode_c_node;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel