AIT-TES / slPCMlib

BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

[Translation Error] Quadrature Lobatto #2

Open Wendymely opened 1 year ago

Wendymely commented 1 year ago

Hello, Whenever I try to check or simulate the examples in the slPCMlib I get the following message:

[1] 11:36:50 Translation Error
[slPCMlib.Interfaces.basicPhTransModel: 53:3-57:40]: Type mismatch for positional argument 1 in Modelica.Math.Nonlinear.quadratureLobatto(f=slPCMlib.Examples.Case600FF_PCM_slPCMlib_SingleLayerPCM.lay.phTrModel.enthFcts.spHeatCap_baselineMelting). The argument has type:
  slPCMlib.Examples.Case600FF_PCM_slPCMlib_SingleLayerPCM.lay.phTrModel.enthFcts.spHeatCap_baselineMelting<function>(Real) => Real
expected type:
  f<function>(#Real) => #Real

I haven’t been able to find the solution to this. Has anyone had this same issue and could maybe help me see what I’m overseeing? Thank you so much!

/cc @AGurami @AdamBuruzs

AdamBuruzs commented 1 year ago

Dear Wendymely! Which Dymola version are you using for the simulation/translation? Which C++ compiler?

Wendymely commented 1 year ago

@AdamBuruzs I’m using Openmodelica v4.0.0 and the translation error comes directly when I try to check the Modelica class. In Openmodelica I use the OMCompiler (Openmodelica Compiler)

AdamBuruzs commented 1 year ago

Dear Wendymely! Thank you for the feedback. I have made an update in the develop branch, where I have solved that problem with the quadraturelobato function. See [(https://github.com/AIT-TES/slPCMlib/commit/afb2750ede73cd00823f496ff205491395a31ff4]. You can simply checkout that branch and try to run it again. Please send a feedback if that worked! ps: until now we have only tested the code with Dymola, but we plan to focus on Openmodelica as well.

Wendymely commented 1 year ago

Dear @AdamBuruzs, the original error message is gone but when I try to compile the compilation process fails and I get the following output:

Model_slPCMlib_no_heater_06inz.c:815:30: warning: implicit declaration of function 'mmc_mk_fnptr' is invalid in C99 [-Wimplicit-function-declaration]
  tmpMeta32 = mmc_mk_box1(0, mmc_mk_fnptr(boxvar_slPCMlib_BasicUtilities_enthalpyHelpers_spHeatCap__baselineMelting));
                             ^
Model_slPCMlib_no_heater_06inz.c:815:30: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
  tmpMeta32 = mmc_mk_box1(0, mmc_mk_fnptr(boxvar_slPCMlib_BasicUtilities_enthalpyHelpers_spHeatCap__baselineMelting));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../include/omc/c/gc/../meta/meta_modelica_mk_box.h:12:58: note: passing argument to parameter 'x0' here
static inline void *mmc_mk_box1(unsigned int ctor, void *x0)
                                                         ^
Model_slPCMlib_no_heater_06inz.c:869:30: warning: implicit declaration of function 'mmc_mk_fnptr' is invalid in C99 [-Wimplicit-function-declaration]
  tmpMeta33 = mmc_mk_box1(0, mmc_mk_fnptr(boxvar_slPCMlib_BasicUtilities_enthalpyHelpers_spHeatCap__baselineMelting));
                             ^
Model_slPCMlib_no_heater_06inz.c:869:30: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
  tmpMeta33 = mmc_mk_box1(0, mmc_mk_fnptr(boxvar_slPCMlib_BasicUtilities_enthalpyHelpers_spHeatCap__baselineMelting));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../include/omc/c/gc/../meta/meta_modelica_mk_box.h:12:58: note: passing argument to parameter 'x0' here
static inline void *mmc_mk_box1(unsigned int ctor, void *x0)
                                                         ^
AdamBuruzs commented 1 year ago

Dear @Wendymely : Can you try with the latest version in the develop branch (I have still added changes yesterday night), and use these compiler settings: image So OMEdit Options/Simulation set Target Language= Cpp, TargetBuild = MinGW, C Compiler = gcc.exe, CXX Compiler = g++

Wendymely commented 1 year ago

Dear @AdamBuruzs I updated my latest version and now I can’t open the library. I get the following Grammar and Scripting Error:

[3] 16:22:17 Grammar Error
[~/slPCMlib/Media_Rubitherm_SP/Rubitherm_SP11_gel.mo: 3:1-136:23]: Expected the package to have within slPCMlib.Media_Rubitherm_SP; but got within ;.

[4] 16:22:17 Scripting Error
Failed to load package slPCMlib () using MODELICAPATH /home/~.

P.S. I added the changes manually to the old version I still had before I did the update and made the changes manually and used (almost) the same compiling settings as you except I used GNU Make as target build because I didn't have MinGW as an option there. The other options would’ve been vxworks69 or debugrt. I also did not have the check box Use static Linking so I couldn’t check that. The only problem now is to figure out why I can’t open the newest version of slPCMlib. I tried removing the library and using git clone as well as downloading the zip document but in both options I got the same error messages.

AdamBuruzs commented 1 year ago

Are you working with windows or linux?

Wendymely commented 1 year ago

@AdamBuruzs I’m using Linux (Ubuntu 20.04)