Opened 8 years ago
Closed 8 years ago
#4498 closed defect (fixed)
External object initialization dependencies
| Reported by: | Bernhard Thiele | Owned by: | Lennart Ochel |
|---|---|---|---|
| Priority: | high | Milestone: | 1.13.0 |
| Component: | Initialization | Version: | |
| Keywords: | Cc: | Patrick Täuber |
Description
I have a model that requires that two external objects are constructed in the correct sequence since one external object (ep1) is an argument to the constructor of the second external object (ep2). The idea is sketched below, the complete example is attached to this ticket.
model Test_EPInit EP1 ep1 = EP1(); EP2 ep2 = EP2(ep1); equation when time > 0.1 then EP1_Print(ep1); EP2_Print(ep2); end when; annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( coordinateSystem(preserveAspectRatio=false))); end Test_EPInit;
Simulating this test model with a nightly build on a 64-bit Linux with
loadFile("EPInit.mo"); simulate(EPInit.Test_EPInit, startTime=0, stopTime=1); getErrorString();
results in a segmentation fault error.
...
messages = "Simulation execution failed for model: EPInit.Test_EPInit
stdout | info | Entering EP1_Constructor()
stdout | info | The initialization finished successfully without homotopy method.
stdout | info | Entering EP2_Print()
stdout | info | EP2_Print: invalid pointer
Limited backtrace at point of segmentation fault
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f3390c09330]
/home/bernhard/data/workspace/OMFMISimulator/testsuite/OMSimulatorModelica/EPInit.Test_EPInit(EP2_Print+0x44)[0x407404]
...
From the outputs it appears to me that the constructor of the second external object is not called at all.
Attachments (1)
Change History (5)
by , 8 years ago
comment:1 by , 8 years ago
| Cc: | added |
|---|---|
| Component: | Backend → Code Generation |
comment:2 by , 8 years ago
| Component: | Code Generation → Initialization |
|---|---|
| Milestone: | Future → 1.12.0 |
| Status: | new → accepted |
comment:3 by , 8 years ago
This seem to work now. Here is the output that I get:
stdout | info | Entering EP1_Constructor() stdout | info | Entering EP2_Constructor() stdout | info | The initialization finished successfully without homotopy method. stdout | info | Entering EP2_Print() stdout | info | EP2_Print: ep2_state=13.30 stdout | info | Entering EP1_Print() stdout | info | EP1_Print: ep1_state=3.30 stdout | info | The simulation finished successfully. stdout | info | Entering EP1_Destructor() stdout | info | Entering EP2_Destructor()
comment:4 by , 8 years ago
| Milestone: | 1.12.0 → 1.13.0 |
|---|---|
| Resolution: | → fixed |
| Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.

The second external object is not processed properly because of a bug or lack in the variables data structure. I added a workaround for that (OMCompiler#1771). @ptaeuber, can you please have a look at the SimCode part that is now failing?
New error messages: