Opened 6 years ago
Closed 5 years ago
#5294 closed defect (fixed)
Backend does not support initial if equation with assert
Reported by: | Willi Braun | Owned by: | Karim Adbdelhak |
---|---|---|---|
Priority: | high | Milestone: | 1.14.0 |
Component: | Initialization | Version: | v1.14.0-dev-nightly |
Keywords: | Cc: | Niklas Worschech |
Description
For instance models as below are not supported by BackendCreate.
loadString(" model A Real x,xd; parameter Real lb=5, ub=10; equation initial equation if x<ub then assert(xd>49, \"Call ub assert\\n\"); end if; if x<lb then assert(xd<49, \"Call lb assert\\n\"); end if; equation der(x) = sin(x*time)+lb*ub; xd = der(x); end A; "); getErrorString(); simulate(A); getErrorString();
Change History (9)
comment:1 by , 6 years ago
Component: | Backend → Initialization |
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Owner: | changed from | to
---|
Karim handled a similar problem in #5226. Maybe he can have a look.
follow-up: 4 comment:3 by , 6 years ago
The PR2889 from ticket #5226 is not accepted jet, but i combined it with the changes from PR2895.
The asserts are triggered and the following error is thrown:
assert | warning | The following assertion has been violated during initialization at time 0.000000 | | | | if x < lb then xd < 49.0 else true assert | error | Call lb assert assert | info | simulation terminated by an assertion at initialization
I will have a look into that.
EDIT: Is this expected behaviour? Since xd always resolves to 50 and x<lb is always true in the initial system, therefore the assert can never be fulfilled.
comment:4 by , 6 years ago
Replying to Karim.Abdelhak:
The PR2889 from ticket #5226 is not accepted jet, but i combined it with the changes from PR2895.
The asserts are triggered and the following error is thrown:
assert | warning | The following assertion has been violated during initialization at time 0.000000 | | | | if x < lb then xd < 49.0 else true assert | error | Call lb assert assert | info | simulation terminated by an assertion at initializationI will have a look into that.
EDIT: Is this expected behaviour? Since xd always resolves to 50 and x<lb is always true in the initial system, because x gets initialized with 0, therefore the assert can never be fulfilled.
Yes, it is. That just a stupid test model to trigger an assert in an initial if-equation.
I'll start the related hudson jobs, and we will see.
follow-up: 6 comment:5 by , 6 years ago
I'm not sure I can follow the commit history. @Karim, when you say you combined PR2889 with changes from 2895, you mean you did it on your local repo? I can't see that on GitHub.
Furthermore, PR2889 produced a regression, so it can't be accepted as it is
follow-up: 7 comment:6 by , 6 years ago
Replying to casella:
I'm not sure I can follow the commit history. @Karim, when you say you combined PR2889 with changes from 2895, you mean you did it on your local repo? I can't see that on GitHub.
Furthermore, PR2889 produced a regression, so it can't be accepted as it is
I guess Karim has tested it locally.
The regression is actually a false positive, since it tells us that tearing is working now as expected. I'll change the test and the push it, again.
comment:7 by , 6 years ago
Replying to wbraun:
Replying to casella:
I'm not sure I can follow the commit history. @Karim, when you say you combined PR2889 with changes from 2895, you mean you did it on your local repo? I can't see that on GitHub.
Furthermore, PR2889 produced a regression, so it can't be accepted as it is
I guess Karim has tested it locally.
The regression is actually a false positive, since it tells us that tearing is working now as expected. I'll change the test and the push it, again.
Correct, i just changed it locally since both pull requests are pending. When the test is changed and both requests are applied it should work as expected. Thanks wbraun!
comment:8 by , 6 years ago
Fixed in PR2895.
@niklwors Can you verify if your model works now as supposed?
comment:9 by , 5 years ago
Milestone: | → 1.14.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Closing the ticket as the original problem is now solved.
Created PR2895 where the model now is passed, but no assert has been triggered. I guess now are the asserts filtered in the initialization somewhere.