Opened 16 years ago

Last modified 14 years ago

#1098 closed defect (fixed)

Wrong instantiation of parameters of complex types

Reported by: AlexeyLebedev Owned by: AlexeyLebedev
Priority: high Milestone:
Component: Version:
Keywords: Cc: AlexeyLebedev,

Description

Hi!

I think that I have found a bug in the instantiation process. Consider the following example:

class Test

record Rec

parameter Real property;

end Rec;


Rec recRepresentative (property=5.7);

 

class C

parameter Rec rec;

end C;

 

C cRepresentative(rec=recRepresentative);

end Test;

Then the parameter cRepresentative.rec.property gets no binding. (The corresponding DAE.VAR.binding is NONE, and there is no equation containing this component reference. At least, this is what happens in the trunk version. I can not debug the MathCore/OSMC version, but it produces the same flat modelica as the trunk version:

fclass Test
parameter Real recRepresentative.property = 5.7;
parameter Real cRepresentative.rec.property;
end Test;

so it probably produces the same DAEs as well.) If one defines C.rec as a variable, not a parameter (like this:

class C

Rec rec;

end C;

), then everything is fine - a binding equation is created:

fclass Test
parameter Real recRepresentative.property = 5.7;
parameter Real cRepresentative.rec.property;
equation

cRepresentative.rec.property = recRepresentative.property;

end Test;

If one defines Rec.property as a variable, not a parameter, then the binding of recRepresentative.property moves to equations (like this:

fclass Test
Real recRepresentative.property;
Real cRepresentative.rec.property;
equation

recRepresentative.property = 5.7;

end Test;

), but the situation with cRepresentative.rec.property stays the same - if C.rec is a parameter, cRepresentative.rec.property has no binding; if C.rec is a variable, a binding equation

cRepresentative.rec.property = recRepresentative.property;

is created.

Best regards,

Alexey

Change History (1)

comment:1 by AlexeyLebedev, 16 years ago

I think I have fixed it. Uploaded the fix to revision 4021

Note: See TracTickets for help on using tickets.