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 Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:2 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.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 Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:5 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:6 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:7 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:8 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:9 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future
Owner: changed from Jens Frenkel to Patrick Täuber
Status: newassigned

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.

Note: See TracTickets for help on using tickets.