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

Using <Nonlinearity> table data in script evaluations?

Messages
137
Country
us-southcarolina
Is it possible to get the <Value> from a <Nonliearity> table stored in an L:var ? Such as

Code:
<Element>
                <Select>
                 <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:X1_Fwd, enum)</Value>
                  <Nonlinearity>
                        <Item Value="0.1" X="-29" />
                        <Item Value="0.3" X="-21" />
                        <Item Value="0.5" X="-16" />
                        <Item Value="0.7" X="-13" />
                        <Item Value="1.0" X="-10" />
                        <Item Value="1.5" X="-7" />
                    </Nonlinearity>
                </Select>
                </Element>

I've tried the above and a couple other ways but no love. I have 6 L:vars that I need to store data in, ea has it's own table data. All 6 tables use the same input data but have different output.

I'm trying to avoid it but i guess if I can't get the tables to work I could try to create non linear equations from the data and use those but my brain hurts just think about doing that.

Joel
 
That's what <Element> <Select> <Value> without any tables, images or else or <Update> sections are for.
 
Bjoern,
That's what <Element> <Select> <Value> without any tables, images or else or <Update> sections are for.

sorry but I'm not following you ?when I use the above all i get is the value of the first L:var in the second L:var, not what i expect which is the interpolation of the input L:var value based on the output data in the table. can this be done this way ?
Joel
 
Last edited:
I found a site that creates Non Linear regression equations from input data so I'm going to try that to create a script that will interpolate the data for me based on my table data. Seems like the sledge hammer "make it fit" approach. It would be so simple if the above would work.

Joel
 
XMLTools has an XMLTables class that is used to extract interpolated values from nonlinear/multicolumn tables. You might want to look into that. Alternatively, every spreadsheet program out there (excel, libreoffice) contains regression analysis capability and the equations can be easily included in your XML script. See this thread for an example. Bob
 
XMLTools has an XMLTables class that is used to extract interpolated values from nonlinear/multicolumn tables. You might want to look into that. Alternatively, every spreadsheet program out there (excel, libreoffice) contains regression analysis capability and the equations can be easily included in your XML script. See this thread for an example. Bob

thanks Bob,

I did some more research and i think I have some direction to proceed now. I've used Excel for years for all kinds of stuff and never knew it would do regression analysis. It's relativity simple (I say now).
Looking ahead, since these lines will eventually be viewed on the HUD glass in relation to RWY point on the ground, the FS9GPS guide was req to me to help with GeoCalc needed to do this alignment. Is that yours? Either way I'm sure I'll be coming back with my hat in my hand for help when i get there.

thanks

Joel
 
Last edited:
Bjoern,


sorry but I'm not following you ?when I use the above all i get is the value of the first L:var in the second L:var, not what i expect which is the interpolation of the input L:var value based on the output data in the table. can this be done this way ?
Joel

You're overthinking. Use <Update> (one section per gauge) or <Element> <Select> <Value> (as many of those per gauge as you like) to do your calculations and writing to variables since elements with non linearity tables, bitmap displays, etc...are intended for reading variables.

E.g.

Code:
<Element><Select><Value>(A:Some variable,number) (L:Some other variable, number) + (>G:Var1)</Value></Select></Element>

<Element>
               <Select>
                <Value>(G:Var1)</Value>
                 <Nonlinearity>
                       <Item Value="0.1" X="-29" />
                       <Item Value="0.3" X="-21" />
                       <Item Value="0.5" X="-16" />
                       <Item Value="0.7" X="-13" />
                       <Item Value="1.0" X="-10" />
                       <Item Value="1.5" X="-7" />
                   </Nonlinearity>
               </Select>
 
You're overthinking. Use <Update> (one section per gauge) or <Element> <Select> <Value> (as many of those per gauge as you like) to do your calculations and writing to variables since elements with non linearity tables, bitmap displays, etc...are intended for reading variables.

E.g.

Code:
<Element><Select><Value>(A:Some variable,number) (L:Some other variable, number) + (>G:Var1)</Value></Select></Element>

<Element>
               <Select>
                <Value>(G:Var1)</Value>
                 <Nonlinearity>
                       <Item Value="0.1" X="-29" />
                       <Item Value="0.3" X="-21" />
                       <Item Value="0.5" X="-16" />
                       <Item Value="0.7" X="-13" />
                       <Item Value="1.0" X="-10" />
                       <Item Value="1.5" X="-7" />
                   </Nonlinearity>
               </Select>

Ok so I follow that ,but the problem is I want to store the result of the value determined in the Nonlinearity table and store it in a L:var, and everyone is saying you can't do that with XML, that <NonLinearity> table are only for shift and rotate evaluations ??

I've pretty much given up on trying to use the tables in the code and instead used non linear regression of the table data in excel to come up with an equation which I'm using in place of the <nonlinearity> section

Joel
 
Ok so I follow that ,but the problem is I want to store the result of the value determined in the Nonlinearity table and store it in a L:var, and everyone is saying you can't do that with XML, that <NonLinearity> table are only for shift and rotate evaluations ??

Correct! In fact the value is already stored in the variable that the non linearity table uses.

I've pretty much given up on trying to use the tables in the code and instead used non linear regression of the table data in excel to come up with an equation which I'm using in place of the <nonlinearity> section

Joel

In excel plot your numbers using xy scatter with lines. Then add a polynomial trendline that is a best fit. In the trendline format select "display equation in chart" then convert that into xml. See post 5 above for the link on how to do that.This code adjusts the jet thrust using a polynomial curve and puts it into an Lvar (>L:eng1_P7_curve,number) and then it is retranslated into (>L:Eng_1_P7,number) which is the value used in the non linearity table. i.e. what the gauge actually displays. There are a mass of other calculations not shown here.
Code:
  <Element>
      <Select>
         <Value>(A:Turb eng1 pressure ratio, ratio) 1 &gt;
if{ (A:TURB ENG1 JET THRUST, psf) 0.2112540846 * 25.2818873075 + (>L:eng1_P7_curve,number) (L:eng1_P7_curve,number) (L:part2,number) - (>L:eng1_P7_curve,number) (L:eng1_P7_curve,number) (L:hightempmod,number) - (>L:eng1_P7_curve,number) (L:eng1_P7_curve,number) (L:lowtempmod,number) + (>L:eng1_P7_curve,number) } els{ (A:AMBIENT PRESSURE,inHg) 0.02 - (>L:eng1_P7_curve,number) }</Value>
      </Select>
   </Element>

      <Element>
      <Select>
         <Value>(L:eng1_P7_curve,number) (A:AMBIENT PRESSURE,inHg) &lt;
if{ (A:AMBIENT PRESSURE,inHg) (>L:Eng_1_P7,number) }
els{ (L:eng1_P7_curve,number) (>L:Eng_1_P7,number) }</Value>
      </Select>
   </Element>

That link relates to calculating P7 at the back of the jet engine. This is used for the RR Conway bypass jets. It took a long time to get a good enough fit. The table of maxima was not so difficult but matching the real gauges was another story. I had to create polynomial curves for plane altitude, ambient temperature and jet thrust. All of them had to have adjustments like lapse etc. in order for the engine to produce the correct P7 for any given airfield elevation and temperature. The point of all that is that if P7 is not within half a point of the table's given value the take-off has to be aborted!
 
Last edited:
Back
Top