1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Flaps XML Gauge Help

Discussion in 'Gauges' started by jimi08, 28/12/11.

  1. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Hello all and Happy Holidays. I am hoping someone can help me out with my issue...

    I am currently working on an xml gauge that serves as a revised auto-flap system for the Acceleration F/A-18 Hornet. In order to make this new system work, I had to install 9 flap settings in the aircraft.cfg instead of the default 3 settings so the flaps would operating throughout the needed flight regime as required. My goal is to have the auto-flap system working once the gear are retracted and return to manual mode while the gear are extended. Everything works as advertised except for one issue. In the F/A-18, the only options that the pilot has for the flaps are Flaps Auto (0 degrees), Flaps Half (30 degrees), and Flaps Full (45 degrees). With my current setup, the auto-flap system disengages with gear down, but the pilot has to toggle through 7 or 8 different flap settings to finally reach Flaps Half or Flaps Full, and vice-versa to fully retract them. Is there a certain way that I can program my xml gauge to only acknowledge flap options .0, .1 and .2 and ignore flaps options .3 through .8 while the gear is down and locked? This way the pilot only has the options of lowering his/her flaps 0, 30 or 45 degrees with the gear down.

    The currently flap order is as follows:
    flap position .0 = 0 degrees
    flap position .1 = 30 degrees (Flaps Half Setting Only)
    flap position .2 = 45 degrees (Flaps Full Setting Only)
    flap position .3 = 3 degrees (Auto-Flaps Operation)
    flap position .4 = 6 degrees (Auto-Flaps Operation)
    flap position .5 = 9 degrees (Auto-Flaps Operation)
    flap position .6 = 12 degrees (Auto-Flaps Operation)
    flap position .7 = 15 degrees (Auto-Flaps Operation)
    flap position .8 = 18 degrees (Auto-Flaps Operation)

    Thanks in advance.

    Jimi
  2. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    No one's got anything on this huh?
  3. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    Hey Justin,

    If you know how to write basic code, you are going to need to set up a logic that says 'if this, then do this', and have your various settings set up for the auto-command, then an 'over-ride' that occurs with gear down.

    You will need to think through the scenarios of how it will work, and write it all down in plane writing first how this will function, then translate it into code.

    If you havent learned to write in code yet, you might see if a gauge maker could write this for you.


    But, if you have the basics of writing code, jump into it and start with one side of it first, like management of flaps at speeds. Get that working first, then blend in the 'over-ride when gear is down' sections. Start on it one piece at a time for now.



    Bill
  4. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Thanks for the reply Bill. I do have a basic understanding of XML coding, just don't know any commands that tell's the code to "skip a numbered sequence". Under certain conditions, I want the code do use all available flaps (as listed above), under others, just the first three. I was wondering if there is some type of "ignore" tag or something that can be used to accomplish this. Anyways, below is a sample of what I have so far in terms of my flap system. The part that I want to augment is the part under "Powered Approach Mode". Forgive me for the sloppiness and I'm sure much of this can be simplified, but again, I am new at this. The project in its entirety can be found at http://www.fsxblueangels.com/forum/viewtopic.php?f=91&t=4584

    Thanks again for your reply and thanks in advance for you help.

    <Gauge Name="F/A-18A FSXBA TEAM Base: Autoflaps.">

    <Comment>
    "AutoFlaps."
    </Comment>


    <Update Frequency="18"/>

    // --- FLAPS (POWERED APPROACH MODE )

    <Element>
    <Select>
    <Value>
    (A:GEAR CENTER POSITION,percent) 30 &gt;
    (A:Flaps handle index, number) 2 &gt; &amp;&amp;
    (A:Flaps handle index, number) 9 &lt; &amp;&amp;
    if{ (&gt;K:FLAPS_2) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:GEAR CENTER POSITION,percent) 0 &gt;
    (A:GEAR CENTER POSITION,percent) 100 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 0 &gt; &amp;&amp;
    if{ (&gt;K:FLAPS_UP) } els{ }
    </Value>
    </Select>
    </Element>

    // --- FLAPS ( 0.6 MACH AND BELOW )

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 2 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 1 &gt; &amp;&amp;
    if{ 0 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 2.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 4.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 2 &lt; &amp;&amp;
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 2.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 4.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 4 &gt; &amp;&amp;
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 4.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 6.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 5 &lt; &amp;&amp;
    if{ 7369 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 4.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 6.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 7 &gt; &amp;&amp;
    if{ 7369 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 6.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 8.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 8 &lt; &amp;&amp;
    if{ 9461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 6.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 8.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 10 &gt; &amp;&amp;
    if{ 9461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 8.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 10.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 11 &lt; &amp;&amp;
    if{ 11553 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 8.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 10.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 13 &gt; &amp;&amp;
    if{ 11553 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 10.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 12.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 14 &lt; &amp;&amp;
    if{ 14000 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 10.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 12.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 16 &gt; &amp;&amp;
    if{ 14000 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 12.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 16.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 17 &lt; &amp;&amp;
    if{ 16383 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 12.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 16.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 19 &gt; &amp;&amp;
    if{ 16383 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 16.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 18.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 14 &lt; &amp;&amp;
    if{ 14000 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 16.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 18.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 16 &gt; &amp;&amp;
    if{ 14000 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 18.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 20.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 11 &lt; &amp;&amp;
    if{ 11553 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 18.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 20.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 13 &gt; &amp;&amp;
    if{ 11553 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 20.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 8 &lt; &amp;&amp;
    if{ 9461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 20.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 10 &gt; &amp;&amp;
    if{ 9461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 24.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 5 &lt; &amp;&amp;
    if{ 7369 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 22.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 24.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 7 &gt; &amp;&amp;
    if{ 7369 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 24.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 26.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 2 &lt; &amp;&amp;
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 24.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 26.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 4 &gt; &amp;&amp;
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 26.5 &gt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 1 &gt; &amp;&amp;
    if{ 0 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>
    Last edited: 5/1/12
  5. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    Hey Jimi,

    Cool. Ok, I see a couple of errors I believe.

    First, using 'index' as measurement will be huge numbers, like 16,000+ reference points of position. You might use something else, like handle/percent.


    Second is your &amp; useage. You can use the word 'and' and it will do the same thing. Second, is that as a law in Schema, you use it for 'each' additional condition. For instance, if you have 4 conditions, you would have 3 'ands'.

    You wrote this;

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) ! &amp;&amp;
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 24.5 &gt; &amp;&amp;
    (A:INCIDENCE ALPHA,Degrees) 26.0 &lt; &amp;&amp;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 4 &gt; &amp;&amp;
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>

    It should be (I believe) like this;

    <Element>
    <Select>
    <Value>
    (A:AIRSPEED MACH,Mach) 0.6 &lt;
    (A:SIM ON GROUND, bool) !
    (A:GEAR CENTER POSITION,Percent) 0.1 &lt;
    (A:INCIDENCE ALPHA,Degrees) 24.5 &gt;
    (A:INCIDENCE ALPHA,Degrees) 26.0 &lt;
    (A:TRAILING EDGE FLAPS LEFT ANGLE,Degrees) 4 &gt;
    and and and and and
    if{ 5461 (&gt;K:FLAPS_SET) } els{ }
    </Value>
    </Select>
    </Element>


    Above, this would be the proper amount of 'ands' or &amps. Always write them at the bottom of the group of conditions, not at each second, third, fourth, etc, condition line and write them 'before' the if logic points, so that the 'ands' are just under or behind 'all' of the conditions, and before the if/else points.

    Try those little improvements and see if the flaps start to work correctly.


    Bill
    Last edited: 5/1/12
  6. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    Also, one last small detail;

    When using 'else', if you do use it, put a sum in there, like 0. If not, I wouldnt even write it in there as I do not think its doing anything as it is blank. It might, if anything, cause an adverse reaction. Probably wont, but best to be careful.


    Are you sure that Flaps_Set is an 'index' setting? Just curious.


    Bill
  7. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Thanks again. I will go ahead and try your suggestions. The code I have posted above does work in the sim with no problems. It took me a while to figure it out, but you can add a index value to the flap system. The sim will take whatever numerical value is indicated and will match it up to whatever "slot" is available per the flaps section in the aircraft config.

    For instance, there is a range for flaps, 0 - 16383. Lets say you have 10 different flap settings listed in your aircraft cfg. So based on 16383 and 10 slots (16383/10 = 1638.3) FSX looks at the possibilities as follows:

    flaps.0= 0 to 1638
    flaps.1= 1639 to 3277
    flaps.2= 3278 to 4915
    flaps.3= 4916 to 6553
    flaps.4= 6554 to 8192
    flaps.5= 8193 to 9830
    flaps.6= 9831 to 11468
    flaps.7= 11468 to 13106
    flaps.8= 13107 to 14745
    flaps.9= 14746 to 16383

    Now, FSX will call for whatever degrees of flap is assigned to that corresponding position. The flaps degrees assigned does not have to be in ascending or descending order. For example, my flaps are assigned as follows in my aircraft's cfg:

    flaps.0= 0
    flaps.1= 30
    flaps.2= 45 (max degrees)
    flaps.3= 3
    flaps.4= 6
    flaps.5= 9
    flaps.6= 12
    flaps.7= 15
    flaps.8= 18
    flaps.9= 20 (max index value)

    If I make my assigned/calculated value 10,000 for example, FSX will see that 10,000 falls between 9831 and 11468, which is the range for flaps.6. For flaps.6, I have assigned the flaps to drop to 12 degrees, so for the value of 10,000 the flaps will drop to 12 degrees. Same thing if you press F8 for a corresponding button for "flaps full". FSX assumes that everyone will assign their flaps in ascending order (i.e. flaps degrees = 0, 3, 6, 9, 12, 15, 18, 30 and 45). So if you press the button asking for full flaps, FSX will give you whatever is in the 16383 slot assuming you have used the previously mentioned numbering scheme, but with my flap assignment listed above, you will not get full flaps, which is 45 degrees. Instead, you will only get 20 degrees of flaps, because that's what's in the last "slot".

    I want to set it up so when the gear is down, the pilot only has the options to set the first 3 settings which is 0 degrees, 30 degrees, and 45 degrees. The other 6 flap settings (flaps.3 through flaps.9) will get ignored.

    The way it is coded now, it works as described above, but the logic is kinda funky, I was just curious on how to write the logic to tell FSX to ignore or disregard flaps 3-9 once gear are down.

    Thanks again.
  8. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,507
    Country:
    unitedstates
    Um, not quite accurate there, Bill.

    All three of the following may be used and are precisely the same!

    && - &amp;&amp; - and

    Also, per my reply in another thread, while you CAN put all the conjunctions (and - or) at the end of the conditions, it is VERY confusing and difficult to parse out the logic that way! It's also very easy to miscount and have too many or too few.

    Best approach is how the OP wrote it, where each conjunction follows each pair of conditions:

    (condition1)
    (condition2) conjuction
    (condition3) conjuction
    (condition4) conjuction
    (condition5) conjuction
    (condition6) conjuction

    if{ actions }
    els{ alternate actions }

    One further comment. Why do folks keep using multiple <Element> entries for their logic? It's horribly untidy and scatters one's logic all over hell and creation... :rolleyes:

    It is much more logical and tidy to put all your "begs in one askit" so to speak and have a single location for all the logic:

    Code:
    <Update Hidden="Yes">
       /* insert all logic sequentially in this single location */
    </Update>
    The major advantage of this arrangement is that if you have several "logic groups" that share the same (condition), then you need only have one logic tree following that (condition) in a nested if{ xxx } action clause.

    For example, suppose your logic has different actions depending on whether the aircraft is on the ground or in the air. Using the <Update> section makes this very efficient and tidy!

    Code:
    <Update Hidden="Yes"
        (A:Sim on Ground)
           if{
                /* insert all remaining condition on ground combinations sequentially here */
             }
           els{
                /* insert all remaining condition airborne combinations sequentially here */
             }
    </Update>
    This could also be written as in the example below, but it is less efficient because you are forcing the sim to check the same variable TWICE, which while it doesn't amount to a huge amount of time, such inefficiency in an entire gauge system it will result in a huge slowdown in sim performance!

    Code:
    <Update Hidden="Yes"
        (A:Sim on Ground)
           if{
                /* insert all remaining condition on ground combinations sequentially here */
             }
    
        (A:Sim on Ground) !
           if{
                /* insert all remaining condition airborne combinations sequentially here */
             }
    </Update>
    Last edited: 6/1/12
  9. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Thanks for the tips guys. Much appreciated...

    So... (ahem)...any tips about coding that will allow me to skip or ignore sequences so I can code these flaps the way I want?
  10. teson1

    teson1

    Joined:
    24/9/09
    Messages:
    130
    Country:
    france
    Interesting details on the flap system. Thanks.

    For your flap system you could try the following:
    (gear = Down)
    (flap > 4915) and
    if{ 4900 (&gt;K:FLAPS_SET) }

    I didn't look up exact variable names, but you should get the idea.

    BR

    Gunter

  11. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona

    Thanks Bill! Some awesome teaching there on Schema. I for one am greatful.

    I have been writing PFD and MFD content for so long, I keep thinking in terms of gauges that have 100 Elements in them, instead of one or two. ack.... Having a hidden gauge with a single 'update' section in it is certainly the way to go.

    Also, separating hidden gauges (XML files) into separate opearations, though related, also (for me) help in maintaining their functionalities and being able to tune them more easily, such as 'auto gear deploy' and 'auto flaps control', etc. Easier manageability...

    Note for Jimi, it appears you can only use 'one' update section per XML gauge.

    Sorry Jimi I didnt walk you through 'all' of this as I am still a student at writing code myself. I was hoping someone better knowledged at this would chime in. Bill L is like our teacher on code.



    Bill O
  12. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    Thanks Teson for the recommendations and thanks Lionheart and n4gix for the coding etiquette.

    But I am looking for more of some type of command rather than a set of conditions to accomplish this task. Just as == means 'equal to', &amp; &amp means 'and', || means 'or', &gt means 'and greater than', and &lt means 'and less than', I am looking for something along those lines that tells the sim to ignore or skip.

    Anybody have anything along those lines?
  13. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    Jimi,

    Tell me 'exactly' what you want the flaps to do.

    Tom taught me that you need to write a script out of what you want something to do, and then you can translate it into code.

    If you need, for instance the flaps to be 'up' or at 40% flaps when;
    * at 130 - 150 knots
    * when landing gear is down
    * when not on ground
    * flaps lever at 4000 to 9000

    etc.... I dont know what you need, so I dont know what to write.

    Now here is what you could do. You could write a 'logic' set of statements that is folded into each flap command that would state,
    * if lever is at 4000 to 4500
    * and.... 'this L:var is not active' (something like (L:AutoFlapsOverRide,bool) is not on, such as (L:AutoFlapsOverRide,bool) 0 == which means its off, 1 == is on), then you could have all the flaps running normal until the (L:AutoFlapsOverRide,bool) is at 1 ==, then you could write another set of commands that operate when 1 == on that command is 'on' (sort of like working a Visibility) where the flaps will do 'this and this and this' when (L:AutoFlapsOverRide,bool) 1 == is true (active or 1).


    I know this might not make sense, and this is why I think I am not the one to help, but..... This is the point. You need to know EXACTLY what 'you' need and write it down in order, and then translate that to code.

    Also, if you have the FS2004 SDK that has all the commands and inputs lists, you can pour over the list and find what you need, like a parts list. The commands are the same as with FSX.



    Bill
  14. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    Here is a list of the code Commands from the FS2004 SDK

    I use these ALWAYS
    Last edited: 7/8/13
  15. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    This is the Doc of 'readings', so you can say 'when this and this and this are occuring.... . '
    Last edited: 7/8/13
  16. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,507
    Country:
    unitedstates
    The only thing that comes to mind right now is the "Goto" command. Be absolutely clear to throughly DOCUMENT each use of the "Goto" labels to eliminate any possible confusion later. Note that there's no limit to how many "Goto" labels are used in any one gauge, but just as it has always been, "Goto" commands can be a nightmare to debug. Use cautiously!

    The one thing to keep in mind with all XML scripts is that they are continuously executed top to bottom. That is why "Gotos" must be either below the (condition) logic, or in an entirely separate @Macro section. Otherwise, there's a danger of creating an endless loop.

    Code:
    <Update Hidden="Yes">
    
       (condition) if{ g1 } els{ g2 }
    
       :1
           /* INSERT THE NORMAL LOGIC HERE */
    
       :2
           /* INSERT THE ALTERNATE LOGIC HERE */
    
    </Update>
    Last edited: 9/1/12
  17. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,507
    Country:
    unitedstates
    Bill, you are not interpreting what the <Update Hidden="Yes"> means correctly. All that does is tell the sim whether it should run the script all the time, or only when the sub-panel that it's assigned to is on screen and has focus.

    Suppose that you have a gauge on a popup panel that's only used occasionally. There's no point to having the sim run that gauge all the time and "eat up CPU cycles" for no good reason! In that case you'd simply use <Update Hidden="No"> to "shut down the gauge" whenever it's not on screen and needed.

    While you can only have one <Update> section per gauge, you can have an <Update> section in every gauge...

    As for the organization of your logic, that's what blank lines and <!-- COMMENTS --> are for.

    Code:
    <Update Hidden="Yes">
       <!--'auto flap deploy' -->
          blah blah
    
       <!-- 'auto gear deploy' -->
          blah blah
    
       <!-- 'electronic engine control' -->
          blah blah
    </Update>
    
  18. jimi08

    jimi08

    Joined:
    27/2/08
    Messages:
    53
    Country:
    us-california
    I think the "Goto" deal might be something on lines of what I am looking for...

    Lion, this is exactly what I want to accomplish:

    Powered Approach (PA) Mode:
    -Gear Down
    -Below 240 CAS
    -Flaps available to pilot are 0 degrees (Auto), 30 degrees (Half), and 45 degrees (Full). Pilot will ONLY BE ABLE TO SET FLAPS TO THOSE THREE SETTINGS while the gear is down and the aircraft is below 240.
    -Assigned flaps in the aircraft cfg for these operations are:
    --flaps-position.0=0 degrees
    --flaps-position.1=30 degrees
    --flaps-position.2=45 degrees

    Up and Away (UA) Mode:
    -Gear Up
    -Above 240 CAS
    -Autoflap system will commence when two above conditions are met and the pilot no longer has ANY authority over the flap system.
    -Flaps raise/lower between 0-18 degrees based on speed and angle of attack (3 degrees of flaps for every 2 degrees of AOA until about 20 degrees of AOA and then reverses back to 0 degrees of flaps beyond 20 degrees of AOA)
    -Assigned flaps in the aircraft cfg for autoflap operations are:
    --flaps-position.0=0 degrees
    --flaps-position.3=3 degrees
    --flaps-position.4=6 degrees
    --flaps-position.5=9 degrees
    --flaps-position.6=12 degrees
    --flaps-position.7=15 degrees
    --flaps-position.8=18 degrees

    Problem: I can get the auto flaps to engage and disengage based on the airspeed and gear configuration as stated above. The problem lies when the aircraft is below 240 and with gear down in the Powered Approach Mode. If the pilot presses the flaps down key one or two times, he/she will get flaps Half and flaps Full respectively base on the listed flap-position lineup. However, if the pilot presses the flaps down key once more, the flaps will preposition themselves to the next flaps-position in the lineup, which is 3 degrees. If hit again, the flaps will now go down the list again to 6, then 9, so forth and so on. But I don't want the pilot to have the option to lower his flaps 3 degrees, or 6 degrees or any of the flap-position settings from position .3 through .8. while in Powered Approach Mode. Just 0 degrees, 30 degrees, and 45 degrees. If the pilot reaches 45 degrees of flap (flap-position.2) and hits the flaps down key again, it does nothing (stays at 45 degrees). It will remain at 45 degrees until one of two things happen:
    1. The pilot decides to raise the flaps and thus the flaps go to either flaps-position.1 (30 degrees) or flaps-position.0 (0 degrees) or...
    2. The pilot raises the gear and accelerates beyond 240 CAS, in which case the flaps automatically transition to Up and Away Mode (autoflaps).

    So the remedy to this problem is to be able to tell the sim through xml coding to deny the pilot the options of using flaps-position.3 through flaps-position.8 while aircraft is in Powered Approach Mode.

    Hope this helps.
    Last edited: 10/1/12
  19. lionheart

    lionheart

    Joined:
    24/10/05
    Messages:
    6,673
    Country:
    us-arizona
    I havent had a clue as to how to write this. What a complex problem.

    Normally, a standard set of logics would be applied to each position that is 'conditional'. The regular non-conditioned 'always works' settings wouldnt need any conditionals (from what I understand, though I could be wrong).

    With flaps, you have several settings, many in your case. So you would need a condition that causes them to lock out, or 'go to position 5 if airspeed and gear are up', and repeat that for each position that would be locked out, deferring them each at a time to the preset location 'if' the variables (airspeed and gear) are present.

    I hope you figure this out. Sorry not to be able to help on this.
  20. teson1

    teson1

    Joined:
    24/9/09
    Messages:
    130
    Country:
    france
    If you want to stick with xml, i.e. not dabble with simconnect/FSUIPC, IMHO you can't avoid that FS wants to go to flap position >=3 when the pilot operates the flap lever to positions beyond position 2 (45°) in PA mode.
    So you'll have to correct that action by FS in the xml gauge by setting the lever position back to position 2.
    There are several options to do this to try out.
    One is the one I have suggested below, anotherone that could be tried is

    (Gear Down)
    (Below 240 CAS) and
    (A:FLAPS HANDLE INDEX,enum) 2 &gt; and
    if{ (>K:Flaps_2) }

    Similar logic should apply to the UA mode.
    Of course you'd have to adapt the logic so it doesn't do stupid stuff when you're transiting from UA to PA mode as well.
    I've not worked a lot with the flap system yet, so these are just suggestions to try out.

    BR

    Gunter

Share This Page