Opened 12 years ago
Closed 12 years ago
#2026 closed defect (fixed)
generated mat-file is invalid
Reported by: | Lennart Ochel | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: | Jens Frenkel |
Description
If you test trunk/testsuite/simulation/modelica/events/EventIteration.mos with default outputFormat (mat) you get the following error:
omc: util/read_matlab4.c:436: omc_matlab4_read_single_val: Assertion `absVarIndex > 0 && absVarIndex <= reader->nvar' failed. Aborted (core dumped)
Change History (14)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
absVarIndex: 0 reader->nvar: 9
#4 0x0000000001f23a6e in omc_matlab4_read_single_val (res=0x7fffffffdce8, reader=0x304c930 <simresglob+16>, varIndex=0, timeIndex=0) at util/read_matlab4.c:438 #5 0x0000000001f23fc2 in omc_matlab4_val (res=0x7fffffffdce8, reader=0x304c930 <simresglob+16>, var=0x5826ce8, time=<optimised out>) at util/read_matlab4.c:524 #6 0x0000000001ed986c in SimulationResultsImpl__val ( filename=0x7fffeeb7d740 "/home/marsj/dev/trunk-nomod/testsuite/simulation/modelica/events/EventIteration_res.mat", varname=0x7ffff7fb74b0 "h1", timeStamp=<optimised out>, simresglob=<optimised out>) at SimulationResults.c:117
comment:3 by , 12 years ago
octave:3> dataInfo dataInfo = 2 2 2 2 2 2 2 2 2 0 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 octave:4> name' ans = time x der(x) z y c3 c2 c1 $PRE.h1 h1
So h1 (the variable that fails) does not get an entry in the dataInfo matrix!!! This is clearly wrong. If it was filtered, it should not have gotten an entry at all.
comment:4 by , 12 years ago
To me it looks like $PRE.h1 is associated with the correct h1 matrix (but it shouldn't be part of the result-file, right?). And h1 gets a bad entry...
comment:5 by , 12 years ago
Yes, h1 should and pre(h1) should not occure.
I have just filtered $whenCondition1 ... $whenConditionN. But the implementation is quite a bad workaround. So probably the bug is linked to that implementation.
comment:6 by , 12 years ago
Yes. It seems the init.xml file lists h1 is an alias of $whenCondition2. So there are two solutions:
1) Don't filter $when
2) Make the backend never select $when as the real variable (always make $when the alias)
comment:8 by , 12 years ago
Cc: | added |
---|
comment:10 by , 12 years ago
one think to the encapsulateWhenConditions module.
I guess it is really awkward to replace
when y then
with
when $whenCondition1 then
The other think: make internal variables prefered as alias is easy to fix. I will do this.
follow-up: 13 comment:11 by , 12 years ago
add the case
// we do not replace symbols case (condition as DAE.CREF(componentRef=_), _, index, ht) then (condition, {}, {}, {}, index, ht);
comment:12 by , 12 years ago
Actually Remove simple Equations takes care on variables with pre. Since all $whens have a pre it is not allowed to the remove simple equations module to replace this variables. If we want to replace them we have to change the handling of the initial system.
comment:13 by , 12 years ago
Replying to jfrenkel:
add the case
// we do not replace symbols case (condition as DAE.CREF(componentRef=_), _, index, ht) then (condition, {}, {}, {}, index, ht);
That case is not possible, because it will break the when-handling.
comment:14 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I guess this is linked to the filterOutput feature. Because the bug occurs since I filter the internal-variables which are introduced for the when-conditions.