Skip to content

Commit

Permalink
Migrate more terms from glossary
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Dec 9, 2020
1 parent 28423cf commit 8a1fd1c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 65 deletions.
5 changes: 1 addition & 4 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,7 @@ \subsection{Component Instance}\label{component-instance}

\subsection{Extends clause}\label{extends-clause}

Each extends-clause (and short-class-definition, as stated in \cref{annotations-for-graphical-objects})
may have layer specific annotations which describe
the rendering of the base class' icon and diagram layers in the
subclass.
Each extends-clause (and short-class-definition, as stated in \cref{annotations-for-graphical-objects}) may have layer specific annotations which describe the rendering of the base class' icon and diagram layers in the derived class.

\begin{lstlisting}[language=modelica]
record IconMap
Expand Down
10 changes: 6 additions & 4 deletions chapters/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ \subsection{Component Declaration Static Semantics}\label{component-declaration-

\subsubsection{Declaration Equations}\label{declaration-equations}

An environment that defines the value of a component of built-in type is
said to define a declaration equation associated with the declared
component. For declarations of vectors and matrices, declaration
equations are associated with each element.
An environment that defines the value of a component of built-in type is said to define a \firstuse{declaration equation} associated with the declared component.
% Note: In variability-of-expressions, it's called a "binding equation", not "declaration equation".
The declaration equation is of the form \lstinline!x = expression! defined by a component declaration, where \lstinline!expression! must not have higher variability than the declared component \lstinline!x! (see \cref{variability-of-expressions}).
Unlike other equations, a declaration equation can be overridden (replaced or removed) by an element modification.

For declarations of vectors and matrices, declaration equations are associated with each element.

Only components of the specialized classes \lstinline!type!, \lstinline!record!, \lstinline!operator record!, and \lstinline!connector!, or components of classes inheriting from \lstinline!ExternalObject! may have declaration equations.
See also the corresponding rule for algorithms, \cref{restrictions-on-assigned-variables}.
Expand Down
22 changes: 9 additions & 13 deletions chapters/equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@ \chapter{Equations}\label{equations}

\section{Equation Categories}\label{equation-categories}

Equations in Modelica can be classified into different categories
depending on the syntactic context in which they occur:
Equations in Modelica can be classified into different categories depending on the syntactic context in which they occur:
\begin{itemize}
\item
\emph{Normal equality equations} occurring in equation sections,
including connect-equations and other equation types of special
syntactic form (\cref{equations-in-equation-sections}).
Normal equality equations occurring in equation sections, including connect-equations and other equation types of special syntactic form (\cref{equations-in-equation-sections}).
\item
\emph{Declaration equations}, which are part of variable, parameter,
or constant declarations (\cref{declaration-equations}).
Declaration equations, which are part of variable, parameter, or constant declarations (\cref{declaration-equations}).
\item
\emph{Modification equations}, which are commonly used to modify
attributes of classes (\cref{modifications}).
Modification equations, which are commonly used to modify attributes of classes (\cref{modifications}).
\item
\emph{Binding equations}, which include both declaration equations and
modification equations (for the value itself).
\firstuse{Binding equations}\index{binding equation}, which include both declaration equations and element modification for the value of the variable itself.
These are considered equations when appearing outside functions, and then a component with a binding equation has its value bound to some expression.
(Binding equations can also appear in functions, see \cref{initialization-and-binding-equations-of-components-in-functions}.)
\item
\emph{Initial equations}, which are used to express equations for
solving initialization problems (\cref{initialization-initial-equation-and-initial-algorithm}).
\willintroduce{Initial equations}, which are used to express equations for solving initialization problems (\cref{initialization-initial-equation-and-initial-algorithm}).
\end{itemize}


\section{Flattening and Lookup in Equations}\label{flattening-and-lookup-in-equations}

A flattened equation is identical to the corresponding nonflattened
Expand Down
14 changes: 6 additions & 8 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,8 @@ \subsection{Initialization and Binding Equations of Components in Functions}
constants.
\end{itemize}

When a function is called components of a function do not have
start-attributes. However, a binding equation (\lstinline!= expression!) with
an expression may be present for a component.
When a function is called components of a function do not have start-attributes.
However, a binding equation\index{binding equation!in function} (\lstinline!= expression!) with an expression may be present for a component.
\begin{nonnormative}
Declaration assignments of the form \lstinline!:= expression! are deprecated, but otherwise identical to binding equations.
\end{nonnormative}
Expand All @@ -737,12 +736,11 @@ \subsection{Initialization and Binding Equations of Components in Functions}
is not used before its binding equations has been executed; it is
an error if no such order exists (i.e.\ the binding must be acyclic).

% The first sentence below needs clarification: clearly, binding equation can also be used for components outside functions.
Binding equations can only be used for components of a function.
If no binding equation is given for a non-input component the
variable is uninitialized (except for record components where modifiers
may also initialize that component). It is an error to use (or return)
an uninitialized variable in a function. Binding equations for input
formal parameters are interpreted as default arguments, as described in
If no binding equation is given for a non-input component the variable is uninitialized (except for record components where modifiers may also initialize that component).
It is an error to use (or return) an uninitialized variable in a function.
Binding equations for input formal parameters are interpreted as default arguments, as described in
\cref{positional-or-named-input-arguments-of-functions}.

\begin{nonnormative}
Expand Down
22 changes: 0 additions & 22 deletions chapters/glossary.tex
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
\chapter{Glossary}\label{glossary}

\glossaryitem{base class}: class A is called a base class of B, if class B
extends class A. This relation is specified by an extends clause in B or
in one of B's base classes. A class inherits all elements from its base
classes, and may modify all non-final elements inherited from base
classes. (See \cref{inheritance-extends-clause}.)

\glossaryitem{binding equation}: Either a declaration equation or an element
modification for the value of the variable. In a non-function a component with a binding
equation has its value bound to some expression. (See \cref{equation-categories}.)
In a function an input component uses the value of the binding equation as default value,
a non-input component starts with that value.
(See \cref{initialization-and-binding-equations-of-components-in-functions}.)

\glossaryitem{class}: a description that generates an object called instance.
The description consists of a class definition, a modification
environment that modifies the class definition, an optional list of
Expand Down Expand Up @@ -40,15 +27,6 @@ \chapter{Glossary}\label{glossary}

\glossaryitem{declaration assignment}: Deprecated name for binding equation in function.

\glossaryitem{declaration equation}: Equation of the form \lstinline!x = expression!
defined by a component declaration. The expression must not have higher
variability than the declared component x. Unlike other equations, a
declaration equation can be overridden (replaced or removed) by an
element modification. (See \cref{declaration-equations}.)

\glossaryitem{derived class} or \glossaryitem{subclass} or \glossaryitem{extended class}:
class B is called derived from A, if B extends A. (See \cref{inheritance-modification-and-redeclaration}.)

\glossaryitem{element}: part of a class definition, one of: class definition,
component declaration, or extends clause. Component declarations and
class definitions are called named elements. An element is either
Expand Down
25 changes: 11 additions & 14 deletions chapters/inheritance.tex
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
\chapter{Inheritance, Modification, and Redeclaration}\label{inheritance-modification-and-redeclaration}

One of the major benefits of object-orientation is the ability to
\emph{extend} the behavior and properties of an existing class. The
original class, known as the \emph{base class}, is extended to create a
more specialized version of that class, known as the \emph{derived
class} or \emph{subclass}. In this process, the data and behavior of the
original class in the form of variable declarations, equations, and
certain other contents are reused, or \emph{inherited}, by the subclass.
In fact, the inherited contents is copied from the superclass into the
subclass, but before copying certain operations, such as type expansion,
checking, and modification, are performed on the inherited contents when
appropriate. This chapter describes the inheritance concept in Modelica,
together with the related concepts modification and redeclaration.
One of the major benefits of object-orientation is the ability to \emph{extend} the behavior and properties of an existing class.
The original class, known as the \willintroduce{base class}, is extended to create a more specialized version of that class, known as the \willintroduce{derived class}.
In this process, the data and behavior of the original class in the form of variable declarations, equations, and certain other contents are reused, or \emph{inherited}, by the derived class.
In fact, the inherited contents is copied from the superclass into the derived class, but before copying certain operations, such as type expansion, checking, and modification, are performed on the inherited contents when appropriate.
This chapter describes the inheritance concept in Modelica, together with the related concepts modification and redeclaration.

\section{Inheritance -- Extends Clause}\label{inheritance-extends-clause}

The class \lstinline!A! is called a \firstuse{base class}\index{base class} of \lstinline!B!, if \lstinline!B! extends \lstinline!A!.
The converse relation is then expressed as \lstinline!B! being a \firstuse{derived class}\index{derived class} of \lstinline!A!, or as \lstinline!B! being \firstuse{derived from} \lstinline!A!.
This relation is specified by an extends-clause in \lstinline!B! or in one of \lstinline!B!'s base classes.
A class inherits all elements from its base classes, and may modify all non-final elements inherited from base classes, as explained below.

The extends-clause is used to specify inheritance from a base class into an (enclosing) class containing the extends-clause.
The syntax of the extends-clause is as follows:
\begin{lstlisting}[language=grammar]
Expand Down Expand Up @@ -271,8 +269,7 @@ \section{Modifications}\label{modifications}
\end{lstlisting}
\end{example}

A modification (e.g.\ \lstinline!C1 c1(x = 5)!) is considered a modification equation,
if the modified variable (here: \lstinline!c1.x!) is a non-parameter variable.
A modification (e.g., \lstinline!C1 c1(x = 5)!) is called a \firstuse{modification equation}\index{modification equation}, if the modified variable (here: \lstinline!c1.x!) is a non-parameter variable.

\begin{nonnormative}
The modification equation is created, if the modified component (here: \lstinline!c1!) is also created (see \cref{class-declarations}). In most cases
Expand Down

0 comments on commit 8a1fd1c

Please sign in to comment.