Opened 11 years ago
Last modified 7 years ago
#2599 new defect
Handling of (tuple) = f(...) when solving non-linear
Reported by: | Willi Braun | Owned by: | probably noone |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
Examples like following were handled wrong in SimCodeUtil:
model TupleNonLinear function ftest input Real a; output Real b; output Integer c; algorithm b := 0; for i in {1} loop //prevent inlining b := b + sin(a); c := integer(a); end for; end ftest; Real a; Integer c; Real x,z; equation der(x) = sin(a + time); (x,c) = ftest(a); z = if c>=1 then 10 else 0; annotation (experiment(StopTime=2)); end TupleNonLinear;
We try to solve the equation
(x,c) = ftest(a) non-linear for
{a,c} but actually only a should be solved
non-linear and c can be calculated then directly.
Change History (12)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Yes, the code we would produce is wrong, since for all
non-linear systems we assume that the iteration variables
are Real and not Integer.
follow-up: 4 comment:3 by , 11 years ago
Are you actually allowed to output both a continuous-time and discrete-time expression for the same equation?
Spec 3.8.3 says:
For an equation expr1 = expr2 where neither expression is of base type Real, both expressions must be discrete-time expressions.
Exceptions are only made for records.
comment:4 by , 11 years ago
Description: | modified (diff) |
---|
Replying to sjoelund.se:
Are you actually allowed to output both a continuous-time and discrete-time expression for the same equation?
Spec 3.8.3 says:
For an equation expr1 = expr2 where neither expression is of base type Real, both expressions must be discrete-time expressions.
Exceptions are only made for records.
That's a really good remark.
I changed the model a bit, so that the mode
has a discrete change of c while the
continues integration.
So I think you are right we need to handle
that whole equation as discrete.
comment:5 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:6 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:11 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.
comment:12 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
Replying to wbraun:
Why? That is actually not an error. I think it is good enough to solve it non-linear.
Anyway, the model gets handled wrong. I changed the model a bit, so that OpenModelica produces wrong results: