Use AFL Data Ref to modify guage

Are you building a cockpit, planning to build one or just dreaming, this is your cockpit builder meeting point

Moderators: russ, Ralph

Message
Author
Nik201
Posts: 6
Joined: Fri Aug 19, 2022 10:23 am
Location: Alicante

Use AFL Data Ref to modify guage

#1 Post by Nik201 »

Hi Guys,
l''m back to building my King Air 350 flight deck after a few months away. I now have version 4 up and running with still lots to do. Hoping that somebody can help out with AM guage modification....

I am using AM for the MIP and the NAV screen with the GNS530 popout (cut out) for the KA350 and it al pretty muchl works. But, I've noticed that the engine guages read the SIM Data Ref string, which is different from the AFL data. Not by much... But necessary!

I use the new engine guages for the 350 as listed under instruments.

I've experimented a bit but cannot get it to read the AFL data. I.e to sync up with the xplane screen.

Any hints? Please

Cheers
Nik

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Use AFL Data Ref to modify guage

#2 Post by jph »

After a google search to find out what one earth an 'afl' could be I now presume you are using airfoillabs.
It would really help if you actually said that. :D

Do they offer a list of custom datarefs and commands ?
Joe
Joe. CISSP, MSc.

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

Re: Use AFL Data Ref to modify guage

#3 Post by Ralph »

Did you already find the correct datarefs?

Nik201
Posts: 6
Joined: Fri Aug 19, 2022 10:23 am
Location: Alicante

Re: Use AFL Data Ref to modify guage

#4 Post by Nik201 »

Hi Joe
Yep point made, however, AFL (Airfoillabs) is commonly in use.. Anyway yes I do have the Data Refs (DR) And have swapped out the SIM DR for the AFL one. But the SIM script uses an -n - which I think references which engine?? I'm still learning the script...
Cheers
Nik

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Use AFL Data Ref to modify guage

#5 Post by Sling »

I think the c172 instruments have provision for both the default and add-on datarefs so take a look at them for examples of how that is done. If it’s the [8] array type dataref conversion that you are struggling with then perhaps a read of the wiki Xplane subscribe pages will help with that. It will follow something like this.

“sim/………/eng_dataref”, “FLOAT[8]”
to
“afl/………/afl_dataref”, “FLOAT”,

To reference the data in the callback you simple omit the [1] or [2] for each engine from the callback argument name.

Nik201
Posts: 6
Joined: Fri Aug 19, 2022 10:23 am
Location: Alicante

Re: Use AFL Data Ref to modify guage

#6 Post by Nik201 »

Hi,
Thanks for the info. Seems logical ..Will set forth immediately 👍
Development video links super ta!
Will advise..
Cheers
Nik

Nik201
Posts: 6
Joined: Fri Aug 19, 2022 10:23 am
Location: Alicante

Re: Use AFL Data Ref to modify guage

#7 Post by Nik201 »

Hi

Ok I have had a play and have added the AFL Subscribe "KA350/ianim/gauges/lEngITT", "FLOAT" and deleted the [8] (eng ref) and I get the gauge reading 2. But the indicator does not move. Why? The AFL value is .49 VS the SIM value of 589, hence we have a disparity.

So I guess one needs to change the lines below to rotate the indicator.

a. The AFL ITT value is .49 so the reference ITTTemp needs to be ITTTemp *10 to bring it into the dial range given the dial start at 2 and end at 12 (as stated on the dial Deg C /100). Hence,

function new_itttemp(itttemp)
temp = var_cap(itttemp * 10, 2, 12)

b. The following I don't understand the logic or rather the reason for >= 601, >= 401 or >=200 tiers, nor the formulaes since the value do not equate to the gauge dial or limits, as per your tuition for building an Airspeed dial, which is much the same process.
As per the Airspeed build these lines should rotate(img_needle, 30 / 200 * (temp - 1001) + 270)

if temp >= 1001 then
rotate(img_needle, 30 / 200 * (temp - 1001) + 270)
elseif temp >= 601 then
rotate(img_needle, 180 / 400 * (temp - 601) + 90)
elseif temp >= 401 then
rotate(img_needle, 60 / 200 * (temp - 401) + 30)
elseif temp >= 200 then
rotate(img_needle, 30 / 200 * (temp - 200) )
end

But the 30/200, 180 / 400, 60/ 200 and 30/200 are not referable in the gauge. I surmise that this should be 10/12 to create a factor for the AFL ITT indicator for the dial. Plus why the + 270,90, 30 and 200 ???

I have played around with factoring and revised the formulas but the indicator at best only moves 10 units in response to the throttle movement. hummmm.

If I can understand the Tiers and the correct factoring this shouldn't be a problem. I guess...

Can you point me in the right direction please.
Ta Muchly
Nik

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Use AFL Data Ref to modify guage

#8 Post by jph »

Hi Nik
It sounds like you could use the previous logic and just multiply the airfoillabs value by 1000 on receipt of the value - prior to the logic conditioning.
Any other new custom conditioning of the arc movement would depend on what linearity or non linearity afl have or have not built into their custom dataref.
Tony is the man to clarify it though.
Joe
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Use AFL Data Ref to modify guage

#9 Post by Keith Baxter »

Hi,


Use Interpolate linear to do that.

https://siminnovations.com/wiki/index.p ... ate_linear

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Nik201
Posts: 6
Joined: Fri Aug 19, 2022 10:23 am
Location: Alicante

Re: Use AFL Data Ref to modify guage

#10 Post by Nik201 »

Hi Guys
Thanks for the input... It's working now. Factoring the AFL value was missing brackets,, duh!
Now onwards for the rest...
CIao
Nik

Post Reply