Skip to content

Commit

Permalink
Cleanup related to 'input'
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 13, 2020
1 parent 6705aee commit f9a076b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 63 deletions.
21 changes: 4 additions & 17 deletions chapters/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -215,26 +215,20 @@ \subsubsection{Declaration Equations}\label{declaration-equations}

\subsubsection{Prefix Rules}\label{prefix-rules}

Variables declared with the \lstinline!flow! or the \lstinline!stream! type prefix shall be a
subtype of Real.
Variables declared with the \lstinline!flow! or the \lstinline!stream! type prefix shall be a subtype of \lstinline!Real!.

Type prefixes (that is, \lstinline!flow!, \lstinline!stream!, \lstinline!discrete!, \lstinline!parameter!, \lstinline!constant!, \lstinline!input!, \lstinline!output!) shall only be applied for type,
record and connector components -- see also record specialized class, \cref{specialized-classes}.

An exception is \lstinline!input! for components whose type is of the special class
function type (these can only be used for function formal parameters and
has special semantics, see \cref{functional-input-arguments-to-functions}), and the \lstinline!input! prefix is not
applied to the elements of the component and is allowed even if the
elements have input or output prefix.
An exception is \lstinline!input! for components whose type is of the special class function type (these can only be used for function formal parameters and has special semantics, see \cref{functional-input-arguments-to-functions}), and the \lstinline!input! prefix is not applied to the elements of the component and is allowed even if the elements have \lstinline!input! or \lstinline!output! prefix.

In addition, instances of classes extending from \lstinline!ExternalObject! may have type prefixes \lstinline!parameter! and \lstinline!constant!, and in functions also type prefixes
\lstinline!input! and \lstinline!output!, see \cref{external-objects}.

The type prefixes \lstinline!flow!, \lstinline!stream!, \lstinline!input! and \lstinline!output! of a structured component (except as described above) are also applied to the elements of the component (this is done after verifying that the type prefixes occurring on elements of the component are correct; e.g.\ the \lstinline!flow! prefix can be used on a record component and all the record elements will generate zero-sum equations, even if elements of a record shall not be declared with the \lstinline!flow! prefix). When any of the type prefixes \lstinline!flow!, \lstinline!stream!, \lstinline!input! and \lstinline!output! are applied for a structured component, no element of the component may have any of these type prefixes. The corresponding rules for the type prefixes \lstinline!discrete!, \lstinline!parameter! and \lstinline!constant! are described in \cref{variability-of-structured-entities} for structured components.

\begin{example}
\lstinline!input! can only be used, if none of the elements has a \lstinline!flow!, \lstinline!stream!, \lstinline!input! or
\lstinline!output! type prefix.
\lstinline!input! can only be used, if none of the elements has a \lstinline!flow!, \lstinline!stream!, \lstinline!input! or \lstinline!output! type prefix.
\end{example}

The prefixes \lstinline!input! and \lstinline!output! have a slightly different semantic meaning
Expand All @@ -246,14 +240,7 @@ \subsubsection{Prefix Rules}\label{prefix-rules}
variables declared as \lstinline!output! are computed in the function body, see
\cref{function-call}.
\item
In \emph{simulation} \emph{models} and \emph{blocks} (i.e., on the top
level of a model or block that shall be simulated), these prefixes
define the interaction with the environment where the simulation model
or block is used. Especially, the \lstinline!input! prefix defines that values for
such a variable have to be provided from the simulation environment
and the \lstinline!output! prefix defines that the values of the corresponding
variable can be directly utilized in the simulation environment, see
the notion of Globally balanced in \cref{balanced-models}.
In \emph{simulation} \emph{models} and \emph{blocks} (i.e., on the top level of a model or block that shall be simulated), these prefixes define the interaction with the environment where the simulation model or block is used. Especially, the \lstinline!input! prefix defines that values for such a variable have to be provided from the simulation environment and the \lstinline!output! prefix defines that the values of the corresponding variable can be directly utilized in the simulation environment, see the notion of \emph{globally balanced} in \cref{balanced-models}.
\item
In component \emph{models} and \emph{blocks}, the \lstinline!input! prefix defines
that a binding equation has to be provided for the corresponding
Expand Down
27 changes: 7 additions & 20 deletions chapters/connectors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -131,39 +131,26 @@ \subsection{Expandable Connectors}\label{expandable-connectors}
The expandable connector instance is automatically augmented with a
new component having the used name and corresponding type.
\item
If the undeclared component is subscripted, an array variable is created, and a connection to the specific array element is performed. Introducing elements in an
array gives an array with at least the specified elements, other elements are either not created or have a default value (i.e.\ as if they were only potentially present,
and the same note regarding the use of `size` also applies here).
If the undeclared component is subscripted, an array variable is created, and a connection to the specific array element is performed. Introducing elements in an array gives an array with at least the specified elements, other elements are either not created or have a default value (i.e.\ as if they were only potentially present, and the same note regarding the use of \lstinline!size! also applies here).
\item
If the variable on the other side of the connect-equation is input or output the new component will be either input or output to satisfy the restrictions in
\cref{restrictions-of-connections-and-connectors} for a non-expandable connector.
If the variable on the other side of the connect-equation is \lstinline!input! or \lstinline!output! the new component will be either \lstinline!input! or \lstinline!output! to satisfy the restrictions in \cref{restrictions-of-connections-and-connectors} for a non-expandable connector.
\begin{nonnormative}
If the existing side refers to an inside connector (i.e.\ a connector of a component) the new variable will copy its causality, i.e.\ input
if input and output if output, since the expandable connector must be an outside connector.
If the existing side refers to an inside connector (i.e.\ a connector of a component) the new variable will copy its causality, i.e.\ \lstinline!input! if \lstinline!input! and \lstinline!output! if \lstinline!output!, since the expandable connector must be an outside connector.
\end{nonnormative}
For an array the input/output property can be deduced separately for each array element.
For an array the \lstinline!input!/\lstinline!output! property can be deduced separately for each array element.
\end{itemize}

\item
When two expandable connectors are connected, each is augmented with
the variables that are only declared in the other expandable connector
(the new variables are neither input nor output). This is repeated
until all connected expandable connector instances have matching
variables.
When two expandable connectors are connected, each is augmented with the variables that are only declared in the other expandable connector (the new variables are neither \lstinline!input! nor \lstinline!output!). This is repeated until all connected expandable connector instances have matching variables.
\begin{nonnormative}
I.e.\ each of the connector instances is expanded to be the union of all connector variables.
\end{nonnormative}

\item
The variables introduced in the elaboration follow additional rules
for generating connection sets (given in \cref{generation-of-connection-equations}).
The variables introduced in the elaboration follow additional rules for generating connection sets (given in \cref{generation-of-connection-equations}).

\item
If a variable appears as an input in one expandable connector, it
should appear as a non-input in at least one other expandable
connector instance in the same augmentation set. An augmentation set
is defined as the set of connected expandable connector instances that
through the elaboration will have matching variables.
If a variable appears as an \lstinline!input! in one expandable connector, it should appear as a non-\lstinline!input! in at least one other expandable connector instance in the same augmentation set. An augmentation set is defined as the set of connected expandable connector instances that through the elaboration will have matching variables.
\begin{example}
\begin{lstlisting}[language=modelica]
expandable connector EngineBus
Expand Down
3 changes: 1 addition & 2 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,7 @@ \section{External Function Interface}\label{external-function-interface}
end IDENT;
\end{lstlisting}

Components in the public part of an external function declaration shall
be declared either as input or output.
Components in the public part of an external function declaration shall be declared either as \lstinline!input! or \lstinline!output!.

\begin{nonnormative}
This is just as for any other function. The components in the protected part allow local variables for temporary storage to be declared.
Expand Down
27 changes: 6 additions & 21 deletions chapters/interface.tex
Original file line number Diff line number Diff line change
Expand Up @@ -338,31 +338,22 @@ \section{Interface Compatibility or Subtyping}\label{interface-compatibility-or-
component interface of \lstinline!B! there must thus exist a plug-compatible
element with the same name in the component interface of \lstinline!A!.
\item
Additional restrictions on the additional information. These elements
should either match or have a natural total order:

Additional restrictions on the additional information. These elements should either match or have a natural total order:
\begin{itemize}
\item
If \lstinline!B! is a non-replaceable long class definition \lstinline!A! must also be a
long class definition.
\item
The \lstinline!flow! or \lstinline!stream! prefix should be matched for compatibility.
\item
Variability is ordered \lstinline!constant! \textless{} \lstinline!parameter! \textless{}
\lstinline!discrete! \textless{} continuous-time (\lstinline!Real! without prefix), and \lstinline!A! is
only compatible with \lstinline!B! if the declared variability in \lstinline!A! is less than
or equal the variability in \lstinline!B!.
Declared variability is ordered \lstinline!constant! \textless{} \lstinline!parameter! \textless{} \lstinline!discrete! \textless{} continuous-time (\lstinline!Real! without prefix), and \lstinline!A! is only compatible with \lstinline!B! if the declared variability in \lstinline!A! is less than or equal the variability in \lstinline!B!.
\begin{nonnormative}
For a redeclaration of an element the variability prefix is as default inherited by the redeclaration (i.e.\ no need to repeat \lstinline!parameter!
when redeclaring a parameter).
For a redeclaration of an element the variability prefix is as default inherited by the redeclaration (i.e.\ no need to repeat \lstinline!parameter! when redeclaring a parameter).
\end{nonnormative}
\item
The input and output prefixes must be matched. This ensures that the
rules regarding inputs/outputs for matching connectors and
(non-connector inputs) are preserved, as well as the restriction on
blocks.
The \lstinline!input! and \lstinline!output! prefixes must be matched. This ensures that the rules regarding inputs/outputs for matching connectors and (non-connector inputs) are preserved, as well as the restriction on blocks.
\begin{nonnormative}
For a redeclaration of an element the input or output prefix is inherited from the original declaration.
For a redeclaration of an element the \lstinline!input! or \lstinline!output! prefix is inherited from the original declaration.
\end{nonnormative}
\item
The \lstinline!inner! and/or \lstinline!outer! prefixes should be matched.
Expand Down Expand Up @@ -421,13 +412,7 @@ \section{Interface Compatibility or Subtyping}\label{interface-compatibility-or-
\section{Plug-Compatibility or Restricted Subtyping}\label{plug-compatibility-or-restricted-subtyping}

\begin{nonnormative}
If a sub-component is redeclared, see \cref{redeclaration}, it is
impossible to connect to any new connector. A connector with input
prefix must be connected to, and since one cannot connect across
hierarchies, one should not be allowed to introduce such a connector at
a level where a connection is not possible. Therefore all public
components present in the interface A that are not present in B must be
connected by default.
If a sub-component is redeclared, see \cref{redeclaration}, it is impossible to connect to any new connector. A connector with \lstinline!input! prefix must be connected to, and since one cannot connect across hierarchies, one should not be allowed to introduce such a connector at a level where a connection is not possible. Therefore all public components present in the interface \lstinline!A! that are not present in \lstinline!B! must be connected by default.
\end{nonnormative}

\begin{definition}[Plug-compatibility (= restricted subtyping)]
Expand Down
5 changes: 2 additions & 3 deletions chapters/revisions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ \subsection{Main changes in Modelica 3.4}\label{main-changes-in-modelica-3-4}
Clarified that states for first order ODE, \cref{the-number-of-equations-needed-for-initialization}. Ticket
\href{https://github.com/modelica/ModelicaSpecification/issues/937}{\#937}.
\item
Clarified adding input/output prefix for expandable connector
variables, \cref{expandable-connectors}. Ticket
\href{https://github.com/modelica/ModelicaSpecification/issues/829}{\#829}.
Clarified adding \lstinline!input!/\lstinline!output! prefix for expandable connector variables, \cref{expandable-connectors}.
Ticket \href{https://github.com/modelica/ModelicaSpecification/issues/829}{\#829}.
\item
Clarified creating elements in expandable connectors, \cref{expandable-connectors}.
Ticket \href{https://github.com/modelica/ModelicaSpecification/issues/428}{\#428}.
Expand Down

0 comments on commit f9a076b

Please sign in to comment.