Opened 5 years ago
Last modified 3 years ago
#5614 new defect
error in FMU instantiate in case of large models
Reported by: | Owned by: | Lennart Ochel | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | FMI | Version: | v1.13.2 |
Keywords: | Cc: |
Description
Hi,
I am working in the frame of a big project funded by the Italian electric transmission system operator (TSO). We are developing a dynamic simulator of electric grids of large dimensions. For this task we build the dynamic models using FMUs compiled by means of OpenModelica. FMUs are then called by an own developed main application which solves the DAE overall system using open source numerical solutors (Sundials and others). For this project we use Qt Creator 4.7.1 Based on Qt 5.9.7 (MSVC 2015, 32 bit).
Till a month ago we were using an old version of OpenModelica (v1.12.0-dev.alpha1 32 bit for Windows) with satisfactory resuls even with huge models (with more than 10 thousands of FMU instances). Now trying to switch to the official last version of OpenModelica(v1.13.2 32 bit for Windows) we get a crash in the FMU instatiate of large models (with more than 1000 instances).
In order to reproduce the error in a much less complex context we have developed a simple main application based on the main.c source code (from FMU SDK A C library by QTronic) downloaded from a link located in https://fmistandard.org/downloads/.
This main.c has been sligtly modified in order to make many instances of the same FMU (a simple model with 1 input 1 output and 1 state) and the error has been reproduced. If it could help I can send you the source code.
Best Regards
Francesco Pretolani
CESI S.p.A.
Via Rubattino, 54 - 20134 Milano (Italy)
email: pretolani@…
Attachments (1)
Change History (11)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Hi Francesco,
many thanks for the answer and the suggestions. I will try the last nightly build and in case attach my source code starting the second part of the month due to August holiday.
Francesco Pretolani
by , 5 years ago
Attachment: | fmuSimple.zip added |
---|
comment:3 by , 5 years ago
Hi Francesco,
this morning I have tryed the latest nightly build OpenModelica v1.14.0-dev-26662-g2ca8f1e957 (32-bit) and I have got the same error I had with the official version v1.13.2 32 bit for Windows. So I send you in attachment a zip file with all the sources in order to allow you to reproduce the error. Here below I include some details:
1) the zip file includes 2 folders: fmuSimple and fmu20
2) fmu20 has been downloaded from FMU SDK A C library by Qtronic; fmuSimple include main.c and sim_support.c downloaded from the same site by Qtronic and modified in order to have many instances of the same fmu (see variable nista=10000 in the function "simulate")
3) the Modelica file fmuSimple.mo is attached as well as three fmus obtained with versions 1.12.0, 1.13.2 and 1.14.0 of OpenModelica. Only the version 1.12.0 works properly. The other versions give a crash with nista greater than 941.
4) for the compilation we use Qt Creator 4.7.1 based on Qt 5.9.7 (MSVC 2015, 32 bit) and gcc (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 5.3.0
5) remember to define the environment variable FMUSDK_HOME = the folder of fmu20
Contact me if any other information is needed.
Best Regards
Francesco Pretolani
comment:4 by , 5 years ago
Milestone: | Future → 1.14.0 |
---|
@lochel, could you please have a look and report?
comment:5 by , 5 years ago
Hi @lochel,
today I have compiled the attached source code (fmuSimple) with Microsoft Visual Studio 2013 (32 bit) and I obtain the same result as with gcc. OpenModelica version 12 FMU works but more recent versions fail (memory fault). The issue seems not related to the compiler. Any ideas?
Regards
Francesco
comment:6 by , 5 years ago
Hi #lochel,
some news about this issue. Our SW development team has found that the crash happens exclusively on Windows in the initialize function when calling the function GC_vasprintf:
Version 1.12.0
int GC_vasprintf(char strp, const char *fmt, va_list ap)
and
int GC_asprintf(char strp, const char *fmt, ...)
Version 1.13.2
int GC_asprintf(const char strp, const char *fmt, ...)
and
int GC_vasprintf(const char strp, const char *fmt, va_list ap)
strp is used as output parametr (for exapmle in 'fmuSimple_setupDataStruc'), this probably cause segmentation fault error.
The Linux official version works fine and the function GC_asprintf is defined as in Windows version 12:
int GC_asprintf(char strp, const char *fmt, ...)
and
int GC_vasprintf(char strp, const char *fmt, va_list ap)
Hope that this input can speed up the solution of this issue.
Regards
Francesco
comment:7 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:9 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
In all likelyhood this is due to some memory access issue due to the use of multiple instances of the same FMU.
@pretolani, to help you with this issue it is essential that we are able to reproduce it on our own, hence we need:
For management purposes, all the required material should preferably attached to this ticket. If you have IP requirements that do not allow you to make it public, please follow these instructions.
Before doing this, I would also suggest that you first try to use an FMU generated by the latest 1.14.0 nightly build, maybe the problem is already solved.
Thanks!