AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
:
- name(node->getStringValue("name", "airspeed-indicator")),
- num(node->getIntValue("number", 0)),
- pitot_port(node->getStringValue("pitot-port", "/systems/pitot")),
- static_port(node->getStringValue("static-port", "/systems/static"))
+ _name(node->getStringValue("name", "airspeed-indicator")),
+ _num(node->getIntValue("number", 0)),
+ _total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")),
+ _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
{
}
AirspeedIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- pitot_port += "/total-pressure-inhg";
- static_port += "/pressure-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
- _total_pressure_node = fgGetNode(pitot_port.c_str(), true);
- _static_pressure_node = fgGetNode(static_port.c_str(), true);
+ _total_pressure_node = fgGetNode(_total_pressure.c_str(), true);
+ _static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_density_node = fgGetNode("/environment/density-slugft3", true);
_speed_node = node->getChild("indicated-speed-kt", 0, true);
}
public:
AirspeedIndicator ( SGPropertyNode *node );
- AirspeedIndicator ( int i);
virtual ~AirspeedIndicator ();
virtual void init ();
private:
- string name;
- unsigned int num;
- string pitot_port;
- string static_port;
+ string _name;
+ unsigned int _num;
+ string _total_pressure;
+ string _static_pressure;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _total_pressure_node;
SGPropertyNode_ptr _static_pressure_node;
Altimeter::Altimeter ( SGPropertyNode *node )
- : name("altimeter"),
- num(0),
- static_port("/systems/static"),
+ : _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]);
-
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "static-port" ) {
- static_port = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in altimeter config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-Altimeter::Altimeter ()
- : _altitude_table(new SGInterpTable)
-{
-
- for (int i = 0; altitude_data[i][0] != -1; i++)
- _altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
}
Altimeter::~Altimeter ()
Altimeter::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- static_port += "/pressure-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ 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_port.c_str(), true);
+ _pressure_node = fgGetNode(_static_pressure.c_str(), true);
_altitude_node = node->getChild("indicated-altitude-ft", 0, true);
}
*
* Input properties:
*
- * /instrumentation/"name"/serviceable
- * /instrumentation/"name"/setting-inhg
- * "static_port"/pressure-inhg
+ * /instrumentation/<name>/serviceable
+ * /instrumentation/<name>/setting-inhg
+ * <static_pressure>
*
* Output properties:
*
- * /instrumentation/"name"/indicated-altitude-ft
+ * /instrumentation/<name>/indicated-altitude-ft
*/
class Altimeter : public SGSubsystem
{
public:
Altimeter (SGPropertyNode *node);
- Altimeter ();
virtual ~Altimeter ();
virtual void init ();
private:
- string name;
- int num;
- string static_port;
+ string _name;
+ int _num;
+ string _static_pressure;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _setting_node;
AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
:
- name("attitude-indicator"),
- num(0),
- vacuum_system("/systems/vacuum")
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = (int) child->getDoubleValue();
- } else if ( cname == "vacuum-system" ) {
- vacuum_system = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in attitude-indicator config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-AttitudeIndicator::AttitudeIndicator ()
+ _name(node->getStringValue("name", "attitude-indicator")),
+ _num(node->getIntValue("number", 0)),
+ _suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
{
}
AttitudeIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- vacuum_system += "/suction-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
- _suction_node = fgGetNode(vacuum_system.c_str(), true);
+ _suction_node = fgGetNode(_suction.c_str(), true);
SGPropertyNode *cnode = node->getChild("config", 0, true);
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
_caged_node = node->getChild("caged-flag", 0, true);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
public:
AttitudeIndicator ( SGPropertyNode *node );
- AttitudeIndicator ();
virtual ~AttitudeIndicator ();
virtual void init ();
private:
- string name;
- int num;
- string vacuum_system;
+ string _name;
+ int _num;
+ string _suction;
Gyro _gyro;
_transmitter_elevation_ft(0),
_transmitter_range_nm(0),
_transmitter_bias(0.0),
- name("dme"),
- num(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in dme config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-DME::DME ()
- : _last_distance_nm(0),
- _last_frequency_mhz(-1),
- _time_before_search_sec(0),
- _transmitter_valid(false),
- _transmitter_elevation_ft(0),
- _transmitter_range_nm(0),
- _transmitter_bias(0.0)
+ _name(node->getStringValue("name", "dme")),
+ _num(node->getIntValue("number", 0))
{
}
DME::init ()
{
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_longitude_node = fgGetNode("/position/longitude-deg", true);
_latitude_node = fgGetNode("/position/latitude-deg", true);
const char * source = _source_node->getStringValue();
if (source[0] == '\0') {
string branch;
- branch = "/instrumentation/" + name + "/frequencies/selected-mhz";
+ branch = "/instrumentation/" + _name + "/frequencies/selected-mhz";
_source_node->setStringValue(branch.c_str());
source = _source_node->getStringValue();
}
public:
DME ( SGPropertyNode *node );
- DME ();
virtual ~DME ();
virtual void init ();
double _transmitter_range_nm;
double _transmitter_bias;
- string name;
- int num;
+ string _name;
+ int _num;
};
return ((int) (value/nearest + 0.5)) * nearest;
}
+
Encoder::Encoder(SGPropertyNode *node)
:
- name("encoder"),
- num(0),
- staticPort("/systems/static"),
+ _name(node->getStringValue("name", "encoder")),
+ _num(node->getIntValue("number", 0)),
+ _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
altitudeTable(new SGInterpTable)
{
int i;
for ( i = 0; altitude_data[i][0] != -1; i++ )
altitudeTable->addEntry(altitude_data[i][0], altitude_data[i][1]);
-
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "static-port" ) {
- staticPort = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN,
- "Error in encoder config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
}
void Encoder::init()
{
string branch;
- branch = "/instrumentation/" + name;
- staticPort += "/pressure-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
// Inputs
- staticPressureNode = fgGetNode(staticPort.c_str(), true);
+ staticPressureNode = fgGetNode(_static_pressure.c_str(), true);
busPowerNode = fgGetNode("/systems/electrical/outputs/encoder", true);
serviceableNode = node->getChild("serviceable", 0, true);
// Outputs
SGPropertyNode_ptr modeCAltitudeNode;
// Internal
- string name;
- int num;
- string staticPort;
+ string _name;
+ int _num;
+ string _static_pressure;
SGInterpTable* altitudeTable;
};
_wp1_altitude_m(0),
_alt_dist_ratio(0),
_distance_m(0),
- _course_deg(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in gps config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-GPS::GPS ()
- : _last_valid(false),
- _last_longitude_deg(0),
- _last_latitude_deg(0),
- _last_altitude_m(0),
- _last_speed_kts(0),
- _wp0_latitude_deg(0),
- _wp0_longitude_deg(0),
- _wp0_altitude_m(0),
- _wp1_latitude_deg(0),
- _wp1_longitude_deg(0),
- _wp1_altitude_m(0),
- _alt_dist_ratio(0),
- _distance_m(0),
- _course_deg(0)
+ _course_deg(0),
+ _name(node->getStringValue("name", "gps")),
+ _num(node->getIntValue("number", 0))
{
}
route->clear();
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_longitude_node = fgGetNode("/position/longitude-deg", true);
_latitude_node = fgGetNode("/position/latitude-deg", true);
double _distance_m;
double _course_deg;
- double bias_length;
- double bias_angle;
- double azimuth_error;
- double range_error;
- double elapsed_time;
-
- string name;
- int num;
+ double _bias_length;
+ double _bias_angle;
+ double _azimuth_error;
+ double _range_error;
+ double _elapsed_time;
+
+ string _name;
+ int _num;
};
HeadingIndicator::HeadingIndicator ( SGPropertyNode *node )
:
- name("heading-indicator"),
- num(0),
- vacuum_system("/systems/vacuum")
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "vacuum-system" ) {
- vacuum_system = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in heading-indicator config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-HeadingIndicator::HeadingIndicator ()
+ _name(node->getStringValue("name", "heading-indicator")),
+ _num(node->getIntValue("number", 0)),
+ _suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
{
}
HeadingIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- vacuum_system += "/suction-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_offset_node = node->getChild("offset-deg", 0, true);
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
- _suction_node = fgGetNode(vacuum_system.c_str(), true);
+ _suction_node = fgGetNode(_suction.c_str(), true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_last_heading_deg = (_heading_in_node->getDoubleValue() +
_offset_node->getDoubleValue());
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
Gyro _gyro;
double _last_heading_deg;
- string name;
- int num;
- string vacuum_system;
+ string _name;
+ int _num;
+ string _suction;
SGPropertyNode_ptr _offset_node;
SGPropertyNode_ptr _heading_in_node;
MagCompass::MagCompass ( SGPropertyNode *node )
: _error_deg(0.0),
_rate_degps(0.0),
- name("magnetic-compass"),
- num(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in magnetic-compass config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-MagCompass::MagCompass ()
- : _error_deg(0.0),
- _rate_degps(0.0)
+ _name(node->getStringValue("name", "magnetic-compass")),
+ _num(node->getIntValue("number", 0))
{
}
MagCompass::init ()
{
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
- _roll_node =
- fgGetNode("/orientation/roll-deg", true);
- _pitch_node =
- fgGetNode("/orientation/pitch-deg", true);
- _heading_node =
- fgGetNode("/orientation/heading-magnetic-deg", true);
- _beta_node =
- fgGetNode("/orientation/side-slip-deg", true);
- _dip_node =
- fgGetNode("/environment/magnetic-dip-deg", true);
- _x_accel_node =
- fgGetNode("/accelerations/pilot/x-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);
+ _roll_node = fgGetNode("/orientation/roll-deg", true);
+ _pitch_node = fgGetNode("/orientation/pitch-deg", true);
+ _heading_node = fgGetNode("/orientation/heading-magnetic-deg", true);
+ _beta_node = fgGetNode("/orientation/side-slip-deg", true);
+ _dip_node = fgGetNode("/environment/magnetic-dip-deg", true);
+ _x_accel_node = fgGetNode("/accelerations/pilot/x-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);
_out_node = node->getChild("indicated-heading-deg", 0, true);
}
double _error_deg;
double _rate_degps;
- string name;
- int num;
+ string _name;
+ int _num;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _roll_node;
MasterReferenceGyro::MasterReferenceGyro ( SGPropertyNode *node ) :
- name("master-reference-gyro"),
- num(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = (int) child->getDoubleValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in mrg config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-MasterReferenceGyro::MasterReferenceGyro ()
+ _name(node->getStringValue("name", "master-reference-gyro")),
+ _num(node->getIntValue("number", 0))
{
}
_indicated_pitch_rate = 0;
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
_g_in_node = fgGetNode("/accelerations/pilot-g-damped", true);
_electrical_node = fgGetNode("/systems/electrical/outputs/MRG", true);
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_off_node = node->getChild("off-flag", 0, true);
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
* /instrumentation/"name"/tumble-norm
* /orientation/pitch-deg
* /orientation/roll-deg
- * "vacuum-system"/suction-inhg
*
* Output properties:
*
private:
- string name;
- int num;
+ string _name;
+ int _num;
double _last_roll;
double _last_pitch;
last_x(0.0),
last_loc_dist(0.0),
last_xtrack_error(0.0),
- name("nav"),
- num(0),
+ _name(node->getStringValue("name", "nav")),
+ _num(node->getIntValue("number", 0)),
_time_before_search_sec(-1.0)
{
SGPath path( globals->get_fg_root() );
term_tbl = new SGInterpTable( term.str() );
low_tbl = new SGInterpTable( low.str() );
high_tbl = new SGInterpTable( high.str() );
-
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN,
- "Error in nav radio config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-
}
morse.init();
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
bus_power_node =
- fgGetNode(("/systems/electrical/outputs/" + name).c_str(), true);
+ fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
// inputs
is_valid_node = node->getChild("data-is-valid", 0, true);
gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true);
std::ostringstream temp;
- temp << name << "nav-ident" << num;
+ temp << _name << "nav-ident" << _num;
nav_fx_name = temp.str();
- temp << name << "dme-ident" << num;
+ temp << _name << "dme-ident" << _num;
dme_fx_name = temp.str();
}
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
}
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
}
double last_loc_dist;
double last_xtrack_error;
- string name;
- int num;
+ string _name;
+ int _num;
// internal periodic station search timer
double _time_before_search_sec;
SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
:
- name("slip-skid-ball"),
- num(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in slip-skid-ball config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-SlipSkidBall::SlipSkidBall ()
+ _name(node->getStringValue("name", "slip-skid-ball")),
+ _num(node->getIntValue("number", 0))
{
}
SlipSkidBall::init ()
{
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
-#include "gyro.hxx"
-
/**
* Model a slip-skid ball.
public:
SlipSkidBall ( SGPropertyNode *node );
- SlipSkidBall ();
virtual ~SlipSkidBall ();
virtual void init ();
private:
- Gyro _gyro;
double _last_pos;
- string name;
- int num;
+ string _name;
+ int _num;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _y_accel_node;
Transponder::Transponder(SGPropertyNode *node)
:
- name("transponder"),
- num(0),
- encoder("/instrumentation/encoder")
+ _name(node->getStringValue("name", "transponder")),
+ _num(node->getIntValue("number", 0)),
+ _mode_c_altitude(node->getStringValue("mode-c-altitude",
+ "/instrumentation/encoder/mode-c-alt-ft"))
{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "encoder" ) {
- encoder = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN,
- "Error in transponder config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
}
void Transponder::init()
{
string branch;
- branch = "/instrumentation/" + name;
- encoder += "/mode-c-alt-ft";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
// Inputs
- pressureAltitudeNode = fgGetNode(encoder.c_str(), true);
+ pressureAltitudeNode = fgGetNode(_mode_c_altitude.c_str(), true);
busPowerNode = fgGetNode("/systems/electrical/outputs/transponder", true);
serviceableNode = node->getChild("serviceable", 0, true);
// Outputs
SGPropertyNode_ptr flightLevelNode;
// Internal
- string name;
- int num;
- string encoder;
+ string _name;
+ int _num;
+ string _mode_c_altitude;
};
#endif // TRANSPONDER_HXX
TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
_last_rate(0),
- name("turn-indicator"),
- num(0)
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in turn-indicator config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-TurnIndicator::TurnIndicator () :
- _last_rate(0)
+ _name(node->getStringValue("name", "turn-indicator")),
+ _num(node->getIntValue("number", 0))
{
}
TurnIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
_electric_current_node =
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
{
std::ostringstream temp;
string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ temp << _num;
+ branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/serviceable").c_str());
public:
TurnIndicator ( SGPropertyNode *node );
- TurnIndicator ();
virtual ~TurnIndicator ();
virtual void init ();
Gyro _gyro;
double _last_rate;
- string name;
- int num;
+ string _name;
+ int _num;
SGPropertyNode_ptr _roll_rate_node;
SGPropertyNode_ptr _yaw_rate_node;
VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
: _internal_pressure_inhg(29.92),
- name("vertical-speed-indicator"),
- num(0),
- static_port("/systems/static")
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "static-port" ) {
- static_port = cval;
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in vertical-speed-indicator config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-VerticalSpeedIndicator::VerticalSpeedIndicator ()
- : _internal_pressure_inhg(29.92)
+ _name(node->getStringValue("name", "vertical-speed-indicator")),
+ _num(node->getIntValue("number", 0)),
+ _static_pressure(node->getStringValue("static-pressure", "/Systems/static/pressure-inhg"))
{
}
VerticalSpeedIndicator::init ()
{
string branch;
- branch = "/instrumentation/" + name;
- static_port += "/pressure-inhg";
+ branch = "/instrumentation/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
- _pressure_node = fgGetNode(static_port.c_str(), true);
+ _pressure_node = fgGetNode(_static_pressure.c_str(), true);
_speed_node = node->getChild("indicated-speed-fpm", 0, true);
// Initialize at ambient pressure
public:
VerticalSpeedIndicator ( SGPropertyNode *node );
- VerticalSpeedIndicator ();
virtual ~VerticalSpeedIndicator ();
virtual void init ();
double _internal_pressure_inhg;
- string name;
- int num;
- string static_port;
+ string _name;
+ int _num;
+ string _static_pressure;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _pressure_node;
static const char *odgauge_name = "Aircraft/Instruments/Textures/od_wxradar.rgb";
wxRadarBg::wxRadarBg ( SGPropertyNode *node) :
- name("wxRadar"),
- num(0),
+ _name(node->getStringValue("name", "wxRadar")),
+ _num(node->getIntValue("number", 0)),
resultTexture( 0 ),
wxEcho( 0 ),
last_switchKnob( "off" ),
sim_init_done ( false ),
odg( 0 )
-{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_INSTR, SG_WARN, "Error in wxRadar config logic" );
- if ( name.length() ) {
- SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-wxRadarBg::wxRadarBg ()
{
}
wxRadarBg::init ()
{
string branch;
- branch = "/instrumentation/" + name;
+ branch = "/instrumentation/" + _name;
- _Instrument = fgGetNode(branch.c_str(), num, true );
+ _Instrument = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = _Instrument->getChild("serviceable", 0, true);
resultTexture = FGTextureManager::createTexture( odgauge_name );
SGPath tpath(globals->get_fg_root());
private:
- string name;
- int num;
+ string _name;
+ int _num;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _Instrument;
PitotSystem::PitotSystem ( SGPropertyNode *node )
:
- num(0),
- name("pitot")
+ _name(node->getStringValue("name", "pitot")),
+ _num(node->getIntValue("number", 0))
{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
- if ( name.length() ) {
- SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-PitotSystem::PitotSystem ( int i )
-{
- num = i;
- name = "pitot";
}
PitotSystem::~PitotSystem ()
PitotSystem::init ()
{
string branch;
- branch = "/systems/" + name;
+ branch = "/systems/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
_density_node = fgGetNode("/environment/density-slugft3", true);
public:
PitotSystem ( SGPropertyNode *node );
- PitotSystem ( int i );
virtual ~PitotSystem ();
virtual void init ();
private:
- int num;
- string name;
+ string _name;
+ int _num;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _pressure_node;
SGPropertyNode_ptr _density_node;
StaticSystem::StaticSystem ( SGPropertyNode *node )
:
- name("static"),
- num(0)
+ _name(node->getStringValue("name", "static")),
+ _num(node->getIntValue("number", 0))
{
- int i;
- for ( i = 0; i < node->nChildren(); ++i ) {
- SGPropertyNode *child = node->getChild(i);
- string cname = child->getName();
- string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else {
- SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
- if ( name.length() ) {
- SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
- }
- }
- }
-}
-
-StaticSystem::StaticSystem ( int i )
-{
- name = "static";
- num = i;
}
StaticSystem::~StaticSystem ()
StaticSystem::init ()
{
string branch;
- branch = "/systems/" + name;
+ branch = "/systems/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
_pressure_out_node = node->getChild("pressure-inhg", 0, true);
private:
- string name;
- int num;
+ string _name;
+ int _num;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _pressure_in_node;
SGPropertyNode_ptr _pressure_out_node;
VacuumSystem::VacuumSystem ( SGPropertyNode *node )
:
- name("vacuum"),
- num(0),
- scale(1.0)
-
+ _name(node->getStringValue("name", "vacuum")),
+ _num(node->getIntValue("number", 0)),
+ _scale(node->getDoubleValue("scale", 1.0))
{
- rpms.clear();
+ _rpms.clear();
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
SGPropertyNode *child = node->getChild(i);
string cname = child->getName();
string cval = child->getStringValue();
- if ( cname == "name" ) {
- name = cval;
- } else if ( cname == "number" ) {
- num = child->getIntValue();
- } else if ( cname == "rpm" ) {
- rpms.push_back(cval);
- } else if ( cname == "scale" ) {
- scale = child->getDoubleValue();
+ if ( cname == "rpm" ) {
+ _rpms.push_back(cval);
} else {
SG_LOG( SG_SYSTEMS, SG_WARN, "Error in vacuum config logic" );
- if ( name.length() ) {
- SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
+ if ( _name.length() ) {
+ SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << _name );
}
}
}
}
-VacuumSystem::VacuumSystem( int i )
-{
- name = "vacuum";
- num = i;
- rpms.clear();
- scale = 1.0;
-}
-
VacuumSystem::~VacuumSystem ()
{
}
{
unsigned int i;
string branch;
- branch = "/systems/" + name;
+ branch = "/systems/" + _name;
- SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+ SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
- for ( i = 0; i < rpms.size(); i++ ) {
- SGPropertyNode_ptr _rpm_node = fgGetNode(rpms[i].c_str(), true);
+ for ( i = 0; i < _rpms.size(); i++ ) {
+ SGPropertyNode_ptr _rpm_node = fgGetNode(_rpms[i].c_str(), true);
_rpm_nodes.push_back( _rpm_node );
}
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
// 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;
+ double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
if ( tmp > rpm ) {
rpm = tmp;
}
private:
- string name;
- int num;
- string_list rpms;
- double scale;
+ string _name;
+ int _num;
+ string_list _rpms;
+ double _scale;
SGPropertyNode_ptr _serviceable_node;
vector<SGPropertyNode_ptr> _rpm_nodes;
SGPropertyNode_ptr _pressure_node;