How to use ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE (SDK DOC ISSUE)

Hey All I need to trigger the ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE when the
user turns on the Battery 2 switch. In the Bonanza, there is a BUS TIE that
links BUS.5 with BUS.1 - so when turning on battery 2, the tie activates and
powers bus 1. This is my systems.cfg

[ELECTRICAL]
bus.1 = Name:BUS1
bus.2 = Connections:bus.1   #Name:LEFT_CB_PANEL_1A
bus.3 = Connections:bus.1   #Name:LEFT_CB_PANEL_1B
bus.4 = Connections:bus.1   #Name:AVIONICS
bus.5 = Name:BUS2
battery.1 = Connections:bus.1   #Capacity:10    #Voltage:curve.1    #Name:Battery_One
battery.2 = Connections:bus.5   #Capacity:3.5   #Voltage:curve.1    #Name:Battery_Two

I have the following in the Bonanza_g36_interior.xml

Then in electricalTemplate.xml I have

        (A:ELECTRICAL MASTER BATTERY:2, Bool)
        if{
            5 1 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)
        }

Can anyone see where I am going wrong?

Ok, So I now have it working with the following code. However, it looks like
you need to have the connection in place for the Bus_to_Bus to be able to
toggle anything. It is probably me being dim however, I wonder whether it
would make sense in the SDK Docs to mention that the connection needs to be
setup in the systems.cfg for the toggle to work. I thought it made a
connection, but this isn’t the case. Again probably me being dim.

            (A:ELECTRICAL MASTER BATTERY:2, Bool) 1 ==
            if{
                6 1 (>K:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)
            }

Hello @CaptMatto Like you said in your comment, the connection should be
established first for the event to work, your declaration of the bus 5 in
systems.cfg should look like this :

bus.5 = Name:BUS2#Connections:bus.1

However we do agree that the documentation was maybe misleading, it will be
changed in a future update. Best regards, Yohan

Thanks @Yoanito ! This is what I have in systems.cfg now:

bus.1 = Name:BUS1
bus.2 = Connections:bus.1   #Name:LEFT_CB_PANEL_1A
bus.3 = Connections:bus.1   #Name:LEFT_CB_PANEL_1B
bus.4 = Connections:bus.1   #Name:AVIONICS
bus.5 = Name:BUS2
bus.6 = Connections:bus.1, bus.5  #Name:BUS_TIE

And in the behaviour

            (A:ELECTRICAL MASTER BATTERY:2, Bool) 1 ==
            (L:XMLVAR_BUSES_TIED, bool) 0 ==
            if{
                (A:PROP RPM:1, rpm) 1800 <=
                if{
                    1 (>L:XMLVAR_BUSES_TIED, bool)
                    6 1 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)
                }
            } els{
                (A:PROP RPM:1, rpm) 2000 >=
                if{
                    0 (>L:XMLVAR_BUSES_TIED, bool)
                    6 1 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)
                }
            }

In the G36 Bonanza, the aircraft has a one-way bus tie between Bus2 and Bus1
that is connected when turning on either battery switch. When the engine is
running, it also operates when the engine RPM is under 1800 and turns off when
over 2000rpm.

I’m getting close
with the behaviour code but I have an issue with it flicking on off. Any
pointers? Slowly getting there with my understanding of RPN.

Hello @CaptMatto I don’t know if this is the only issue but in the following
condition :

                (A:ELECTRICAL MASTER BATTERY:2, Bool) 1 ==
	            (L:XMLVAR_BUSES_TIED, bool) 0 ==            
		if{

You need to add an operator between the two conditions (and/or/==/!= depending
of the desired behavior), currently only the LVar value will be used for the
“if”, the Electrical master battery condition will be forgotten on the stack.
Best Regards, Yohan