Coder Social home page Coder Social logo

Comments (10)

jowr avatar jowr commented on July 24, 2024

Hi again - I have now fixed most issues and I have a fully automated build and deploy setup. Please have a look at https://github.com/jowr/ExternalMedia/actions for details. I am also going to change the title and the initial post to reflect the latest changes.

@casella and @beutlich, could any of you test the libraries with OpenModelica? I do not seem to have any success even though I use the OMDev environment for compiling the static libraries.

You can grab a the build of this version jowr@88eff7f from here: https://ipudk-my.sharepoint.com/:u:/g/personal/jowr_ipu_dk/ERSQtkDKSQNFmYqRfCwMLfcBUt96k-BTaSDpzYxIzvZYMw?e=Rduoaw

from externalmedia.

slamer59 avatar slamer59 commented on July 24, 2024

Hello,
can you point more precisely on the problem you face with testing with OpenModelica ?

I found this package which do similar constrcution with OpenModelica on Linux/Windows/MacOs.

https://github.com/dynawo/dynawo

from externalmedia.

jowr avatar jowr commented on July 24, 2024

Hi and thank you for getting back to me. My problem is that I can compile the library with OMDev on Windows, but when I open it in the OMEdit software, simulation fails for both 32bit and 64bit. Unfortunately, I have never used OpenModelica myself and i have a hard time debugging this. Here are the logs for 64bit:

C:/Program Files/OpenModelica1.16.0-64bit/share/omc/scripts/Compile.bat ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical gcc mingw64 parallel 8 0
PATH = "C:\PROGRA~1\OPENMO~1.0-6\tools\msys\mingw64\bin;C:\PROGRA~1\OPENMO~1.0-6\tools\msys\mingw64\bin\..\..\usr\bin;"
mingw32-make: Entering directory 'C:/Users/jowr.AD/AppData/Local/Temp/OPENMO~1/OMEdit/EXTERN~1.TES'
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_records.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_records.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_01exo.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_01exo.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_02nls.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_02nls.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_03lsy.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_03lsy.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_04set.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_04set.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     "-IC:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include" -I"C:/Program Files/OpenModelica1.16.0-64bit/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_05evt.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_05evt.c
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c: In function 'omc_ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_setState__pT':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:49:53: warning: passing argument 3 of 'TwoPhaseMedium_setState_pT_C_impl' from incompatible pointer type [-Wincompatible-pointer-types]
   TwoPhaseMedium_setState_pT_C_impl(_p_ext, _T_ext, &_state_ext, MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp1)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp2)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp3)));
                                                     ^
In file included from ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_includes.h:4:0,
                 from ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:7:
C:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include/externalmedialib.h:144:14: note: expected 'ExternalThermodynamicState * {aka struct <anonymous> *}' but argument is of type 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState * {aka struct <anonymous> *}'
  EXPORT void TwoPhaseMedium_setState_pT_C_impl(double p, double T, ExternalThermodynamicState *state, const char *mediumName, const char *libraryName, const char *substanceName);
              ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c: In function 'omc_ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_setState__ph':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:100:65: warning: passing argument 4 of 'TwoPhaseMedium_setState_ph_C_impl' from incompatible pointer type [-Wincompatible-pointer-types]
   TwoPhaseMedium_setState_ph_C_impl(_p_ext, _h_ext, _phase_ext, &_state_ext, MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp1)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp2)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp3)));
                                                                 ^
In file included from ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_includes.h:4:0,
                 from ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:7:
C:/Users/jowr.AD/Downloads/binaries/ExternalMedia 3.2.3/Resources/Include/externalmedialib.h:143:14: note: expected 'ExternalThermodynamicState * {aka struct <anonymous> *}' but argument is of type 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState * {aka struct <anonymous> *}'
  EXPORT void TwoPhaseMedium_setState_ph_C_impl(double p, double h, int phase, ExternalThermodynamicState *state, const char *mediumName, const char *libraryName, const char *substanceName);
              ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c: In function 'omc_ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_molarMass':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:167:9: warning: implicit declaration of function 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get' [-Wimplicit-function-declaration]
   _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get(_completeState1._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
         ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:167:112: error: '_completeState1' undeclared (first use in this function)
   _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get(_completeState1._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
                                                                                                                ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:167:112: note: each undeclared identifier is reported only once for each function it appears in
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c: In function 'omc_ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_molarMass':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:274:9: warning: implicit declaration of function 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get' [-Wimplicit-function-declaration]
   _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get(_completeState2._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
         ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:274:112: error: '_completeState2' undeclared (first use in this function)
   _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get(_completeState2._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
                                                                                                                ^
<builtin>: recipe for target 'ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o' failed
mingw32-make: *** [ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o] Error 1
mingw32-make: *** Waiting for unfinished jobs....
mingw32-make: Leaving directory 'C:/Users/jowr.AD/AppData/Local/Temp/OPENMO~1/OMEdit/EXTERN~1.TES'
Compilation process failed. Exited with code 2.

from externalmedia.

slamer59 avatar slamer59 commented on July 24, 2024

Thanks for the log.
I will share my findings (sorry if it is too obvisous):
2 errors with undeclared variable _completeState1
relates to this transformation

model TestStatesSupercritical

extends this package
package CO2CoolProp "CoolProp model of CO2"

I don't understand why it doesnot find the variable.

from externalmedia.

slamer59 avatar slamer59 commented on July 24, 2024

Hello,
I was able to reproduce the error inside OMEdit. In message I have this error too

[1] 10:26:15 Traduction Erreur
[C:/OM116/OM32bit/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo: 182:7-184:92]: Internal error NFEvalFunction.evaluateExternal failed on ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.completeState1.Medium.getMolarMass, evaluation of userdefined external functions not yet implemented

[2] 10:26:15 Traduction Erreur
[C:/OM116/OM32bit/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo: 182:7-184:92]: Internal error NFEvalFunction.evaluateExternal failed on ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.completeState2.Medium.getMolarMass, evaluation of userdefined external functions not yet implemented

[3] 10:26:15 Traduction Avertissement
[ExternalMedia.Common.CheckCoolPropOptions: 2:1-104:25]: Pure function ‘ExternalMedia.Common.CheckCoolPropOptions‘ contains a call to impure function ‘Modelica.Utilities.Streams.print‘.


I feel that library is not loaded.
**Version
Connected to OpenModelica v1.16.0 (32-bit)
Connected to OMSimulator v2.1.0-dev-230-g10c82c8-mingw

Installation path C:/Users/xxxxxx/Documents/Developpements/Programs/OpenModelica-1.16.0-32bit

Copyright Open Source Modelica Consortium (OSMC).
Distributed under OSMC-PL and GPL, see www.openmodelica.org.**

from externalmedia.

sgolle avatar sgolle commented on July 24, 2024

After I compiled the development branch v.3.3.0-dev only with CoolProp on Linux, which was successful, I tried to test it in OpenModelica, but a couple of errors occured:

make -j8 -f ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.makefile
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_records.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_records.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_01exo.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_01exo.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_02nls.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_02nls.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_03lsy.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_03lsy.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_04set.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_04set.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_05evt.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_05evt.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_06inz.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_06inz.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_07dly.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_07dly.c
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_08bnd.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_08bnd.c
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:49:53: warning: incompatible pointer types passing 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState *' to parameter of type 'ExternalThermodynamicState *' [-Wincompatible-pointer-types]
  TwoPhaseMedium_setState_pT_C_impl(_p_ext, _T_ext, &_state_ext, MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp1)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp2)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp3)));
                                                    ^~~~~~~~~~~
/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include/externalmedialib.h:144:96: note: passing argument to parameter 'state' here
        EXPORT void TwoPhaseMedium_setState_pT_C_impl(double p, double T, ExternalThermodynamicState *state, const char *mediumName, const char *libraryName, const char *substanceName);
                                                                                                      ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:100:65: warning: incompatible pointer types passing 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState *' to parameter of type 'ExternalThermodynamicState *' [-Wincompatible-pointer-types]
  TwoPhaseMedium_setState_ph_C_impl(_p_ext, _h_ext, _phase_ext, &_state_ext, MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp1)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp2)), MMC_STRINGDATA(MMC_REFSTRINGLIT(tmp3)));
                                                                ^~~~~~~~~~~
/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include/externalmedialib.h:143:107: note: passing argument to parameter 'state' here
        EXPORT void TwoPhaseMedium_setState_ph_C_impl(double p, double h, int phase, ExternalThermodynamicState *state, const char *mediumName, const char *libraryName, const char *substanceName);
                                                                                                                 ^
clang  -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers     "-I/home/xxx/.openmodelica/libraries/ExternalMedia 3.2.1/Resources/Include" -I"/home/xxx/Programme/OpenModelica/build/bin/../include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_09alg.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_09alg.c
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:167:9: warning: implicit declaration of function 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get' is invalid in C99 [-Wimplicit-function-declaration]
  _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get(_completeState1._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
        ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:167:112: error: use of undeclared identifier '_completeState1'
  _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState1_Medium_FluidConstants_array_get(_completeState1._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
                                                                                                               ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:274:9: warning: implicit declaration of function 'ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get' is invalid in C99 [-Wimplicit-function-declaration]
  _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get(_completeState2._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
        ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:274:112: error: use of undeclared identifier '_completeState2'
  _MM = ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_completeState2_Medium_FluidConstants_array_get(_completeState2._Medium._fluidConstants, 1, ((modelica_integer) 1))._molarMass;
                                                                                                               ^
4 warnings and 2 errors generated.
make: *** [<builtin>: ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o] Error 1
make: *** Waiting for unfinished jobs....
Compilation process failed. Exited with code 2.

from externalmedia.

jowr avatar jowr commented on July 24, 2024

This one still remains to be fixed, but we had a web meeting yesterday and agreed to prioritize OpenModelica compatibility. By the way, the test fluids seem to work which indicates that we are not too far from a working solution. Once #26 is merged, you can check the docs and see whether they need improvement with respect to OpenModelica.

from externalmedia.

dongkeun-oh avatar dongkeun-oh commented on July 24, 2024

Hi, I recently joined in this interest, and I saw that the latest OpenModelica now works escaping from the long trouble with the fluidConstant array, which was the reason of compilation errors as @sgolle showed previously.
As I mentioned https://trac.openmodelica.org/OpenModelica/ticket/6331, the critical spot was "initializing constants by means of external functions"; now, DLL call is employed to implement such a process seamlessly; see https://trac.openmodelica.org/OpenModelica/ticket/5240.

Then, I checked that all CoolProp tests in ExternalMedia.Test.CoolProp.CO2 are working based on an old version (4.2.6).
So, now, I'm doing my best with the newest CoolProp (6.4.1), but a couple of issues are emerged, mainly, in runtime, in spite of the success of compilation in the both passes of making the library (libExternalMedia) and doing the simulations for test.

I just list up the remaining issues as the following;

  1. Some tests are hang, during the calculation of thermodynamic state; TestBasepropertiesImplicit is a typical one.

    • Calculations to update the thermodynamic states can be placed out of range, owing to the radical trials in the solving process of the simulation.
    • So, in case of such a "out of range", there should be a proper exception handling, not exiting the process. That means -DMODELICA_ERROR=0 can be the spot of trouble in such a case, and setting that variable as 1 seems to solve the symptom almost completely.
    • Even though the exception of 'ValueError' are handled, the other variables of state are recommended to be updated in consequence of (even) wrong result. So, I would suggest to do some minor modifications of the functions in coolpropsolver.cpp.
  2. REFPROP backend doesn't work.

    • According to the error message in the frontend (NF), some AbstractState functions like calc_first_saturation_deriv are missing. However, some guys like me look able to implement the missing parts, comparing with the old version (4.2.6), and I would try sooner or later.
  3. DLL (or shard object) is to be installed.

    • As I mentioned, it's owing to the NF calling DLL to initialize the constant (fluidConstant). I manually generate it, and copy it, which is a kind of brute-force manner. So, I ask to modify the building script to generate and to install the DLL in proper manner of naming and locating, with which I'm not familiar at all.

As a result, I managed to make it work, in spite of some brute-force modification, and I'm going to arrange my modification to show you as something applicable.

Your paying attention to what I did will be appreciated

from externalmedia.

casella avatar casella commented on July 24, 2024

@jowr, the title of this issue is probably obsolete by now. Let's see how the version on the v.3.3.0 branch works now, and if we can get it to run in OpenModelica with help from dongkeun-oh, then we can merge it on master and release it for good.

from externalmedia.

jowr avatar jowr commented on July 24, 2024

Agreed - I can have a look at all these issues when I am back from Easter vacation...

from externalmedia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.