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

Help with XML code for Stall Warning Light

Messages
4
Country
unitedstates
I’m new to XML gauge programming. I’m trying to create a STALL WARNING light gauge. The light should illuminate when airspeed less than 170 knots, when flaps are less than 5 degrees, and when the aircraft is off the ground. If I remove the SIM ON GROUND bool, the light illuminates after landing, when on the ground.

Any help would be greatly appreciated

Here is my guess work trouble code:

<?xml version="1.0" encoding="utf-8"?>
<Gauge Name="727 FLAPS Warning" Version="1.1">
<Element>
<Select>
<Value>
(A: SIM ON GROUND, bool) 0;
(A:AIRSPEED INDICATED, knots) 170 &lt; and
if{ 1 (A:Trailing edge flaps0 left percent,percent) 10 &lt; } els {1}
</Value>
<Case Value="0">
<Image Name="lightoff.bmp"/>
</Case>
<Case Value="1">
<Image Name="lighton.bmp"/>
</Case>
</Select>
</Element>
</Gauge>
 

Vitus

Resource contributor
Messages
1,480
Country
newzealand
Code:
<?xml version="1.0" encoding="utf-8"?>
<Gauge Name="727 FLAPS Warning" Version="1.1">
    <Element>
        <Select>
            <Value>
                (A:SIM ON GROUND,bool) 0 ==
                (A:AIRSPEED INDICATED,knots) 170 &lt; and
                (A:Trailing edge flaps0 left percent,percent) 10 &lt; and
                if{ 1 } els{ 0 }
            </Value>
            <Case Value="0">
                <Image Name="lightoff.bmp"/>
            </Case>
            <Case Value="1">
                <Image Name="lighton.bmp"/>
            </Case>
        </Select>
    </Element>
</Gauge>

make sure:
- that there are no spaces between if and the {
- that there are no spaces between els and {
- that there is a space AFTER and BEFORE the { and } respectively

You're using fs9 terminology, which I don't use. I'm not sure if the &lt; substitute is needed or even valid. If this doesn't work, try replacing &lt; with a simple <
 
Messages
440
Country
us-wisconsin
Vitus, you are speedy! Was just about to post.
You're using fs9 terminology, which I don't use. I'm not sure if the &lt; substitute is needed or even valid. If this doesn't work, try replacing &lt; with a simple <
That is incorrect. By using the literal "<" (less than) the xml parser is expecting the start of a tag, the gauge will not load.
On the other hand, one could get by using the literal ">" (greater than).
For overall good practices, when using the greater/less than as comparators (and any derivative of), it is best just to use the html code wholly - &gt; &lt; &gt;= &lt;=
In my practice I use the html codes above for comparators but when writing to a L:Var or when initiating a K:Event I use the literal ">". It can be done either way using one's own preference.
Here are 4 more versions that all represent the same code as Vitus posted above except I went 1 step further and brought the electrical circuit into play -
XML:
<!-- 
(A: SIM ON GROUND, bool) ! is the same as (A:SIM ON GROUND,bool) 0 == because it is boolean to start 
-->

<Value>
(A: SIM ON GROUND, bool) ! (A:AIRSPEED INDICATED, knots) 170 &lt; (A:Trailing edge flaps0 left percent, percent) 10 &lt;
(A:CIRCUIT GENERAL PANEL ON, bool) and and and if{ 1 } els{ 0 }
</Value>

<Value>
(A: SIM ON GROUND, bool) ! (A:AIRSPEED INDICATED, knots) 170 &lt; and (A:Trailing edge flaps0 left percent, percent) 10 &lt; and
(A:CIRCUIT GENERAL PANEL ON, bool) and if{ 1 } els{ 0 }
</Value>

<!-- 
The following should work too without the if/els.
The reason is that the "WHOLE EXPRESSION" uses comparitors (results are 1 or 0) and booleans (results are 1 or 0).
The final logic being used are logical ANDs and the result of those can only be a 1 or a 0
-->

<Value>
(A: SIM ON GROUND, bool) ! (A:AIRSPEED INDICATED, knots) 170 &lt; (A:Trailing edge flaps0 left percent, percent) 10 &lt;
(A:CIRCUIT GENERAL PANEL ON, bool) and and and
</Value>

<Value>
(A: SIM ON GROUND, bool) ! (A:AIRSPEED INDICATED, knots) 170 &lt; and (A:Trailing edge flaps0 left percent, percent) 10 &lt; and
(A:CIRCUIT GENERAL PANEL ON, bool) and
</Value>
 
Messages
4
Country
unitedstates
Yes Sir ! Great job guys. I tried two different methods and it works. On the ground, the light goes out. If I forget to set flaps, I'll get a warning light for STALL Warning or STALL Buffeting. Thank you so much for teaching how to write more than 3 variables in fs9 terminology. Afterwards, I compared the syntax you wrote above, with this link https://www.fsdeveloper.com/forum/threads/the-basics.343638/. Just to get a better understanding on different techniques. Thanks so much ! I hope this help other newcomers with basic XML coding.

Much Appreciated! Vitus and Spokes2112
 
Messages
4
Country
unitedstates
That is, If I forget to set flaps while on the approach at low speeds, I'll get a STALL WARNING (while in the air, not on the ground).
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
FYI, there is a built in stall warning in the sim. It comes on when the angle of attack is above the value for maximum CL as defined in Record 404. That is a true stall situation, you are beginning to lose lift through having too big an angle of attack.
You can do it your way for the reasons you stated, but it is not a true stall unless the built in one triggers at the same time.
Roy
 
Messages
4
Country
unitedstates
I like your keyword " true stall". Some FS designers, program Record 404 with very limited response time with stall warning system. I'm not sure if you can hear or feel the buffeting in the actual T-tail Jet aircraft before true stall. From my understanding with T-tail turbojets aircraft, the stall warning triggers 5 Knots above true stall. When I practice stalls in some of these aircraft, the stick shaker sound heard, I lose control. Once the stickshaker sound starts, within 3 to 5 seconds, I'm in a flat spin or simply out of control (pending on flight simulator aircraft). I wish the FS aircraft designers could provide some type of early reminder (perhaps 10-15 knots above true stall for the stickshaker). Yes, I could correct the warning light to display something like " Aircraft in Buffeting Affect".
 
Top