A parametric Circuit breaker panel

Working on a instrument project or just finished a project? Show it to others!

Moderators: russ, Ralph

Post Reply
Message
Author
JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

A parametric Circuit breaker panel

#1 Post by JackZ »

Still learning Lua .
Lua is a very powerful language, especially when considering arrays.
Arrays of nearly everything can be defined, including arrays of functions.

So a parametric "on the fly" creation of arrays of buttons/switches including animation can be done quite with a few lines of code.
here as an example a circuit breaker panel of 9 lines of 10 c/b defined in less than 130 lines of code for the Hotsatrt TBM 900.
with a simple table that contains the definition, legend, rating and relevant dataref

Code: Select all

-- Circuit breakers definition and location
-------------------------------------------------------------------------
function cb_definition()
--List of C/B

-- dataref, label line1, label,line2, amps rating, position x,position y

-- set "XX" as value for the Amps rating for no display of the C/B image and animation
-- but the legend can be set nontheless
---------------------------------------------------------------------------
cb[1][1]={"","","","XX",100,28}--empty
cb[1][2]={"","","","XX",220,28}--empty
cb[1][3]={"dataref FUEL1","","","7½",335,28}
cb[1][4]={"dataref COM1","","","20",498,28}
cb[1][5]={"dataref ","","","XX",592,28}--empty
cb[1][6]={"dataref ","","","3",675,28}
cb[1][7]={"dataref ENG1","","","3",845,28}
cb[1][8]={"dataref ENG2","","","35",1005,28}
cb[1][9]={"dataref FUEL1","","","XX",1100,28}--empty
cb[1][10]={"dataref FUEL2","","","XX",1230,28}--empty
image.png
image.png (126.83 KiB) Viewed 1680 times
image.png
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

Post Reply