Coder Social home page Coder Social logo

Comments (6)

JonWel avatar JonWel commented on July 24, 2024

Hi,

I never tested to use it with OMC.
When I worked on this project, I understood it was only working with Dymola, but that it would be nice if it could be ported to OpenModelica in some maybe future projects.

In term of things that changed, as I focussed on the C++ code and I don't think I introduce much changes that could brake the possibility to use OMC.
So if I had to decide, I would go for 3.3.0-dev, in order to do the work only once.

@jowr will probably have a more enlighten view on this issue.

from externalmedia.

jacquemoud avatar jacquemoud commented on July 24, 2024

Could you eventually test to import the Externalmedia Library into OMC just to share your experience?
https://build.openmodelica.org/omc/builds/windows/releases/1.12/final/
From my poor experience sofar, the 32-bit Version digest better the compilation of the Test cases.
However not everything is working well with the Coolprop, Refprop linkage...

Many Thanks

from externalmedia.

slamer59 avatar slamer59 commented on July 24, 2024

Hello,
I'm trying to build ExternalMedia with OMC.
I experienced some problem.

Here is my step:

git clone https://github.com/slamer59/ExternalMedia.git ExternalMedia-fork
cd ExternalMedia-fork/
git pull origin v.3.3.0-dev
cd Projects
chmod 755 BuildLib-CMake.sh
./BuildLib-CMake.sh

I change a little this script to:

  • add a variable pointing to cmake 3 version. I had cmake 2.8 with CMP0053 Policy warning wich raise an error at the end.
  • FLUIDP=0

And experienced this problem for Main dependencies and related to CoolProp::REFOPROP:

Scanning dependencies of target main
[ 86%] Building CXX object CMakeFiles/main.dir/Tests/coolprop_comparisons.cpp.o
[ 88%] Building CXX object CMakeFiles/main.dir/Sources/basesolver.cpp.o
[ 89%] Building CXX object CMakeFiles/main.dir/Sources/coolpropsolver.cpp.o
[ 91%] Building CXX object CMakeFiles/main.dir/Sources/errorhandling.cpp.o
[ 93%] Building CXX object CMakeFiles/main.dir/Sources/externalmedialib.cpp.o
[ 94%] Building CXX object CMakeFiles/main.dir/Sources/mingw_gcc_comutil.cpp.o
[ 96%] Building CXX object CMakeFiles/main.dir/Sources/solvermap.cpp.o
[ 98%] Building CXX object CMakeFiles/main.dir/Sources/testsolver.cpp.o
[100%] Linking CXX executable main
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function `getFunctionPointer(char const*, DLLNameManglingStyle)':
REFPROPMixtureBackend.cpp:(.text+0x2d5): undefined reference to `dlsym'
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function `load_REFPROP(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
REFPROPMixtureBackend.cpp:(.text+0xfe6): undefined reference to `dlopen'
REFPROPMixtureBackend.cpp:(.text+0x1030): undefined reference to `dlerror'
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function `unload_REFPROP(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
REFPROPMixtureBackend.cpp:(.text+0x1310): undefined reference to `dlclose'
REFPROPMixtureBackend.cpp:(.text+0x1326): undefined reference to `dlerror'
CoolProp/CMakeFiles/CoolProp.dir/src/Backends/REFPROP/REFPROPMixtureBackend.cpp.o: In function `CoolProp::REFPROPMixtureBackend::~REFPROPMixtureBackend()':
REFPROPMixtureBackend.cpp:(.text+0x1f17): undefined reference to `dlclose'
collect2: ld a retourné 1 code d'état d'exécution
gmake[2]: *** [main] Erreur 1
gmake[1]: *** [CMakeFiles/main.dir/all] Erreur 2
gmake: *** [all] Erreur 2

Do you have an idea ? I think I should deactivate something because libExternalMediaLib.a seems already build ?

**Version Info ** :

-- ExternalMedia library version: 3.2.1
-- COOLPROP_INSTALL_PREFIX=/home/thomas.pedot/Sources-Logiciels/Modelica/ExternalMedia-fork/externals/CoolProp.git/install_root
-- CoolProp version: 6.1.1dev
-- Setting bitness flag -m64
-- Library compilation detected:
-- Creating CoolProp, a 64-bit library
-- CMAKE_SYSTEM_NAME: Linux
-- COOLPROP_STATIC_LIBRARY: OFF
-- COOLPROP_SHARED_LIBRARY: OFF
-- COOLPROP_OBJECT_LIBRARY: ON
-- CONVENTION:
-- COOLPROP_LIBRARY_HEADER:
-- COOLPROP_LIBRARY_SOURCE:
-- COMPILE_FLAGS:  -m64
-- LINK_FLAGS:  -m64
-- Configuring done
-- Generating done

with:

OMEdit 1.13.0~dev
Connected to OpenModelica 1.13.0~dev

I will try with a 32bits version as suggested.

Regards

from externalmedia.

slamer59 avatar slamer59 commented on July 24, 2024

I fail to compile ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical

/opt/rh/devtoolset-4/root/usr/bin/gcc -fopenmp   -fPIC -O0 -falign-functions -march=native  -fopenmp    "-I/home/thomas.pedot/Sources-Logiciels/Modelica/ExternalMedia-fork/Modelica/ExternalMedia 3.2.1/Resources/Include" -I"/opt/openmodelica-nightly/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_17inl.o ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_17inl.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:85: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:6:
/home/thomas.pedot/Sources-Logiciels/Modelica/ExternalMedia-fork/Modelica/ExternalMedia 3.2.1/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 ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState_s *}'
  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:133: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:6:
/home/thomas.pedot/Sources-Logiciels/Modelica/ExternalMedia-fork/Modelica/ExternalMedia 3.2.1/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 ExternalMedia_Test_CoolProp_CO2_TestStatesSupercritical_Medium_ThermodynamicState_s *}'
  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_GenericModels_CompleteThermodynamicState$completeState1_Medium_molarMass':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:238:138: error: '_fluidConstants' undeclared (first use in this function)
   _MM = ((ExternalMedia_Test_GenericModels_CompleteThermodynamicState$completeState1_Medium_FluidConstants*)(generic_array_element_addr(&_fluidConstants, sizeof(ExternalMedia_Test_GenericModels_CompleteThermodynamicState$completeState1_Medium_FluidConstants), 1, /* modelica_integer */ ((modelica_integer) 1))))->_molarMass;
                                                                                                                                          ^
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:238:138: 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_GenericModels_CompleteThermodynamicState$completeState2_Medium_molarMass':
ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.c:383:138: error: '_fluidConstants' undeclared (first use in this function)
   _MM = ((ExternalMedia_Test_GenericModels_CompleteThermodynamicState$completeState2_Medium_FluidConstants*)(generic_array_element_addr(&_fluidConstants, sizeof(ExternalMedia_Test_GenericModels_CompleteThermodynamicState$completeState2_Medium_FluidConstants), 1, /* modelica_integer */ ((modelica_integer) 1))))->_molarMass;
                                                                                                                                          ^
make: *** [ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical_functions.o] Error 1
make: *** Waiting for unfinished jobs....
Compilation process failed. Exited with code 2.

There is some like warning warning: passing argument 3 of 'TwoPhaseMedium_setState_pT_C_impl' from incompatible pointer type [-Wincompatible-pointer-types]

from externalmedia.

JonWel avatar JonWel commented on July 24, 2024

Hi @slamer59 , I can't try myself for now, but looking at your log, it seems it has some problem linking to REFPROP.

I do not think it has anything to do with the use of OMC, but rather a drawback of the current way to import Coolprop. The script you are running download the last development version of CoolProp, whereas it would make more sense to point to the last release, and make some debugging of the Linux script.

So I see 3 issues to solve:

  • #8
  • To check if everything is still working on the Windows compilation.
  • A new issue to open to debug de Linux compilation (if necessary)

from externalmedia.

jowr avatar jowr commented on July 24, 2024

The basics work with OMC - many rough edges though. We have to continue working on it, but the information in this issue is outdated now.

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.