ibell / coolprop

Deprecated version - go to
https://github.com/CoolProp/CoolProp
MIT License
24 stars 16 forks source link

CoolProp in Scilab #209

Open JAExposito opened 10 years ago

JAExposito commented 10 years ago

Hello,

I am trying to solve a problem using Scilab and CoolProp and I would like to know if you have any information or examples of code in Scilab for using CoolProp.

By this moment I have used example below but I do not know how to use other functions like DerivTerms for instance or how to change between EOS and TTSE.

[v, o] = getversion(), if o(2) == "x64" then link('CoolProp_x64.dll', ['PropsSIScilab','HAPropsScilab'], 'c'); else link('CoolProp.dll', ['PropsSIScilab','HAPropsScilab'], 'c'); end //link('show');

funcprot(0)

function [out]=Props(Output,Input1,Value1,Input2,Value2,Name) out = call("PropsSIScilab",Output,1,"c",Input1,2,"c",Value1,3,"d",Input2,4,"c",Value2,5,"d",Name,6,"c","out",[1,1],7,"d") endfunction

function [out]=HAProps(Output,Input1,Value1,Input2,Value2,Input3,Value3) out = call("HAPropsScilab",Output,1,"c",Input1,2,"c",Value1,3,"d",Input2,4,"c",Value2,5,"d",Input3,6,"c",Value3,7,"d","out",[1,1],8,"d") endfunction

[rho] = Props("D","T",298.15,"P",101325.0,"R134a") disp(rho)

[h] = HAProps("H","T",298.15,"P",101325.0,"W",0.003) disp(h)

ulink()

If someone could give me any information or any help I would really appreciate it.

Thanks in advance.

jowr commented 10 years ago

Hi, I do not use Scilab myself, so please take my advice with some caution, but I can try and help you a little bit.

Scilab needs extra exports which are defined in https://github.com/ibell/coolprop/blob/master/wrappers/Scilab/scilab_functions.cpp . Hence, there are only these two functions available. If you know some C++, you are invited to add more functions and submit a pull request. I am sure we can include those changes.

For the time being, you can access all the output from DerivTerms through Props. You simply need to provide the input keys that you would use for DerivTerms and pass them to the Props function. There is an internal mapping that should give you the exact same functionality.

TTSE won't work without extra functions in the Scilab wrapper, sorry.

ibell commented 10 years ago

@jowr is quite right. Scilab uses a different and limited set of inputs for DLL. You could follow the c++ code and expose the needed functions based on the model of the exposed functions. That would be a nice contribution.

On 4/15/14, Jorrit Wronski notifications@github.com wrote:

Hi, I do not use Scilab myself, so please take my advice with some caution, but I can try and help you a little bit.

Scilab needs extra exports which are defined in https://github.com/ibell/coolprop/blob/master/wrappers/Scilab/scilab_functions.cpp . Hence, there are only these two functions available. If you know some C++, you are invited to add more functions and submit a pull request. I am sure we can include those changes.

For the time being, you can access all the output from DerivTerms through Props. You simply need to provide the input keys that you would use for DerivTerms and pass them to the Props function. There is an internal mapping that should give you the exact same functionality.

TTSE won't work without extra functions in the Scilab wrapper, sorry.


Reply to this email directly or view it on GitHub: https://github.com/ibell/coolprop/issues/209#issuecomment-40516581