Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Probelm with replaceable/redeclare model

Probelm with replaceable/redeclare model

Hello,

I get an error trying to redeclare a replaceable model, the simple code is the following:

Code:


model MyInternalModel
  parameter Real par = 1;
end MyInternalModel;

model MyModel
  replaceable model ReplaceableInternalModel = MyInternalModel;
  ReplaceableInternalModel internalModel;
end MyModel;

model MyTestModel

parameter Real localPar = 1;

MyModel intModel(redeclare model ReplaceableInternalModel = MyInternalModel(final par = localPar)); //This doesn't work.

//MyModel intModel(redeclare model ReplaceableInternalModel = MyInternalModel(final par = 1)); // This works

end MyTestModel;

The error message is the following:

Code:


Error: Variable localPar not found in scope MyModel
Error: Error occurred while flattening model MyTestModel

I'm using the latest OM version (r11081) in Linux 64-bit.

Is this illegal code o is it a bug? It is so simple that I thought it should work.

Thank you for any help,

Best regards,

Javier

There are 0 guests and 0 other users also viewing this topic
You are here: