# include <config.h>
#endif
+#include <cstdlib>
#include <cstring>
#include <simgear/structure/exception.hxx>
float available_amps = ideal_amps;
return available_amps - amps;
} else {
- SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" );
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
}
return 0.0;
// cout << "external amps = " << 0.0 << endl;
return ideal_volts;
} else {
- SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" );
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
}
return 0.0;
// cout << "external amps = " << 0.0 << endl;
return ideal_amps;
} else {
- SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" );
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown supplier type" );
}
return 0.0;
} else if ( s->get_kind() == FG_BUS ) {
s->add_output( this );
} else {
- SG_LOG( SG_ALL, SG_ALERT,
+ SG_LOG( SG_SYSTEMS, SG_ALERT,
"Attempt to connect to something that can't provide an output: "
<< child->getStringValue() );
}
} else {
- SG_LOG( SG_ALL, SG_ALERT, "Can't find named source: "
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: "
<< child->getStringValue() );
}
} else if ( cname == "output" ) {
== FGElectricalSupplier::FG_BATTERY ) {
s->add_output( this );
} else {
- SG_LOG( SG_ALL, SG_ALERT,
+ SG_LOG( SG_SYSTEMS, SG_ALERT,
"Attempt to connect to something that can't provide an input: "
<< child->getStringValue() );
}
} else {
- SG_LOG( SG_ALL, SG_ALERT, "Can't find named source: "
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: "
<< child->getStringValue() );
}
} else if ( cname == "switch" ) {
SGPropertyNode *path_n = fgGetNode("/sim/systems/electrical/path");
if ( path_n ) {
if ( path.length() ) {
- SG_LOG( SG_ALL, SG_INFO,
+ SG_LOG( SG_SYSTEMS, SG_INFO,
"NOTICE: System manager configuration specifies an " <<
"electrical system: " << path << " but it is " <<
"being overridden by the one specified in the -set.xml " <<
}
if ( path.length() ) {
- SGPath config( globals->get_fg_root() );
- config.append( path );
-
+ SGPath config = globals->resolve_aircraft_path(path);
+
// load an obsolete xml configuration
- SG_LOG( SG_ALL, SG_WARN,
+ SG_LOG( SG_SYSTEMS, SG_WARN,
"Reading deprecated xml electrical system model from\n "
<< config.str() );
try {
if ( build(config_props) ) {
enabled = true;
} else {
- SG_LOG( SG_ALL, SG_ALERT,
- "Detected a logic error in the electrical system ");
- SG_LOG( SG_ALL, SG_ALERT,
- "specification file. See earlier errors for " );
- SG_LOG( SG_ALL, SG_ALERT,
- "details.");
- exit(-1);
+ throw sg_exception("Logic error in electrical system file.");
}
} catch (const sg_exception&) {
- SG_LOG( SG_ALL, SG_ALERT,
+ SG_LOG( SG_SYSTEMS, SG_ALERT,
"Failed to load electrical system model: "
<< config.str() );
}
} else {
- SG_LOG( SG_ALL, SG_INFO,
+ SG_LOG( SG_SYSTEMS, SG_INFO,
"No xml-based electrical model specified for this model!");
}
" " );
if ( node->apply_load( load, dt ) < 0.0 ) {
- SG_LOG(SG_ALL, SG_ALERT,
+ SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!");
}
}
" " );
if ( node->apply_load( load, dt ) < 0.0 ) {
- SG_LOG(SG_ALL, SG_ALERT,
+ SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!");
}
}
// cout << "battery load = " << load << endl;
if ( node->apply_load( load, dt ) < 0.0 ) {
- SG_LOG(SG_ALL, SG_ALERT,
+ SG_LOG(SG_SYSTEMS, SG_ALERT,
"Error drawing more current than available!");
}
}
new FGElectricalConnector( node, this );
connectors.push_back( c );
} else {
- SG_LOG( SG_ALL, SG_ALERT, "Unknown component type specified: "
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown component type specified: "
<< name );
return false;
}
}
// cout << s << " input_volts = " << volts << endl;
} else {
- SG_LOG( SG_ALL, SG_ALERT, "unkown node type" );
+ SG_LOG( SG_SYSTEMS, SG_ALERT, "unknown node type" );
}
int i;