Skip to content

Commit

Permalink
Migrate remaining glossary entries
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Dec 10, 2020
1 parent 819e819 commit 9c7841e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 168 deletions.
36 changes: 14 additions & 22 deletions chapters/arrays.tex
Expand Up @@ -5,16 +5,13 @@ \chapter{Arrays}\label{arrays}
which in the case of matrices has the consequence that all rows in a
matrix have equal length, and all columns have equal length.

Each array has a certain dimensionality, i.e., number of dimensions. The
degenerate case of a scalar variable is not really an array, but can be
regarded as an array with zero dimensions. Vectors have one dimension,
matrices have two dimensions, etc.
Each array has a certain dimensionality, i.e., number of dimensions.
The degenerate case of a \firstuse{scalar}\index{scalar} variable is not really an array, but can be regarded as an array with zero dimensions.
\firstuse{Vectors}\index{vector} have one dimension, matrices (sing.\ \firstuse{matrix}\index{matrix}) have two dimensions, etc.


So-called row vectors and column vectors do not exist in Modelica and cannot be distinguished since vectors have only one
dimension. If distinguishing these is desired, row matrices and column matrices are available, being the corresponding
two-dimensional entities. However, in practice this is seldom needed since the usual matrix arithmetic and linear algebra
operations have been defined to give the expected behavior when operating on Modelica vectors and matrices.
So-called row vectors and column vectors do not exist in Modelica and cannot be distinguished since vectors have only one dimension.
If distinguishing these is desired, row matrices and column matrices are available, being the corresponding two-dimensional entities.
However, in practice this is seldom needed since the usual matrix arithmetic and linear algebra operations have been defined to give the expected behavior when operating on Modelica vectors and matrices.

Modelica is a strongly typed language, which also applies to array
types. The number of dimensions of an array is fixed and cannot be
Expand All @@ -31,8 +28,7 @@ \chapter{Arrays}\label{arrays}

\section{Array Declarations}\label{array-declarations}

The Modelica type system includes scalar number, vector, matrix (number
of dimensions, ndim=2), and arrays of more than two dimensions.
The Modelica type system includes scalar number, vector, matrix (number of dimensions, ndim=2), and arrays of more than two dimensions.

\begin{nonnormative}
There is no distinction between a row and column vector.
Expand Down Expand Up @@ -945,20 +941,16 @@ \subsection{Vector Construction}\label{vector-construction}

\section{Array Indexing}\label{array-indexing}

The array indexing operator \emph{name}\lstinline![!\emph{...}\lstinline!]! is used to
access array elements for retrieval of their values or for updating
these values. An indexing operation is subject to upper and lower array
dimension index bounds (\cref{array-dimension-lower-and-upper-index-bounds}). The indexing operator takes two or more
operands, where the first operand is the array to be indexed and the rest of the operands are index expressions:
The array indexing operator \lstinline!$\mathit{name}$[$\ldots$]! is used to access array elements for retrieval of their values or for updating these values.
An indexing operation is subject to upper and lower array dimension index bounds (\cref{array-dimension-lower-and-upper-index-bounds}).
The indexing operator takes two or more operands, where the first operand is the array to be indexed and the rest of the operands are \firstuse{index}\index{index} (or \firstuse{subscript}\index{subscript}) expressions:

\lstinline!$\mathit{arrayname}$[$\mathit{indexexpr}_{1}$, $\mathit{indexexpr}_{2}$, $\ldots$]!

A colon is used to denote all indices of one dimension. A vector
expression can be used to pick out selected rows, columns and elements
of vectors, matrices, and arrays. The number of dimensions of the
expression is reduced by the number of scalar index arguments. If the
number of index arguments is smaller than the number of dimensions of
the array, the trailing indices will use `\lstinline!:!'.
A colon (`\lstinline!:!') is used to denote all indices of one dimension.
A vector expression can be used to pick out selected rows, columns and elements of vectors, matrices, and arrays.
The number of dimensions of the expression is reduced by the number of scalar index arguments.
If the number of index arguments is smaller than the number of dimensions of the array, the trailing indices will use `\lstinline!:!'.

It is also possible to use the array access operator to assign to element/elements of an array in algorithm sections.
This is called an \firstuse{indexed assignment statement}\index{assignment statement!indexed}.
Expand Down
12 changes: 11 additions & 1 deletion chapters/classes.tex
Expand Up @@ -162,6 +162,7 @@ \subsection{Component Declaration Static Semantics}\label{component-declaration-

If the \lstinline[language=grammar]!type-specifier! of the component declaration denotes a built-in type (\lstinline!RealType!, \lstinline!IntegerType!, etc.), the flattened or instantiated component has the same type.

% Seems sufficient to just have \indexinline variant of 'partial' in index.
A class defined with \lstinline!partial!\indexinline{partial} in the \lstinline[language=grammar]!class-prefixes! is called a \firstuse{partial} class.
Such a class is allowed to be incomplete, and cannot be instantiated in a simulation model; useful, e.g., as a base-class.

Expand Down Expand Up @@ -214,6 +215,8 @@ \subsubsection{Declaration Equations}\label{declaration-equations}

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

A \firstuse{prefix}\index{prefix} is property of an element of a class definition which can be present or not be present, e.g., \lstinline!final!, \lstinline!public!, \lstinline!flow!.

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,
Expand Down Expand Up @@ -697,7 +700,7 @@ \subsection{Short Class Definitions}\label{short-class-definitions}

\subsection{Restriction on combining base-classes and other elements}\label{restriction-on-combining-base-classes-and-other-elements}

It is not legal to combine other components or base-classes with an extends from an array class, a class with non-empty base-prefix, a simple type (\lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String! and enumeration types), or any class transitively extending from an array class, a class with non-empty base-prefix, or a simple type (\lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String! and enumeration types).
It is not legal to combine other components or base-classes with an extends from an array class, a class with non-empty base-prefix, a \firstuse{simple type}\index{simple type} (\lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String! and enumeration types), or any class transitively extending from an array class, a class with non-empty base-prefix, or a simple type.

\begin{example}
\begin{lstlisting}[language=modelica]
Expand Down Expand Up @@ -1306,6 +1309,12 @@ \section{Balanced Models}\label{balanced-models}

\section{Predefined Types and Classes}\label{predefined-types-and-classes}

% Not including definition of 'predefined type' from old glossary, since it seems inconsistent with actual use, since, at least
% ExternalObject is also described as a predefined type.
% The definition sounds more like the description of 'simple type'.
%One of the types \lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String! and types defined as \lstinline!enumeration! types.
%The component declarations of the predefined types define attributes such as \lstinline!min!, \lstinline!max!, and \lstinline!unit!.

The \firstuse{attributes}\index{attribute} of the predefined variable types (\lstinline!Real!, \lstinline!Integer!, \lstinline!Boolean!, \lstinline!String!) and \lstinline!enumeration! types are described below with Modelica syntax although they are predefined.
All attributes are predefined and attribute values can only be defined using a modification, such as in \lstinline!Real x(unit = "kg")!.
Attributes cannot be accessed using dot notation, and are not constrained by equations and algorithm sections.
Expand All @@ -1324,6 +1333,7 @@ \section{Predefined Types and Classes}\label{predefined-types-and-classes}
\end{nonnormative}

The definitions use \lstinline!RealType!\indexinline{RealType}, \lstinline!IntegerType!\indexinline{IntegerType}, \lstinline!BooleanType!\indexinline{BooleanType}, \lstinline!StringType!\indexinline{StringType}, \lstinline!EnumType!\indexinline{EnumType} as mnemonics corresponding to machine representations.
These are called the \firstuse{primitive types}\index{primitive type}.

\subsection{Real Type}\label{real-type}

Expand Down
4 changes: 4 additions & 0 deletions chapters/equations.tex
Expand Up @@ -7,6 +7,10 @@ \chapter{Equations}\label{equations}
% henrikt-ma: Keeping this sentence from the old glossary only because it mentions the 'instantaneous equations':
Special cases are: initial equations, instantaneous equations, declaration equations.

% Including definition of 'instantaneous' from old glossary here, even though the term isn't really used outside the introductory chapter.
An equation or statement is \firstuse{instantaneous}\index{instantaneous} if it holds only at events, i.e., at single points in time.
The equations and statements of a when-clause are instantaneous, see \cref{when-equations} and \cref{when-statements}.

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

% henrikt-ma: One would have expected this list to also describe the instantaneous equations.
Expand Down
8 changes: 3 additions & 5 deletions chapters/functions.tex
Expand Up @@ -4,7 +4,7 @@ \chapter{Functions}\label{functions}

\section{Function Declaration}\label{function-declaration}

A Modelica function is a specialized class (\cref{function-as-a-specialized-class}) using the keyword \lstinline!function!.
A Modelica \firstuse{function}\index{function} is a specialized class (\cref{function-as-a-specialized-class}) using the keyword \lstinline!function!.
The body of a Modelica function is an algorithm section that contains procedural algorithmic code to be executed when the function is called, or alternatively an external function specifier (\cref{external-function-interface}).
Formal parameters are specified using the \lstinline!input!\indexinline{input} keyword, whereas results are denoted using the \lstinline!output!\indexinline{output} keyword.
This makes the syntax of function definitions quite close to Modelica class definitions, but using the keyword \lstinline!function! instead of \lstinline!class!.
Expand Down Expand Up @@ -918,10 +918,8 @@ \section{Record Constructor Functions}\label{record-constructor-functions}
same name and in the same scope as the record class is implicitly
defined according to the following rules:

The declaration of the record is partially flattened including
inheritance, modifications, redeclarations, and expansion of all names
referring to declarations outside of the scope of the record to their
fully qualified names.
% Warning: 'partial flatteing' doesn't seem to be defined. See 'partial instantitation'.
The declaration of the record is partially flattened including inheritance, modifications, redeclarations, and expansion of all names referring to declarations outside of the scope of the record to their fully qualified names.

\begin{nonnormative}
The partial flattening is performed in order to remove potentially conflicting import-clauses in the record constructor function due to flattening the inheritance tree.
Expand Down
88 changes: 0 additions & 88 deletions chapters/glossary.tex
@@ -1,89 +1 @@
\chapter{Glossary}\label{glossary}

\glossaryitem{flattening}: the computation that creates a flattened class of a
given class, where all inheritance, modification, etc.\ has been
performed and all names resolved, consisting of a flat set of equations,
algorithm sections, component declarations, and functions. (See \cref{flattening-process}.)

\glossaryitem{function}: a class of the specialized class function. (See \cref{functions}.)

\glossaryitem{function subtype} or \glossaryitem{function compatible interface}: A
is a function subtype of B iff A is a subtype of B and the additional
arguments of function A that are not in function B are defined in such a
way (e.g.\ additional arguments need to have default values), that A can
be called at places where B is called. (See \cref{function-compatibility-or-function-subtyping-for-functions}.)

\glossaryitem{identifier} or ident: an atomic (not composed) name. Example:
\lstinline!Resistor! (See \cref{identifiers-names-and-keywords}.)

\glossaryitem{index} or \glossaryitem{subscript}: An expression, typically of \lstinline!Integer! type or the colon symbol (\lstinline!:!), used to reference a component (or a range of components) of an array. (See \cref{array-indexing}.)

\glossaryitem{instantaneous}: An equation or statement is instantaneous if it
holds only at events, i.e., at single points in time. The equations and
statements of a when-clause are instantaneous. (See \cref{when-equations} and
\cref{when-statements}.)

\glossaryitem{literal}: a real, integer, boolean, enumeration, or string
literal. Used to build expressions. (See \cref{literal-constants}.)

\glossaryitem{matrix}: an array where the number of dimensions is 2. (See
\cref{arrays}.)

\glossaryitem{operator record}: A record with user-defined operations;
defining e.g.\ multiplication and addition see \cref{overloaded-operators}.

\glossaryitem{partial}: a class that is incomplete and cannot be instantiated
in a simulation model; useful e.g.\ as a base-class. (See \cref{component-declaration-static-semantics}.)

\glossaryitem{partial flattening}: first find the names of declared local
classes and components. Modifiers, if present, are merged to the local
elements and redeclarations are performed. Then base-classes are looked
up, flattened and inserted into the class. See also flattening, which
additionally flattens local elements and performs modifications. (See
\cref{flattening-process}.)

\glossaryitem{plug-compatibility}: see restricted subtyping and \cref{plug-compatibility-or-restricted-subtyping}.

\glossaryitem{predefined type}: one of the types \lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!,
\lstinline!String! and types defined as \lstinline!enumeration! types. The component
declarations of the predefined types define attributes such as \lstinline!min!, \lstinline!max!,
and \lstinline!unit!. (See \cref{predefined-types-and-classes}.)

\glossaryitem{prefix}: property of an element of a class definition which can
be present or not be present, e.g.\ \lstinline!final!, \lstinline!public!, \lstinline!flow!. (See \cref{prefix-rules}.)

\glossaryitem{primitive type}: one of the built-in types \lstinline!RealType!,
\lstinline!BooleanType!, \lstinline!IntegerType!, \lstinline!StringType!, \lstinline!EnumType!. The primitive types are
used to define attributes and value of predefined types and enumeration
types. (See \cref{predefined-types-and-classes}.)

\glossaryitem{redeclare}: the modifier that changes a replaceable element.
(See \cref{redeclaration})

\glossaryitem{replaceable}: an element that can be replaced by a different
element having a compatible interface. (See \cref{redeclaration})

\glossaryitem{restricted subtyping} or \glossaryitem{plug-compatibility}: a type A
is a restricted subtype of type B iff A is a subtype of B, and all
public components present in A but not in B must be default-connectable.
This is used to avoid introducing, via a redeclaration, an un-connected
connector in the object/class of type A at a level where a connection is
not possible. (See \cref{plug-compatibility-or-restricted-subtyping}.)

\glossaryitem{scalar} or scalar variable: a variable that is not an array.

\glossaryitem{simple type:} \lstinline!Real!, \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String! and enumeration types

\glossaryitem{specialized class}: one of: \lstinline!model!, \lstinline!connector!, \lstinline!package!, \lstinline!record!, \lstinline!block!, \lstinline!function!, \lstinline!type!. The class restriction of a class represents an assertion regarding the content of the class and restricts its use in other classes. For example, a class having the \lstinline!package! class restriction must only contain classes and constants. (See \cref{specialized-classes}.)

\glossaryitem{subtype} or \glossaryitem{interface compatible}: relation between types. \lstinline!A! is a subtype of (interface compatible with) \lstinline!B! iff a number of properties of \lstinline!A! and \lstinline!B! are the same and all important elements of \lstinline!B! have corresponding elements in \lstinline!A! with the same names and their types being subtypes of the corresponding element types in \lstinline!B!. See also restricted subtyping and function restricted subtyping. (See \cref{interface-compatibility-or-subtyping}.)

\glossaryitem{supertype}: relation between types. The inverse of subtype. \lstinline!A! is a subtype of \lstinline!B! means that \lstinline!B! is a supertype of \lstinline!A!. (See \cref{interface-compatibility-or-subtyping}.)

\glossaryitem{transitively nonreplaceable}: a class reference is considered
transitively non-replaceable if there are no replaceable elements in the
referenced class, or any of its base classes or constraining types
transitively at any level. (See \cref{transitively-non-replaceable}.)

\glossaryitem{vector}: an array where the number of dimensions is 1. (See
\cref{arrays}.)
9 changes: 3 additions & 6 deletions chapters/inheritance.tex
Expand Up @@ -670,12 +670,9 @@ \subsection{The class extends Redeclaration Mechanism}\label{the-class-extends-r
to apply modifiers to the new declaration.
\end{nonnormative}

For \lstinline!redeclare class extends B($\ldots$)! the inherited class is subject
to the same restrictions as a redeclare of the inherited element, and
the original class \lstinline!B! should be replaceable, and the new element is only
replaceable if the new definition is replaceable. In contrast to normal
extends it is not subject to the restriction that \lstinline!B! should be
transitively non-replaceable (since \lstinline!B! should be replaceable).
% henrikt-ma: Adding index entry for 'replaceable' here, since I can't find a place where the term is really explained in terms of using the corresponding keyword.
For \lstinline!redeclare class extends B($\ldots$)! the inherited class is subject to the same restrictions as a redeclare of the inherited element, and the original class \lstinline!B! should be \firstuse{replaceable}\index{replaceable}, and the new element is only replaceable if the new definition is replaceable.
In contrast to normal extends it is not subject to the restriction that \lstinline!B! should be transitively non-replaceable (since \lstinline!B! should be replaceable).

The syntax rule for \lstinline!class extends! construct is in the definition of the
\lstinline!class-specifier! nonterminal (see also class declarations in \cref{class-declarations}):
Expand Down

0 comments on commit 9c7841e

Please sign in to comment.