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

Third degree equation in xml

Messages
126
Country
italy
I want to make an equation of the third degree in xml language.
The equation is the following:

y=1,284(x^3) - 1,354(x^2) + 0,438x + 0,989

I can write as

y=x[x(1,284x - 1,354) + 0,438] + 0,989

[x(1,284x - 1,354) + 0,438] in xml is: x s0 1,284* 1,354 - l0 0,438 +

The questions is:

x[x(1,284x - 1,354) + 0,438] in xml is: x s0 s1 1,284* 1,354 - l0 0,438 + l1
 
Use the Power operator. As per SDK, 2 5 pow returns 32.

Same as 2^5.

Bob
 
If you need y value, then:

y = 1.284 x 3 pow * 1.354 x 2 pow * - 0.438 x * + 0.989 +

Tom
 
This equation should give values ranging from 1.00 to 1.79
If you want to get only the first decimal: 1.35 I want the second number, then 3.
In short, I want to simulate this mechanism:
154k294.jpg
 
With option shift:
EPR 1.00

9 9
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1
1.0 0

EPR 1.32
9
9 8
8 7
7 6
6 5
5 4
4 3
1. 3 2
2 1
1 0
0
The code is:

<Element>
<Position X="97" Y="94"/>
<MaskImage Name="ENG_number1.bmp" ImageSizes="21,32">
<Axis X="0" Y="0"/>
</MaskImage>
<Image Name="ENG_number1E.bmp" ImageSizes="21,352">
<Nonlinearity>
<Item Value="0" X="0" Y="320"/>
<Item Value="10" X="0" Y="0"/>
</Nonlinearity>
</Image>
<Shift>
<Value> ..........................</Value>
<Failures>
<SYSTEM_ENGINE Action="0"/>
</Failures>
</Shift>
</Element>

<Element>
<Position X="64" Y="94"/>
<MaskImage Name="ENG_number1.bmp" ImageSizes="21,32">
<Axis X="0" Y="0"/>
</MaskImage>
<Image Name="ENG_number1E.bmp" ImageSizes="21,352">
<Nonlinearity>
<Item Value="0" X="0" Y="320"/>
<Item Value="10" X="0" Y="0"/>
</Nonlinearity>
</Image>
<Shift>
<Value> ..........................</Value>
<Failures>
<SYSTEM_ENGINE Action="0"/>
</Failures>
</Shift>
</Element>


This is for the digits after the ","
But how do I write the two previous values ricavandoli expression?
 
I guess he needs some program logic to extract both decimal digits from the current EPR value to position the respective bitmap number strip for the display.
Similar to a COM radio with drums for each digit.
 
You know the ca 747? I'm doing just the EPR gauge similar to that panel.
I'm doing this job because the gauge of the EPR 747 is patterned rfp template engine RR, while I want to do it like that of P & W engine.
You know the rfp 747? I'm doing just the EPR gauge similar to that panel.
I'm doing this job because the gauge of the EPR 747 is patterned rfp template engine RR, while I want to do it like that of P & W engine.
The indicators of the engines of the 747 give two indication: the first as a visual indication, given the hand that moves on the scale designed; there is also a second indication is that it gives a numerical indication approximates to two decimal places.


15yd5om.jpg


I want to simulate the second indication. Since l '"1" fixed, I have to find the equation of the first and second decimal place starting from the cubic equation of the post.
The equation is the variable "(A: TURB ENG1 CORRECTED N1 percent) 100 /"
EPR value is : 1.284 (A:TURB ENG1 CORRECTED N1,percent) 100 / 3 pow * 1.354 (A:TURB ENG1 CORRECTED N1,percent) 100 / 2 pow * - 0.438 (A:TURB ENG1 CORRECTED N1,percent) 100 / * + 0.989 +
 
It looks like you want to have scrolling digits rather than snapping digits. If that's the case then this should work -

Code:
<Element Name="EPR Tenths">
<Position X="64" Y="94"/>
<MaskImage Name="ENG_number1.bmp" ImageSizes="21,32">
<Axis X="0" Y="0"/>
</MaskImage>
<Image Name="ENG_number1E.bmp" ImageSizes="21,352">
<Nonlinearity>
<Item Value="0" X="0" Y="320"/>
<Item Value="10" X="0" Y="0"/>
</Nonlinearity>
</Image>
<Shift>
<Value>1.284 (A:TURB ENG1 CORRECTED N1,percent) 100 / 3 pow * 1.354 (A:TURB ENG1 CORRECTED N1,percent) 100 / 2 pow * - 0.438 (A:TURB ENG1 CORRECTED N1,percent) 100 / * + 0.989 +  100000 + 10 * 10 %
</Value>
<Failures>
<SYSTEM_ENGINE Action="0"/>
</Failures>
</Shift>
</Element>


<Element Name="EPR Hundreths">
<Position X="97" Y="94"/>
<MaskImage Name="ENG_number1.bmp" ImageSizes="21,32">
<Axis X="0" Y="0"/>
</MaskImage>
<Image Name="ENG_number1E.bmp" ImageSizes="21,352">
<Nonlinearity>
<Item Value="0" X="0" Y="320"/>
<Item Value="10" X="0" Y="0"/>
</Nonlinearity>
</Image>
<Shift>
<Value>1.284 (A:TURB ENG1 CORRECTED N1,percent) 100 / 3 pow * 1.354 (A:TURB ENG1 CORRECTED N1,percent) 100 / 2 pow * - 0.438 (A:TURB ENG1 CORRECTED N1,percent) 100 / * + 0.989 100000 + 100 * 10 %</Value>
<Failures>
<SYSTEM_ENGINE Action="0"/>
</Failures>
</Shift>
</Element>

Roman
 
That is the formula to extract only the 10ths of a computed number while scrolling.
Assume from your formula you have an EPR of 1.28 then -

1.28 + 100000 = 100001.28 (This is done for higher precision)
100001.28 * 100 = 10000128
10000128 10 % = 2.8 ( 10 % is the modulo of 10 which in simple terms is getting the remainder of the division by 10, 10000128 10 / = 1000012.8 )

2.8 is the result of pulling the 10ths of your calculation.

Here are my notes from the FS2002/4 days for pulling digits -


To have scrolling tapes use original or based on original and remove the "flr" operator.

For retrieving the ".01s" (High precision , scrolling ) 100000 + 100 * 10 %

For retrieving the ".1s" ( high precision w/ snap ) 100000 + 100 * d 1 % r flr 100 % d 10 / flr r 10 % 9 == if{ + } -OR- (High precision based on original) 100000 + 10 * 10 % flr -OR- (ORIGINAL, scrolling) 10 * 10 %

For retrieving the "ones" ( high precision w/ snap ) 100000 + 100 * d 1 % r flr 1000 % d 100 / flr r 100 % 99 == if{ + } -OR- (ORIGINAL, scrolling) 10 %

For retrieving the "tens" ( high precision w/ snap ) 100000 + 100 * d 1 % r flr 10000 % d 1000 / flr r 1000 % 999 == if{ + } -OR- (High precision based on original) 100000 + 100 % 10 / flr -OR- (ORIGINAL) 100 % 10 / flr

For retrieving the "hundreds" ( high precision w/ snap ) 100000 + d 1 % r flr 1000 % d 100 / flr r 100 % 99 == if{ + } -OR- (High precision based on original) 100000 + 1000 % 100 / flr -OR- (ORIGINAL) 1000 % 100 / flr

For retrieving the "thousands" ( high precision w/ snap ) 100000 + d 1 % r flr 10000 % d 1000 / flr r 1000 % 999 == if{ + } -OR- (High precision based on original) 100000 + 100000 % 1000 % 100 / flr -OR- (ORIGINAL) 100000 % 1000 % 100 / flr



Microsoft originals Alt window 747.

For "1s" scrolling - 10 %
For "10s" snapped - s1 10 / 10 % flr l1 10 % 9 > if{ l1 10 % 9 - + }
For "100s" snapped - s1 100 / 10 % flr l1 100 % 99 > if{ l1 10 % 9 - + }
For "1000s" snapped - s1 1000 / 10 % flr l1 1000 % 999 > if{ l1 10 % 9 - + }
For "10,000s" snapped - s1 10000 / 10 % flr l1 10000 % 9999 > if{ l1 10 % 9 - + }

There is a more elegant way of getting snapped digits here - http://www.fsdeveloper.com/wiki/index.php?title=XML:_Macros_-_Extracting_Digits

The wiki here has loads of helpful information supplementing the SDK - http://www.fsdeveloper.com/wiki/index.php?title=Category:Panel_and_Gauge_Design

See the "modulus operator" in the gauges wiki.
 
OK thank you very much.
A last question must be read in this code:

10 / int 10%

100% 99-0 max +
 
I don't know whats with the 100000 + though. There is really no need for it.

If your EPR is 1.35, you can get the digits the following way:


Code:
EPR 100 * 10 % // This will turn it to 135 and mod by 10 so you are left with 5

EPR 10 * int 10 % //This will turn it to 13(the int gets rid of 0.5) and mod by 10 so you are left with 3

EPR int //This turns 1.35 into 1.

The // is my comments to the code....But keep in mind that while the code is XML, my comment is C++ based so don't included it in yours ;)
 
Thank you all for the help! The gauge is almost finished, I have to make adjustments to the <Nonlinearity>.
If you see from the picture, halfway Hundreths the EPR, the EPR Tenths are somewhere between 1 and 2.
xpa5y1.jpg

There is a way to keep fixed the EPR Tenths through the range of EPR Hundreths?
Gauge epr real 747:
333d4as.jpg
 
Put an int after the % for your second digit so it gets rounded down to an integer(non floating point) value.
 
Ok !!!!!!!! engines panel completed.
The next step will be the autopilot of 747 classic ............ someone wants to help me? I intend to achieve even overhead, fuel panel, Elettrical panel and hydraulic panel
 
Back
Top