Opened 11 years ago

Closed 11 years ago

#2336 closed defect (fixed)

Enumeration array with bindings flagged as structurally singular

Reported by: Per Östlund Owned by: Lennart Ochel
Priority: normal Milestone: 1.9.1
Component: Backend Version: trunk
Keywords: Cc: Lennart Ochel, Jens Frenkel

Description

OMC says that the following model is structurally singular, which it shouldn't be. I'm quite sure it used to work a couple of months ago.

model M
  type E = enumeration(one, two);
  Real x[E] = {1, 2};
end M;

The model works if you don't use an enumeration though:

model M
  Real x[2] = {1, 2};
end M;

Change History (9)

comment:1 by Lennart Ochel, 11 years ago

Owner: changed from probably noone to Lennart Ochel
Status: newassigned

I will have a look.

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

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:3 by Lennart Ochel, 11 years ago

Cc: Jens Frenkel added

I tried to step throw the code, but it is way too complex. I strongly recommend to revise and simplify it a lot. But that will need some time.
Jens, can you have a look or just give me a hint?

comment:4 by Lennart Ochel, 11 years ago

The error message is the following:

Error: Model is structurally singular, error found sorting equations 
 1: x[1] = 1.0;
2: x[2] = 2.0;
 for variables 
 x[M.E.two](1), x[M.E.one](2)
Error: Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

It seems that the variables get differently expanded for the variable vector and inside the equations. Hence, both cannot get mapped anymore.

comment:5 by Lennart Ochel, 11 years ago

This is a problem with the preOptModule <inlineArrayEqn>. After it get applied, the system changes to the following and it is not anymore possible to match the system as I pointed out above:

pre-optimization module inlineArrayEqn:


Variables (2)
========================================
1: x[M.E.two]:VARIABLE() .M, .Real type: Real [2]
2: x[M.E.one]:VARIABLE() .M, .Real type: Real [2]


Equations (2, 2)
========================================
1/1 (1): x[1] = 1.0
2/2 (1): x[2] = 2.0

comment:6 by Lennart Ochel, 11 years ago

Before that preOptModule get applied, the equation was the following

Equations (1, 2)
========================================
1/1 (2): x = {1.0, 2.0}

The equation should get expanded to the following

1/1 (1): x[M.E.one] = 1.0
2/2 (1): x[M.E.two] = 2.0
Last edited 11 years ago by Lennart Ochel (previous) (diff)

comment:7 by Adrian Pop, 11 years ago

Maybe expandCref replaces enums with integers.
Is a good question if we should keep the enum as they are in the back-end or replace them with integers. From my side I think we should keep them as enums.

in reply to:  7 comment:8 by Lennart Ochel, 11 years ago

Replying to adrpo:

Maybe expandCref replaces enums with integers.
Is a good question if we should keep the enum as they are in the back-end or replace them with integers. From my side I think we should keep them as enums.

I agree. Probably we should keep the enumerations. Hence, the equation shoulg get expended as I proposed above.

comment:9 by Lennart Ochel, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r19589.

Note: See TracTickets for help on using tickets.