]> git.mxchange.org Git - flightgear.git/blobdiff - src/Systems/electrical.cxx
Moved some of the low level scene graph construction code over to simgear.
[flightgear.git] / src / Systems / electrical.cxx
index 2559874cace44b644658ab9f3e962a829e44c01f..4f8329af5706e2675feae2a6782212bbbdb93ceb 100644 (file)
@@ -56,6 +56,7 @@ FGElectricalSupplier::FGElectricalSupplier ( SGPropertyNode *node ) {
     }
     volts = node->getDoubleValue("volts");
     amps = node->getDoubleValue("amps");
+    rpm_src = node->getStringValue("rpm-source");
 
     int i;
     for ( i = 0; i < node->nChildren(); ++i ) {
@@ -69,7 +70,7 @@ FGElectricalSupplier::FGElectricalSupplier ( SGPropertyNode *node ) {
         }
     }
 
-    _rpm_node = fgGetNode("/engines/engine[0]/rpm", true);
+    _rpm_node = fgGetNode( rpm_src.c_str(), true);
 }  
 
 
@@ -200,7 +201,7 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node,
 
 // set all switches to the specified state
 void FGElectricalConnector::set_switches( bool state ) {
-    cout << "setting switch state to " << state << endl;
+    // cout << "setting switch state to " << state << endl;
     for ( unsigned int i = 0; i < switches.size(); ++i ) {
         switches[i]->setBoolValue( state );
     }
@@ -301,10 +302,10 @@ void FGElectricalSystem::update (double dt) {
         connectors[i]->set_value( 0.0 );
     }
 
-    // for each supplier, propogate the electrical current
+    // for each supplier, propagate the electrical current
     for ( i = 0; i < suppliers.size(); ++i ) {
         // cout << " Updating: " << suppliers[i]->get_name() << endl;
-        propogate( suppliers[i], 0.0, " " );
+        propagate( suppliers[i], 0.0, " " );
     }
 
 }
@@ -346,8 +347,8 @@ bool FGElectricalSystem::build () {
 }
 
 
-// propogate the electrical current through the network
-void FGElectricalSystem::propogate( FGElectricalComponent *node, double val,
+// propagate the electrical current through the network
+void FGElectricalSystem::propagate( FGElectricalComponent *node, double val,
                                     string s ) {
     s += " ";
 
@@ -388,9 +389,9 @@ void FGElectricalSystem::propogate( FGElectricalComponent *node, double val,
     }
     // cout << s << node->get_name() << " -> " << node->get_value() << endl;
 
-    // propogate to all children
+    // propagate to all children
     for ( i = 0; i < node->get_num_outputs(); ++i ) {
-        propogate( node->get_output(i), current, s );
+        propagate( node->get_output(i), current, s );
     }
 }