Skip to content

Commit 7f398fa

Browse files
authored
Merge pull request #3212 from HansOlsson/AddMayOnlyConnectOnce
Limiting number of connections.
2 parents 0553160 + ee2e642 commit 7f398fa

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

chapters/annotations.tex

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,38 @@ \subsection{Connection Restrictions}\label{connection-restrictions}
489489
The protected components and connections needed to internally handle the support-connector is omitted.
490490
\end{example}
491491

492+
A connector component declaration may have the following annotation:
493+
\begin{lstlisting}[language=modelica]
494+
annotation(mayOnlyConnectOnce = "message");
495+
\end{lstlisting}%
496+
\annotationindex{mayOnlyConnectOnce}
497+
498+
It makes it an error if the connector is connected from the outside and:
499+
\begin{itemize}
500+
\item For non-stream connectors the connection set has more than two elements.
501+
\item For stream connectors (see \cref{stream-connectors}), the connection set has more than two elements whose flow variable may be negative (based on evaluation of the \lstinline!min!-attribute).
502+
\end{itemize}
503+
For an array of connectors it applies separately to each element.
504+
505+
\begin{nonnormative}
506+
This annotation is intended for non-causal connectors, see \cref{restrictions-of-connections-and-connectors}.
507+
The connection handling operates on connection sets, and thus this restriction should also operate on those sets.
508+
The set handling avoids the case where only one of two equivalent models generate diagnostics.
509+
The stream connector part is primarily intended to exclude sensor-variables, see \cref{connection-of-3-stream-connectors-where-one-mass-flow-rate-is-identical-to-zero-n-3-and}, but also excludes non-reversible outgoing flows.
510+
\end{nonnormative}
511+
512+
\begin{example}
513+
This can be used for components that implement mixing of fluids where it is not desired to combine that with the normal stream-connector mixing.
514+
\begin{lstlisting}[language=modelica]
515+
partial model MultiPort
516+
parameter Integer n = 0 annotation(Dialog(connectorSizing = true));
517+
FluidPort_a port_a(redeclare package Medium = Medium);
518+
FluidPorts_b ports_b[n](redeclare each package Medium = Medium)
519+
annotation (mayOnlyConnectOnce = "Should only connect once per element!");
520+
end MultiPort;
521+
\end{lstlisting}
522+
\end{example}
523+
492524
\section{Graphical Objects}\label{annotations-for-graphical-objects}\label{graphical-objects}
493525

494526
A graphical representation of a class consists of two abstraction

0 commit comments

Comments
 (0)