Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit df1914c

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Fix ConnectEquations.associatedFlowCref.
- Handle arrays of connectors in associatedFlowCref too. Belonging to [master]: - #2643
1 parent 2fa8c5e commit df1914c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Compiler/NFFrontEnd/NFConnectEquations.mo

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -787,19 +787,20 @@ function associatedFlowCref
787787
stream cref."
788788
input ComponentRef streamCref;
789789
output ComponentRef flowCref;
790+
protected
791+
Type ty;
792+
ComponentRef rest_cr;
793+
InstNode flow_node;
790794
algorithm
791-
flowCref := match streamCref
792-
local
793-
InstNode flow_node;
795+
ComponentRef.CREF(ty = ty, restCref = rest_cr) := streamCref;
794796

797+
flowCref := match Type.arrayElementType(ty)
795798
// A connector with a single flow, append the flow node to the cref and return it.
796-
case ComponentRef.CREF(ty = Type.COMPLEX(complexTy = ComplexType.CONNECTOR(flows = {flow_node})))
799+
case Type.COMPLEX(complexTy = ComplexType.CONNECTOR(flows = {flow_node}))
797800
then ComponentRef.prefixCref(flow_node, InstNode.getType(flow_node), {}, streamCref);
798801

799802
// Otherwise, remove the first part of the cref and try again.
800-
case ComponentRef.CREF()
801-
then associatedFlowCref(streamCref.restCref);
802-
803+
else associatedFlowCref(rest_cr);
803804
end match;
804805
end associatedFlowCref;
805806

0 commit comments

Comments
 (0)