You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported by choeger on 13 Aug 2014 09:07 UTC
Consider the following small model:
model Test2model CconstantReal k =1;
constantReal p =0;
end C;
model DconstantReal k =2;
constantReal p =2;
end D;
model Ereplaceablemodel C2 = C;
replaceablemodel C3 = C2(k = C2.p +10);
Real x;
equation
x = C3.k;
end E;
model F = E(redeclaremodel C3 = D, redeclaremodel C2 = D);
F e;
end Test2;
I wonder whether this is actually legal? C2 is certainly not transitively non-replacable, so can I have a "redeclaration chain" like that? Dymola accepts this. OpenModelica complains about a field not found.
Assuming it is legal, how about the modifications?
Basically, there are 3 ways to deal with the modification of C2:
evaluate before redeclaration of C3 takes effect (i.e. C3=D, x=2)
This may also be the case when the modification is discarded.
evaluate after redeclaration of C3 takes effect, but before C2 (i.e. C3=C(k=C.p+2), x=10)
evaluate after redeclaration of C3 and after C2 (i.e. C3=D(k=D.p+10), x=12)
AFAIK, modifications are "merged" according to the spec, i.e. the modification inside E is never lost. When we also assume that redeclarations are always applied before modifications, the only legal answer should be 3.
However we decide, I propose to add this as a test case to the compliance suite.
I agree that only option 3 makes sense, and also that C2 isn't transitively non-replaceable as it should be.
Will need to check if there is any overlap, but otherwise I think it makes sense to add this as two two-cases, one for the "non-replaceable" issue and one for the value (modified in some way to avoid the previous issue).
Reported by choeger on 13 Aug 2014 09:07 UTC
Consider the following small model:
I wonder whether this is actually legal? C2 is certainly not transitively non-replacable, so can I have a "redeclaration chain" like that? Dymola accepts this. OpenModelica complains about a field not found.
Assuming it is legal, how about the modifications?
Basically, there are 3 ways to deal with the modification of C2:
This may also be the case when the modification is discarded.
AFAIK, modifications are "merged" according to the spec, i.e. the modification inside E is never lost. When we also assume that redeclarations are always applied before modifications, the only legal answer should be 3.
However we decide, I propose to add this as a test case to the compliance suite.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1552
The text was updated successfully, but these errors were encountered: