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 )
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 , 10 years ago
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Description: | modified (diff) |
---|
Package file needed to reproduce the error