Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non optional connector #3129

Merged
merged 17 commits into from
Jul 1, 2022
Merged
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
32 changes: 31 additions & 1 deletion chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ \section{Simulations}\label{annotations-for-simulations}\label{simulations}
\end{annotationdefinition}


\section{Single Use of Class}\label{annotation-for-single-use-of-class}\label{single-use-of-class}
\section{Usage Restrictions}\label{usage-restrictions}
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\subsection{Single Use of Class}\label{annotation-for-single-use-of-class}\label{single-use-of-class}

For state machines it is useful to have single instances of local classes.
This can be done using:
Expand All @@ -458,6 +459,35 @@ \section{Single Use of Class}\label{annotation-for-single-use-of-class}\label{si
The annotation \fmtannotationindex{singleInstance} in a class indicates that there should only be one component instance of the class, and it should be in the same scope as the class is defined.
The intent is to remove the class when the component is removed and to prevent duplication of the component.

\subsection{Connection Restrictions}\label{connection-restrictions}
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved

A connector component declaration may have the following annotation:
\begin{lstlisting}[language=modelica]
annotation(mustBeConnected = "message");
\end{lstlisting}%
\annotationindex{mustBeConnected}

It makes it an error if the connector is not connected from the outside (for a conditional connector this check is only active if the connector is enabled).
For an array of connectors it applies separately to each element.

\begin{nonnormative}
This annotation is intended for non-causal connectors, see \cref{restrictions-of-connections-and-connectors}.
It is particularly suited for stream connectors, see \cref{stream-connectors}.
\end{nonnormative}

\begin{example}
This can be used for some optional connectors that should be connected when conditionally enabled.
\begin{lstlisting}[language=modelica]
partial model PartialWithSupport
Flange_b flange;
parameter Boolean useSupport;
Support support if useSupport
annotation(
mustBeConnected = "Support connector should be connected if activated.");
end PartialWithSupport;
\end{lstlisting}
The protected components and connections needed to internally handle the support-connector is omitted.
\end{example}

\section{Graphical Objects}\label{annotations-for-graphical-objects}\label{graphical-objects}

Expand Down
8 changes: 1 addition & 7 deletions chapters/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,8 @@ \subsection{Conditional Component Declaration}\label{conditional-component-decla
Adding the component and then removing it ensures that the component is valid.

If a connect equation defines the connection of a non-conditional component \lstinline!c1! with a conditional component \lstinline!c2! and \lstinline!c2! is de-activated, then \lstinline!c1! must still be a declared element.
\end{nonnormative}

If the condition is true for a public connector containing flow
variables the connector must be connected from the outside.

\begin{nonnormative}
The reason for this restriction is that the default flow equation is probably incorrect (since it could otherwise
be an unconditional connector) and the model cannot check that connector is connected.
There are annotations to handle the case where the connector should be connected when activated, see \cref{annotations-for-the-graphical-user-interface}.
\end{nonnormative}

\section{Class Declarations}\label{class-declarations}
Expand Down