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

Heaviside in XML possible?

Messages
240
Country
germany
Hello devs!

Is there a way to code a heaviside function in XML?
If so I need to integrate it further on, but I hope I can solve this on my own then.

Any ideas? :)

Best regards,
Steven
 
Do you mean something like (L:Var, number) 0 < if{ 0 (>L:Heaviside, enum) } (L:Var, number) 0 > if{ 1 (>L:Heaviside, enum) } ?

I imagine there are several other slick ways to code it ...

Bob
 
less typing:
Code:
0 1 (L:Var, number) 0 < ? (>L:heaviside, enum)
 
I only recently figured out how the conditional operator (the ?) works. After nearly 5 years of doing ifs and elses when this would have done 1 line in the place of 4 I cant get enough of it.
 
Thank you both a lot for your quick replies!

Indeed, the ? operator is soooo nice and effective. When I looked at the operator table in the SDK this was the best find.

Well, it's a bit more complicated... To keep it short: I want to calculate a CL (lift coeff) based on AoA input. The graph of this function can't be expressed by single formula, but needs to be splitted in 3 intervals. Thus the Heaviside.

(Later on I want to integrate this formula along the span of a rotorblade. But I guess there is no easy way to achieve this in xml :confused:)
 
Well, it's a bit more complicated... To keep it short: I want to calculate a CL (lift coeff) based on AoA input. The graph of this function can't be expressed by single formula, but needs to be splitted in 3 intervals. Thus the Heaviside.

If you install XMLTools V2, you can make use of XMLTABLES class and build a lookup table of CL vs AOA with as many records/intervals as needed. Even you can merge the results of two or more tables in a temp table where the final value is going to be extracted.

Tom
 
Tom, this idea is awesome! Why didn't I think of this..using your tool all the time :)

This way I csn handle the CL value like a L:var and use it in a formula.

EDIT:
I was too optimistic about this again :D This is actually just another way to get the CL as a variable which is dependend on several factors. But for the integration these factors must be directly included in a formula and not summed up in a variable.
However, nice idea.


Will look into this.

Thank you guys!
 
Last edited:
Steven,
Unless you are doing the aerodynamics external to the simulator inbuilt calculations, you have two major issues with what you want to achieve.
First is that the helicopter flight model does not use CL. Rotor lift is a function of collective and RPM and other factors like number of blades, blade length and inflow_vel_reference. Makes sense since there is no simple AOA CL relationship to lift unlike fixed wing.

Second is that even if the helicopter model did use CL, CL is not a settable parameter. Nor is a readable parameter. The way to calculate it is from AOA and LINEAR CL ALPHA which is the CL/AOA slope.

Whatever Tom's XML Tools can do, you can only change "settable" parameters if you want to change the simulator behavior.

However, if you intend to model performance using methods external to the simulator calculations that is a different story.

Roy
 
Roy,

Thanks for your reply. Aerodynamics are indeed completely externally calculated, but in an XML gauge.
Only velocities and rotations are set via Tom's tool.
 
less typing:
Code:
0 1 (L:Var, number) 0 < ? (>L:heaviside, enum)
Ture, less typing, but you're a pro, I'm not! :p

Actually, I thought Heaviside is 0 when the argument is negative, and 1 when its positive. Not defined for 0, which is why I wrote it the way I did. Having said that, I hope a real mathematician will correct my understanding if it is incorrect. It's been too long since I was in grad school.

Bob
 
Well...from a programming perspective Heaviside would remain at whatever value it was last given during the transition between < 0 > 0. So undefined is kind of moot.
 
Back
Top