coolprop icon indicating copy to clipboard operation
coolprop copied to clipboard

CoolProp in Scilab

Open JAExposito opened this issue 11 years ago • 2 comments

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.

JAExposito avatar Apr 15 '14 10:04 JAExposito

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.

jowr avatar Apr 15 '14 18:04 jowr

@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 [email protected] 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

ibell avatar Apr 16 '14 07:04 ibell