lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed Jan 28 2015 at 9:59:12 AM Renaud Kern <renaud.kern@gmail.com> wrote:
I'm looking for someone who could create a luarocks that bind the Coolprop C++ library.  
It should firstly bind the following functions Props1SI, PropsSI (CoolProp.h file) and  HAPropsSI (HumidAirProp.h)

I had never heard about this lib before, but I did make LuaJIT bindings to it, grap it from here [1].

All the highlevel C-bindings are implemented that are listed here [2], including those requested by Renaud. It looks rather easy to wrap these with Lua C API as well, but someone else can do that, ;-).

I didn't use static lib, but the shared one. It is of course possible to statically link it, say for example inside LuaJIT or OpenRestyor Lua C API wrapper etc. But, well... it's better than nothing.

Quick usage example (I have aliased the functions, so you can call them with the normal "PropsSI", "get_parameter_information_string" etc. names as well, but I liked the short ones better):

local c = require "resty.coolprop"
print(c.props("D", "T", 298.15, "P", 101325, "Nitrogen"))
print(c.props("C", "P", 101325, "T", 300, "Water"))
print(c.props("d(Hmass)/d(T)|P", "P", 101325, "T", 300, "Water"))
print(c.props("D", "P", 101325, "T", 300, "Air.mix"))
print(c.phase("P", 101325, "Q", 0, "Water"))
print(c.global("predefined_mixtures"))
print(c.index("T"))
print(c.f2k(10))
print(c.k2f(c.f2k(10)))


[1] https://github.com/bungle/lua-resty-coolprop
[2] https://github.com/CoolProp/CoolProp/blob/master/include/CoolPropLib.h