Opened 9 years ago

Last modified 7 years ago

#3840 new defect

Incorrect message about cyclic parameters

Reported by: Michael Wetter Owned by: somebody
Priority: high Milestone: Future
Component: Frontend Version:
Keywords: Cc:

Description

Simulating TestPackage.Example gives the error

Cyclically dependent constants or parameters found in scope `TestPackage.TestModel`

Here is a test model that illustrates the construct we use:

package TestPackage
model Example
  TestModel t(set_a = true, a = 2);
end Example;

model TestModel
  parameter Boolean set_a = true "Set to true to set parameter a";
  parameter Real a = b
    annotation(Dialog(enable=set_a));
  parameter Real b = a
    annotation(Dialog(enable=not set_a));
end TestModel;
end TestPackage;

I agree that TestPackage.TestModel has a cyclic dependency, but when used in TestPackage.Example, this dependency is removed by setting a=2, hence there is no need to issue the error.

A use case for such a construct is Annex60.Fluid.Chillers.Examples.Carnot_TEva in which the user can specify a Carnot effectiveness from which the Carnot efficiency is computed, or vice versa, depending on a parameter such as set_a.

This is used in 15 out of the 20 regression tests of Annex 60 that fail. Can this test be delayed in OpenModelica until the parameters are assigned?

Change History (3)

comment:1 by Lennart Ochel, 9 years ago

Component: *unknown*Frontend

I set the component to frontend, since that is where the error is thrown. I am pretty sure that I've implemented a similar check in the backend. So maybe the frontend check is not needed.

comment:3 by Matthis Thorade <m.thorade@…>, 7 years ago

Another note: When simulating with OMC Flag -d=ignoreCycles as suggested by the error message the models run just fine. So this issue is really only about when to apply the check.

Note: See TracTickets for help on using tickets.