1
0
Fork 0

Prepare and implement reinit methods for instruments

to clear error conditions, drifts, offsets etc
This commit is contained in:
ThorstenB 2012-09-17 00:12:29 +02:00
parent 65a5f6744f
commit 043128c7c0
44 changed files with 238 additions and 62 deletions

View file

@ -80,6 +80,12 @@ AirspeedIndicator::init ()
_environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment"); _environmentManager = (FGEnvironmentMgr*) globals->get_subsystem("environment");
} }
void
AirspeedIndicator::reinit ()
{
_speed_node->setDoubleValue(0.0);
}
#ifndef FPSTOKTS #ifndef FPSTOKTS
# define FPSTOKTS 0.592484 # define FPSTOKTS 0.592484
#endif #endif

View file

@ -40,6 +40,7 @@ public:
virtual ~AirspeedIndicator (); virtual ~AirspeedIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
private: private:

View file

@ -75,13 +75,20 @@ Altimeter::setSettingHPa( double value )
void void
Altimeter::init () Altimeter::init ()
{ {
raw_PA = 0.0;
_kollsman = 0.0;
_pressure_node = fgGetNode(_static_pressure.c_str(), true); _pressure_node = fgGetNode(_static_pressure.c_str(), true);
_serviceable_node = _rootNode->getChild("serviceable", 0, true); _serviceable_node = _rootNode->getChild("serviceable", 0, true);
_press_alt_node = _rootNode->getChild("pressure-alt-ft", 0, true); _press_alt_node = _rootNode->getChild("pressure-alt-ft", 0, true);
_mode_c_node = _rootNode->getChild("mode-c-alt-ft", 0, true); _mode_c_node = _rootNode->getChild("mode-c-alt-ft", 0, true);
_altitude_node = _rootNode->getChild("indicated-altitude-ft", 0, true); _altitude_node = _rootNode->getChild("indicated-altitude-ft", 0, true);
reinit();
}
void
Altimeter::reinit ()
{
_raw_PA = 0.0;
_kollsman = 0.0;
} }
void void
@ -105,13 +112,13 @@ Altimeter::update (double dt)
double pressure = _pressure_node->getDoubleValue(); double pressure = _pressure_node->getDoubleValue();
double press_alt = _press_alt_node->getDoubleValue(); double press_alt = _press_alt_node->getDoubleValue();
// The mechanism settles slowly toward new pressure altitude: // The mechanism settles slowly toward new pressure altitude:
raw_PA = fgGetLowPass(raw_PA, _altimeter.press_alt_ft(pressure), trat); _raw_PA = fgGetLowPass(_raw_PA, _altimeter.press_alt_ft(pressure), trat);
_mode_c_node->setDoubleValue(100 * SGMiscd::round(raw_PA/100)); _mode_c_node->setDoubleValue(100 * SGMiscd::round(_raw_PA/100));
_kollsman = fgGetLowPass(_kollsman, _altimeter.kollsman_ft(_settingInHg), trat); _kollsman = fgGetLowPass(_kollsman, _altimeter.kollsman_ft(_settingInHg), trat);
if (_quantum) if (_quantum)
press_alt = _quantum * SGMiscd::round(raw_PA/_quantum); press_alt = _quantum * SGMiscd::round(_raw_PA/_quantum);
else else
press_alt = raw_PA; press_alt = _raw_PA;
_press_alt_node->setDoubleValue(press_alt); _press_alt_node->setDoubleValue(press_alt);
_altitude_node->setDoubleValue(press_alt - _kollsman); _altitude_node->setDoubleValue(press_alt - _kollsman);
} }

View file

@ -36,6 +36,7 @@ public:
virtual ~Altimeter (); virtual ~Altimeter ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
virtual void bind(); virtual void bind();
virtual void unbind(); virtual void unbind();
@ -51,7 +52,7 @@ private:
double _tau; double _tau;
double _quantum; double _quantum;
double _kollsman; double _kollsman;
double raw_PA; double _raw_PA;
double _settingInHg; double _settingInHg;
SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _serviceable_node;

View file

@ -65,6 +65,16 @@ AttitudeIndicator::init ()
_roll_int_node = node->getChild("internal-roll-deg", 0, true); _roll_int_node = node->getChild("internal-roll-deg", 0, true);
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true); _pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
_roll_out_node = node->getChild("indicated-roll-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 void

View file

@ -45,6 +45,7 @@ public:
virtual ~AttitudeIndicator (); virtual ~AttitudeIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -88,6 +88,14 @@ DME::init ()
if( NULL == _audioIdent ) if( NULL == _audioIdent )
_audioIdent = new DMEAudioIdent( temp.str() ); _audioIdent = new DMEAudioIdent( temp.str() );
_audioIdent->init(); _audioIdent->init();
reinit();
}
void
DME::reinit ()
{
_time_before_search_sec = 0;
} }
void void

View file

@ -39,6 +39,7 @@ public:
virtual ~DME (); virtual ~DME ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double delta_time_sec); virtual void update (double delta_time_sec);
private: private:

View file

@ -328,7 +328,11 @@ GPS::init ()
// last thing, add the deprecated prop watcher // last thing, add the deprecated prop watcher
new DeprecatedPropListener(_gpsNode); new DeprecatedPropListener(_gpsNode);
}
void
GPS::reinit ()
{
clearOutput(); clearOutput();
} }

View file

@ -84,6 +84,7 @@ public:
// SGSubsystem interface // SGSubsystem interface
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double delta_time_sec); virtual void update (double delta_time_sec);
virtual void bind(); virtual void bind();

View file

@ -13,6 +13,12 @@ Gyro::~Gyro ()
{ {
} }
void Gyro::reinit(void)
{
_power_norm = 0.0;
_spin_norm = 0.0;
}
void void
Gyro::update (double delta_time_sec) Gyro::update (double delta_time_sec)
{ {

View file

@ -18,12 +18,15 @@ public:
*/ */
Gyro (); Gyro ();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Gyro (); virtual ~Gyro ();
/**
* Reset the gyro.
*/
void reinit(void);
/** /**
* Update the gyro. * Update the gyro.

View file

@ -48,8 +48,16 @@ HeadingIndicator::init ()
_heading_out_node = node->getChild("indicated-heading-deg", 0, true); _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_heading_bug_error_node = node->getChild("heading-bug-error-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); _heading_bug_node = node->getChild("heading-bug-deg", 0, true);
reinit();
}
void
HeadingIndicator::reinit ()
{
_last_heading_deg = (_heading_in_node->getDoubleValue() + _last_heading_deg = (_heading_in_node->getDoubleValue() +
_offset_node->getDoubleValue()); _offset_node->getDoubleValue());
_gyro.reinit();
} }
void void

View file

@ -42,6 +42,7 @@ public:
virtual ~HeadingIndicator (); virtual ~HeadingIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -63,7 +63,6 @@ HeadingIndicatorDG::init ()
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", 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 ); SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
_offset_node = node->getChild("offset-deg", 0, true); _offset_node = node->getChild("offset-deg", 0, true);
_serviceable_node = node->getChild("serviceable", 0, true); _serviceable_node = node->getChild("serviceable", 0, true);
@ -75,11 +74,7 @@ HeadingIndicatorDG::init ()
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true); _electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
_align_node->setDoubleValue(0); reinit();
_error_node->setDoubleValue(0);
_last_heading_deg = (_heading_in_node->getDoubleValue() +
_offset_node->getDoubleValue() + _align_node->getDoubleValue());
} }
void void
@ -108,6 +103,20 @@ HeadingIndicatorDG::unbind ()
fgUntie((branch + "/spin").c_str()); 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 void
HeadingIndicatorDG::update (double dt) HeadingIndicatorDG::update (double dt)
{ {
@ -162,7 +171,7 @@ HeadingIndicatorDG::update (double dt)
_heading_out_node->setDoubleValue(heading); _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 // and the selected heading for use with an autopilot
static SGPropertyNode *bnode static SGPropertyNode *bnode
= fgGetNode( "/autopilot/settings/heading-bug-deg", false ); = fgGetNode( "/autopilot/settings/heading-bug-deg", false );

View file

@ -40,6 +40,7 @@ public:
virtual ~HeadingIndicatorDG (); virtual ~HeadingIndicatorDG ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);
@ -51,7 +52,6 @@ private:
std::string name; std::string name;
int num; int num;
//string vacuum_system;
SGPropertyNode_ptr _offset_node; SGPropertyNode_ptr _offset_node;
SGPropertyNode_ptr _heading_in_node; SGPropertyNode_ptr _heading_in_node;

View file

@ -74,9 +74,17 @@ HeadingIndicatorFG::init ()
_heading_out_node = node->getChild("indicated-heading-deg", 0, true); _heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_off_node = node->getChild("off-flag", 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() + _last_heading_deg = (_heading_in_node->getDoubleValue() +
_offset_node->getDoubleValue()); _offset_node->getDoubleValue());
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true); _gyro.reinit();
} }
void void
@ -91,7 +99,6 @@ HeadingIndicatorFG::bind ()
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
fgTie((branch + "/spin").c_str(), fgTie((branch + "/spin").c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
} }
void void

View file

@ -42,6 +42,7 @@ public:
virtual ~HeadingIndicatorFG (); virtual ~HeadingIndicatorFG ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -185,9 +185,14 @@ void InstVerticalSpeedIndicator::init ()
node->getNode("indicated-speed-fps", true); node->getNode("indicated-speed-fps", true);
_speed_min_node = _speed_min_node =
node->getNode("indicated-speed-fpm", true); node->getNode("indicated-speed-fpm", true);
}
void InstVerticalSpeedIndicator::reinit ()
{
// Initialize at ambient pressure // Initialize at ambient pressure
_internal_pressure_inhg = _pressure_node->getDoubleValue(); _internal_pressure_inhg = _pressure_node->getDoubleValue();
_speed_ft_per_s = 0.0;
_internal_sea_inhg = _sea_node->getDoubleValue();
} }

View file

@ -58,6 +58,7 @@ public:
virtual ~InstVerticalSpeedIndicator (); virtual ~InstVerticalSpeedIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
private: private:

View file

@ -118,6 +118,9 @@ void FGKR_87::init () {
_sgr->tie_to_listener(); _sgr->tie_to_listener();
} }
void FGKR_87::reinit () {
_time_before_search_sec = 0;
}
void FGKR_87::bind () { void FGKR_87::bind () {
_tiedProperties.setRoot(fgGetNode("/instrumentation/kr-87", true)); _tiedProperties.setRoot(fgGetNode("/instrumentation/kr-87", true));

View file

@ -109,6 +109,7 @@ public:
~FGKR_87(); ~FGKR_87();
void init (); void init ();
void reinit ();
void bind (); void bind ();
void unbind (); void unbind ();
void update (double dt_sec); void update (double dt_sec);

View file

@ -48,8 +48,16 @@ MagCompass::init ()
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true); _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true); _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
_out_node = node->getChild("indicated-heading-deg", 0, true); _out_node = node->getChild("indicated-heading-deg", 0, true);
reinit();
} }
void
MagCompass::reinit ()
{
_error_deg = 0.0;
_rate_degps = 0.0;
}
void void
MagCompass::update (double delta_time_sec) MagCompass::update (double delta_time_sec)

View file

@ -44,6 +44,7 @@ public:
virtual ~MagCompass (); virtual ~MagCompass ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
private: private:

View file

@ -43,7 +43,6 @@ using std::string;
// Constructor // Constructor
FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) : FGMarkerBeacon::FGMarkerBeacon(SGPropertyNode *node) :
audio_vol(NULL), audio_vol(NULL),
need_update(true),
outer_blink(false), outer_blink(false),
middle_blink(false), middle_blink(false),
inner_blink(false), inner_blink(false),
@ -121,11 +120,16 @@ FGMarkerBeacon::init ()
_sgr = smgr->find("avionics", true); _sgr = smgr->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();
blink.stamp(); reinit();
outer_marker = middle_marker = inner_marker = false;
} }
void
FGMarkerBeacon::reinit ()
{
blink.stamp();
outer_marker = middle_marker = inner_marker = false;
_time_before_search_sec = 0.0;
}
void void
FGMarkerBeacon::bind () FGMarkerBeacon::bind ()
@ -160,8 +164,6 @@ FGMarkerBeacon::unbind ()
void void
FGMarkerBeacon::update(double dt) FGMarkerBeacon::update(double dt)
{ {
need_update = false;
// On timeout, scan again, this needs to run every iteration no // On timeout, scan again, this needs to run every iteration no
// matter what the power or serviceable state. If power is turned // matter what the power or serviceable state. If power is turned
// off or the unit becomes unserviceable while a beacon sound is // off or the unit becomes unserviceable while a beacon sound is

View file

@ -51,8 +51,6 @@ class FGMarkerBeacon : public SGSubsystem
SGPropertyNode_ptr serviceable; SGPropertyNode_ptr serviceable;
SGPropertyNode_ptr sound_working; SGPropertyNode_ptr sound_working;
bool need_update;
bool outer_marker; bool outer_marker;
bool middle_marker; bool middle_marker;
bool inner_marker; bool inner_marker;
@ -83,6 +81,7 @@ public:
~FGMarkerBeacon(); ~FGMarkerBeacon();
void init (); void init ();
void reinit ();
void bind (); void bind ();
void unbind (); void unbind ();
void update (double dt); void update (double dt);

View file

@ -41,19 +41,6 @@ MasterReferenceGyro::~MasterReferenceGyro ()
void void
MasterReferenceGyro::init () 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; string branch;
branch = "/instrumentation/" + _name; branch = "/instrumentation/" + _name;
@ -83,12 +70,32 @@ MasterReferenceGyro::init ()
_hdg_input_source_node = node->getChild("heading-source", 0, true); _hdg_input_source_node = node->getChild("heading-source", 0, true);
_fast_erect_node = node->getChild("fast-erect", 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); _electrical_node->setDoubleValue(0);
_responsiveness_node->setDoubleValue(0.75); _responsiveness_node->setDoubleValue(0.75);
_off_node->setBoolValue(false); _off_node->setBoolValue(false);
_hdg_input_source_node->setBoolValue(false); _hdg_input_source_node->setBoolValue(false);
_fast_erect_node->setBoolValue(false); _fast_erect_node->setBoolValue(false);
_g_in_node->setDoubleValue(1); _g_in_node->setDoubleValue(1);
_gyro.reinit();
} }
void void

View file

@ -43,6 +43,7 @@ public:
virtual ~MasterReferenceGyro (); virtual ~MasterReferenceGyro ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -267,6 +267,12 @@ FGNavRadio::init ()
node->getNode( "dme-in-range", true )->alias( fgGetNode("/instrumentation/dme[0]/in-range", true ) ); node->getNode( "dme-in-range", true )->alias( fgGetNode("/instrumentation/dme[0]/in-range", true ) );
} }
void
FGNavRadio::reinit ()
{
_time_before_search_sec = -1.0;
}
void void
FGNavRadio::bind () FGNavRadio::bind ()
{ {

View file

@ -190,6 +190,7 @@ public:
~FGNavRadio(); ~FGNavRadio();
void init (); void init ();
void reinit ();
void bind (); void bind ();
void unbind (); void unbind ();
void update (double dt); void update (double dt);

View file

@ -36,6 +36,14 @@ SlipSkidBall::init ()
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true); _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
_out_node = node->getChild("indicated-slip-skid", 0, true); _out_node = node->getChild("indicated-slip-skid", 0, true);
_override_node = node->getChild("override", 0, true); _override_node = node->getChild("override", 0, true);
reinit();
}
void
SlipSkidBall::reinit ()
{
_out_node->setDoubleValue(0.0);
} }
void void

View file

@ -37,6 +37,7 @@ public:
virtual ~SlipSkidBall (); virtual ~SlipSkidBall ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
private: private:

View file

@ -124,6 +124,12 @@ TACAN::init ()
_electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true); _electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true);
} }
void
TACAN::reinit ()
{
_time_before_search_sec = 0;
}
void void
TACAN::update (double delta_time_sec) TACAN::update (double delta_time_sec)
{ {

View file

@ -40,6 +40,7 @@ public:
virtual ~TACAN (); virtual ~TACAN ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double delta_time_sec); virtual void update (double delta_time_sec);
private: private:

View file

@ -377,6 +377,12 @@ TCAS::AdvisoryCoordinator::AdvisoryCoordinator(TCAS* _tcas) :
void void
TCAS::AdvisoryCoordinator::init(void) TCAS::AdvisoryCoordinator::init(void)
{
reinit();
}
void
TCAS::AdvisoryCoordinator::reinit(void)
{ {
clear(); clear();
previous = current; previous = current;
@ -1181,6 +1187,13 @@ TCAS::init(void)
threatDetector.init(); threatDetector.init();
} }
void
TCAS::reinit(void)
{
nextUpdateTime = 0;
advisoryCoordinator.reinit();
}
void void
TCAS::bind(void) TCAS::bind(void)
{ {

View file

@ -238,6 +238,7 @@ class TCAS : public SGSubsystem
void bind (SGPropertyNode* node); void bind (SGPropertyNode* node);
void init (void); void init (void);
void reinit (void);
void update (int mode); void update (int mode);
void clear (void); void clear (void);
@ -385,6 +386,7 @@ public:
virtual void bind (void); virtual void bind (void);
virtual void unbind (void); virtual void unbind (void);
virtual void init (void); virtual void init (void);
virtual void reinit (void);
virtual void update (double dt); virtual void update (double dt);
}; };

View file

@ -46,6 +46,15 @@ TurnIndicator::init ()
_electric_current_node = _electric_current_node =
fgGetNode("/systems/electrical/outputs/turn-coordinator", true); fgGetNode("/systems/electrical/outputs/turn-coordinator", true);
_rate_out_node = node->getChild("indicated-turn-rate", 0, true); _rate_out_node = node->getChild("indicated-turn-rate", 0, true);
reinit();
}
void
TurnIndicator::reinit ()
{
_last_rate = 0;
_gyro.reinit();
} }
void void

View file

@ -44,6 +44,7 @@ public:
virtual ~TurnIndicator (); virtual ~TurnIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -39,6 +39,12 @@ VerticalSpeedIndicator::init ()
_speed_node = node->getChild("indicated-speed-fpm", 0, true); _speed_node = node->getChild("indicated-speed-fpm", 0, true);
_speed_up_node = fgGetNode("/sim/speed-up", true); _speed_up_node = fgGetNode("/sim/speed-up", true);
reinit();
}
void
VerticalSpeedIndicator::reinit ()
{
// Initialize at ambient pressure // Initialize at ambient pressure
_internal_pressure_inhg = _pressure_node->getDoubleValue(); _internal_pressure_inhg = _pressure_node->getDoubleValue();
} }

View file

@ -36,6 +36,7 @@ public:
virtual ~VerticalSpeedIndicator (); virtual ~VerticalSpeedIndicator ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void update (double dt); virtual void update (double dt);
private: private:

View file

@ -37,6 +37,15 @@ StaticSystem::init ()
_serviceable_node = node->getChild("serviceable", 0, true); _serviceable_node = node->getChild("serviceable", 0, true);
_pressure_in_node = fgGetNode("/environment/pressure-inhg", true); _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
_pressure_out_node = node->getChild("pressure-inhg", 0, 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 void
@ -56,7 +65,6 @@ StaticSystem::update (double dt)
double trat = _tau ? dt/_tau : 100; double trat = _tau ? dt/_tau : 100;
double target = _pressure_in_node->getDoubleValue(); double target = _pressure_in_node->getDoubleValue();
double current = _pressure_out_node->getDoubleValue(); double current = _pressure_out_node->getDoubleValue();
// double delta = target - current;
_pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat)); _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));
} }
} }

View file

@ -40,6 +40,7 @@ public:
virtual ~StaticSystem (); virtual ~StaticSystem ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);

View file

@ -46,6 +46,14 @@ VacuumSystem::init()
} }
_pressure_node = fgGetNode("/environment/pressure-inhg", true); _pressure_node = fgGetNode("/environment/pressure-inhg", true);
_suction_node = node->getChild("suction-inhg", 0, true); _suction_node = node->getChild("suction-inhg", 0, true);
reinit();
}
void
VacuumSystem::reinit()
{
_suction_node->setDoubleValue(0.0);
} }
void void

View file

@ -43,6 +43,7 @@ public:
virtual ~VacuumSystem (); virtual ~VacuumSystem ();
virtual void init (); virtual void init ();
virtual void reinit ();
virtual void bind (); virtual void bind ();
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);