Opened 10 years ago

Last modified 3 years ago

#3450 closed defect

Cyclic dependant parameter error in replaceable function — at Version 3

Reported by: Markus Dahl Owned by: somebody
Priority: high Milestone: 1.19.0
Component: New Instantiation Version:
Keywords: Cc:

Description (last modified by Henrik Tidefelt)

Running the ExampleModel from the package below will yield the following error:

15:55:39 Translation Error
[CTest: 9:47-9:80]: Cykliskt beroende konstanter eller parametrar hittades i definitionsomr�de : {x}.

or translated to english..

Error: Cyclically dependent constants or parameters found in scope : {x}.

In the ambient model, changing the modifier x=x in the redeclaration of the function to x=5 will resolve the error. However those two statements should be equivalent.

Below is the package


package CTest

model ExampleModel

Component component;
inner Ambient ambient;

end ExampleModel;

model Ambient

extends CTest.AmbientBase(redeclare final function func = CTest.func(x = x));
parameter Real x = 5;

end Ambient;

partial model AmbientBase

replaceable partial function func = CTest.func;
parameter Real var_value = 2;

end AmbientBase;

model Component

outer Ambient ambient;
parameter Real var = ambient.func(ambient.var_value);
Real z;

equation

z = var;

end Component;

function func

input Real x;
output Real y;

algorithm

y := x + 2;

end func;

end CTest;


Change History (4)

by Markus Dahl, 10 years ago

Attachment: CTest.mo added

Package file needed to reproduce the error

comment:1 by Adrian Pop, 10 years ago

I guess this is a duplicate of #3368.

comment:2 by Markus Dahl, 10 years ago

The error message generated from the ExampleModel in CTest.mo is not the same as in ticket #3368. CTest also succesfully validates while #3368 does not. However the tickets are very similar.

comment:3 by Henrik Tidefelt, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.