]> git.mxchange.org Git - flightgear.git/commitdiff
Prepare and implement reinit methods for instruments
authorThorstenB <brehmt@gmail.com>
Sun, 16 Sep 2012 22:12:29 +0000 (00:12 +0200)
committerThorstenB <brehmt@gmail.com>
Mon, 17 Sep 2012 11:45:30 +0000 (13:45 +0200)
to clear error conditions, drifts, offsets etc

44 files changed:
src/Instrumentation/airspeed_indicator.cxx
src/Instrumentation/airspeed_indicator.hxx
src/Instrumentation/altimeter.cxx
src/Instrumentation/altimeter.hxx
src/Instrumentation/attitude_indicator.cxx
src/Instrumentation/attitude_indicator.hxx
src/Instrumentation/dme.cxx
src/Instrumentation/dme.hxx
src/Instrumentation/gps.cxx
src/Instrumentation/gps.hxx
src/Instrumentation/gyro.cxx
src/Instrumentation/gyro.hxx
src/Instrumentation/heading_indicator.cxx
src/Instrumentation/heading_indicator.hxx
src/Instrumentation/heading_indicator_dg.cxx
src/Instrumentation/heading_indicator_dg.hxx
src/Instrumentation/heading_indicator_fg.cxx
src/Instrumentation/heading_indicator_fg.hxx
src/Instrumentation/inst_vertical_speed_indicator.cxx
src/Instrumentation/inst_vertical_speed_indicator.hxx
src/Instrumentation/kr_87.cxx
src/Instrumentation/kr_87.hxx
src/Instrumentation/mag_compass.cxx
src/Instrumentation/mag_compass.hxx
src/Instrumentation/marker_beacon.cxx
src/Instrumentation/marker_beacon.hxx
src/Instrumentation/mrg.cxx
src/Instrumentation/mrg.hxx
src/Instrumentation/navradio.cxx
src/Instrumentation/navradio.hxx
src/Instrumentation/slip_skid_ball.cxx
src/Instrumentation/slip_skid_ball.hxx
src/Instrumentation/tacan.cxx
src/Instrumentation/tacan.hxx
src/Instrumentation/tcas.cxx
src/Instrumentation/tcas.hxx
src/Instrumentation/turn_indicator.cxx
src/Instrumentation/turn_indicator.hxx
src/Instrumentation/vertical_speed_indicator.cxx
src/Instrumentation/vertical_speed_indicator.hxx
src/Systems/static.cxx
src/Systems/static.hxx
src/Systems/vacuum.cxx
src/Systems/vacuum.hxx

index d31fd7672fd53de1b7404beee0abe1295e71bc5d..a3ff2df4eecb75d06af945c5d74bb5b936189b8c 100644 (file)
@@ -80,6 +80,12 @@ AirspeedIndicator::init ()
     _environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment");
 }
 
+void
+AirspeedIndicator::reinit ()
+{
+    _speed_node->setDoubleValue(0.0);
+}
+
 #ifndef FPSTOKTS
 # define FPSTOKTS 0.592484
 #endif
index 26dd15a525167c1b63c2a25e12289c07a1443741..1222b492feaf321531048aff6c21cec01a377366 100644 (file)
@@ -40,6 +40,7 @@ public:
     virtual ~AirspeedIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
 
 private:
index 3924ed7c92dabd7d5885acf706f41f80c0ee46c3..3ef2046872993ad20a145054a1be7d192e70745e 100644 (file)
@@ -75,13 +75,20 @@ Altimeter::setSettingHPa( double value )
 void
 Altimeter::init ()
 {
-    raw_PA = 0.0;
-    _kollsman = 0.0;
     _pressure_node     = fgGetNode(_static_pressure.c_str(), true);
     _serviceable_node  = _rootNode->getChild("serviceable", 0, true);
     _press_alt_node    = _rootNode->getChild("pressure-alt-ft", 0, true);
     _mode_c_node       = _rootNode->getChild("mode-c-alt-ft", 0, true);
     _altitude_node     = _rootNode->getChild("indicated-altitude-ft", 0, true);
+
+    reinit();
+}
+
+void
+Altimeter::reinit ()
+{
+    _raw_PA = 0.0;
+    _kollsman = 0.0;
 }
 
 void
@@ -105,13 +112,13 @@ Altimeter::update (double dt)
         double pressure = _pressure_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 * SGMiscd::round(raw_PA/100));
+        _raw_PA = fgGetLowPass(_raw_PA, _altimeter.press_alt_ft(pressure), trat);
+        _mode_c_node->setDoubleValue(100 * SGMiscd::round(_raw_PA/100));
         _kollsman = fgGetLowPass(_kollsman, _altimeter.kollsman_ft(_settingInHg), trat);
         if (_quantum)
-            press_alt = _quantum * SGMiscd::round(raw_PA/_quantum);
+            press_alt = _quantum * SGMiscd::round(_raw_PA/_quantum);
         else
-            press_alt = raw_PA;
+            press_alt = _raw_PA;
         _press_alt_node->setDoubleValue(press_alt);
         _altitude_node->setDoubleValue(press_alt - _kollsman);
     }
index f57c1ad37400d2503835dfdc4c6dde4ce2ef0d02..121cafa7ce72b2ea1af6a8c0bc146112b09d8fca 100644 (file)
@@ -36,6 +36,7 @@ public:
     virtual ~Altimeter ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
     virtual void bind();
     virtual void unbind();
@@ -51,7 +52,7 @@ private:
     double _tau;
     double _quantum;
     double _kollsman;
-    double raw_PA;
+    double _raw_PA;
     double _settingInHg;
 
     SGPropertyNode_ptr _serviceable_node;
index 19f6d4c708ad0d20973eabc01650603efadc4006..de79e811df38e939f610c9b55d92569a0abb743f 100644 (file)
@@ -65,6 +65,16 @@ AttitudeIndicator::init ()
     _roll_int_node = node->getChild("internal-roll-deg", 0, true);
     _pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
     _roll_out_node = node->getChild("indicated-roll-deg", 0, true);
+
+    reinit();
+}
+
+void
+AttitudeIndicator::reinit ()
+{
+    _roll_int_node->setDoubleValue(0.0);
+    _pitch_int_node->setDoubleValue(0.0);
+    _gyro.reinit();
 }
 
 void
index 4bdc48b90c51a9452f895e3dabad25bd2945a65c..14453511d21e651b3ee5a57dd0f6a62869087051 100644 (file)
@@ -45,6 +45,7 @@ public:
     virtual ~AttitudeIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
index bcea965d83b596c766f49a772f4d50406e6f428b..ae1ce11e97af4d23b4371daabfb916453a5b59cd 100644 (file)
@@ -88,6 +88,14 @@ DME::init ()
     if( NULL == _audioIdent ) 
         _audioIdent = new DMEAudioIdent( temp.str() );
     _audioIdent->init();
+
+    reinit();
+}
+
+void
+DME::reinit ()
+{
+    _time_before_search_sec = 0;
 }
 
 void
index 084fd8207569fc5e770258116112ee873d444ddd..376e1ce9ca767f960501c2b083312c62ffa4667e 100644 (file)
@@ -39,6 +39,7 @@ public:
     virtual ~DME ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double delta_time_sec);
 
 private:
index 3d15e8e57a11a4ef4c5e1179483795772cabae54..729ad0526f70460098d9127db6f3a991713e3f6e 100644 (file)
@@ -328,7 +328,11 @@ GPS::init ()
   
   // last thing, add the deprecated prop watcher
   new DeprecatedPropListener(_gpsNode);
-  
+}
+
+void
+GPS::reinit ()
+{
   clearOutput();
 }
 
index 21cd461662d4404e32b62146d40bcfbf812133b0..f1e191d1fcd0fb2b5d64f59b158f0a1194f5f65e 100644 (file)
@@ -84,6 +84,7 @@ public:
 
   // SGSubsystem interface
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double delta_time_sec);
 
     virtual void bind();
index 93fee30bedbb9354f51c0a1f014eda5d4dc3b034..6de938e9a63de5ff59266c3a26a57e4085cf2da9 100644 (file)
@@ -13,6 +13,12 @@ Gyro::~Gyro ()
 {
 }
 
+void Gyro::reinit(void)
+{
+    _power_norm = 0.0;
+    _spin_norm = 0.0;
+}
+
 void
 Gyro::update (double delta_time_sec)
 {
index eee834cb636b501d559b627b51ab97d2aee38735..53a71c69f1cf151c3790b4e075c5db88c374f801 100644 (file)
@@ -18,12 +18,15 @@ public:
      */
     Gyro ();
 
-
     /**
      * Destructor.
      */
     virtual ~Gyro ();
 
+    /**
+     * Reset the gyro.
+     */
+    void reinit(void);
 
     /**
      * Update the gyro.
index d026be3e076d771e0b053cc0f865637f2263505b..12daafb8a6288734e712fa789455f25730795fde 100644 (file)
@@ -48,8 +48,16 @@ HeadingIndicator::init ()
     _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
     _heading_bug_error_node = node->getChild("heading-bug-error-deg", 0, true);
     _heading_bug_node = node->getChild("heading-bug-deg", 0, true);
+
+    reinit();
+}
+
+void
+HeadingIndicator::reinit ()
+{
     _last_heading_deg = (_heading_in_node->getDoubleValue() +
                          _offset_node->getDoubleValue());
+    _gyro.reinit();
 }
 
 void
index ecd06fb1848dc6ebf1a9f3eb792c5fe59a0c2565..f340c05ddadc0aaa33b25f7e311c663ebffb9bf8 100644 (file)
@@ -42,6 +42,7 @@ public:
     virtual ~HeadingIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
index 287938983965e04a7d2a6b42bd25f607d1d619ab..3f64a0c82a37b070f501cdceb14f4bec9a71539d 100644 (file)
@@ -61,25 +61,20 @@ HeadingIndicatorDG::init ()
 
     _heading_in_node = fgGetNode("/orientation/heading-deg", true);
     _yaw_rate_node   = fgGetNode("/orientation/yaw-rate-degps", true);
-     _g_node         =   fgGetNode("/accelerations/pilot-g", true);
+     _g_node         = fgGetNode("/accelerations/pilot-g", true);
 
-
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
-    _offset_node = node->getChild("offset-deg", 0, true);
-    _serviceable_node = node->getChild("serviceable", 0, true);
+    SGPropertyNode *node    = fgGetNode(branch.c_str(), num, true );
+    _offset_node            = node->getChild("offset-deg", 0, true);
+    _serviceable_node       = node->getChild("serviceable", 0, true);
     _heading_bug_error_node = node->getChild("heading-bug-error-deg", 0, true);
-    _error_node = node->getChild("error-deg", 0, true);
-    _nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
-    _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
-    _align_node = node->getChild("align-deg", 0, true);
+    _error_node             = node->getChild("error-deg", 0, true);
+    _nav1_error_node        = node->getChild("nav1-course-error-deg", 0, true);
+    _heading_out_node       = node->getChild("indicated-heading-deg", 0, true);
+    _align_node             = node->getChild("align-deg", 0, true);
 
     _electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
 
-    _align_node->setDoubleValue(0);
-    _error_node->setDoubleValue(0);
-
-    _last_heading_deg = (_heading_in_node->getDoubleValue() +
-        _offset_node->getDoubleValue() + _align_node->getDoubleValue());
+    reinit();
 }
 
 void
@@ -108,6 +103,20 @@ HeadingIndicatorDG::unbind ()
     fgUntie((branch + "/spin").c_str());
 }
 
+void
+HeadingIndicatorDG::reinit (void)
+{
+    // reset errors/drift values
+    _align_node->setDoubleValue(0.0);
+    _error_node->setDoubleValue(0.0);
+    _offset_node->setDoubleValue(0.0);
+
+    _last_heading_deg = (_heading_in_node->getDoubleValue() +
+        _offset_node->getDoubleValue() + _align_node->getDoubleValue());
+
+    _gyro.reinit();
+}
+
 void
 HeadingIndicatorDG::update (double dt)
 {
@@ -162,7 +171,7 @@ HeadingIndicatorDG::update (double dt)
 
     _heading_out_node->setDoubleValue(heading);
 
-                                 // calculate the difference between the indicacted heading
+                                 // calculate the difference between the indicated heading
                                  // and the selected heading for use with an autopilot
     static SGPropertyNode *bnode
         = fgGetNode( "/autopilot/settings/heading-bug-deg", false );
index f5035b15934b2515ccfeda4e26a21660f9aa77b9..d4f2fb759eff2849818aacdafaaf995b925637e4 100644 (file)
@@ -40,6 +40,7 @@ public:
     virtual ~HeadingIndicatorDG ();\r
 \r
     virtual void init ();\r
+    virtual void reinit ();\r
     virtual void bind ();\r
     virtual void unbind ();\r
     virtual void update (double dt);\r
@@ -51,7 +52,6 @@ private:
 \r
     std::string name;\r
     int num;\r
-    //string vacuum_system;\r
 \r
     SGPropertyNode_ptr _offset_node;\r
     SGPropertyNode_ptr _heading_in_node;\r
index 406300f12f01b158fb1519cead55d11a6a2ad28d..eeeaf1bd4570a58f5272327f63de6d858c6a27e3 100644 (file)
@@ -61,7 +61,7 @@ HeadingIndicatorFG::init ()
     string branch;
     branch = "/instrumentation/" + name;
     
-       _heading_in_node = fgGetNode("/orientation/heading-deg", true);
+    _heading_in_node = fgGetNode("/orientation/heading-deg", true);
 
     SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
     if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) {
@@ -69,14 +69,22 @@ HeadingIndicatorFG::init ()
       _offset_node->setDoubleValue( -globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES );
     }
     _serviceable_node = node->getChild("serviceable", 0, true);
-       _error_node = node->getChild("heading-bug-error-deg", 0, true);
-       _nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
+    _error_node = node->getChild("heading-bug-error-deg", 0, true);
+    _nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
     _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
     _off_node         = node->getChild("off-flag", 0, true);
 
+    _electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
+
+    reinit();
+}
+
+void
+HeadingIndicatorFG::reinit ()
+{
     _last_heading_deg = (_heading_in_node->getDoubleValue() +
                          _offset_node->getDoubleValue());
-       _electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
+    _gyro.reinit();
 }
 
 void
@@ -91,7 +99,6 @@ HeadingIndicatorFG::bind ()
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
     fgTie((branch + "/spin").c_str(),
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
-       
 }
 
 void
index cb31470d9adc62e16d8b8ad8f36f450bbfc3d816..9ed2bce0bc77a46b2e75a922f1aa1f0dc8990249 100644 (file)
@@ -41,8 +41,9 @@ public:
     HeadingIndicatorFG ();
     virtual ~HeadingIndicatorFG ();
 
-    virtual void init ();   
-    virtual void bind (); 
+    virtual void init ();
+    virtual void reinit ();
+    virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
 
index 8730901c92ff2116d13abe306bb21050e39be188..639b950255112aa64d07dea180874fee0599305e 100644 (file)
@@ -185,9 +185,14 @@ void InstVerticalSpeedIndicator::init ()
         node->getNode("indicated-speed-fps", true);
     _speed_min_node =
         node->getNode("indicated-speed-fpm", true);
+}
 
+void InstVerticalSpeedIndicator::reinit ()
+{
     // Initialize at ambient pressure
     _internal_pressure_inhg = _pressure_node->getDoubleValue();
+    _speed_ft_per_s = 0.0;
+    _internal_sea_inhg = _sea_node->getDoubleValue();
 }
 
 
index 18e818604e80e19aa57d7731c7d033e53006270c..10c9f00c18e954408a9b2e82852f8559e8bbd559 100644 (file)
@@ -58,6 +58,7 @@ public:
     virtual ~InstVerticalSpeedIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
 
 private:
index 22694f7cf6ef3532bb80dfc75f55f477c5435f30..8b968c73a6f4cbe04875cf1b283048f83e18b081 100644 (file)
@@ -118,6 +118,9 @@ void FGKR_87::init () {
     _sgr->tie_to_listener();
 }
 
+void FGKR_87::reinit () {
+    _time_before_search_sec = 0;
+}
 
 void FGKR_87::bind () {
     _tiedProperties.setRoot(fgGetNode("/instrumentation/kr-87", true));
index cd10cf4459e3a10e5cf4cf650d1cf49bc27ebe75..626b502838405f55fb9b0663258507e82c8c62f5 100644 (file)
@@ -109,6 +109,7 @@ public:
     ~FGKR_87();
 
     void init ();
+    void reinit ();
     void bind ();
     void unbind ();
     void update (double dt_sec);
index cf8ee8c894db6690ac06afb9a62cd5830a0cc3eb..74252b1ed192a302675fd465c1f02a243aa0264d 100644 (file)
@@ -48,8 +48,16 @@ MagCompass::init ()
     _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
     _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
     _out_node = node->getChild("indicated-heading-deg", 0, true);
+
+    reinit();
 }
 
+void
+MagCompass::reinit ()
+{
+    _error_deg = 0.0;
+    _rate_degps = 0.0;
+}
 
 void
 MagCompass::update (double delta_time_sec)
index 474babdafa0f26ddcdeb33a708bbe49831d6f000..91af5c056cd696d396b9f42549528005caab3d3e 100644 (file)
@@ -44,6 +44,7 @@ public:
     virtual ~MagCompass ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
 
 private:
index 5fa56fadef3d3379887e87baee19ba4857f78947..41b981536a6262e6da037e66b03e5523bda64518 100644 (file)
@@ -43,7 +43,6 @@ using std::string;
 // Constructor
 FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) :
     audio_vol(NULL),
-    need_update(true),
     outer_blink(false),
     middle_blink(false),
     inner_blink(false),
@@ -121,12 +120,17 @@ FGMarkerBeacon::init ()
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
-    blink.stamp();
+    reinit();
+}
 
+void
+FGMarkerBeacon::reinit ()
+{
+    blink.stamp();
     outer_marker = middle_marker = inner_marker = false;
+    _time_before_search_sec = 0.0;
 }
 
-
 void
 FGMarkerBeacon::bind ()
 {
@@ -160,8 +164,6 @@ FGMarkerBeacon::unbind ()
 void
 FGMarkerBeacon::update(double dt)
 {
-    need_update = false;
-
     // On timeout, scan again, this needs to run every iteration no
     // matter what the power or serviceable state.  If power is turned
     // off or the unit becomes unserviceable while a beacon sound is
index 52259b6a2c49ced3ed2a6dbb75a417e3ea911eb7..5836f92ea3a4d1aa4b21c0d16339f28e3d63ec5e 100644 (file)
@@ -51,8 +51,6 @@ class FGMarkerBeacon : public SGSubsystem
     SGPropertyNode_ptr serviceable;
     SGPropertyNode_ptr sound_working;
 
-    bool need_update;
-
     bool outer_marker;
     bool middle_marker;
     bool inner_marker;
@@ -83,6 +81,7 @@ public:
     ~FGMarkerBeacon();
 
     void init ();
+    void reinit ();
     void bind ();
     void unbind ();
     void update (double dt);
index 2b1280340d35263c0cb207701ba072d744d30ab5..1eb1f239441761a08b2e6d493172bb6767f26fb5 100644 (file)
@@ -41,19 +41,6 @@ MasterReferenceGyro::~MasterReferenceGyro ()
 void
 MasterReferenceGyro::init ()
 {
-    _last_hdg = 0;
-    _last_roll = 0;
-    _last_pitch = 0;
-    _indicated_hdg = 0;
-    _indicated_roll = 0;
-    _indicated_pitch = 0;
-    _indicated_hdg_rate = 0;
-    _indicated_roll_rate = 0;
-    _indicated_pitch_rate = 0;
-    _erect_time = 180;
-    _last_g = 1;
-    _g_error = 10;
-
     string branch;
     branch = "/instrumentation/" + _name;
 
@@ -83,12 +70,32 @@ MasterReferenceGyro::init ()
     _hdg_input_source_node = node->getChild("heading-source", 0, true);
     _fast_erect_node = node->getChild("fast-erect", 0, true);
 
+    reinit();
+}
+
+void
+MasterReferenceGyro::reinit ()
+{
+    _last_hdg = 0;
+    _last_roll = 0;
+    _last_pitch = 0;
+    _indicated_hdg = 0;
+    _indicated_roll = 0;
+    _indicated_pitch = 0;
+    _indicated_hdg_rate = 0;
+    _indicated_roll_rate = 0;
+    _indicated_pitch_rate = 0;
+    _erect_time = 180;
+    _last_g = 1;
+    _g_error = 10;
+
     _electrical_node->setDoubleValue(0);
     _responsiveness_node->setDoubleValue(0.75);
     _off_node->setBoolValue(false);
     _hdg_input_source_node->setBoolValue(false);
     _fast_erect_node->setBoolValue(false);
     _g_in_node->setDoubleValue(1);
+    _gyro.reinit();
 }
 
 void
index 25be4d8e6923b8b454c577ce5b94c51650adcf71..7f8f9774255fe835d2328c4db6891ef0d3757e23 100644 (file)
@@ -43,6 +43,7 @@ public:
     virtual ~MasterReferenceGyro ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
index 4c054ff9c604f43ea2f84c14cc37c386abb44932..d908e74909040f5c5ba97e3f45a28bb7a3996aa1 100644 (file)
@@ -267,6 +267,12 @@ FGNavRadio::init ()
     node->getNode( "dme-in-range", true )->alias( fgGetNode("/instrumentation/dme[0]/in-range", true ) );
 }
 
+void
+FGNavRadio::reinit ()
+{
+    _time_before_search_sec = -1.0;
+}
+
 void
 FGNavRadio::bind ()
 {
index 1c33f5eb60050738d52062ce5e46b4659592c438..0debf55dd8217404d2be78f5dc4b8c76457d59fd 100644 (file)
@@ -190,6 +190,7 @@ public:
     ~FGNavRadio();
 
     void init ();
+    void reinit ();
     void bind ();
     void unbind ();
     void update (double dt);
index b5a439158a7fb0c58fc75e27600093fc5ba8dbeb..4bb1f916bdc7ed58b2a7595bc0dff7534a29768b 100644 (file)
@@ -36,6 +36,14 @@ SlipSkidBall::init ()
     _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
     _out_node = node->getChild("indicated-slip-skid", 0, true);
     _override_node = node->getChild("override", 0, true);
+
+    reinit();
+}
+
+void
+SlipSkidBall::reinit ()
+{
+    _out_node->setDoubleValue(0.0);
 }
 
 void
index 1dc1c8916b6e492841f47b48605524e3ca9d9719..728717b22fbd74b91b5c055848c1b0dcac8ddcf7 100644 (file)
@@ -37,6 +37,7 @@ public:
     virtual ~SlipSkidBall ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
 
 private:
index 21fc2f4935640adf69c70918ee43fe18efed5922..dfdab58fde6a0ee262ec52bdfd1fd227ff76aa0e 100644 (file)
@@ -124,6 +124,12 @@ TACAN::init ()
     _electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true);
 }
 
+void
+TACAN::reinit ()
+{
+    _time_before_search_sec = 0;
+}
+
 void
 TACAN::update (double delta_time_sec)
 {
index 083efa665042b6fbf2d1081a88ce3acdcde9b653..fd26b22c2aabfdee2e8edb512ad639c9d23cf8b3 100644 (file)
@@ -40,6 +40,7 @@ public:
     virtual ~TACAN ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double delta_time_sec);
 
 private:
index 32cd6f637876927fbe3b5a8a057cb27525f1c774..95a4dda5fbd2d86af2af247bc921fd1e87faad67 100644 (file)
@@ -377,6 +377,12 @@ TCAS::AdvisoryCoordinator::AdvisoryCoordinator(TCAS* _tcas) :
 
 void
 TCAS::AdvisoryCoordinator::init(void)
+{
+    reinit();
+}
+
+void
+TCAS::AdvisoryCoordinator::reinit(void)
 {
     clear();
     previous = current;
@@ -1181,6 +1187,13 @@ TCAS::init(void)
     threatDetector.init();
 }
 
+void
+TCAS::reinit(void)
+{
+    nextUpdateTime = 0;
+    advisoryCoordinator.reinit();
+}
+
 void
 TCAS::bind(void)
 {
index f44faf3985ecca5c1421671f958274bc66e5f157..9f9f0964e0cd087288a19e7ef69b6fda10d9d8b5 100644 (file)
@@ -238,6 +238,7 @@ class TCAS : public SGSubsystem
 
         void bind            (SGPropertyNode* node);
         void init            (void);
+        void reinit          (void);
         void update          (int mode);
 
         void clear           (void);
@@ -385,6 +386,7 @@ public:
     virtual void bind   (void);
     virtual void unbind (void);
     virtual void init   (void);
+    virtual void reinit (void);
     virtual void update (double dt);
 };
 
index 6b91cae37bf256b4f4813d64e884d1d43882fc0a..06fd868e2ba8f313b10b35efe54f581fd64c74b6 100644 (file)
@@ -46,6 +46,15 @@ TurnIndicator::init ()
     _electric_current_node = 
         fgGetNode("/systems/electrical/outputs/turn-coordinator", true);
     _rate_out_node = node->getChild("indicated-turn-rate", 0, true);
+
+    reinit();
+}
+
+void
+TurnIndicator::reinit ()
+{
+    _last_rate = 0;
+    _gyro.reinit();
 }
 
 void
index 04a8e6fcb10132a5d1968265629d42d5148aada3..096e8fcd62dc098ad9f61e0637900f5b47e16c56 100644 (file)
@@ -44,6 +44,7 @@ public:
     virtual ~TurnIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
index f5991265107fded22a674b2a4bf5e6dc06ea4621..55d3a77ed5a686fea385fbd28b59d4bbaa2ba871 100644 (file)
@@ -39,7 +39,13 @@ VerticalSpeedIndicator::init ()
     _speed_node = node->getChild("indicated-speed-fpm", 0, true);
     _speed_up_node = fgGetNode("/sim/speed-up", true);
 
-                                // Initialize at ambient pressure
+    reinit();
+}
+
+void
+VerticalSpeedIndicator::reinit ()
+{
+    // Initialize at ambient pressure
     _internal_pressure_inhg = _pressure_node->getDoubleValue();
 }
 
index 56b4f0e18366a594f2c9eec5d3cc67798680bf30..8c9b31ac695090c39669b3ed752baa512a0866c3 100644 (file)
@@ -36,6 +36,7 @@ public:
     virtual ~VerticalSpeedIndicator ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void update (double dt);
 
 private:
index e8447121c14caf51946e97acbb96fefe7a60d4b6..f58d1ce3cd457a675caa914515a2eaef4bf0a4b0 100644 (file)
@@ -37,6 +37,15 @@ StaticSystem::init ()
     _serviceable_node = node->getChild("serviceable", 0, true);
     _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
     _pressure_out_node = node->getChild("pressure-inhg", 0, true);
+
+    reinit();
+}
+
+void
+StaticSystem::reinit ()
+{
+    // start with settled static pressure
+    _pressure_out_node->setDoubleValue(_pressure_in_node->getDoubleValue());
 }
 
 void
@@ -56,7 +65,6 @@ StaticSystem::update (double dt)
         double trat = _tau ? dt/_tau : 100;
         double target = _pressure_in_node->getDoubleValue();
         double current = _pressure_out_node->getDoubleValue();
-        // double delta = target - current;
         _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));
     }
 }
index b4853d1ea26f405151027606e750605a74738ce0..b50d32c5adc91a03d415a5fabd0cd4c86a50c83a 100644 (file)
@@ -40,6 +40,7 @@ public:
     virtual ~StaticSystem ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);
index b7f91e0ec29dd2f8dbb2aced1c4bb1cb78b4f1b6..9bf84e284d48fb5a4f992cb8122fb61426c1162c 100644 (file)
@@ -46,6 +46,14 @@ VacuumSystem::init()
     }
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
     _suction_node = node->getChild("suction-inhg", 0, true);
+
+    reinit();
+}
+
+void
+VacuumSystem::reinit()
+{
+    _suction_node->setDoubleValue(0.0);
 }
 
 void
@@ -69,14 +77,14 @@ VacuumSystem::update (double dt)
     if (!_serviceable_node->getBoolValue()) {
         suction = 0.0;
     } else {
-       // select the source with the max rpm
+        // select the source with the max rpm
         double rpm = 0.0;
-       for ( i = 0; i < _rpm_nodes.size(); i++ ) {
-         double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
-         if ( tmp > rpm ) {
-           rpm = tmp;
-         }
-       }
+        for ( i = 0; i < _rpm_nodes.size(); i++ ) {
+          double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
+          if ( tmp > rpm ) {
+            rpm = tmp;
+          }
+        }
         double pressure = _pressure_node->getDoubleValue();
         // This magic formula yields about 4 inhg at 700 rpm
         suction = pressure * rpm / (rpm + 4875.0);
index 3b47132699f8b0fea6d8372690bece43352db515..c9507c81648f5dc5aab82e80a4d24ada3f33e94e 100644 (file)
@@ -43,6 +43,7 @@ public:
     virtual ~VacuumSystem ();
 
     virtual void init ();
+    virtual void reinit ();
     virtual void bind ();
     virtual void unbind ();
     virtual void update (double dt);