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

XML synthax difficulty

Luka's given you the summary answer already. I could write pages and pages of technical explanation but honestly it would be so dense and incomprehensible that I may as well simply type gibberish... :rotfl:

Although the unique way that MS/ACES have adopted XML script is new, the programming technique used is ancient in computer years, harkening back to the early 1960's of Hewlett-Packard calculators* with their ubiquitious "stack operations."

* see also:
http://h20331.www2.hp.com/Hpsub/downloads/HP12CRPNstack.pdf
http://en.wikipedia.org/wiki/Reverse_Polish_notation#Hewlett-Packard
http://www.jacques-laporte.org/The stack.htm
 
Thank you for links. I begin to understand.

So , I have again many difficulties.

Since a 4 days, I try to modify the autopilot.xml for that when I climb for 18000ft to my final flight level, in mach mode with autopilot, i want that speed will be refresh. In fact, the default autopilot of FSX as a bug, because when your are at 18000ft and when you select mach mode and set mach valu to 0.77, It memories the speed in IAS at this time (+- 370 knots at this altitude) and while the plane climb, It don't refresh the speed with altitude increase, and when I arrive at FL300, I am in overspeed, when the PA show 0.77m, the real mach is 0.89 !! I must to touch the setting mach on the VC for It refresh)

So, I do some errors in my code and I don't find where is it.

I have tried many combination and it's don't work !

At this moment, I am in my office for lunch time, and I havn't FSX in my computer, but I have tried to write new code .

Do you think that it could work ?

<!-- Control refresh Mach value while climb in mach hold mode -->
<Update id="Refresh mach">
<Script>
(A:Autopilot Mach Hold, bool) 0 !
(A:Indicated Altitude,feet) 18000 &gt; &amp;
if{ %((A:Autopilot Mach Hold Var,number))%!1.2f! (&gt;L:MY_AP_MACH,mach) %((A:Airspeed Mach,mach))%!1.2f! (&gt;L:MY_ACTUAL_MACH,mach) %((A:airspeed indicated or true,knots))%!3d! (&gt;L:ACTUAL_IAS,knots) }
(A:Autopilot Mach Hold, bool) 0 !
(A:Vertical speed, feet per minute) 400 > &amp;
(L:MY_ACTUAL_MACH,mach) (L:MY_AP_MACH,mach) &gt;= &amp;
if{ (L:ACTUAL_IAS,knots) (&gt;K:AP_SPD_VAR_SET) }
</Script>
</Update>
 
Last edited:
I Have found the right code ! It's Works !!!

Never overspeed !!!

<!-- Control constant Mach climb -->
<!-- G:VAR1 = Selected mach by user -->
<Update id="Constant Mach Climb">
<Script>
(A:Autopilot Airspeed Hold, bool) 0 !
(A:Indicated Altitude, Feet) 20000 > and
(A:Airspeed Mach,mach) 0.6 >= and
(A:Vertical speed, feet per minute) 500 > and
(A:Airspeed Mach,mach) (A:Autopilot Mach Hold Var,number) >= and
if{ (>K:AP_PANEL_SPEED_HOLD_TOGGLE) (G:VAR1,mach) (>K:AP_PANEL_MACH_HOLD_TOGGLE) }
</Script>
</Update>
 
Nicely done. Now, allow me to repost your script using the #
Code:
 tags instead of the [quote] tags so that the indent-formatting is preserved. It makes it much easier to read that way:
[CODE]
<!-- Control constant Mach climb -->
<!-- G:VAR1 = Selected mach by user -->
<Update id="Constant Mach Climb">
  <Script>
    (A:Autopilot Airspeed Hold, bool) 0 !
    (A:Indicated Altitude, Feet) 20000 > and
    (A:Airspeed Mach,mach) 0.6 >= and
    (A:Vertical speed, feet per minute) 500 > and
    (A:Airspeed Mach,mach) (A:Autopilot Mach Hold Var,number) >= and
    if{ (>K:AP_PANEL_SPEED_HOLD_TOGGLE) (G:VAR1,mach) (>K:AP_PANEL_MACH_HOLD_TOGGLE) }
  </Script>
</Update>
 
What about fist line?
Code:
(A:Autopilot Airspeed Hold, bool) 0 !
This is always true. Maybe "(A:Autopilot Airspeed Hold, bool) !" or "(A:Autopilot Airspeed Hold, bool) 0 !=" or something else?
 
For example:

(condition1) (condition2) (condition3) (condition4) (condition5) and or and and

This parses out to:

(condition1) and (condition2)
or
(condition3) and (condition4) and (condition5)

Hi, sorry for jumping in, but I'd like to clarify something important:

Any time an operator (like and, or, +, -, etc) is extracted from the stack, its replacement is an expression which results from the evaluation of the preceeding value (or more than one in some cases).
Going to this specific example, the correct flow would be:

(condition 5) and (condition 4) -> gives a result ie call it (c45)
then
(c45) or (condition 3) -> the next result (c345)
then
(c345) and (condition 2) -> other result (c2345)
then the final evaluation
(c2345) and (condition 1) -> (c12345)

Hope this helps to make a better understandig :)

Tom
 
Actually Tom, it doesn't, or at least it doesn't for me. What then is the correct syntax for what I actually want, which is...

Code:
either
(c1) and (c2)
are both true

[B]OR[/B]

(c3) and (c4) and (c5)
are all true
 
Actually Tom, it doesn't, or at least it doesn't for me. What then is the correct syntax for what I actually want, which is...

Code:
either
(c1) and (c2)
are both true

[B]OR[/B]

(c3) and (c4) and (c5)
are all true

Hi Bill, that should be

(C1) (C2) and (C3) (C4) (C5) and and or

Tom
 
Hi Bill, that should be

(C1) (C2) and (C3) (C4) (C5) and and or

Tom

Okay, then in my preferred way:

(C1) (C2) and (C3) (C4) and (C5) and or

I prefer to keep my conjunctions tidy; subjective conjuntivitis is to blame. :D
 
Thank you for your knowledge.

I have progressed in XML code and I have manager the default fsx autopilot with custom fonction thanks to you.

Now; I began to create a new gauge for managed the VNAV of my aircraft.

So, I would like take in consideration the mass of the aircraft to set the differents rates to climb.

I have to way for that:

First is several G:Var use by time of climb and set at startup, to these G:VAR a value by weight like this :
Code:
(G:Var2) 0 == if{
(A:TOTAL WEIGHT, kilograms) 50000 < if{ 3800 (>G:Var2) 3000 (>G:Var3) 2500 (>G:Var4) 2000 (>G:Var5) 1600 (>G:Var6) }
50000 65000 (A:TOTAL WEIGHT, kilograms) rng if{ 3700 (>G:Var2) 2800 (>G:Var3) 2400 (>G:Var4) 1800 (>G:Var5) 1500 (>G:Var6) }
65000 68000 (A:TOTAL WEIGHT, kilograms) rng if{ 3500 (>G:Var2) 2600 (>G:Var3) 2200 (>G:Var4) 1600 (>G:Var5) 1400 (>G:Var6) }
68000 75000 (A:TOTAL WEIGHT, kilograms) rng if{ 3000 (>G:Var2) 2400 (>G:Var3) 2000 (>G:Var4) 1400 (>G:Var5) 1200 (>G:Var6) }
}

So , I don't know if it is possible to place a condition into an other condition like this.

If yes, I would like set the Vertical speed like this :

Code:
(G:Var1) 4 ==
(L:CSTRVnav) 1 == and
(A:Airspeed Select Indicated or True, Knots) 240 > and
	if{ (g:Var2) (>K:AP_VS_VAR_SET_ENGLISH) 5 (>G:Var1) }
(G:Var1) 5 ==
(L:CSTRVnav) 1 == and
10000 11000 (A:Indicated Altitude, feet) rng and
	if{ 2000 (>K:AP_VS_VAR_SET_ENGLISH) 300 (>K:AP_SPD_VAR_SET) 6 (>G:Var1) }
(G:Var1) 6 ==
(L:CSTRVnav) 1 == and
	11000 18000 (A:Indicated Altitude, feet) rng and
	if{ (G:Var3) (>K:AP_VS_VAR_SET_ENGLISH) 7 (>G:Var1) }
(G:Var1) 7 ==
(L:CSTRVnav) 1 == and
18000 25100 (A:Indicated Altitude, feet) rng and
	if{ (G:Var4) (>K:AP_VS_VAR_SET_ENGLISH) 77 (>K:AP_MACH_VAR_SET) }
(G:Var1) 7 ==
(L:CSTRVnav) 1 == and
25100 28000 (A:Indicated Altitude, feet) rng and
	if{ (G:Var5) (>K:AP_VS_VAR_SET_ENGLISH) }
(G:Var1) 7 ==
(L:CSTRVnav) 1 == and
28000 34000 (A:Indicated Altitude, feet) rng and
	if{ (G:Var6) (>K:AP_VS_VAR_SET_ENGLISH) }
(G:Var1) 7 ==
(L:CSTRVnav) 1 == and
(A:Indicated Altitude, feet) 34000 > and
	if{ 1000 (>K:AP_VS_VAR_SET_ENGLISH) }


Is this code is permit (assign the value of a G:Var to a K:event like this --> (G:Var5) (>K:AP_VS_VAR_SET_ENGLISH) ?

The second method is to create a coefficent with the aircraft weight and use a single G:Var :

My calculation :
((mass of the aircraft / 100000) * 2 ) -0.20


60000kg will be the 1 coefficient.

example with aircraft that weight 75 000kg :
75000/100000 = 0.75
0.75 * 2 = 1.50
1.50 - 0.20 = 1.30
1.30 is my coefficent.

like this :
Code:
(G:Var2, number) 0 == if{
(A:Total Weight, kilograms) 100000 / 2 * 0.20 - (>G:Var2)
 }

And use this G:Var like this

If standart vertical speed be 1800ft/mn (60000kg aircraft) I want that the coefficient 1.3 it will be 1800 / 1.3 = 1384 rounded to 1400

I have tried this code :

Code:
(G:Var1) 5 ==
(L:CSTRVnav) 1 == and
10000 11000 (A:Indicated Altitude, feet) rng and
	if{ 18 (G:Var2) / 100 * int (>K:AP_VS_VAR_SET_ENGLISH) 300 (>K:AP_SPD_VAR_SET) 6 (>G:Var1) }


In my head :
18 (G:Var2) / ----> 18 / 1.30 = 13.846
13.846 * 100 = 1384
int of 1384 = 1400

But It doesn't work.

The two methods do not work


All this code is in an invisible gauge without bitmap, so I have placed it between <Update> .....</Update>

At this time , only this code works :

Code:
........
(G:Var1) 4 ==
(L:CSTRVnav) 1 == and
(A:Airspeed Select Indicated or True, Knots) 240 > and
	if{ 3500 (>K:AP_VS_VAR_SET_ENGLISH) 5 (>G:Var1) }
(G:Var1) 5 ==
(L:CSTRVnav) 1 == and
10000 11000 (A:Indicated Altitude, feet) rng and
	if{ 1800 (>K:AP_VS_VAR_SET_ENGLISH) 310 (>K:AP_SPD_VAR_SET) 6 (>G:Var1) }
(G:Var1) 6 ==
(L:CSTRVnav) 1 == and
10500 18000 (A:Indicated Altitude, feet) rng and
(A:Airspeed Select Indicated or True, Knots) 290 > and
	if{ 2500 (>K:AP_VS_VAR_SET_ENGLISH) 7 (>G:Var1) }
........
....


For now, I had to assign a fixed rate at each stage of the ascent to the gauge works, but I'd really like it fits the weight

Thank you for your help ....
 
Last edited:
This is incorrect:

13.846 * 100 = 1384
int of 1384 = 1400

since the int of 1384 is 1384 (the nearest integer).

instead do this:

int of 13.846 is 14
14 * 100 = 1400

Hope this helps,
 
you're totally right, I am very tired !!

but I do not think this is because of this that it does not work
 
So , I don't know if it is possible to place a condition into an other condition like this.

Yes, that approach looks OK.

If yes, I would like set the Vertical speed like this :

Is this code is permit (assign the value of a G:Var to a K:event like this --> (G:Var5) (>K:AP_VS_VAR_SET_ENGLISH) ?

Yes, this is possible, although I do not know your exact logic. That may be where your error lies?
 
Back
Top