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

What is this XML doing ?

Messages
497
Country
unitedstates
I am trying to figure out what this XML is doing ? (and why )

Code:
(A:RECIP ENG1 BRAKE POWER,ft lb per second) 0 >
 if{ 0 (>K:SPOILERS_SET,numbers) } 
 els
 { 
 (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ 16383 >
  	if
  	{ 16383 (>K:SPOILERS_SET,numbers) } 
  	els
  	{ (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ (>K:SPOILERS_SET,numbers) } 
  }

It is in an XML Guage for a RED BULL type aircraft, that has no modeled Spoilers. I assume the plane flies as if it had invisible Spoilers ?


I want to MODIFY this XML, so that it does NOT keep sending out a value for K:SPOILER_SET each time the Gauge is run (18 / sec) ( and flooding Multiplayer with Unneccesary data )

If the Value of the SPOILER Handle has not changed, then I do not want it to trigger the Event to set the SPOILER Handle to the same value that it is already at.
( I may also be setting the Gauge to run once / seconds)


One part that really confuses me is

Code:
(A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ 16383 >
  	if

if (-A:RECIP ENG1 BRAKE POWER,ft lb per second > 16383)

Totally confused.

Geoff
 
Add a timer to slow down the evaluation time.

(P:Absolute time,seconds) 1 % 0.25 > !

The script above will only execute every 1/4th second.

The /-/ will negate the value to which it is applied.

Code:
(A:RECIP ENG1 BRAKE POWER,ft lb per second) 0 >
(P:Absolute time,seconds) 1 % 0.25 > !
and
 if{ 0 (>K:SPOILERS_SET,numbers) } 
 els
 { 
 (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ 16383 >
  	if
  	{ 16383 (>K:SPOILERS_SET,numbers) } 
  	els
  	{ (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ (>K:SPOILERS_SET,numbers) } 
  }
 
Add a timer to slow down the evaluation time.

(P:Absolute time,seconds) 1 % 0.25 > !

The script above will only execute every 1/4th second.

The /-/ will negate the value to which it is applied.

Code:
(A:RECIP ENG1 BRAKE POWER,ft lb per second) 0 >
(P:Absolute time,seconds) 1 % 0.25 > !
and
 if{ 0 (>K:SPOILERS_SET,numbers) } 
 els
 { 
 (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ 16383 >
  	if
  	{ 16383 (>K:SPOILERS_SET,numbers) } 
  	els
  	{ (A:RECIP ENG1 BRAKE POWER,ft lb per second) /-/ (>K:SPOILERS_SET,numbers) } 
  }


Thanks Bill, but I am still confused by the /-/

I am reading the XML as

INFIX:

Code:
if ( (A:RECIP ENG1 BRAKE POWER,ft lb per second) > 0 )
   {  
   (K:SPOILERS_SET,numbers) = 0;
   }
   else
   {
   if ( -(A:RECIP ENG1 BRAKE POWER,ft lb per second) > 16383)
     {
     (K:SPOILERS_SET,numbers) = 16383;
     }
     else
     {
     (K:SPOILERS_SET,numbers) = - (A:RECIP ENG1 BRAKE POWER,ft lb per second);
     }
   }

K:SPOILERS_SET = 0 to 16383
The XML would appear to be assuming that (A:RECIP ENG1 Brake Power) is always represented as a NEGATIVE value ???

The reason for even looking at this code, is because, each time it executes, it is always triggering event K:Spoiler_set to set the Spoiler, even if the spoiler is already in the correct position.

My aim is to modify the code, so it only triggers the event to change the Spoiler value, if the spoiler needs to be moved.

But reason for negating the (A:RECIP ENG1 BRAKE POWER) is the confusion, as the SDK does not indicate that (A:RECIP ENG1 BRAKE POWER) is a negative value.

I think purpose of the XML is to simulate the injection of power additives, at high engine power levels, by appling Imaginary Spoilers at lower engine power levels, When one runs out of spoiler to add, then the effect of increased Power will have a more significant effect on the planes performance.

( Plane was originally a FS2004 plane. hence thsi method of simulating adding power additives at higher power settings ?? )

Geoff
 
Hi
Ive done something similar to the above code to model engine HP drop (aircraft slows at full throttle ect) due to wrong engine management....anyway another way to fix the issue of firing all the time is to copy the a:var to an L:var
I had the same issue with the prop pitch set command ..have a look here and see if that helps http://www.fsdeveloper.com/forum/showthread.php?t=23178
Wozza
edit to save any confusion this is the code I ended up using :)
(the L:Prop,enum) 0 == && is there so it could be switch on and off by the user,you wont need that as your code is on all the time)

Code:
  <Element>
    <Select>
      <Value>(A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) (L:Throttle,enum) != (L:Prop,enum) 0 == &amp;&amp; if{ 0 54 (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) rng if{ 8939 (>K:PROP_PITCH1_SET) (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) (&gt;L:throttle,enum) } } 
      </Value>
    </Select>
 </Element>
 
Last edited:
Thanks Bill, but I am still confused by the /-/
Geoff

I think it's just an alternative to using
Code:
 0 (A:RECIP ENG1 BRAKE POWER,ft lb per second) -

Not sure which is more readable though...

Doug
 
I think it's just an alternative to using
Code:
 0 (A:RECIP ENG1 BRAKE POWER,ft lb per second) -

Not sure which is more readable though...

Doug

Yes, I understabnd the /-/ syntax, but WHY is there a MINUS there at all ???

I am fast concluding that the original XML may be incorrectly coded ?

The XML just does not sense (to me), unless "RECIP_ENG1_BRAKE_POWER" is negative, and it being Negative, make even less sense.

I doubt that I will ever get the hang of reading backwards !
Wonder if XML comes more easily to Chineese programmers :P

Time to go find "The Black Box"

Geoff
 
It may well be a negative value, although the SDK certainly makes no mention of it. I guess the only way is to actually read and display the variable to find out...
 
Back
Top