Opened 9 years ago
Closed 7 years ago
#3975 closed defect (fixed)
Incorrect evaluation of boolean vector expression in when statements
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Consider the following test case:
model M Boolean b1, b2; Integer i(start = 0, fixed = true); equation b1 = if time > 0.1 then false else false; b2 = if time > 0.2 then true else false; when cat(1,not{b1}, not {b2}) then i = pre(i)+1; end when; end M;
When compiling it, I get
M.c:125:69: error: incompatible types when assigning to type 'modelica_boolean {aka signed char}' from type 'boolean_array {aka struct base_array_s}' data->localData[0]->booleanVars[0] /* $whenCondition1 DISCRETE */ = tmp4;
Note that other boolean expressions are dealt with niceley, e.g.
model M2 Boolean b1, b2; Integer i(start = 0, fixed = true); equation b1 = if time > 0.1 then false else false; b2 = if time > 0.2 then true else false; when cat(1,{not b1}, {not b2}) then i = pre(i)+1; end when; end M2;
Change History (5)
comment:1 by , 8 years ago
Milestone: | 1.10.0 → 1.11.0 |
---|
comment:2 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.
follow-up: 4 comment:3 by , 7 years ago
Component: | Code Generation → New Instantiation |
---|---|
Milestone: | 1.12.0 → 2.0.0 |
Owner: | changed from | to
Status: | new → assigned |
With the new front-end, OMEdit just crashes on this test case
comment:4 by , 7 years ago
comment:5 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The model M
now simulates correctly with OMEdit v1.13.0-dev-113-g8c6364e6 (64-bit) connected to v1.13.0-dev-602-g4204ff08e (64-bit), when using the new FE.
Also this variant simulates correctly
model M3 Boolean b1, b2; Integer i(start = 0, fixed = true); equation b1 = if time > 0.1 then false else true; b2 = if time > 0.2 then false else true; when cat(1,not{b1}, not {b2}) then i = pre(i)+1; end when; end M3;
Note:
See TracTickets
for help on using tickets.
Ticket retargeted after milestone closed