• 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 Flaps Unbalance Alert.

Zeiten

Resource contributor
Messages
444
Country
norway
Hi!

Can't get this code to work correctly.

The light should go on when either;
1. Test switch is pushed (working)
2. Detects difference in flap position.

It works when the left flap fails, but not when the right fails.

Any thoughts guys?

Code:
 <Value>
         (A:ELECTRICAL MASTER BATTERY, bool)
         (L:CC Switch Flaps Unbalance Triggered,enum)
         and
       
         if{
         (A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;

         if{ 1 (L:CC Switch Flaps Unbalance Triggered,enum) }
         els{ 0 (L:CC Switch Flaps Unbalance Triggered,enum) } }

         els{
         (A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;

         if{ 1 (L:CC Switch Flaps Unbalance Triggered,enum) }
         els{ 0 (L:CC Switch Flaps Unbalance Triggered,enum) }
         }
         or
         </Value>


Cheers
Daniel

Heretic: NOT sent from my HTC ONE using Tapatalk :whiteflag
 
LoL!


There's a ">" or "&gt;" missing in front of "(L:CC Switch Flaps Unbalance Triggered,enum)" in the if { ... } and els{ ... } brackets. The variable won't switch states that way.
Also, why "enum"? 1 and 0 is a classical boolean operation.
Is the "or" at the end of the code intentional?


Shortened and cleaned up version:
Code:
<Value>
(A:ELECTRICAL MASTER BATTERY, bool)
(L:CC Switch Flaps Unbalance Triggered,enum)
and

if{
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;
or
  if{ 1 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) }
  els{ 0 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) } }
</Value>
 
Sorry, the > and &gt; was there in my code.

Posted the wrong code ;)

Was not awake enough to see that, and now that I see the code you have posted my eyes woke up :)
Thanks mate!

And BTW, the enum is there because the switch is a 3 posistion switch.
Test left - off - test right.
 
Last edited:
Since it is not possible to make (A:TRAILING EDGE FLAPS LEFT PERCENT, percent) differ from (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) using Flap's standard events, are you using SIMVARS class from XMLTools or another C++/Simconnect/FSUIPC approach?

Tom
 
Just testing it by FSX own failure settings and it works just good.

While I'm not planning on making any failure of any kinds to the model, I like it to be correctly.
 
Was not awake enough to see that, and now that I see the code you have posted my eyes woke up :)
Thanks mate!


You're welcome.

By the way, do you still have a working version of the L-1011 VC?
The one in the library here can't be opened in Max 9 ("File Open Failed").
 
Just testing it by FSX own failure settings and it works just good.

While I'm not planning on making any failure of any kinds to the model, I like it to be correctly.

Oh ok, just FSX standard failures.

I understand those do not actually show on the model; if by any chance you would like to see the assymetry reflected on the external view I recommend to try SIMVARS class; it is absolutely simple to code in XML and the visuals add much realism to the situation.

Tom
 
The asymmetric effect is shown at the external model as well.
 

Attachments

  • fsx 2014-08-03 20-19-59-14.png
    fsx 2014-08-03 20-19-59-14.png
    881.9 KB · Views: 550
Now the main question is how on earth to animate the flap position needle when one of the flaps have failed.
There is only one needle for both flaps.

ATM I'm putting both left and right flap position into a L:var and make that move the needle and it works great as long as the flaps don't fail.
When one of the fails it only will go halfway down the scale (of course)
So guess I need to check whenever the flaps have failed and then double the value of the L:var.

Or am I over thinking this?
 
If your aircraft has only one needle for both flaps positions, I guess the needle should indicate the commanded position, providing one of the sides reached it, and the light should illuminate to indicate the assymetry. But's only a guess, maybe the right answer is in the POH.

@Heretic,

(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;
or


Shortened ;):

(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) !=

Tom
 
Actually looks like it gets it's data from the right side gearbox.
Then data from the left and right gearboxes goes into a flap contactor box that detects any asymmetric movement that would trigger the light to go on.

Well, that's good news ;)
flaps.jpg
 
Sorry, but I don't really understand the condition in your code :( Would you mind clearing it up to me?


Code:
<Value>
(A:ELECTRICAL MASTER BATTERY, bool)
(L:CC Switch Flaps Unbalance Triggered,enum)      <---- so whenever this is NULL it won't do the if clause, right??
and

if{
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;
or
if{ 1 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) }
els{ 0 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) } }      <------ but this line would set it to NULL......
</Value>
 
If you are using a test switch (with its own L:Var) then I would use something short like this:

Code:
<Value>
(A:ELECTRICAL MASTER BATTERY, bool)
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) !=
(L:Flaps test switch,enum) 0 !=      <---- in case your 3 position switch has its OFF position at 0
or
and
</Value>

Steven
 
Sorry, but I don't really understand the condition in your code :( Would you mind clearing it up to me?


Code:
<Value>
(A:ELECTRICAL MASTER BATTERY, bool)
(L:CC Switch Flaps Unbalance Triggered,enum)      <---- so whenever this is NULL it won't do the if clause, right??
and

if{
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;
(A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;
or
if{ 1 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) }
els{ 0 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) } }      <------ but this line would set it to NULL......
</Value>

The last els{ statement was removed in order for it to work...
 
This is what I have now and it works just as I want to.

Switch

Code:
<PartInfo>
    <Name>CC_Switch_Flaps_Unbalance</Name>
    <AnimLength>100</AnimLength>
    <Animation>
       <Parameter>
       <Code>50 (L:CC Switch Flaps Unbalance,enum) 50 * +</Code>
        <Lag>400</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <MouseFlags>LeftSingle+Leftrelease+RightSingle+RightRelease+DownRepeat</MouseFlags>
            <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 ==
                if{ -1 (>L:CC Switch Flaps Unbalance,enum)  1 (>L:CC Switch Flaps Unbalance Triggered,enum) }
            (M:Event) 'LeftRelease' scmp 0 ==
                if{ 0 (>L:CC Switch Flaps Unbalance,enum) 0 (>L:CC Switch Flaps Unbalance Triggered,enum) }
            (M:Event) 'RightSingle' scmp 0 ==
                if{ 1 (>L:CC Switch Flaps Unbalance,enum) 1 (>L:CC Switch Flaps Unbalance Triggered,enum) }
            (M:Event) 'RightRelease' scmp 0 ==
                if{ 0 (>L:CC Switch Flaps Unbalance,enum) 0 (>L:CC Switch Flaps Unbalance Triggered,enum) }
       </CallbackCode>
    </MouseRect>
</PartInfo>

Logic:

Code:
          (A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &gt;
          (A:TRAILING EDGE FLAPS LEFT PERCENT, percent) (A:TRAILING EDGE FLAPS RIGHT PERCENT, percent) &lt;
          or
          if{ 1 (&gt;L:CC Switch Flaps Unbalance Triggered,enum) }

2D Light

Code:
   <Element>
      <Position X="132" Y="95"/>
      <Select>
        <Value>
        (A:ELECTRICAL MASTER BATTERY, bool)
        (L:CC Switch Flaps Unbalance Triggered,enum)
        and
        </Value>
         <Case Value="1">
            <Image Name="Ann_Flaps_Unbalance.bmp" Bright="Yes" ImageSizes="101,37,0,0"/>
         </Case>
      </Select>
   </Element>

I know that the code could be more efficient, but it works ;)
 
Back
Top