Changeset f6e7c77 in OpenModelica


Ignore:
Timestamp:
2012-11-20T10:34:17+01:00 (11 years ago)
Author:
Per Östlund <per.ostlund@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
69de9ca
Parents:
2c58d767
Message:
  • Fixed connect with multiple inheritance, in both old and new instantiation.
  • Added test case MultipleInheritanceConnect and updated Modelica.Fluid.Examples.HeatingSystem test which is now balanced.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13982 f25d12d1-65f4-0310-ae8a-bbce733d8d8e

Location:
Compiler/FrontEnd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Compiler/FrontEnd/ConnectUtil.mo

    r09fafda9 rf6e7c77  
    150150      then inChildSets;
    151151
     152    // Check if the node already exists. In that case it's probably due to
     153    // multiple inheritance and we should ignore it.
     154    case (Connect.SETS(sets = Connect.SET_TRIE_NODE(nodes = nodes)),
     155        Connect.SETS(sets = node))
     156      equation
     157        name = setTrieNodeName(node);
     158        _ = setTrieGetNode(name, nodes);
     159      then
     160        inParentSets;
     161
    152162    // In the normal case we add the trie on the child sets to the parent, and
    153163    // also merge their lists of connection crefs and outer connects.
     
    12531263  end match;
    12541264end setTrieNewNode;
     1265
     1266protected function setTrieNodeName
     1267  input SetTrieNode inNode;
     1268  output String outName;
     1269algorithm
     1270  outName := match(inNode)
     1271    local
     1272      String name;
     1273
     1274    case Connect.SET_TRIE_NODE(name = name) then name;
     1275    case Connect.SET_TRIE_LEAF(name = name) then name;
     1276    case Connect.SET_TRIE_DELETED(name = name) then name;
     1277
     1278  end match;
     1279end setTrieNodeName;
    12551280
    12561281protected function mergeSets
  • Compiler/FrontEnd/ConnectUtil2.mo

    rb9444fb rf6e7c77  
    683683  "Determines the face of a connector element, i.e. inside or outside. A
    684684   connector element is outside if the first identifier in the cref is a
    685    connector, otherwise inside. This function takes the optional component
    686    returned from lookupConnectorCref instead of a cref though."
    687   input Option<Component> inPrefixComponent;
     685   connector, otherwise inside."
     686  input DAE.ComponentRef inCref;
     687  input Component inComponent;
    688688  output Face outFace;
    689689algorithm
    690   outFace := match(inPrefixComponent)
     690  outFace := match(inCref, inComponent)
    691691    local
    692692      Component comp;
     
    694694      Face face;
    695695
    696     // No prefix component means a simple identifier, i.e. the connector element
    697     // itself is the first identifier.
    698     case NONE() then Connect2.OUTSIDE();
    699 
    700     // A prefix component, face depends on if it's a connector or not.
    701     case SOME(comp)
    702       equation
     696    // Non-qualified connector crefs are always outside.
     697    case (DAE.CREF_IDENT(ident = _), _) then Connect2.OUTSIDE();
     698
     699    // Qualified connector crefs are allowed to be on two forms: m.c or
     700    // c1.c2.c3..., where m is a non-connector component and cN a connector.
     701    // To determine the face of a connector we only need to look at the parent
     702    // of the given connector element.
     703    case (DAE.CREF_QUAL(ident = _), _)
     704      equation
     705        SOME(comp) = InstUtil.getComponentParent(inComponent);
    703706        is_conn = InstUtil.isConnectorComponent(comp);
    704707        // Connector => outside, not connector => inside.
     
    709712  end match;
    710713end getConnectorFace;
    711 
     714       
    712715public function isConstOrComplexConnector
    713716  input Connector inConnector;
  • Compiler/FrontEnd/Typing.mo

    rb9444fb rf6e7c77  
    15361536        (cref, comp, pre_comp) =
    15371537          lookupConnectorCref(inCref, inPrefix, inSymbolTable, inInfo);
    1538         (cref, face, is_deleted) = typeConnectorCref2(cref, comp, pre_comp, inInfo);
     1538        (cref, face, is_deleted) = typeConnectorCref2(cref, inCref, comp, pre_comp, inInfo);
    15391539      then
    15401540        (cref, face, comp, is_deleted);
     
    15451545protected function typeConnectorCref2
    15461546  input DAE.ComponentRef inCref;
     1547  input DAE.ComponentRef inUnprefixedCref;
    15471548  input Option<Component> inComponent;
    15481549  input Option<Component> inPrefixComponent;
     
    15531554algorithm
    15541555  (outCref, outFace, outIsDeleted) :=
    1555   match(inCref, inComponent, inPrefixComponent, inInfo)
     1556  match(inCref, inUnprefixedCref, inComponent, inPrefixComponent, inInfo)
    15561557    local
    15571558      Face face;
     
    15631564
    15641565    // A connector that is part of a deleted conditional component.
    1565     case (_, NONE(), NONE(), _)
     1566    case (_, _, NONE(), NONE(), _)
    15661567      then (inCref, Connect2.NO_FACE(), true);
    15671568
    15681569    // A connector which is itself deleted.
    1569     case (_, SOME(InstTypes.DELETED_COMPONENT(_)), _, _)
     1570    case (_, _, SOME(InstTypes.DELETED_COMPONENT(_)), _, _)
    15701571      then (inCref, Connect2.NO_FACE(), true);
    15711572
    15721573    // A component that should be added to an expandable connector. It can only
    15731574    // be outside, since only connectors on the form m.c are inside.
    1574     case (_, NONE(), SOME(comp), _)
     1575    case (_, _, NONE(), SOME(comp), _)
    15751576      equation
    15761577        /* ------------------------------------------------------------------*/
     
    15851586
    15861587    // A normal connector.
    1587     case (cref, SOME(comp), _, _)
     1588    case (cref, _, SOME(comp), _, _)
    15881589      equation
    15891590        /* ------------------------------------------------------------------*/
     
    15911592        /* ------------------------------------------------------------------*/
    15921593        ConnectCheck.checkComponentIsConnector(comp, inPrefixComponent, inCref, inInfo);
    1593         face = ConnectUtil2.getConnectorFace(inPrefixComponent);
     1594        face = ConnectUtil2.getConnectorFace(inUnprefixedCref, comp);
    15941595        cref = InstUtil.typeCrefWithComponent(cref, comp);
    15951596      then
     
    16531654      equation
    16541655        comp = InstSymbolTable.lookupCref(inCref, inSymbolTable);
    1655         opt_pre_comp = InstUtil.getComponentParent(comp);
    1656       then
    1657         (SOME(comp), opt_pre_comp);
     1656      then
     1657        (SOME(comp), NONE());
    16581658
    16591659    // If the cref is qualified but we couldn't find it, it might be part of a
Note: See TracChangeset for help on using the changeset viewer.