Opened 12 years ago

Closed 12 years ago

#2025 closed defect (worksforme)

Look-up failed for replaceable functions.

Reported by: mikaelf@… Owned by: somebody
Priority: critical Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

Flattening of the ErrorTest? model in the following code fails due to look-up failure for the replaceable functions.

package Test
  model ErrorTest
    inner replaceable Test.TestModel testModel;
  end ErrorTest;
  model TestModel
    extends Test.Base(redeclare final function someOffset = constantOffset(offset = offset), redeclare final function coefficient = someCoefficient(coef_fixed = coef));
  protected
    outer Modelica.Mechanics.MultiBody.World world;
    function constantOffset
      extends Test.offsetBase;
      input Modelica.SIunits.Distance offset = 0;
    algorithm
      someOffset:={0,offset,0};
    end constantOffset;
    function someCoefficient
      extends Test.coefficientBase;
      input Real coef_fixed = 1;
    algorithm
      coef:=coef_fixed;
    end someCoefficient;
  end TestModel;
  partial function coefficientBase
    output Real coef = 1;
  end coefficientBase;
  partial function offsetBase
    output Modelica.SIunits.Position someOffset[3] = zeros(3);
  end offsetBase;
  partial model Base
    replaceable function coefficient = Test.coefficientBase;
    replaceable function someOffset = Test.offsetBase;
  end Base;
end Test;

Error message:

[30] 14:26:27 Validation of model Test.ErrorTest
Error: [:0:0-0:0] Error occurred while flattening model Test.ErrorTest
Error: [<interactive>:13:7-13:49] Class Modelica.SIunits.Distance not found in scope Test.TestModel.constantOffset.
Error: [<interactive>:8:110-8:167] Modified element coefficient not found in class Base.

Corresponding MathCore ticket: #3951

Change History (1)

comment:1 by Martin Sjölund, 12 years ago

Resolution: worksforme
Status: newclosed

Works in trunk (r14629) with warnings:

[a.mo:8:5-8:51:writable] Warning: No corresponding 'inner' declaration found for component .Modelica.Mechanics.MultiBody.World testModel.world declared as 'outer '.
  The existing 'inner' components are:
    There are no 'inner' components defined in the model in any of the parent scopes of 'outer' component's scope: Test.TestModel.
  Check if you have not misspelled the 'outer' component name.
  Please declare an 'inner' component with the same name in the top scope.
  Continuing flattening by only considering the 'outer' component declaration.

Make sure you loaded MSL and that you are running the latest version.

Last edited 12 years ago by Martin Sjölund (previous) (diff)
Note: See TracTickets for help on using tickets.