Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in derivatives from Matlab #573

Closed
Astrinus opened this issue Apr 3, 2015 · 4 comments
Closed

Bug in derivatives from Matlab #573

Astrinus opened this issue Apr 3, 2015 · 4 comments
Milestone

Comments

@Astrinus
Copy link

Astrinus commented Apr 3, 2015

I'm trying to get derivatives (partial and saturation) from Matlab.
I'm using the low-level interface and I can update the state and get properties like density, enthalpy and so on; however, when I issue

as.first_partial_deriv(CoolProp.iDmass,CoolProp.iHmass,CoolProp.iP)

to get d(rho)/d(H)|P, I get the following messages:

Warning: NewPointerObj problem. clientdata NULL. guessed CoolPropDbl 
Warning: NewPointerObj problem. creating SwigRef as opposed to
CoolPropDbl 

ans = 

<Swig Object of type _p_CoolPropDbl, ptr=4642573344, own=1>

and I don't know what I should do with this (I guess) pointer, since Matlab has no way I could find to dereference it.
Storing the object in a variable and trying to fiddle with it didn't help.
The same happens with first_saturation_deriv: this behaviour seems very different from their C++ counterparts, which return a number.

@ibell
Copy link
Contributor

ibell commented Apr 3, 2015

Actually, I think I see the problem with this particular case, and I think
I can fix it (exposed function should use doubles instead of CoolPropDbl)

Or you could switch over to a more well constructed language like python.
Everything works fine in python, it is what the two main developers work in
most of the time.

On Fri, Apr 3, 2015 at 2:18 AM, Astrinus notifications@github.com wrote:

I'm trying to get derivatives (partial and saturation) from Matlab.
I'm using the low-level interface and I can update the state and get
properties like density, enthalpy and so on; however, when I issue

as.first_partial_deriv(CoolProp.iDmass,CoolProp.iHmass,CoolProp.iP)

to get d(rho)/d(H)|P, I get the following messages:

Warning: NewPointerObj problem. clientdata NULL. guessed CoolPropDbl
Warning: NewPointerObj problem. creating SwigRef as opposed to
CoolPropDbl

ans =

<Swig Object of type _p_CoolPropDbl, ptr=4642573344, own=1>

and I don't know what I should do with this (I guess) pointer, since
Matlab has no way I could find to dereference it.
Storing the object in a variable and trying to fiddle with it didn't help.
The same happens with first_saturation_deriv: this behaviour seems very
different from their C++ counterparts, which return a number.


Reply to this email directly or view it on GitHub
#573.

@Astrinus
Copy link
Author

Astrinus commented Apr 3, 2015

The problem is that this is part of a bigger project which uses Simulink as well and requires lot of work hours to be ported in Python (which I know, but the others not). So porting is not feasible.

@ibell ibell changed the title Get derivatives from Matlab Bug in derivatives from Matlab Apr 4, 2015
@ibell
Copy link
Contributor

ibell commented Apr 4, 2015

Yeah if you are using Simulink, you are stuck with MATLAB. I'll fix this issue.

@ibell ibell added this to the v 5.1 milestone Apr 4, 2015
@ibell ibell closed this as completed in 1b7973c Apr 4, 2015
@ibell
Copy link
Contributor

ibell commented Apr 4, 2015

Got it - a one line fix in the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants