Opened 12 years ago
Last modified 7 years ago
#2045 assigned defect
Initialisation of external object fails
Reported by: | Martin Sjölund | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: |
Description
https://svn.modelica.org/projects/Modelica_EmbeddedSystems/trunk/Modelica_DeviceDrivers/ @r5977
To silence some warnings, optionally download: https://svn.modelica.org/projects/Modelica_EmbeddedSystems/trunk/Modelica_Synchronous/ @r5977
Initialisation of external object fails for Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP. I checked it by adding a print statement to the constructor function, which was never executed. The constructor should be called once (and only once), and before it is used.
Note that the symbolic init could not be used because
Model is structurally singular, error found sorting equations 2: $PRE.getReal.y[2] = $_start(getReal.y[2]); 4: $PRE.getReal.y[1] = $_start(getReal.y[1]);
Bug taken from the forums
Change History (16)
comment:1 by , 11 years ago
Milestone: | 1.9.0 → 1.9.1 |
---|
comment:2 by , 10 years ago
Status: | new → assigned |
---|
comment:3 by , 10 years ago
Just wanted to mention that the repo quoted above has moved to https://github.com/modelica/Modelica_DeviceDrivers
comment:4 by , 10 years ago
Actually, I get no simulation executable at all. I get the following errors if I try to build that model:
Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c: In function ‘omc_Modelica__DeviceDrivers_Packaging_SerialPackager___addRealAsFloat’: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c:216: warning: passing argument 2 of ‘MDD_SerialPackagerAddDoubleAsFloat’ discards qualifiers from pointer target type /home/lochel/Documents/tests/2045/Modelica_DeviceDrivers/trunk/Modelica_DeviceDrivers 1.3/Resources/Include/MDDSerialPackager.h:244: note: expected ‘double *’ but argument is of type ‘const double *’ Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c: In function ‘omc_Modelica__DeviceDrivers_Packaging_SerialPackager___addInteger’: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c:225: warning: passing argument 2 of ‘MDD_SerialPackagerAddInteger’ discards qualifiers from pointer target type /home/lochel/Documents/tests/2045/Modelica_DeviceDrivers/trunk/Modelica_DeviceDrivers 1.3/Resources/Include/MDDSerialPackager.h:162: note: expected ‘int *’ but argument is of type ‘const int *’ Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c: In function ‘omc_Modelica__DeviceDrivers_Packaging_SerialPackager___addReal’: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP_functions.c:233: warning: passing argument 2 of ‘MDD_SerialPackagerAddDouble’ discards qualifiers from pointer target type /home/lochel/Documents/tests/2045/Modelica_DeviceDrivers/trunk/Modelica_DeviceDrivers 1.3/Resources/Include/MDDSerialPackager.h:205: note: expected ‘double *’ but argument is of type ‘const double *’ Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.c: In function ‘Modelica_DeviceDrivers_Blocks_Examples_TestSerialPackager_UDP_eqFunction_82’: Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.c:521: error: ‘$PgetInteger$PpkgOut$lB1$rB$PautoPkgBitSize’ undeclared (first use in this function) Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.c:521: error: (Each undeclared identifier is reported only once Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.c:521: error: for each function it appears in.) make: *** [Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDP.o] Error 1
comment:5 by , 10 years ago
Hm, strange. Can confirm that. Was working with Dymola using Visual C on Windows or gcc on Linux. Maybe connected to using the clang compiler. Currently I don't know, but I will have a look into it.
comment:6 by , 10 years ago
That error is not related to the code in the library. It is $PgetInteger$PpkgOut$lB1$rB$PautoPkgBitSize
that is not defined anywhere (getInteger.pkgOut[1].autoPkgBitSize
).
comment:7 by , 10 years ago
It exists only on a conditional base and should only be used if "nu == 1
".
when initial() then pkgIn.autoPkgBitSize = if nu == 1 then alignAtByteBoundery(pkgOut[1].autoPkgBitSize)*8 + n*64 else n*64; end when;
However, even if the model is simplified there are (other) problems. I commited a simplified model to the master branch (Blocks/Examples/TestSerialPackager_UDPMinimalForOMCTest.mo).
This model compiles (though with warnings), but generates a segmentation fault during simulation:
Limited backtrace at point of segmentation fault /home/bernhard/bt/workrepos/openmodelica/build/lib/omc/libSimulationRuntimeC.so(+0x539d4)[0xb739d4] [0xda440c] /tmp/OpenModelica/Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_UDPMinimalForOMCTest(Modelica_DeviceDrivers_Blocks_Examples_TestSerialPackager_UDPMinimalForOMCTest_eqFunction_11+0x45)[0x8051915]
I can't say whether this is due to initialization, or due s.th. else.
comment:8 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:9 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:10 by , 10 years ago
The example propagates ExternalObjects in connect equations. This is a problem and currently not supported by OpenModelica. See also the discussion at https://trac.modelica.org/Modelica/ticket/1669.
comment:15 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:16 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
Postponed until 1.9.1