CHT & EGT per cylinder

Help creating logic scripts for Air Manager Instruments

Moderators: Ralph, russ

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

CHT & EGT per cylinder

#1 Post by Keith Baxter » Wed Nov 11, 2020 4:56 pm

Hi,

There are no datarefs in Xplane for CHT & EGT per cylinder. Only per engine. :(

Anyone done some code to simulate, that they are willing to share?
Or suggestions on method.
I want to get the "LEAN" working in the G1000

The Δ PEAK etc I can handle.

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 

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

Re: CHT & EGT per cylinder

#2 Post by Ralph » Wed Nov 11, 2020 6:01 pm

In the JPI EDM it used a random number. But in a aircraft there will probably be some physical things that determine this, like the position of the cylinder and the airflow (so airspeed I guess). But that'll be different for every aircraft type.

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

Re: CHT & EGT per cylinder

#3 Post by Keith Baxter » Wed Nov 11, 2020 6:32 pm

Ralph wrote:
Wed Nov 11, 2020 6:01 pm
In the JPI EDM it used a random number. But in a aircraft there will probably be some physical things that determine this, like the position of the cylinder and the airflow (so airspeed I guess). But that'll be different for every aircraft type.
Hi Ralph,

je database is groot in je hoofd. ;)

Yes, those are understood and explained in this short article.

https://www.researchgate.net/publicatio ... g/download


The whole lot
https://www.researchgate.net/figure/Lyc ... _310459698

I am more looking for a logarithm/random number that will vary each cylinder temp.

Xplane does have a mixture ratio dataref (per engine). If writing to it will change the CHT/EGT I have not determined yet.

Having done an apprenticeship with a stretched 1600cc VW engine to 1800cc with a rayjay turbo for the KR2 , I know that the left side of the beetle engines, normally cyl3, is the one to overheat when on dual carb setup the left carb is adjusted too lean.

This is going to be an interesting "side" project. Don't have time for it right now so will just make provision.

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 

frumpy
Posts: 236
Joined: Sat Jan 30, 2016 12:01 pm

Re: CHT & EGT per cylinder

#4 Post by frumpy » Thu Nov 12, 2020 8:50 am

I did this with the second turbine of the EC135 VEMD:

-- Random
math.randomseed(os.time())
N1dev = (math.random(-12,13)/10) -- N1 of engine 2 will be between -1.2 and +1.3% different from engine 1
TOTdev = math.modf(N1dev*11) -- same with turbine temperature, a used engine has a higher RPM and will run hotter to produce the same power

-- example for turbine temperature
txt_set(VALUE_TOT1, string.format("%.0f", TOT[1])) -- just reading the array
txt_set(VALUE_TOT2, string.format("%.0f", TOT[2]+TOTdev)) -- adding the deviation to it
dev01.png
dev02.png

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

Re: CHT & EGT per cylinder

#5 Post by Keith Baxter » Thu Nov 12, 2020 9:51 am

Hi,
@frumpy awesome. Thanks for that. I will give it a try.

Just an update of how far I am with this.



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 

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

Re: CHT & EGT per cylinder

#6 Post by Ralph » Thu Nov 12, 2020 10:11 am

Very nice work Keith!

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

Re: CHT & EGT per cylinder

#7 Post by Keith Baxter » Thu Nov 12, 2020 10:13 am

Ralph wrote:
Thu Nov 12, 2020 10:11 am
Very nice work Keith!
Thank you Ralph.

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 

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

Re: CHT & EGT per cylinder

#8 Post by Keith Baxter » Fri Nov 13, 2020 10:09 am

Hi,

Ok what am I doing wrong. I can get the highest value from a table but AM throws out an error using table.maxn to get the key

Code: Select all

my_table={10,300,1,6}

High_val=math.max(table.unpack(my_table))

print(High_val)

highest_key=table.maxn(my_table)
--Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices. (To do its job this function does a linear traversal of the whole table.)

print(highest_key)

Ok this does the same thing. But I want to know what I am doing wrong with table.maxn.

Code: Select all

my_table={10,300,1,6}

local key, max = 1, my_table[1]
for k, v in ipairs(my_table) do
    if my_table[k] > max then
        key, max = k, v
    end
end

print(key, max)
Keith


EDIT: OK ignore FOUND OUT WHY.

table.getn was deprecated in lua 5.1

table.maxn was deprecated in lua 5.2

BTW @Corjan what level of lua is AM using? 5.4.1?
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 

frumpy
Posts: 236
Joined: Sat Jan 30, 2016 12:01 pm

Re: CHT & EGT per cylinder

#9 Post by frumpy » Fri Nov 13, 2020 7:59 pm

Your welcome, Keith. I like the crispness of your gauges! :)

Perhaps you would want to round the values, to simulate the resolution of the temperature sensor.
In the EC135 it's 5°C steps, which also makes the reading less jittery:

TOT1 = (math.floor(TOT[1] /5)*5) -- round to 5°C steps
TOT2 = (math.floor((TOT[2]+TOTdev) /5)*5) -- deviation added, rounded

txt_set(VALUE_TOT1, string.format("%.0f", TOT1))
txt_set(VALUE_TOT2, string.format("%.0f", TOT2))

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

Re: CHT & EGT per cylinder

#10 Post by Keith Baxter » Sat Nov 14, 2020 3:36 pm

Hi

@frumpy I did try the random code you provided (thank you for that) but found that the random changing every second did not reflect a realistic event.

I did mod it a bit and changed the <seed>. However I am still not happy.

I will look into varying the <seed> based on a few factors like altitude,climatic conditions, air speed, hobbs , peek temp, duration of excess temp, oil temp, gearbox temp etc

A lot of these variables are not available from the sim so will have to be part of the AUX pages. <info> and <system setup page's>

The rounding to 5° increment's is something I will consider as the jumping is distinctive. I will try and see if i can find out how each air frame handles that aspect. Please keep the suggestions coming as they are definitely giving insight to many aspects and appreciated.



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 

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests