hi there,

i'am currently playing with the electrical system. i'am not sure if i,ve
 found a bug or if i'am using it the wrong way.

if configured the following setup:

(supplier (alternator) 115V)
           |
(connector (with switch A))
           |
        (bus A)
           |
      (connector)
           |
       (output A)


i've noticed that the properties bound to bus A and output A are not
updated (to 0V) if i switch of switch A.

after reading the source code a little bit, i've noticed, that
properties are not always updated (they are only updated if
FGElectricalSystem::propagate() goes down the "electric tree", which
only happens if the current volts are greater than the volts in the
current FGElectricalComponent; this is not the case if, in my case,
switch A is false, because current volts is set to 0 if a switch is
false/off).

i've written a small patch (attached to this mail) which updates all the
connected properties of the buses and outputs, after updating the
FGElectricalSystem-objects.


but maybe there is a bug in my thinking and usage of the elements...

cu markus

-- 
Markus Barenhoff - Hamburg - Germany - Earth
url: http://www.alios.org/ - mail: [EMAIL PROTECTED]
pgpkey: 0xAE7C7759 fp: 79 64 AA D9 B7 16 F5 06  6A 88 5F A9 4D 49 45 BB

Index: electrical.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Systems/electrical.cxx,v
retrieving revision 1.34
diff -r1.34 electrical.cxx
515a516,533
> 	//
> 	// update the properties of buses and outputs
> 	//
>     for ( i = 0; i < buses.size(); ++i ) {
> 		FGElectricalBus *node = (FGElectricalBus *)buses[i];		
> 		for( j = 0; j < node->get_num_props(); ++j ) {
> 			fgSetFloat( node->get_prop(j).c_str(), node->get_volts() );
> 		}
>     }
> 
> 	for ( i = 0; i < outputs.size(); ++i ) {
> 		FGElectricalOutput *node = (FGElectricalOutput *)outputs[i];		
> 		for( j = 0; j < node->get_num_props(); ++j ) {
> 			fgSetFloat( node->get_prop(j).c_str(), node->get_volts() );
> 		}
>     }
> 
> 

Reply via email to