FGElectricalOutput::FGElectricalOutput ( SGPropertyNode *node ) {
kind = FG_OUTPUT;
- output_amps = 0.1;
+ output_amps = 0.1; // arbitrary default value
name = node->getStringValue("name");
+ SGPropertyNode *draw = node->getNode("rated-draw");
+ if ( draw != NULL ) {
+ output_amps = draw->getDoubleValue();
+ }
+ // cout << "rated draw = " << output_amps << endl;
+
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
SGPropertyNode *child = node->getChild(i);
string cval = child->getStringValue();
if ( cname == "prop" ) {
switch_node = fgGetNode( cval.c_str(), true );
- cout << "switch node = " << cval << endl;
+ // cout << "switch node = " << cval << endl;
} else if ( cname == "initial-state" ) {
if ( cval == "off" || cval == "false" ) {
initial_state = false;
}
- cout << "initial state = " << initial_state << endl;
+ // cout << "initial state = " << initial_state << endl;
+ } else if ( cname == "rating-amps" ) {
+ rating_amps = atof( cval.c_str() );
+ circuit_breaker = true;
+ // cout << "initial state = " << initial_state << endl;
}
}
switch_node->setBoolValue( initial_state );
- cout << " value = " << switch_node->getBoolValue() << endl;
+ // cout << " value = " << switch_node->getBoolValue() << endl;
}
<< child->getStringValue() );
}
} else if ( cname == "switch" ) {
- // set default value of switch to true
- // cout << "Switch = " << child->getStringValue() << endl;
+ // cout << "Switch = " << child->getStringValue() << endl;
FGElectricalSwitch s( child );
- // FGElectricalSwitch s( fgGetNode(child->getStringValue(), true),
- // 100.0f,
- // false );
- // fgSetBool( child->getStringValue(), true );
add_switch( s );
}
}
SGPath config( globals->get_fg_root() );
config.append( path_n->getStringValue() );
- SG_LOG( SG_ALL, SG_ALERT, "Reading electrical system model from "
+ SG_LOG( SG_ALL, SG_INFO, "Reading electrical system model from "
<< config.str() );
try {
readProperties( config.str(), config_props );
<< config.str() );
}
- } else
- SG_LOG( SG_ALL, SG_ALERT,
+ } else {
+ SG_LOG( SG_ALL, SG_WARN,
"No electrical model specified for this model!");
+ }
delete config_props;
}