Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions chapters/connectors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ \subsection{Connection Graphs and Their Operators}\label{overconstrained-equatio
The edges of the virtual connection graph are implicitly defined by \lstinline!connect! and explicitly by \lstinline!Connections.branch!, see table below.
\lstinline!Connections! is a built-in package in global scope containing built-in operators.
Additionally, corresponding nodes of the virtual connection graph have to be defined as roots or as potential roots with functions \lstinline!Connections.root! and \lstinline!Connections.potentialRoot!, respectively.
Furthermore there is \lstinline!Connections.uniqueRoot! which is a simpler variant that can only have one root without any loops.

The overconstrained equation operators for connection graphs are listed below.
Here, \lstinline!a! and \lstinline!b! are connector instances that may be hierarchically structured, e.g., \lstinline!a! may be an abbreviation for \lstinline!enginePort.frame_a!.
Expand All @@ -815,6 +816,8 @@ \subsection{Connection Graphs and Their Operators}\label{overconstrained-equatio
{\lstinline!Connections.potentialRoot(a.R, $\ldots$)!} & Potential root node & \Cref{modelica:Connections.potentialRoot}\\
{\lstinline!Connections.isRoot(a.R)!} & Predicate for being selected as root & \Cref{modelica:Connections.isRoot}\\
{\lstinline!Connections.rooted(a.R)!} & Predicate for being closer to root & \Cref{modelica:Connections.rooted}\\
{\lstinline!Connections.uniqueRoot(a.R, msg)!} & Define a unique root node & \Cref{modelica:Connections.uniqueRoot}\\
{\lstinline!Connections.uniqueRootIndices(a.R, b.R)!} & Checking structure of root indices & \Cref{modelica:Connections.uniqueRootIndices}\\
\hline
\end{tabular}
\end{center}
Expand Down Expand Up @@ -903,6 +906,41 @@ \subsection{Connection Graphs and Their Operators}\label{overconstrained-equatio
\end{semantics}
\end{operatordefinition}

\begin{operatordefinition}[Connections.uniqueRoot]
\begin{synopsis}\begin{lstlisting}
Connections.uniqueRoot(a.R, msg)
\end{lstlisting}\end{synopsis}
\begin{semantics}
The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!a! is a \firstuse[definite root node]{(definite) root node}\index{root node!definite} in a virtual connection graph.
The input \lstinline!a! may be an array, in which case the operator is applied to each element of the array.
Every virtual state diagram graph must have exactly one \lstinline!uniqueRoot! definition (and no normal or potential roots), before breakable branches are removed.
The second argument is a message that shall be reported if the root is not unique together with the component paths of the roots; if two unique roots are connected and the message arguments are different either or both arguments may be used.

\begin{nonnormative}
This definition shall be used if in a model with connector \lstinline!a! the overdetermined record \lstinline!a.R! is (consistently) assigned, e.g., from a parameter expressions, and the overdetermined connectors do not allow multiple roots.
It is used for the \lstinline!Modelica_StateGraph2! library.
\end{nonnormative}
\end{semantics}
\end{operatordefinition}

\begin{operatordefinition}[Connections.uniqueRootIndices]
\begin{synopsis}\begin{lstlisting}
Connections.uniqueRoot(a.R, b.R, msg)
\end{lstlisting}\end{synopsis}
\begin{semantics}
The arguments \lstinline!a.R! and \lstinline!b.R! shall be vectors of overdetermined types or record instances, and \lstinline!size(b.R, 1)<=size(a.R, 1)!.
The arguments \lstinline!a.R! must be unique roots.
The result is an integer vector, \lstinline!rootIndices!, of length \lstinline!size(a.R, 1)! containing a permutation of \lstinline!1:size(a.R, 1)! such that:
There is a (unique) path from \lstinline!a[rootIndices[i]].R! to \lstinline!b[i].R! if \lstinline!i<=size(b.R,1)!.
There is no path from \lstinline!a[rootIndices[i]].R! to any \lstinline!b.R! if \lstinline!i>size(b.R,1)!.
In case no such vector exist an error message should be given and include the third argument \lstinline!msg!.

\begin{nonnormative}
This is used for checking parallel connections in the \lstinline!Modelica_StateGraph2! library.
\end{nonnormative}
\end{semantics}
\end{operatordefinition}

\begin{nonnormative}
Note, that \lstinline!Connections.branch!, \lstinline!Connections.root!, \lstinline!Connections.potentialRoot! do not generate equations.
They only generate nodes and edges in the virtual graph for analysis purposes.
Expand Down
4 changes: 2 additions & 2 deletions chapters/equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ \subsection{Connect-Equations}\label{connect-equations}
connect "(" component-reference "," component-reference ")" ";"
\end{lstlisting}

These can be placed inside \lstinline!for!-equations and \lstinline!if!-equations; provided the indices of the \lstinline!for!-loop and conditions of the \lstinline!if!-equation are evaluable expressions that do not depend on \lstinline!cardinality!, \lstinline!rooted!, \lstinline!Connections.rooted!, or \lstinline!Connections.isRoot!.
These can be placed inside \lstinline!for!-equations and \lstinline!if!-equations; provided the indices of the \lstinline!for!-loop and conditions of the \lstinline!if!-equation are evaluable expressions that do not depend on \lstinline!cardinality!, \lstinline!rooted!, \lstinline!Connections.rooted!, \lstinline!Connections.isRoot!, or \lstinline!Connections.uniqueRootIndices!.
The \lstinline!for!-equations/\lstinline!if!-equations are expanded.
\lstinline!connect!-equations are described in detail in \cref{connect-equations-and-connectors}.

The same restrictions apply to \lstinline!Connections.branch!, \lstinline!Connections.root!, and \lstinline!Connections.potentialRoot!; which after expansion are handled according to \cref{equation-operators-for-overconstrained-connection-based-equation-systems1}.
The same restrictions apply to \lstinline!Connections.branch!, \lstinline!Connections.root!, \lstinline!Connections.potentialRoot!, and \lstinline!Connections.uniqueRoot!; which after expansion are handled according to \cref{equation-operators-for-overconstrained-connection-based-equation-systems1}.

\subsection{If-Equations}\label{if-equations}

Expand Down
2 changes: 2 additions & 0 deletions chapters/operatorsandexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,8 @@ \subsection{Evaluable Expressions}\label{evaluable-expressions}
\lstinline!Connections.isRoot(A.R)!
\item
\lstinline!Connections.rooted(A.R)!
\item
\lstinline!Connections.uniqueRootIndices!
\end{itemize}
\end{itemize}

Expand Down