plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

BeechHouse avatar image
BeechHouse asked davux3 answered

Help! Trying to make sense of A/L/K/O/X VARs...

Some background:

I'm not an aircraft developer, rather, I'm an Integration Engineer working on a sim conversion from X-Plane to 2020. I deal mostly with micro-controllers and sending/receiving data using the above aforementioned VAR architecture.

But I am thoroughly confused about a few things (My first conversion effort) so I'll try to summarize:

I'm working with the Black Square KingAir350i mod. In particular, the AVIONICS switch.

There is an LVAR called:

var_avionicsMasterSwitch


It's a BOOL, so, setting it to 1 obviously 'turns on' the Avionics, but... it doesn't. All it does is animate the switch. It does nothing else.

In the AnalogKingAir.XML file is this snippet:

<Component ID="AvionicsPowerSwitch" Node="AvionicsPowerSwitch">
<UseTemplate Name="ASOBO_GT_Switch_Code">
<ANIM_NAME>AvionicsPowerSwitch</ANIM_NAME>
<ANIM_CODE> (L:var_avionicsMasterSwitch, bool) 100 *</ANIM_CODE>
<LEFT_SINGLE_CODE>
(L:var_avionicsMasterSwitch, bool) ! (&gt;L:var_avionicsMasterSwitch, bool)

(L:var_avionicsMasterSwitch, bool) if{
(L:var_avionicsMasterBreaker, bool) if{
4 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:17, Bool) ! if{ 4 17 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
2 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:19, Bool) ! if{ 2 19 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
3 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:21, Bool) ! if{ 3 21 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
}
}
els{
4 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:17, Bool) if{ 4 17 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
2 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:19, Bool) if{ 2 19 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
3 (&gt;A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:21, Bool) if{ 3 21 (&gt;K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
}
</LEFT_SINGLE_CODE>
<ANIM_LAG>800</ANIM_LAG>

<WWISE_EVENT_1>avionic_switch_on</WWISE_EVENT_1>
<WWISE_EVENT_2>avionic_switch_off</WWISE_EVENT_2>

<PART_ID>AvionicsPowerSwitch</PART_ID>
<TOOLTIP_TITLE></TOOLTIP_TITLE>
<TOOLTIPID>Avionics Power</TOOLTIPID>
</UseTemplate>
</Component>



Here is the Bus Architecture from the SYSTEMS.CFG file:

[ELECTRICAL]
bus.1 = Connections:bus.13, bus.2, bus.3#Name:CENTER_BUS
bus.2 = Connections:bus.4, bus.1#Name:LEFT_BUS
bus.3 = Connections:bus.4, bus.1#Name:RIGHT_BUS
bus.4 = Connections:bus.2, bus.3#Name:TRIPLE_FED_BUS
bus.5 = Connections:bus.4#Name:TRIPLE_FED_BATTERY_INTERMEDIATE
bus.6 = Connections:bus.3, bus.4#Name:26VAC_L
bus.7 = Connections:bus.3, bus.4#Name:115VAC_L
bus.8 = Connections:bus.4, bus.3#Name:26VAC_R
bus.9 = Connections:bus.4, bus.3#Name:115VAC_R
bus.10 = Connections:bus.7#Name:INTERMEDIATE_115VAC_BUS_1
bus.11 = Connections:bus.4#Name:ENG_INST_L
bus.12 = Connections:bus.4#Name:ENG_INST_R
bus.13 = Connections:bus.1, bus.5#Name:HOT_BATTERY_BUS
bus.14 = Connections:bus.4#Name:LANDING_GEAR_LIGHTS_BUS
bus.15 = Connections:bus.9#Name:INTERMEDIATE_115VAC_BUS_2
bus.16 = Connections:bus.17#Name:AVIONICS_BUS_1
bus.17 = Connections:bus.4#Name:INTERMEDIATE_AVIONICS_BUS_1
bus.18 = Connections:bus.19#Name:AVIONICS_BUS_2
bus.19 = Connections:bus.2#Name:INTERMEDIATE_AVIONICS_BUS_2
bus.20 = Connections:bus.21#Name:AVIONICS_BUS_3
bus.21 = Connections:bus.3#Name:INTERMEDIATE_AVIONICS_BUS_3


My question is in 2 parts:

1. How to I actually get this Avionics switch to "Do" something, (Like turn on all the radios, etc...) What does that bus logic do?

2. Do the WWISE events actually need to be called to perform this action? If so, How would I call/reference those WWISE events?

Any help is appreciated. Like I said, I'm VERY new at this. (I learn by example and by watching others, so if possible, please don't tell me to read the docs. :-) I've spent 2 weeks pouring over mountains of docs and am no further along than I was when I started, unfortunately.

Thanks all.

PS: This is the project:
b1900d.jpg

simconnectwasm
b1900d.jpg (248.5 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

1 Answer

·
davux3 avatar image
davux3 answered

Here's the variable scope list: https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm


The above code sets that L:Var in one location (L:Vars are global to the current user session). Then in another location it is checking the var and then subsequently checking the bus/circuit status and toggling it if it doesn't match the expected state.


WWise events trigger a sound to play.


Normally to turn avionics on you'd send a K:AVIONICS_MASTER_SET. Avionics "bus" is a special concept that predates the modern electrical system, it doesn't have a bus layout like the other stuff you'll see in ELECTRICAL.


10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.