Changeset 37b44b1e in OpenModelica


Ignore:
Timestamp:
2022-06-29T10:41:46+02:00 (22 months ago)
Author:
Per Östlund <perost86@…>
Parents:
2c25668
git-author:
Per Östlund <perost86@…> (06/29/22 10:39:38)
git-committer:
Per Östlund <perost86@…> (06/29/22 10:41:46)
Message:

Handle unevaluable dimensions in connector check

  • Skip the connector balance check if a connector contains unevaluable dimensions (which can happen during e.g. checkModel).

Fixes #9160

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/NFFrontEnd/NFComponent.mo

    re4e4270 r37b44b1e  
    989989    output Integer flows = 0;
    990990    output Integer streams = 0;
     991    output Boolean knownSize = true;
    991992  protected
    992993    Type ty;
     
    997998    Integer comp_size = 0, p, f, s;
    998999    Function fn;
     1000    Boolean known_size;
    9991001  algorithm
    10001002    cls := InstNode.getClass(classInstance(component));
     
    10081010      Function.instFunctionNode(eq_node, NFInstContext.NO_CONTEXT, info(component));
    10091011      fn := listHead(Function.typeNodeCache(eq_node));
    1010       comp_size := Type.sizeOf(Function.returnType(fn));
     1012      ty := Function.returnType(fn);
     1013
     1014      if Type.hasKnownSize(ty) then
     1015        comp_size := Type.sizeOf(ty);
     1016      else
     1017        comp_size := 0;
     1018        knownSize := false;
     1019      end if;
    10111020    else
    10121021      ty := getType(component);
     
    10161025      if isRoot then
    10171026        comp_size := 1;
     1027      elseif Type.hasKnownSize(ty) then
     1028        comp_size := Dimension.sizesProduct(Type.arrayDims(ty));
    10181029      else
    1019         comp_size := Dimension.sizesProduct(Type.arrayDims(ty));
     1030        comp_size := 0;
     1031        knownSize := false;
    10201032      end if;
    10211033
     
    10261038        if Type.isRecord(ty) or isRoot then
    10271039          for c in ClassTree.getComponents(Class.classTree(cls)) loop
    1028             (p, f, s) := countConnectorVars(InstNode.component(c), false);
     1040            (p, f, s, known_size) := countConnectorVars(InstNode.component(c), false);
    10291041            potentials := potentials + p * comp_size;
    10301042            flows := flows + f * comp_size;
    10311043            streams := streams + s * comp_size;
     1044            knownSize := known_size and knownSize;
    10321045          end for;
    10331046        end if;
  • OMCompiler/Compiler/NFFrontEnd/NFTyping.mo

    rf3c607f r37b44b1e  
    340340protected
    341341  Integer pots, flows, streams;
     342  Boolean known_size;
    342343  Component comp;
    343344  InstNode parent;
     
    354355  end if;
    355356
    356   (pots, flows, streams) := Component.countConnectorVars(comp);
     357  (pots, flows, streams, known_size) := Component.countConnectorVars(comp);
     358
     359  if not known_size then
     360    return;
     361  end if;
    357362
    358363  // Modelica 3.2 section 9.3.1:
  • testsuite/flattening/modelica/connectors/Makefile

    r802adce r37b44b1e  
    4343ConnectorBalance6.mo \
    4444ConnectorBalance7.mo \
     45ConnectorBalance8.mos \
    4546ConnectorComponents.mo \
    4647ConnectorCompOrder.mo \
Note: See TracChangeset for help on using the changeset viewer.