## Recommended Posts

I need help with specific problem I am working on together with Alex.

What we need to achieve basically is weight changes of an aircraft relative to ambient temperature. At the moment the mass raise is linear. I would like to make it like this curve, below: (on the scheme, the first row is ambient temperature of Celsius in 5 degree increament, while the second row is additional weight in LBs). Please, note that the increase is started above 5 deg of C, but for simplicity it can start from 0.

Is there any chance for light code that can be a part of a script (that runs very often) and does the math to get such a curve of increase?

I guess it might be a factor as a variable that rises along with the ambient temperature. Then the temperature have to be multiplied by the factor to get the rise in weight.

At the moment, the constant factor (to get linear increase) is app. 182 lbs for every degree of Celsius.

##### Share on other sites
• 1

##### Share on other sites

Thanks for fast response, Reyhard!
Oh, man... those fireworks looks so interesting :) The only problem is ... I am total dumb when it comes to math and scripting, huh...

I do have something like this. What's next then?

http://www.wolframalpha.com/input/?i=fit+((0.0,0),(5,150),(10,400),(15,850),(20,1350),(25,2150),(30,3300),(35,4600),(40,6300),(45,8400))

##### Share on other sites

x = temperature

result = extra lbs

```fnc_calcWeight = {
params["_temperature"];
_weight = (4.82576*_temperature)^2-(38.0076*_temperature)+166.818;
_weight
};

 call fnc_calcWeight; //result 13771.60```

dunno how you planning to get temperature but I assumed you already have that figured out ;)

##### Share on other sites

Yeaa, the temp creation script is already done by Alex. The only thing that worries me here is that according to my scheme, at 25 deg of C it shouldn't have been more than 2150 lbs extra. In your example result is like 50x more. Any thoughts?
Also, is there any way to make it a part of a script not a separate function? The script is gonna be run in 1 sec loop, client side so no big deal I guess.
Nevermind, I think I am able to adjust the script for the function or vice versa. Just let's assure ourselves that all is OK on math side. 13771 lbs seems to be too much :) Anyway, thanks a lot man, much appreciated!

EDIT: Just realized that those weight numbers were total numbers of rises, not an incremental ones. Perhaps, that was the problem? Below is a new curve:

http://www.wolframalpha.com/input/?i=fit+((0.0,0.0),(5.0,150.0),(10.0,250.0),(15.0,350.0),(20.0,400.0),(25.0,800.0),(30.0,1150.0),(35.0,1300.0),(40.0,1700.0),(45.0,2100.0))

##### Share on other sites

ah, didn't looked at your scheme too much tbh. it seems it's all wrong

create scheme were in x axis you have temp & in y axis additional weight. then, use that curve & those points to generate new functions

that new curve should consist of those points like (x,y), so (x - i.e. 25, y - value of y in x axis is equal to 2150) [ or just (25,2150) ]

then use generated functions from "Least-squares best fits:" and replace x with your _temperature variable

imo it should be enough for your friend to get the idea ;)

##### Share on other sites

Well, actually the scheme was created the way you said. The first curve was like the one below which means that expected extra weight should be 4600 lbs @ 35 deg of C.

`fit ((0.0,0),(5,150),(10,400),(15,850),(20,1350),(25,2150),(30,3300),(35,4600),(40,6300),(45,8400))`

The only problem is that the result you posted which is:

` call fnc_calcWeight; //result 13771.60`

is far from expected one (2150 lbs @ 25 deg of C). I've done some tests - with the same curve/function you implemented I got 28770 lbs extra @ 37 deg of C.

The second curve I posted was like the one below, which means that expected extra weight @ 35 deg of C should be 1300 lbs more comparing to 30 deg of C:

`fit ((0.0,0.0),(5.0,150.0),(10.0,250.0),(15.0,350.0),(20.0,400.0),(25.0,800.0),(30.0,1150.0),(35.0,1300.0),(40.0,1700.0),(45.0,2100.0))`

This time I got -514 lbs @ 37 deg of C.

[sOLVED]

EDIT: OK, I converted units into kilograms, created another curve and divided whole calculations by custom factor to get expected results that are consistent with RL performance tables. Thanks Reyhard for putting me back on track!