• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Send Bmp state to LVar?

TurboCompound

Resource contributor
Messages
190
Hi all!

I've gotten into the hobby of home cockpit building, and I have been working on wiring my LEDs to the sim. I can write a script that will write the LVars to FSUIPC offsets without any problem, but the logic for many of the xml gauges is very complex and lengthy, often using several AVars and LVars at once to drive their logic. Because of that, I would basically need to re-write the entire Gauge in SIOC to have my LEDs match the BMPs for the lamps in the sim. I was wondering if there was a line I could add to the XML gauges that would check the state of the Gauge Bitmap and write it to an LVar. That way, I could use the LVar in SIOC, and the Actually LED would always match the lamp in the sim. XML is not the most intuitive language, I'm afraid. I only understand it to the point where I can get a basic idea of the logic behind each gauge.

Sorry if this doesn't make sense or is too simple a question.
 
Unfortunately, no that is not possible. If the gauges your aircraft uses are all XML type though, you should be able to use Robbie's "Blackbox" utility to discover what the exact L:vars are being used, then read that same L:var in SIOC to signal your LED.
 
I already know which LVars are being used thanks to good ol' notepad, but the problem is that many of the annunciators and indicators use many LVars and AVars at once to determine their state. For example, certain Lamps may only work when certain inverters as well as the batteries are on. It might be something like "if this LVar = 1 and this LVar = 0 and this AVar = 1 and this AVar < 150, then lamp.BMP is visible" The problem is that I would quite literally need to re-write that whole thing in SIOC. That is one of the simpler examples. Many of the gauges have logic even more complex than that, and it would be very painstaking to re write the XML code as SIOC code.

Sorry to beat a dead bush, but are you sure that there isn't a "if this BMP is visible, then L:FUEL_LOW = 1" kind of command?

Thanks
 
Hi all!

would check the state of the Gauge Bitmap

Post a sample of the xml code that you would like to add 1 more variable.
Post the section of code for 1 led light.....A visual would help everyone.
And explain what bitmap is for.... please!

When you say check gauge bitmap, this means to me the state of that visibility tag.
So you could add more variables to the existing code depending on what Gauge Bitmap is!
Maybe i am confused on this wording.
 
Sorry to beat a dead bush, but are you sure that there isn't a "if this BMP is visible, then L:FUEL_LOW = 1" kind of command?
Absolutely certain. However, you could very easily add a tiny bit of XML to store the existing evaluations and control your own custom L:variables...
Code:
d (>L:SIOC_var1,enum)
The stack operator "d" duplicates the top value of the stack (in other words the result of the evaluation), then that is stuffed into your custom L:var (>L:SOIC_var1,enum).

For example, suppose there is a really complex evaluation within a <Visibility> section you want to use:
Original:
Code:
<Visibility>
  (A:HYDRAULIC PRESSURE:1,psi) 1680 &lt;
  (L:B737_HydPressEng1_Switch,bool) !
  (A:HYDRAULIC PRESSURE:2,psi) 1680 &lt;
  (L:B737_HydPressEng2_Switch,bool) !
  (L:B737_HydPressElec1_Switch,bool) !
  (L:B737_HydPressElec2_Switch,bool) ! + + + + +
</Visibility>
Edited:
Code:
<Visibility>
  (A:HYDRAULIC PRESSURE:1,psi) 1680 &lt;
  (L:B737_HydPressEng1_Switch,bool) !
  (A:HYDRAULIC PRESSURE:2,psi) 1680 &lt;
  (L:B737_HydPressEng2_Switch,bool) !
  (L:B737_HydPressElec1_Switch,bool) !
  (L:B737_HydPressElec2_Switch,bool) ! + + + + +
  d (>L:SIOC_var1,enum)
</Visibility>
 
I haven't gotten a chance to solder everything yet. In the meantime, I've also been working with servos for some of the gauges on the overhead panel.

Now let's say I wanted to code this ammeter gauge in SIOC:
Code:
      <Rotate>
         <Value Minimum="-100" Maximum="300">(L:DC_Volt_Switch, number) -2 == if{ (A:Electrical battery load,amps) } els{ (L:DC_Volt_Switch, number) -1 == if{ (A:Electrical genalt1 bus amps,amps) 7 * } els{ (L:DC_Volt_Switch, number) 0 == if{ (A:Electrical main bus amps,amps) 7 * } els{ (L:DC_Volt_Switch, number) 1 == if{ (A:Electrical genalt2 bus amps,amps) 7 * } els{ (L:DC_Volt_Switch, number) 2 == if{ (A:Electrical battery load,amps) } } } } }</Value>
         <Failures>
               <SYSTEM_ELECTRICAL Action="0"/>
            </Failures>
            <Nonlinearity>
               <Item Value="-100" X="51" Y="71"/>
               <Item Value="0" X="46" Y="49"/>
               <Item Value="200" X="91" Y="35"/>
               <Item Value="300" X="96" Y="60"/>
            </Nonlinearity>
            <Delay DegreesPerSecond="50"/>
         </Rotate>

As you can see, it relies on a five position selector knob (L : DC_Volt_Switch) to decide which value to read from (Generator 1, Battery 1, GPU, etc.). This is the kind of logic that is difficult to replicate in SIOC.
The line you provided works for simple, visible/not visible type of gauge. Will it also work with gauges that have rotational values?
 
....
As you can see, it relies on a five position selector knob (L : DC_Volt_Switch) to decide which value to read from (Generator 1, Battery 1, GPU, etc.). This is the kind of logic that is difficult to replicate in SIOC.
The line you provided works for simple, visible/not visible type of gauge. Will it also work with gauges that have rotational values?

Absolutely. Bill's example is the way to go.

At the end of every script that gives a condition ( <Visible>, <Value>,etc) put the " d (>L:Var,unit)" and you will get an LVar that "replicates" that condition.

Besides, you can install XMTools and its LocalVarsLogger.xml gauge to inspect those LVar values, just to check whether they are working according to you needs.

Tom
 
Excellent. Thank you.
This may sound a bit stupid, but when you say "d (>L:Var, unit)," do I literally write "unit" or am I supposed to put something specific after the comma? My understanding of XML is only enough to get a basic understanding of a scripts function.

I already have an FSUIPC Lua script that logs the state of L:Vars, so it won't be a problem for me to test them.
 
am I supposed to put something specific after the comma?

That's the answer; check the SDK for (A:Vars) supported units, which use the same, or simply use number if you don't want to bother doing that. Also in (>L:Var...) replace "Var" with a proper name ;)

Tom
 
No, you must add it at the end of this script:

Code:
<Value Minimum="-100" Maximum="300">
  (L:DC_Volt_Switch, number) -2 == if{ (A:Electrical battery load,amps) }
  els{ (L:DC_Volt_Switch, number) -1 ==
  if{ (A:Electrical genalt1 bus amps,amps) 7 * }
  els{ (L:DC_Volt_Switch, number) 0 ==
  if{ (A:Electrical main bus amps,amps) 7 * }
  els{ (L:DC_Volt_Switch, number) 1 ==
  if{ (A:Electrical genalt2 bus amps,amps) 7 * }
  els{ (L:DC_Volt_Switch, number) 2 ==
  if{ (A:Electrical battery load,amps) } } } } } d (>L:Ammeter1_SIOC,number)</Value>

Tom
 
Thanks.
I'll just add the part with the delay in SIOC.
Maybe one day I'll understand XML fully. There's really so much you can do with it and so much that has been done with it.
*cough*Edetroit*cough*David Maltby*cough*
 
Does your login name refer to the R3350TC? One of my favorite engines... :)
 
Yes, it very much does. In fact, I fly Manfred Mahn's L749 all the time. I believe that you host it on your website. 1000 times better than JustFlight's. I love trying to fly a three man airplane by myself from cold and dark.
 
Back
Top