Opened 14 years ago

Last modified 14 years ago

#1354 closed defect (fixed)

Wrong number of equations reported

Reported by: Jan Brugård Owned by: Jan Brugård
Priority: blocker Milestone:
Component: Version:
Keywords: Cc: Jan Brugård,

Description

Consider the following model:

model WrongNumberofEquations
  type Transparency= Modelica.Icons.TypeReal(min=0, max=1);
  type Shininess= Modelica.Icons.TypeReal(min=0, max=1);
  input Transparency transparency=0 ;
  Shininess shininess=0 ;
end WrongNumberofEquations;

The model reports that it has 3 equations and 1 variable, which is clearly incorrect. Both types are aliases of type Real. If the model is changed to use reals instead it reports 1 equation and 1 variable (i.e. it works, but it should probably report to of each whereof one is input):

model WrongNumberofEquations2
  input Real transparency=0 ;
  Real shininess=0 ;
end WrongNumberofEquations2;

Change History (6)

comment:2 by Adrian Pop, 14 years ago

Counting of equations is a back-end issue.

comment:3 by Jan Brugård, 14 years ago

Adrian, for my education, is it always? I thought that it could depend on where it all goes wrong (Peter is not here to ask)?

comment:4 by Per Östlund, 14 years ago

It's not always the backend, because it can't count correctly that which is not correct. This is therefore fixed in revision 6960 of trunk, see test case mosfiles/ComplexTypeEquationCount. I'll add it to the 1.5.1-Maintenance branch too.

comment:5 by Peter Aronsson, 14 years ago

The problem is indeed in the frontend:

instantiateModel(WrongNumberofEquations) =>
"class WrongNumberofQuations

input Real transparency(min = 0.0, max = 1.0) = 0.0;
Real shininess(min = 0.0, max = 1.0) = 0.0;

equation

transparency = 0.0;
shininess = 0.0;

end WrongNumberofQuations;
Note that equations should not be generated, since they are variable bindings.

comment:6 by Peter Aronsson, 14 years ago

Ooops,

Someone fixed it while I was editing the ticket. ;)

Note: See TracTickets for help on using tickets.