coolprop icon indicating copy to clipboard operation
coolprop copied to clipboard

Return values for undefined functions in Modelica wrapper

Open jowr opened this issue 11 years ago • 6 comments

The solver classes in the ExternalMedia package contain function definitions that need to be overwritten by the actual solver implementation. Even though these functions might not be implement, they still return a value (often 0). This behaviour is confusing since the error message does not make it to the Modelica layer and a return value of zero is not very suspicious. An example can be found in basesolver.cpp in line 384. BaseSolver::isentropicEnthalpy is not implemented in coolpropsolver.cpp and returns 0.

What should we do about it? I recommend having an error message travelling all the way up to Modelica...

jowr avatar Sep 06 '13 15:09 jowr

I think this is fixed now. Could one of you Windows-users please verify that things work as expected? I added a test to the Modelica package in CoolProp2Modelica,Test.TestMedium.TestIsentropicExpansion.

Please close the issue if it is resolved.

jowr avatar Sep 07 '13 12:09 jowr

I don't know how to test this - Ill ask Sylvain or Adriano later on this week.

ibell avatar Sep 15 '13 18:09 ibell

@squoilin can you please check this?

ibell avatar Sep 30 '13 19:09 ibell

It does not seem to work in Windows. The function Medium.isentropicEnthalpy(p_out,state_in) crashes the console.

squoilin avatar Oct 02 '13 08:10 squoilin

Hm, I cannot get it to work properly. We have two options:

  1. Abort model execution with an error message on Linux and without error message on Windows
  2. Return a value that is obviously wrong (-_HUGE) on both platforms. I think both options are better than the standard external media behaviour (return 0). Does anyone have strong feelings about this? I suggest to go for option 2 and put a note in the docs.

Well, I guess the best way would be to remove the functions from ExternalTwoPhaseMedium and add them to the FluidPropMedium interface. This allows us to avoid calls on the Modelica level. This could be improved a lot by properly designing the Modelica part. At the moment, it is very obvious that the Modelica standard interface was made with ExternalMedia in mind, which in turn focusses on FluidProp as property library... We should move this discussion to the ExternalMedia package.

I remove this from the 4.0 milestone since it should be solved elsewhere.

jowr avatar Nov 04 '13 10:11 jowr

Added a message in https://github.com/thermocycle/CoolProp2Modelica-library/commit/6cf800ef42e2e405f9dc9b111173e3fd77981312

jowr avatar Nov 04 '13 10:11 jowr