function getChainLength extends Modelica.Icons.Function; import Modelica.Math.Vectors.find; input Integer startLinkIdx; input Integer connectionMatrix[:, 2]; output Integer chainLength; end getChainLength;