Non Linear Gauge Calculations

Questions about deployment and use of Air Manager Instruments

Moderators: Ralph, russ

Message
Author
flyatr
Posts: 291
Joined: Tue Dec 01, 2015 8:53 am

Re: Non Linear Gauge Calculations

shadyowl2 wrote:Do you have to calculate for each indication ie 40 knots 60 knots? do you start at 0 or 260?
In lua it would look like this:

Code: Select all

``````function newDataFrom Sim (airspeed)
if airspeed<= 60 then
angle = ...
elseif airspeed> 60 and airspeed<= 180 then
angle=36/19 * airspeed -1350/19
else
angle =...
end
img_rotate(image_needle, angle)
end
``````
That's all you need to do.

flyatr
Posts: 291
Joined: Tue Dec 01, 2015 8:53 am

Re: Non Linear Gauge Calculations

You can do it in Excel, too. Add a diagram and right-ckick on the line and select "add trend line" (not sure about the English translation).
Then "show formula".
Attachments

Posts: 176
Joined: Tue Dec 08, 2015 5:06 pm

Re: Non Linear Gauge Calculations

flyatr wrote:
shadyowl2 wrote:Do you have to calculate for each indication ie 40 knots 60 knots? do you start at 0 or 260?
In lua it would look like this:

Code: Select all

``````function newDataFrom Sim (airspeed)
if airspeed<= 60 then
angle = ...
elseif airspeed> 60 and airspeed<= 180 then
angle=36/19 * airspeed -1350/19
else
angle =...
end
img_rotate(image_needle, angle)
end
``````
That's all you need to do.

Code will not work, error in instrument at line 17 cannot use '....' outside a vararg functon
OORAH!!!! Its a Marine Thing....USMC retired

flyatr
Posts: 291
Joined: Tue Dec 01, 2015 8:53 am

Re: Non Linear Gauge Calculations

I put the dots in for you to finish! Let's see.

These are the value pairs I read from your gauge. Note that you have to do it again more accurately. Also you need another area from zero to 40 I didn't do.

area 1:
40 knots 15 degrees
60 knots 45 degrees
The equation solver (link above) returns y=3/2x-45

area 2:
60 knots 45 degrees
180 knots 270 degrees
The equation solver (link above) returns y=15/8x-135/2

area 3:
180 knots 270 degrees
270 knots 345 degrees
The equation solver (link above) returns y=5/6x+120

Code: Select all

``````function newDataFromSim (airspeed)
if airspeed<= 60 then
angle = (3/2) * airspeed - 45
elseif airspeed> 60 and airspeed<= 180 then
angle = (15/8) * airspeed - (135/2)
else
angle = (5/6) *airspeed + 120
end
img_rotate(image_needle, angle)
end

fsx_variable_subscribe(  "AIRSPEED INDICATED", "Knots", newDataFromSim)
``````

Posts: 176
Joined: Tue Dec 08, 2015 5:06 pm

Re: Non Linear Gauge Calculations

Think I'll wait for Ralph's tutorial way too confusing
OORAH!!!! Its a Marine Thing....USMC retired

Ralph
Posts: 5070
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Non Linear Gauge Calculations

I'll see if I can do one tomorrow evening.

JackZ
Posts: 1849
Joined: Mon Feb 22, 2016 1:02 pm

Re: Non Linear Gauge Calculations

shadyowl2 wrote:Think I'll wait for Ralph's tutorial way too confusing
May I suggest you take the time to fully read my previous post, I explain how to solve your problem. Don't hesitate to ask if something is not clear.
It's probably better for you to understand how the problem can be solved, rather than using a pre done formula. Like this, you'll be able to reproduce it and adapt it to whatever instrument you may create.
Then submit to the community the WHOLE code you've created, even if it's not completely working , so anyone including me, FlyAtr and Ralph can help you.
This approach would be more efficient and pedagogical for you in my sense...
My ten cents!
Jacques
Last edited by JackZ on Mon Apr 11, 2016 5:40 pm, edited 1 time in total.
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):

JackZ
Posts: 1849
Joined: Mon Feb 22, 2016 1:02 pm

Re: Non Linear Gauge Calculations

shadyowl2 wrote:Think I'll wait for Ralph's tutorial way too confusing
May I suggest you take the time to fully read my previous post, I explain how to solve your problem. Don't hesitate to ask if something is not clear.
It's probably better for you to understand how the problem can be solved, rather than using a pre done formula. Like this, you'll be able to reproduce it and adapt it to whatever instrument you may create.
Then submit to the community the WHOLE code you've created, even if it's not completely working , so anyone including me, FlyAtr and Ralph can help you.
This approach would be more efficient and pedagogical for you in my sense...
My ten cents!
Jacques
Last edited by JackZ on Mon Apr 11, 2016 5:40 pm, edited 1 time in total.
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):

Posts: 176
Joined: Tue Dec 08, 2015 5:06 pm

Re: Non Linear Gauge Calculations

Jack,
I've gone over your post so many times and it still make no sense, I have very little programing skills and my math skills are pre historic LOL.... I'm the type of person who needs to actually see things happen (ie tutorial) with something like this or im lost...Hands on type of person....
OORAH!!!! Its a Marine Thing....USMC retired

JackZ
Posts: 1849
Joined: Mon Feb 22, 2016 1:02 pm

Re: Non Linear Gauge Calculations

No problem, I can understand that.
The tutorial made by Ralph will be valuable anyway!

Regards
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):