• 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.

FSX Very Basic Question

I tested the gauge in-game. The success was mixed. The Fuel switch worked as expected (though I forgot that the light comes on when the fuel switch is off, so the battery thing works in reverse. Fortunately, I think I can fix that.)

However, the problem was that the APU Starter light would not come on. I'm sure that the code is just screaming the answer at me, but I just don't know enough to catch on. Any ideas? Doug's XML debugger showed that L:APU_Starter was indeed changing to 1, so it must be one of the other values. The debugger did not list L:APU_Ign as an active variable.
Code:
<Gauge Name="CL6_APU_Panel" Version="0.3">
    <Image Name="APU_Panel.bmp"/>
  
    <Element>
    <Position X="221" Y="52"/>
        <Select>
            <Value>(L:APU_FuelSOV,Bool) (A:ELECTRICAL MASTER BATTERY, bool) and</Value>
            <Case Value="0">
                <Image Name="FuelValveClosed.bmp"/>
            </Case>
            <Case Value="1">
                <Image Name="FuelValveOpen.bmp"/>
            </Case>
        </Select>
    </Element>
  
    <Element>
    <Position X="368" Y="52"/>
        <Select>
            <Value>(L:APU_Starter,Bool) (A:FUEL TANK LEFT MAIN LEVEL,pounds) 5 &gt; and (A:ELECTRICAL MASTER BATTERY,bool) and (L:APU_FuelSOV,Bool)and</Value>
            <Case Value="0">
                <Image Name="APU_Start.bmp"/>
            </Case>
            <Case Value="1">
                <Image Name="APU_Start_Ign.bmp"/>
                1 (>L:APU_Ign,bool)
            </Case>
        </Select>
    </Element>
  
    <Mouse>
        <Area Left="221" Right="285" Top="52" Bottom="116">
            <Tooltip>APU Fuel Valve</Tooltip>
            <Cursor Type="Hand"/>
            <Click>(L:APU_FuelSOV,Bool) ! (&gt;L:APU_FuelSOV,Bool)</Click>
        </Area>
        <Area Left="368" Right="432" Top="52" Bottom="116">
            <Tooltip>APU Start/Stop</Tooltip>
            <Cursor Type="Hand"/>
            <Click>(L:APU_Starter,Bool) ! (&gt;L:APU_Starter,Bool)</Click>
        </Area>
    </Mouse>
  
</Gauge>
 
Check your use of FUEL TANK LEFT MAIN LEVEL. You use pounds unit when it is expecting percent. You might be thinking of FUEL TANK LEFT MAIN QUANTITY.
 
It works when I remove it, though strangely enough it seems to work regardless of the state of L:APU_FuelSOV.
 
It works when I remove it, though strangely enough it seems to work regardless of the state of L:APU_FuelSOV.
Yeah, that's why I pointed out that it wasn't correct to use (A:FUEL TANK LEFT MAIN LEVEL, pounds), and why I suggested that you remove it from your script so you could see if that was, in fact, the only culprit. Take a look at the online SDK to see a list of all A:Vars and the recommended units. If inappropriate units are used, then variables will return values that likely won't work with your code, as was the case with your example, I believe. The wiki section of this site contains a description of what goes on behind the scenes with units - how Flight Sim handles units.

One other point is that I believe Doug and Tom's debuggers show L:Vars but, if I remember correctly, not A:Vars. That's one reason I use BlackBox3, though its limitation is that it wont work debugging modeldef XML. I think that if you could have seen what was going on with that A:Var, then you would have known there was an issue there. Mind you, each of those tools has its strengths and all are recommended.

Below is a BB3 screenshot of some Fuel A:Vars with various units applied. Its from an airplane with 100% fuel added, 121 gallons in the left main tank. Each value is "correct" in the sense that the values returned follow the FS units logic, but they don't all make sense unless one understands how units work.

Note the value returned for a 99.99% full tank using (A:FUEL TANK LEFT MAIN LEVEL, pounds) is 2.2046. The 5 &gt; in your script was a problem in this case. (A:FUEL TANK LEFT MAIN LEVEL, pounds) is always less than 5, and the Case Value would always be zero. Again, the fundamental error was the incorrect units with that A:Var.

Bob

upload_2015-5-10_19-23-50.jpeg


[edit] Explanation of the BB3 values:

FUEL TANK LEFT MAIN LEVEL: This is a percent type variable, and the default unit of measurement is percent over 100. The tank is ~100% full, so Flight Sim stores the value 1.0000 into memory (1.0000 percent over 100=100%), together with a flag that says its a percent type of unit. When FS is asked to display (A:FUEL TANK LEFT MAIN LEVEL, percent), then it recognizes this as a percent type unit as well, and applies a 100x conversion factor so that the value returned for percent is 99.9987.

However, when FS is asked to display (A:FUEL TANK LEFT MAIN LEVEL, pounds), then it assumes this is a weight variable. The default weight unit is kilograms, so FS assumes that the 1.0000 stored in memory represents 1.0000 kg. When it is asked to covert that to pounds, it returns 2.2046 (1 kg=2.2046 pounds). But that value has no meaning because A:FUEL TANK LEFT MAIN LEVEL is a percent variable, not a weight variable.


FUEL TANK LEFT MAIN QUANTITY: This is a volume variable, and the default unit of measurement is cubic meter. The tank has about 121 gallons in it, so Flight Sim stores the value 0.458038 into memory (121 gallons=0.458038 cubic meters), together with a flag that says its a volume type of unit. When FS is asked to display (A:FUEL TANK LEFT MAIN QUANTITY, gallons), then it recognizes this as a volume type unit, applies the cubic meter to gallons conversion, and it returns 120.9984.

However, when you ask FS to display (A:FUEL TANK LEFT MAIN QUANTITY, pounds), then it assumes this as a weight variable. The default weight unit is kilograms, so FS assumes that the 0.458038 stored in memory represents 0.458038 kg. When it is asked to covert that to pounds, it returns 1.0098 (0.45803 kg=1.0098 pounds). But that value has no meaning because A:FUEL TANK LEFT MAIN QUANTITY is a volume variable, not a weight variable.

Make sense?
 
Last edited:
It works when I remove it, though strangely enough it seems to work regardless of the state of L:APU_FuelSOV.

Hi,

Besides Bob's comment, you must leave a space between (L:APU_FuelSOV,Bool) and and, otherwise (L:APU_FuelSOV,Bool) is not recognized. Like:

Code:
<Value>(L:APU_Starter,Bool) (A:FUEL TANK LEFT MAIN LEVEL,percent) 5 &gt; and (A:ELECTRICAL MASTER BATTERY,bool) and (L:APU_FuelSOV,Bool) and</Value>

And you must remove 1 (>L:APU_Ign,bool) in <Case Value="1">. <Case> is a container for other tags, and does not support scripts.

Tom
 
Interesting. I didn't realize that FS processed units that way. I'll see if I can find the right units.
Keep going! I imagine XML might be easy for you since you already work with SIOC for your home built. That sounds more difficult to me.
 
It's different is all. It's like learning a Slavic language then learning a Germanic language.
That being said, I feel like I'm starting to get a basic idea of XML.

However, there is still the issue of "1 (>L:APU_Ign,bool)." Would I place it here?
<Value>(L:APU_Starter,Bo...and (L:APU_FuelSOV,Bool)and; 1 (>L:APU_Ign,bool)</Value>
 
Code:
<Gauge Name="CL6_APU_Panel" Version="0.3">
<Image Name="APU_Panel.bmp"/>

<Element>
<Position X="221" Y="52"/>
<Select>
<Value>(L:APU_FuelSOV,Bool) (A:ELECTRICAL MASTER BATTERY, bool) and</Value>
<Case Value="0">
<Image Name="FuelValveClosed.bmp"/>
</Case>
<Case Value="1">
<Image Name="FuelValveOpen.bmp"/>
</Case>
</Select>
</Element>

<Element>
<Position X="368" Y="52"/>
<Select>
<Value>(L:APU_Starter,bool)</Value>
<Case Value="0">
<Image Name="APU_Start.bmp"/>
</Case>
<Case Value="1">
<Image Name="APU_Start_Ign.bmp"/>
</Case>
</Select>
</Element>

<Mouse>
<Area Left="221" Right="285" Top="52" Bottom="116">
<Tooltip>APU Fuel Valve</Tooltip>
<Cursor Type="Hand"/>
<Click>(L:APU_FuelSOV,Bool) ! (&gt;L:APU_FuelSOV,Bool)</Click>
</Area>
<Area Left="368" Right="432" Top="52" Bottom="116">
<Tooltip>APU Start/Stop</Tooltip>
<Cursor Type="Hand"/>
<Click> (A:FUEL TANK LEFT MAIN LEVEL,pounds) 5 &gt; (A:ELECTRICAL MASTER BATTERY,bool) and (L:APU_FuelSOV,Bool) and
if{ (L:APU_Starter,bool) ! (>L:APU_Starter,bool) }</Click>
</Area>
</Mouse>

</Gauge>
 
However, there is still the issue of "1 (>L:APU_Ign,bool)." Would I place it here?
<Value>(L:APU_Starter,Bo...and (L:APU_FuelSOV,Bool)and; 1 (>L:APU_Ign,bool)</Value>

What I notice after inspecting your code is that you want to show "APU_Start_Ign.bmp" when

Code:
(L:APU_Starter,Bool) (A:FUEL TANK LEFT MAIN LEVEL,percent) 5 &gt; and (A:ELECTRICAL MASTER BATTERY,bool) and (L:APU_FuelSOV,Bool) and

and, at the same time, you want to keep that status in (L:APU_Ign,bool). It means that (L:APU_Ign,bool) depends on a value returned by the script from above.

Therefore, you can simply code this:

Code:
<Value>(L:APU_Starter,Bool) (A:FUEL TANK LEFT MAIN LEVEL,percent) 5 &gt; and (A:ELECTRICAL MASTER BATTERY,bool) and (L:APU_FuelSOV,Bool) and d (>L:APU_Ign,bool)</Value>

the d character replicates the result of the previous script, so (L:APU_Ign,bool) can receive a copy of that value.

Tom
 
Back
Top