Opened 11 years ago

Closed 11 years ago

#2336 closed defect (fixed)

Enumeration array with bindings flagged as structurally singular

Reported by: perost Owned by: lochel
Priority: normal Milestone: 1.9.1
Component: Backend Version: trunk
Keywords: Cc: lochel, jfrenkel

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 Changed 11 years ago by lochel

  • Owner changed from probably noone to lochel
  • Status changed from new to assigned

I will have a look.

comment:2 Changed 11 years ago by sjoelund.se

  • Milestone changed from 1.9.0 to 1.9.1

Postponed until 1.9.1

comment:3 Changed 11 years ago by lochel

  • Cc jfrenkel 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 Changed 11 years ago by lochel

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 Changed 11 years ago by lochel

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 Changed 11 years ago by lochel

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 lochel (previous) (diff)

comment:7 follow-up: Changed 11 years ago by 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.

comment:8 in reply to: ↑ 7 Changed 11 years ago by lochel

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 Changed 11 years ago by lochel

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r19589.

Note: See TracTickets for help on using tickets.