Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#2793 closed defect (fixed)

Connect equation bug on outer declared components used in arrays

Reported by: ivar.torstensson@… Owned by: Per Östlund
Priority: high Milestone: 1.9.4
Component: Frontend Version: trunk
Keywords: Cc:

Description

When an array of components contain outer declared components, OpenModelica will give an error related to the connection statements to the outer component. This is not present when the array is split to a number of component declarations.

Here's a small example, containing a working and a failing experiment:

package Sandbox
  model InnerOuterModel
    Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a;
      Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T=297.15);
  equation
    connect(fixedTemperature.port, port_a);
  end InnerOuterModel;

  model LowerLevelModel
    outer InnerOuterModel innerOuterModel;
    Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow(Q_flow=1);
  equation
    connect(fixedHeatFlow.port, innerOuterModel.port_a);
  end LowerLevelModel;

  model TopLevelModelWorking "Working example"
    inner InnerOuterModel innerOuterModel;
    LowerLevelModel lowerLevelModel1;
    LowerLevelModel lowerLevelModel2;
  end TopLevelModelWorking;

  model TopLevelModelFailing "Failing example"
    inner InnerOuterModel innerOuterModel;
    LowerLevelModel lowerLevelModel[2];
  end TopLevelModelFailing;
end Sandbox;

This bug was introduced between r21892 and r21946. I suspect r21896.

Change History (4)

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

Component: UnknownFrontend
Owner: changed from somebody to Per Östlund
Status: newassigned

The "failing" model actually works. But prints out a misleading error-messages.

comment:2 by Per Östlund, 10 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r22066. The cause was r21937 when I implemented a check for subscript bounds in connects, which doesn't always work since the cref types are sometimes wrong. This only seems to happen for compiler generated crefs (like inner/outer stuff), in which case we don't really need to check the subscripts anyway. Fixing the types is probably quite hard, so my fix for now is to simply not check such crefs.

comment:3 by Dietmar Winkler, 9 years ago

Milestone: Futurepre1.9.4

It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.

comment:4 by Martin Sjölund, 7 years ago

Milestone: pre1.9.41.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.