Opened 12 years ago
Last modified 7 years ago
#2120 assigned defect
Make sure solving for a variable always solves the equation
Reported by: | Martin Sjölund | Owned by: | Patrick Täuber |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description
model M Real r[3]; equation r[1] = 1; r[integer(time)] = 2; r[2] = time; end M;
We get r[3]
is solved by:
Variables (1) ======================================== 1: r[3]:VARIABLE() .M, .Real type: Real [3] Equations (1, 1) ======================================== 1/1 (1): {1.0, time, r[3]}[integer(time, 0)] = 2.0
Add an assertion integer(time) == 3
, and use r[3] = 2.0
.
Change History (9)
comment:1 by , 11 years ago
Milestone: | 1.9.0 → 1.9.1 |
---|
comment:2 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:3 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:8 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:9 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|---|
Owner: | changed from | to
Status: | new → assigned |
I expect that this model should be rejected because it is not possible to guarantee its solvability in general.
As of v1.13.0-dev-155-g68350e9 we get
[1] 23:04:31 Symbolic Error An independent subset of the model has imbalanced number of equations (1) and variables (0). variables: equations: 1 : r[integer(time)] = 2.0 [2] 23:04:31 Translation Error pre-optimization module clockPartitioning (simulation) failed.
I'm not sure if this is the expected output, but I guess not generating code for simulation in this case is a good idea.
Postponed until 1.9.1