Opened 11 years ago
Last modified 7 years ago
#2599 new defect
Handling of (tuple) = f(...) when solving non-linear
Reported by: | wbraun | Owned by: | probably noone |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by wbraun)
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 in reply to: ↑ description Changed 11 years ago by lochel
comment:2 Changed 11 years ago by wbraun
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.
comment:3 follow-up: ↓ 4 Changed 11 years ago by 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.
comment:4 in reply to: ↑ 3 Changed 11 years ago by wbraun
- 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 Changed 10 years ago by sjoelund.se
- Milestone changed from 1.9.1 to 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 Changed 10 years ago by sjoelund.se
- Milestone changed from 1.9.2 to 1.9.3
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:7 Changed 9 years ago by sjoelund.se
- Milestone changed from 1.9.3 to 1.9.4
Moved to new milestone 1.9.4
comment:8 Changed 9 years ago by sjoelund.se
- Milestone changed from 1.9.4 to 1.9.5
Milestone pushed to 1.9.5
comment:9 Changed 9 years ago by sjoelund.se
- Milestone changed from 1.9.5 to 1.10.0
Milestone renamed
comment:10 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.10.0 to 1.11.0
Ticket retargeted after milestone closed
comment:11 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.11.0 to 1.12.0
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:12 Changed 7 years ago by casella
- Milestone changed from 1.12.0 to 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: