# Calculate Kollsman shift/ft versus setting/inHg # Computationally efficient if, for any given instance # of this class, the setting is not being changed often. # Typical usage: # kxx = atmo.Kollsman.new(); # kyy = atmo.Kollsman.new(); # print (kxx.shift(29.92)); # calculates # print (kyy.shift(30.92)); # calculates # print (kxx.shift(29.92)); # uses cached value # print (kyy.shift(30.92)); # uses cached value Kollsman = { new : func { { parents : [Kollsman] } }, ft : nil, set : nil, shift : func(setting) { if (setting == me.set) {return me.ft} me.set = setting; me.ft = 145442.156 * (1 - math.exp(math.ln(me.set/29.921260) * 0.1902632365)) } };