#3340 closed defect (fixed)
asserts inside initial equation triggers after initialization aswell
| Reported by: | Owned by: | Lennart Ochel | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.9.4 |
| Component: | Backend | Version: | 1.9.0Beta |
| Keywords: | Cc: |
Description
Asserts which are placed inside the initial equation part trigger aswell during the main simulation.
model Bug
Modelica.Blocks.Interfaces.RealInput x
annotation (Placement(transformation(extent={{-120,-20},{-80,20}})));
initial equation
assert(x>0,"x have to be greater 0 at initial");
equation
annotation ();
end Bug;
Minimal example is attached to this ticket.
Attachments (1)
Change History (10)
by , 10 years ago
comment:1 by , 10 years ago
| Component: | OMEdit → Backend |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:2 by , 10 years ago
follow-up: 5 comment:3 by , 10 years ago
Lennart, the problem seems to be in your script. How does that looks like?
comment:4 by , 10 years ago
Sorry but i can not reproduce your error message.
I am using the nightly version of OMEdit from 2015/05/19.
After loading the package:
package OMCBug
model Bug
Modelica.Blocks.Interfaces.RealInput x annotation(Placement(transformation(extent = {{-120, -20}, {-80, 20}})));
initial equation
assert(x > 0, "x have to be greater 0 at initial");
equation
annotation();
end Bug;
model BugToplvl
OMCBug.Bug bug annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 0.5, offset = 1) annotation(Placement(transformation(extent = {{-64, -10}, {-44, 10}})));
equation
connect(bug.x, ramp.y) annotation(Line(points = {{-10, 0}, {-26, 0}, {-43, 0}}, color = {0, 0, 127}));
annotation();
end BugToplvl;
annotation(uses(Modelica(version = "3.2.1")));
end OMCBug;
Simulation of the model "BugToplvl" fails.
comment:5 by , 10 years ago
Replying to adrpo:
Lennart, the problem seems to be in your script. How does that looks like?
Oops! You are right.
comment:6 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
This should be fixed with 56d186b60d7904ed253b34995e6ff4543a16e09d/OMCompiler.
I tested it using the following assertion:
initial equation assert(x>0, "x have to be greater 0 at initial", AssertionLevel.warning);
comment:7 by , 10 years ago
| Milestone: | Future → 1.9.4 |
|---|

Asserts in initial equations do not work for me at all. I get the following error message: