Opened 9 years ago
Closed 9 years ago
#4387 closed defect (fixed)
Functions with no return value are not called in when ( initial() ) clauses
| Reported by: | Bernhard Thiele | Owned by: | Lennart Ochel |
|---|---|---|---|
| Priority: | high | Milestone: | 1.12.0 |
| Component: | Backend | Version: | v1.12.0 |
| Keywords: | Cc: | tobias.bellmann@… |
Description
The following model doesn't make the expected call to print during initialization.
model TestWhen
equation
when initial() then
Modelica.Utilities.Streams.print("In initial\n");
end when;
end TestWhen;
Change History (7)
follow-up: 4 comment:1 by , 9 years ago
comment:2 by , 9 years ago
| Status: | new → accepted |
|---|
Or use an initial equation instead of an when initial() clause ;)
comment:4 by , 9 years ago
Replying to janK:
Quick fix: Replace
equationwithalgorithm:)
I just realized that a when initial() clause will be evaluated twice if it is part of an algorithm section.
comment:5 by , 9 years ago
I saw it too, but didn't pay a lot of attention to it. Only with print this flaw was revealed - what a coincidence. Probably it is still worth fixing that. Issues could result if in initial() files (for writing e.g. results) are opened twice.
comment:6 by , 9 years ago
Right, seems not be a big issue yet. Anyway, I will fix it with OMCompiler#1607.
comment:7 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |

Quick fix: Replace
equationwithalgorithm:)