ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Error simulating tables in Dymola

Open christiankral opened this issue 4 months ago • 5 comments

This ticket refers to compile issues in https://github.com/modelica/ModelicaStandardLibrary/pull/4674#issuecomment-3316263483 and https://github.com/modelica/ModelicaStandardLibrary/pull/4674#issuecomment-3316263483

I tested Modelica.Blocks.Examples.LogicalNetwork1 in the current master branch. Under Dymola2025x for Linux I get the following error message:

Compilation of [Modelica.Blocks.Examples.LogicalNetwork1](modelica://Modelica.Blocks.Examples.LogicalNetwork1) failed.

Note: There were translation errors that might explain the problem.

Compiler message:
Using CC=cc -Wl,--no-as-needed
dsmodel.c: In function ‘Modelica_Blocks_Types_ExternalCombiTimeTable_M’:
dsmodel.c:267:9: error: ‘ModelicaStandardTables_CombiTimeTable_init3’ undeclared (first use in this function); did you mean ‘ModelicaStandardTables_CombiTimeTable_init2’?
267 | ModelicaStandardTables_CombiTimeTable_init3)(fileName0_0, tableName0_0,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ModelicaStandardTables_CombiTimeTable_init2
dsmodel.c:267:9: note: each undeclared identifier is reported only once for each function it appears in

This problem does not happen if I run this example with the default MSL in Dymola2025x.

Surprisingly, this issue does not occur when I test this example model from the master branch in OpenModelica.

christiankral avatar Sep 22 '25 07:09 christiankral

My Linux version Tuxedo 24.04 is derived from Ubuntu 24.04:

> uname -a
Linux sprinx 6.14.0-110029-tuxedo #29~24.04.1tux1 SMP PREEMPT_DYNAMIC Thu Aug 28 15:23:22 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

christiankral avatar Sep 22 '25 07:09 christiankral

Correct. I tested with Dymola 2025x Refresh 1 under Windows 11 24H2: Compiling and linking the model (Visual C++). dsmodel.c LINK : fatal error LNK1181: Eingabedatei "ModelicaIO.lib" kann nicht geffnet werden. Error generating Dymosim.

AHaumer avatar Sep 22 '25 15:09 AHaumer

There are two issues:

  • The pre-built libraries are no longer part of MSL after the release of MSL 4.1.0, and Dymola 2026x with MSL 4.1.0 is not yet released.
  • For Linux there is also a minor issue with when to use the internal libraries in MSL in Dymola 2025x Refresh 1, so you have to set Advanced.Translation.PlaceDymolaSourceFirst=2; but that only works if there are pre-built libraries in MSL

Solutions:

  • Download and install pre-built libraries (will be a bit messy):
    • Copy Resources/Library from MSL 4.1.0 branch to development version (will cause problems if there are any changes in C-source). Either just file copy or some special git cherrypick/revert command.
    • We could deliver pre-built libraries in some other way (e.g., as zip-file)
  • Build libraries locally, we will check if Dymola can automate that in some way in a future version
  • Wait for Dymola 2026x

I believe the special git commands are something like this - make sure that there are no uncommitted changes before starting (and this assumes you want to simulate on your local master branch - see below):

git checkout master
git cherry-pick --no-commit 90d43f3c1c3b37449b754cc909a0878b45e423ec

and perform tests in Dymola with Advanced.Translation.PlaceDymolaSourceFirst=2 and then to get back to normal

git checkout -f master

Notes:

  • The --no-commit is important, we don't want to resurrect these binaries by accident.
  • There will be weird git error messages from cherry-pick, ignore that
  • You can replace master in both of them with some other branch; the idea with -f master is to get back to track
  • We could stream-line the cherry-picking commands, which especially would remove the weird error messages

I have only tested with Visual Studio and WSL under Windows, not on a true Linux machine.

HansOlsson avatar Sep 24 '25 08:09 HansOlsson

@AHaumer @christiankral regarding the instructions above:

  • Are they clear?
  • Does it work for you as well?

If not, please add more information.

HansOlsson avatar Sep 30 '25 14:09 HansOlsson

@HansOlsson Thank you for your instructions. I tried:

  • Download and install pre-built libraries (will be a bit messy):
    • Copy Resources/Library from MSL 4.1.0 branch to development version (will cause problems if there are any changes in C-source). Either just file copy or some special git cherrypick/revert command.

I copied the linux64 library files of MSL 4.1.0 to a local work directory /work/Modelica/Resources/Library/linux64/ and it just worked.

christiankral avatar Oct 06 '25 11:10 christiankral