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

P3D v1 Automatic Spoiler

Messages
10,163
Country
us-arizona
Hey all,

Im trying to enduce drag via a hidden gauge that turns on spoilers.

This is for an electric plane; the retracting air generator, and or prop regenerative breaking (turns to generator mode when throttle is off, enducing some slight drag).


I cant get the code to work for some reason. If I hit the / key, the plane slows, so I know Spoilers are working, but the code isn't. Any ideas what is wrong?


Code:
  <Update Hidden="Yes">
    <!-- 1 SECOND UPDATE -->
    (P:Absolute time,seconds) 1 % 1 > !
    if{
          (* XML script goes in here *)
            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  3 &lt;
            (L:AVE WPAPU, bool)  1 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knots) 20 &gt;
                       if{
                           1 (>K:SPOILERS_ON) 
                         }
                 }
              els{ 0 }
   </Update>


NEXT, below, different version//////////////////////////////

  <Update Hidden="Yes">
    <!-- 1 SECOND UPDATE -->
    (P:Absolute time,seconds) 1 % 1 > !
    if{
          (* XML script goes in here *)
            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  3 &lt;
            (L:AVE WPAPU, bool)  1 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knots) 20 &gt;
                       if{
                           1 (>K:SPOILERS_ON) 
                         }
                 }
              els{ 
                           1 (>K:SPOILERS_OFF)
                  }

   </Update>



I have also tried 1 (>K:SPOILERS_OFF,bool) and this didn't work either.

I don't want to use SPOILERS_TOGGLE as I need to know if they are on/off. If they reload the plane in flight, it would mess up the on/off position logic, if I am correct.



NOTE: ON the top, it 'should' be and/or, but I don't know how that would be written. (Can one write and or ?) But, or should work fine, right? I tried using 'or' and also the || symbols.
 
You're missing the closing bracket for your first if statement.

In computerese, 'or' is in fact 'and/or'
'Or' without 'and' is referred to as exclusive or, the xml symbol for which currently escapes me.

Doug
 
You're missing the closing bracket for your first if statement.

In computerese, 'or' is in fact 'and/or'
'Or' without 'and' is referred to as exclusive or, the xml symbol for which currently escapes me.

Doug


ACK! It is.... Why didn't I see that...

Thanks David.



In other words, computerese A or B is the same as not( notA and notB)

Phabian


wooooot???? :eek:
 
if A and B are both true, then
(A or B) returns true.

if A and B are both true, then
(A xor B) return FALSE.

Doug

Sorry... In plain English, 'exclusive or' means one, or the other, but not both.
 
Last edited:
Thanks for clarifying that.



Well, the gauge is still not working. Im posting the entire thing incase it is somewhere else that I am missing.



Code:
<Gauge Name="Recharger System" Version="1.1">
  <Size X="5" Y="5" />

  <Update Hidden="Yes">
    <!-- 1 SECOND UPDATE -->
    (P:Absolute time,seconds) 1 % 1 > !
    if{
          (* XML script goes in here *)
            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  3 &lt;
            (L:AVE WPAPU, bool)  1 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knots) 20 &gt;
                       if{
                           1 (>K:SPOILERS_ON,bool) 
                         }
                 }
              els{ 
                           1 (>K:SPOILERS_OFF,bool) 
                 }
       }

  </Update>

 </Gauge>
 
What happens if you take this out:

(* XML script goes in here *)

Doug.
 
Nope, nothing.

I also changed 'knots' to 'knot'. Nothing.

Just tried this as well, making it a dual separate system. Didn't work either.


Code:
  <Update Hidden="Yes">
    <!-- 1 SECOND UPDATE -->
    (P:Absolute time,seconds) 1 % 1 > !
    if{
       
            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  3 &lt;
            (L:AVE WPAPU, bool)  1 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knot) 20 &gt;
                       if{
                           1 (>K:SPOILERS_ON,bool) 
                         }
                 }

            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  5 &gt;
            (L:AVE WPAPU, bool)  0 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knot) 20 &gt;
                       if{
                           1 (>K:SPOILERS_OFF,bool) 
                         }
                 }


       }
 
Try going with just this:
Code:
            (A:GENERAL ENG THROTTLE LEVER POSITION:1,percent)  3 &lt;
            (L:AVE WPAPU, bool)  1 ==
             ||
               if{
                  (A:AIRSPEED INDICATED,knots) 20 &gt;
                       if{
                           1 (>K:SPOILERS_ON,bool) 
                         }
                 }
              els{ 
                           1 (>K:SPOILERS_OFF,bool) 
                 }

My gut is telling me that (P:Absolute time,seconds) 1 % is not doing what you think it is...

Doug
 
Hey Doug,

No go. :(

I was just combing through the entries on the panel config. Nothing there that looks wrong. All correctly spelled, etc.
 
William,

It looks all good and should work except,,,, somewhere in your trying and retrying a "unit" got slipped into a K: command.

(>K:SPOILERS_ON,bool) <-- Will never work
(>K:SPOILERS_ON) <-- Will work

The K: commands must be spelled exactly as given by the SDK..
:banghead: It can happen LOL!

Roman
 
Thanks Roman. I couldn't remember if K: 's had bools or not.


I changed those and the spoilers still didn't engage. I cant believe this. How hard can it be to make spoilers deploy.....?
 
I'm canceling this.

Thanks everyone for the excellent idea's. Makes me mad it didn't work. The schedule Im in says to drop it, so its time to launch the updates as they are on this bird.

Perhaps someday the mystery to why this didn't work will be revealed.




Bill
 
Bill,

At first sight I find that (P:Absolute time,seconds) 1 % 1 > ! is always true, as (P:Absolute time,seconds) 1 % will be never greater than 1.

Also writing (>K:SPOILERS_ON,bool) or (>K:SPOILERS_ON) is the same and works ok, the unit part is simply discarded. (>K:spoilers_on) would be the same as well. Only K: must be in capitals.

Tom
 
Bill just tried this and it works ok, if you ever return to it..Added a part to keep from constant firing.

Code:
<Update Hidden="Yes" Frequency="1">
(L:AVE WPAPU, bool)  1 ==  
(A:GENERAL ENG THROTTLE LEVER POSITION:1,percent) 3 &lt; ||
    if{ 
      (A:AIRSPEED INDICATED,knots) 20 &gt; (A:SPOILERS HANDLE POSITION, percent) 98 &lt; and 
            if{ (>K:SPOILERS_ON) } }
     els{ 
       (A:SPOILERS HANDLE POSITION, percent) 1 &gt; 
            if{ (>K:SPOILERS_OFF) } }
</Update>

Roman
 
Last edited:
Roman,

If this worked for you, and its not working for me (just tested it) then it must be in the config.

When I hit / key, spoilers come on, speed begins dropping rapidly. When I turn on WPAPU or drop the throttle to zero, nothing occurs. I have spoilers active in the AIR file and config file, but nada...

I hope the mystery reveals itself someday.




Bill
 
If this is any help. Its a code to automatically raise the spoilers by 25% in case of overspeed. Or if they are already out then they "blowback".
vololiberista

Code:
<Update Frequency="3"/>
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>
 
Roman,

If this worked for you, and its not working for me (just tested it) then it must

I recall you're coding for P3D, not FSX.
Perhaps there are operators not supported by P3D?

Try replacing || with or
Also forcing the conditionals, for example:

Code:
              1 if{
                  (A:AIRSPEED INDICATED,knots) 20 &gt;
                       if{
                            (>K:SPOILERS_ON) 
                         }
                 }

Etc.

Tom
 
If this is any help. Its a code to automatically raise the spoilers by 25% in case of overspeed. Or if they are already out then they "blowback".
vololiberista

Code:
<Update Frequency="3"/>
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>


Thanks Vololiberista
 
Back
Top