diff --git a/chapters/abstract.tex b/chapters/abstract.tex index be9e214d0..aad767e7f 100644 --- a/chapters/abstract.tex +++ b/chapters/abstract.tex @@ -6,7 +6,7 @@ \end{center} This document defines the Modelica\footnote{% -\firstuse{Modelica}\index{Modelica} is a registered trademark of the Modelica Association. +\firstuse{Modelica} is a registered trademark of the Modelica Association. } language, version~\mlsversion, which is developed by the Modelica Association, a non-profit organization with seat in Linköping, Sweden. Modelica is a freely available, object-oriented language for modeling of large, complex, and heterogeneous systems. diff --git a/chapters/annotations.tex b/chapters/annotations.tex index 381919d3f..56e79f063 100644 --- a/chapters/annotations.tex +++ b/chapters/annotations.tex @@ -198,7 +198,7 @@ \subsubsection{Plot Curves}\label{plot-curves} \subsubsection{Escape sequences}\label{text-markup-escape-sequences} -In an attribute inside a figure where the variable replacements of \cref{variable-replacements} or the text markup of \cref{text-markup-in-captions} can be used, the following use of \firstuse{text markup escape sequences}\index{text markup escape sequence}\index{escape sequence!text markup} applies. +In an attribute inside a figure where the variable replacements of \cref{variable-replacements} or the text markup of \cref{text-markup-in-captions} can be used, the following use of \firstuse[text markup escape sequence]{text markup escape sequences}\index{escape sequence!text markup} applies. These escape sequences are applied after the application of other markup, and is not applied at all inside some of the other markup, see details for the respective markup. The percent character `\%' shall be encoded \lstinline!%%!. The following are all the recognized escape sequences: @@ -320,7 +320,7 @@ \subsubsection{Text Markup in Captions}\label{text-markup-in-captions} not supported, and any paragraph break before the first paragraph or after the last paragraph has no impact.) -\firstuse{Vendor-specific markup}\index{vendor-specific markup} takes the form \lstinline!%__$\mathit{nameOfVendor}_{1}$($\mathit{data}_{1}$)$\ldots$__$\mathit{nameOfVendor}_{n}$($\mathit{data}_{n}$)[$\mathit{text}$]!, where $n \geq 1$. +\firstuse[vendor-specific markup]{Vendor-specific markup} takes the form \lstinline!%__$\mathit{nameOfVendor}_{1}$($\mathit{data}_{1}$)$\ldots$__$\mathit{nameOfVendor}_{n}$($\mathit{data}_{n}$)[$\mathit{text}$]!, where $n \geq 1$. The $\mathit{nameOfVendor}$ consists of only digits and letters, and shall only convey the name of the vendor defining the meaning of the associated $\mathit{data}$. Text markup escape sequences don't apply inside the $\mathit{data}$, implying that it cannot contain the closing parenthesis, `)'. A tool which does not understand any of the vendor-specific meanings shall only display the mandatory $\mathit{text}$, but the $\mathit{text}$ may also be used together with the vendor-specific $\mathit{data}$. diff --git a/chapters/arrays.tex b/chapters/arrays.tex index 34232e24c..6aa86e3ec 100644 --- a/chapters/arrays.tex +++ b/chapters/arrays.tex @@ -9,8 +9,8 @@ \chapter{Arrays}\label{arrays} 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 \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. +The degenerate case of a \firstuse{scalar} variable is not really an array, but can be regarded as an array with zero dimensions. +\firstuse[vector]{Vectors} have one dimension, matrices (sing.\ \firstuse{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. @@ -82,7 +82,7 @@ \section{Array Declarations}\label{array-declarations} \end{table} % henrikt-ma: The following paragraph was only modified slightly when migrated from the old glossary to the index, and seems to be in need of more attention: -A component declared with array dimensions, or where the element type is an array type, is called an \firstuse{array variable}\index{array!variable}. +A component declared with array dimensions, or where the element type is an array type, is called an \firstuse[array!variable]{array variable}. It is a component whose components are \willintroduce{array elements} (see below). For an array variable, the ordering of its components matters: The $k$th element in the sequence of components of an array variable \lstinline!x! is the array element with index \lstinline!k!, denoted \lstinline!x[k]!. @@ -92,7 +92,7 @@ \section{Array Declarations}\label{array-declarations} An array element is hence referenced using $n$ indices in general, where $n$ is the number of dimensions of the array. % henrikt-ma: The following paragraph was only modified slightly when migrated from the old glossary to the index, and seems to be in need of more attention: -A component contained in an array variable is called an \firstuse{array element}\index{array!element}. +A component contained in an array variable is called an \firstuse[array!element]{array element}. An array element has no identifier. Instead they are referenced by array access expressions called indices that use enumeration values or positive integer index values. @@ -577,7 +577,7 @@ \subsubsection{Reduction Expressions}\label{reduction-expressions} function-name "(" expression1 for iterators ")" \end{lstlisting}% \index{for@\robustinline{for}!reduction expression} -is a \firstuse{reduction expression}\index{reduction expression}. +is a \firstuse{reduction expression}. The expressions in the iterators of a reduction expression shall be vector expressions. They are evaluated once for each reduction expression, and are evaluated in the scope immediately enclosing the reduction expression. @@ -706,7 +706,7 @@ \subsection{Matrix and Vector Algebra Functions}\label{matrix-and-vector-algebra \section{Vector, Matrix and Array Constructors}\label{vector-matrix-and-array-constructors} -The \firstuse{array constructor}\index{array!constructor} function \lstinline!array(A, B, C, $\ldots$)! constructs an array from its arguments according to the following rules: +The \firstuse[array!constructor]{array constructor} function \lstinline!array(A, B, C, $\ldots$)! constructs an array from its arguments according to the following rules: \begin{itemize} \item Size matching: All arguments must have the same sizes, i.e., @@ -751,7 +751,7 @@ \subsection{Array Constructor with Iterators}\label{array-constructor-with-itera \begin{lstlisting}[language=grammar] array "(" expression for iterators ")" \end{lstlisting} -is an \firstuse{array constructor with iterators}\index{array!constructor!with iterators}. +is an \firstuse[array!constructor!with iterators]{array constructor with iterators}. The expressions inside the iterators of an array constructor shall be vector expressions. They are evaluated once for each array constructor, and are evaluated in the scope immediately enclosing the array constructor. @@ -947,7 +947,7 @@ \section{Array Indexing}\label{array-indexing} 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: +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} (or \firstuse{subscript}) expressions: \lstinline!$\mathit{arrayname}$[$\mathit{indexexpr}_{1}$, $\mathit{indexexpr}_{2}$, $\ldots$]! @@ -957,7 +957,7 @@ \section{Array Indexing}\label{array-indexing} 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}. +This is called an \firstuse[assignment statement!indexed]{indexed assignment statement}. If the index is an array the assignments take place in the order given by the index array. For assignments to arrays and elements of arrays, the entire right-hand side and the index on the left-hand side are evaluated before any element is assigned a new value. diff --git a/chapters/classes.tex b/chapters/classes.tex index 9d7d2636d..fd47de47b 100644 --- a/chapters/classes.tex +++ b/chapters/classes.tex @@ -93,12 +93,12 @@ \section{Component Declarations}\label{component-declarations} Component declarations are described in this section. -A \firstuse{component declaration}\index{component!declaration} is an element of a class definition that generates a component. +A \firstuse[component!declaration]{component declaration} is an element of a class definition that generates a component. A component declaration specifies (1) a component name, i.e., an identifier, (2) the class to be flattened in order to generate the component, and (3) an optional \lstinline!Boolean! parameter expression. Generation of the component is suppressed if this parameter expression evaluates to false. A component declaration may be overridden by an element-redeclaration. -A \firstuse{component}\index{component} or \firstuse{variable}\index{variable} is an instance (object) generated by a component declaration. +A \firstuse{component} or \firstuse{variable} is an instance (object) generated by a component declaration. Special kinds of components are scalar, array, and attribute. \subsection{Syntax and Examples of Component Declarations}\label{syntax-and-examples-of-component-declarations} @@ -162,7 +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. +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. If the \lstinline[language=grammar]!type-specifier! of the component does not denote a built-in type, the name of the type is looked up (\cref{static-name-lookup}). @@ -202,7 +202,7 @@ \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 \firstuse{declaration equation}\index{declaration equation}\index{declaration equation!zzzzz@\igobble |seealso{binding equation}} associated with the declared component. +An environment that defines the value of a component of built-in type is said to define a \firstuse{declaration equation}\index{declaration equation!zzzzz@\igobble |seealso{binding 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. @@ -214,7 +214,7 @@ \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!. +A \firstuse{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!. @@ -337,23 +337,23 @@ \subsection{Acyclic Bindings of Constants and Parameters}\label{acyclic-bindings \subsection{Component Variability Prefixes discrete, parameter, constant}\label{component-variability-prefixes-discrete-parameter-constant} -The prefixes \lstinline!discrete!, \lstinline!parameter!, \lstinline!constant! of a component declaration are called \firstuse{variability prefixes}\index{variability!prefix}\index{component variability}\index{declared variability}\index{variability!declared|see{declared variability}} and define in which situation the variable values of a component are initialized (see \cref{events-and-synchronization} and \cref{initialization-initial-equation-and-initial-algorithm}) and when they are changed in transient analysis (= solution of initial value problem of the hybrid DAE): +The prefixes \lstinline!discrete!, \lstinline!parameter!, \lstinline!constant! of a component declaration are called \firstuse[variability!prefix]{variability prefixes}\index{component variability}\index{declared variability}\index{variability!declared|see{declared variability}} and define in which situation the variable values of a component are initialized (see \cref{events-and-synchronization} and \cref{initialization-initial-equation-and-initial-algorithm}) and when they are changed in transient analysis (= solution of initial value problem of the hybrid DAE): \begin{itemize} \item A variable \lstinline!vc! declared with \lstinline!constant!\indexinline{constant} prefix remains constant during transient analysis, with a value that is unaffected by the initialization problem. - This is called a \firstuse{constant}, or \firstuse{constant variable}\index{constant!variable}\index{component variability!constant}. + This is called a \firstuse[---]{constant}, or \firstuse[constant!variable]{constant variable}\index{component variability!constant}. \item A variable \lstinline!vc! declared with the \lstinline!parameter!\indexinline{parameter} prefix remains constant during transient analysis, with a value determined by the initialization problem. - This is called a \firstuse{parameter}, or \firstuse{parameter variable}\index{parameter!variable}\index{component variability!parameter}. + This is called a \firstuse[---]{parameter}, or \firstuse[parameter!variable]{parameter variable}\index{component variability!parameter}. \item - A \firstuse{discrete-time variable}\index{discrete-time!variable}\index{component variability!discrete-time} \lstinline!vd! is a variable that is discrete-valued (that is, not of \lstinline!Real! type) or assigned in a \lstinline!when!-clause. + A \firstuse[discrete-time!variable]{discrete-time variable}\index{component variability!discrete-time} \lstinline!vd! is a variable that is discrete-valued (that is, not of \lstinline!Real! type) or assigned in a \lstinline!when!-clause. The \lstinline!discrete!\indexinline{discrete} prefix may be used to clarify that a variable is discrete-time. It has a vanishing time derivative between events. Note that this is not the same as saying that \lstinline!der(vd)=0! almost everywhere, as the derivative is not even defined at the events. It is not allowed to apply \lstinline!der! to discrete-time variables. During transient analysis the variable can only change its value at event instants (see \cref{events-and-synchronization}). \item - A \firstuse{continuous-time variable}\index{continuous-time!variable}\index{component variability!continuous-time} is a \lstinline!Real! variable without any prefix that is not assigned in a \lstinline!when!-clause. + A \firstuse[continuous-time!variable]{continuous-time variable}\index{component variability!continuous-time} is a \lstinline!Real! variable without any prefix that is not assigned in a \lstinline!when!-clause. A continuous-time variable \lstinline!vn! may have a non-vanishing time derivative (provided \lstinline!der(vn)! is allowed this can be expressed as \lstinline!der(vn) <> 0!) and may also change its value discontinuously at any time during transient analysis (see \cref{events-and-synchronization}). It may also contain a combination of these effects. Regarding existence of \lstinline!der(vn)!, see \cref{modelica:der}. @@ -549,11 +549,11 @@ \subsection{Conditional Component Declaration}\label{conditional-component-decla \section{Class Declarations}\label{class-declarations} -Essentially everything in Modelica is a \firstuse{class}\index{class}, from the predefined classes \lstinline!Integer! and \lstinline!Real!, to large packages such as the Modelica standard library. +Essentially everything in Modelica is a \firstuse{class}, from the predefined classes \lstinline!Integer! and \lstinline!Real!, to large packages such as the Modelica standard library. The description consists of a class definition, a modification environment that modifies the class definition, an optional list of dimension expressions if the class is an array class, and a lexically enclosing class for all classes. -The object generated by a class is called an \firstuse{instance}\index{instance}. +The object generated by a class is called an \firstuse{instance}. An instance contains zero or more components (i.e., instances), equations, algorithms, and local classes. An instance has a type (\cref{interface-or-type}). % Commenting out parts from old glossary that seem excessive here. @@ -580,8 +580,8 @@ \section{Class Declarations}\label{class-declarations} The following is the formal syntax of class definitions, including the special variants described in later sections. -An \firstuse{element}\index{element} is part of a class definition, and is one of: class definition, component declaration, or \lstinline!extends!-clause. -Component declarations and class definitions are called \firstuse{named elements}\index{named elements}. +An \firstuse{element} is part of a class definition, and is one of: class definition, component declaration, or \lstinline!extends!-clause. +Component declarations and class definitions are called \firstuse[named element]{named elements}. An element is either inherited from a base class or local. \begin{lstlisting}[language=grammar] @@ -730,7 +730,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 \lstinline[language=grammar]!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 \lstinline[language=grammar]!base-prefix!, or a simple type. +It is not legal to combine other components or base classes with an extends from an array class, a class with non-empty \lstinline[language=grammar]!base-prefix!, a \firstuse{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 \lstinline[language=grammar]!base-prefix!, or a simple type. \begin{example} \begin{lstlisting}[language=modelica] @@ -786,7 +786,7 @@ \section{Specialized Classes}\label{specialized-classes} % The difference between the set of specializations given here and those that are defined below need some sort of explanation. \lstinline!record!, \lstinline!type!, \lstinline!model!, \lstinline!block!, \lstinline!package!, \lstinline!function! and \lstinline!connector! have the properties of a general class, apart from restrictions. -Moreover, they have additional properties called \firstuse{enhancements}\index{enhancement!specialized class}. +Moreover, they have additional properties called \firstuse[enhancement!specialized class]{enhancements}. The definitions of the specialized classes are given below (additional restrictions on inheritance are in \cref{restrictions-on-the-kind-of-base-class}): \begin{itemize} \item \lstinline!record!\indexinline{record} -- @@ -1344,7 +1344,7 @@ \section{Predefined Types and Classes}\label{predefined-types-and-classes} %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. +The \firstuse[attribute]{attributes} 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. @@ -1382,7 +1382,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}. +These are called the \firstuse[primitive type]{primitive types}. \subsection{Real Type}\label{real-type} diff --git a/chapters/connectors.tex b/chapters/connectors.tex index 09c28e39f..555309034 100644 --- a/chapters/connectors.tex +++ b/chapters/connectors.tex @@ -75,8 +75,8 @@ \subsection{Connection Sets}\label{connection-sets} \subsection{Inside and Outside Connectors}\label{inside-and-outside-connectors} -In an element instance \lstinline!M!, each connector element of \lstinline!M! is called an \firstuse{outside connector}\index{outside connector} with respect to \lstinline!M!. -Any other connector elements that is hierarchically inside \lstinline!M!, but not in one of the outside connectors of \lstinline!M!, is called an \firstuse{inside connector}\index{inside connector} with respect to \lstinline!M!. +In an element instance \lstinline!M!, each connector element of \lstinline!M! is called an \firstuse{outside connector} with respect to \lstinline!M!. +Any other connector elements that is hierarchically inside \lstinline!M!, but not in one of the outside connectors of \lstinline!M!, is called an \firstuse{inside connector} with respect to \lstinline!M!. This is done before resolving \lstinline!outer! elements to corresponding \lstinline!inner! ones. \begin{example} @@ -106,8 +106,8 @@ \subsection{Inside and Outside Connectors}\label{inside-and-outside-connectors} \subsection{Expandable Connectors}\label{expandable-connectors} -If the \lstinline!expandable!\indexinline{expandable} qualifier is present on a connector definition, all instances of that connector are referred to as \firstuse{expandable connectors}\index{expandable connector}. -Instances of connectors that do not possess this qualifier will be referred to as \firstuse{non-expandable connectors}\index{non-expandable connector}. +If the \lstinline!expandable!\indexinline{expandable} qualifier is present on a connector definition, all instances of that connector are referred to as \firstuse[expandable connector]{expandable connectors}. +Instances of connectors that do not possess this qualifier will be referred to as \firstuse[non-expandable connector]{non-expandable connectors}. Before generating \willintroduce{connection equations}, non-parameter scalar variables and non-parameter array elements declared in expandable connectors are marked as only being potentially present. @@ -239,7 +239,7 @@ \subsection{Expandable Connectors}\label{expandable-connectors} \end{lstlisting} \end{example} -An expandable connector array component for which \lstinline!size! is not defined (see \cref{array-dimension-and-size-functions}) is referred to as a \firstuse{sizeless array component}\index{sizeless array component}. +An expandable connector array component for which \lstinline!size! is not defined (see \cref{array-dimension-and-size-functions}) is referred to as a \firstuse{sizeless array component}. Such a component shall not be used without subscripts, and the subscripts must slice the array so that the sizeless dimensions are removed. \begin{example} @@ -365,7 +365,7 @@ \subsection{Expandable Connectors}\label{expandable-connectors} \section{Generation of Connection Equations}\label{generation-of-connection-equations} -When generating \firstuse{connection equations}\index{connection equations}, \lstinline!outer! elements are resolved to the corresponding \lstinline!inner! elements in the instance hierarchy (see instance hierarchy name lookup \cref{instance-hierarchy-name-lookup-of-inner-declarations}). +When generating \firstuse[connection equation]{connection equations}, \lstinline!outer! elements are resolved to the corresponding \lstinline!inner! elements in the instance hierarchy (see instance hierarchy name lookup \cref{instance-hierarchy-name-lookup-of-inner-declarations}). The arguments to each \lstinline!connect!-equation are resolved to two connector elements. For every use of the \lstinline!connect!-equation @@ -810,9 +810,9 @@ \subsection{Overconstrained Equation Operators for Connection Graphs}\label{over If the elements of a record \lstinline!Record! are not independent from each other, the equation \lstinline!R1 = R2! contains redundant equations. \end{nonnormative} -A type class with an \lstinline!equalityConstraint! function declaration is called \firstuse{overdetermined type}\index{overdetermined!type}. -A record class with an \lstinline!equalityConstraint! function definition is called \firstuse{overdetermined record}\index{overdetermined!record}. -A connector that contains instances of overdetermined type and/or record classes is called \firstuse{overdetermined connector}\index{overdetermined!connector}. +A type class with an \lstinline!equalityConstraint! function declaration is called \firstuse[overdetermined!type]{overdetermined type}. +A record class with an \lstinline!equalityConstraint! function definition is called \firstuse[overdetermined!record]{overdetermined record}. +A connector that contains instances of overdetermined type and/or record classes is called \firstuse[overdetermined!connector]{overdetermined connector}. An overdetermined type or record may neither have flow components nor may be used as a type of flow components. If an array is used as argument to any of the \lstinline!Connections.*! functions it is treated as one unit -- unlike \lstinline!connect!, there is no special treatment of this case, compare \cref{connect-equations-and-connectors}. @@ -843,7 +843,7 @@ \subsection{Overconstrained Equation Operators for Connection Graphs}\label{over connect(A, B) \end{lstlisting}\end{synopsis} \begin{semantics} -Defines \firstuse{optional spanning-tree edge}\index{optional spanning-tree edge} from the overdetermined type or record instances in connector instance \lstinline!A! to the corresponding overdetermined type or record instances in connector instance \lstinline!B! for a virtual connection graph. +Defines \firstuse{optional spanning-tree edge} from the overdetermined type or record instances in connector instance \lstinline!A! to the corresponding overdetermined type or record instances in connector instance \lstinline!B! for a virtual connection graph. The types of the corresponding overdetermined type or record instances shall be the same. \end{semantics} \end{operatordefinition*} @@ -853,7 +853,7 @@ \subsection{Overconstrained Equation Operators for Connection Graphs}\label{over Connections.branch(A.R, B.R) \end{lstlisting}\end{synopsis} \begin{semantics} -Defines a \firstuse{required spanning-tree edge}\index{required spanning-tree edge} from the overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! to the corresponding overdetermined type or record instance \lstinline!R! in connector instance \lstinline!B! for a virtual connection graph. +Defines a \firstuse{required spanning-tree edge} from the overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! to the corresponding overdetermined type or record instance \lstinline!R! in connector instance \lstinline!B! for a virtual connection graph. This function can be used at all places where a \lstinline!connect!-equation is allowed. \begin{nonnormative} @@ -871,7 +871,7 @@ \subsection{Overconstrained Equation Operators for Connection Graphs}\label{over Connections.root(A.R) \end{lstlisting}\end{synopsis} \begin{semantics} -The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! is a (definite) \firstuse{root node}\index{definite root node}\index{root node!definite} in a virtual connection graph. +The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! is a (definite) \firstuse[definite root node]{root node}\index{root node!definite} in a virtual connection graph. \begin{nonnormative} This definition shall be used if in a model with connector \lstinline!A! the overdetermined record \lstinline!A.R! is (consistently) assigned, e.g., from a parameter expressions. @@ -885,7 +885,7 @@ \subsection{Overconstrained Equation Operators for Connection Graphs}\label{over Connections.potentialRoot(A.R, priority=$p$) \end{lstlisting}\end{synopsis} \begin{semantics} -The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! is a \firstuse{potential root node}\index{potential root node}\index{root node!potential} in a virtual connection graph with priority \lstinline!p! ($p \geq 0$). +The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!A! is a \firstuse{potential root node}\index{root node!potential} in a virtual connection graph with priority \lstinline!p! ($p \geq 0$). If no second argument is provided, the priority is zero. \lstinline!p! shall be a parameter expression of type \lstinline!Integer!. In a virtual connection subgraph without a \lstinline!Connections.root! definition, one of the potential roots with the lowest priority number is selected as root. @@ -947,7 +947,7 @@ \subsection{Converting the Connection Graph into Trees and Generating Connection trees with the selected root nodes as roots. \end{enumerate} -After this analysis, the \firstuse{connection equations}\index{connection equations!overconstrained} are generated in the following way: +After this analysis, the \firstuse[connection equations!overconstrained]{connection equations} are generated in the following way: \begin{enumerate} \item For every optional spanning-tree edge (i.e., a \lstinline!connect(A, B)! equation), in one of the spanning trees, the connection equations are generated according to \cref{generation-of-connection-equations}. diff --git a/chapters/dae.tex b/chapters/dae.tex index ecb6999ae..93675ddb0 100644 --- a/chapters/dae.tex +++ b/chapters/dae.tex @@ -90,7 +90,7 @@ \chapter{Modelica DAE Representation}\label{modelica-dae-representation} The generated set of equations is used for simulation and other analysis activities. Simulation means that an initial value problem is solved, i.e., initial values have to be provided for the states $x$, \cref{initialization-initial-equation-and-initial-algorithm}. The equations define a DAE\index{DAE} (Differential Algebraic Equations) which may have discontinuities, a variable structure and/or which are controlled by a discrete-event system. -Such types of systems are called \firstuse{hybrid DAEs}\index{hybrid DAE}. +Such types of systems are called \firstuse[hybrid DAE]{hybrid DAEs}. Simulation is performed in the following way: \begin{enumerate} \item\label{perform-simulation-integrate} diff --git a/chapters/equations.tex b/chapters/equations.tex index 4a287b9d4..b3d767678 100644 --- a/chapters/equations.tex +++ b/chapters/equations.tex @@ -1,6 +1,6 @@ \chapter{Equations}\label{equations} -An \firstuse{equation}\index{equation} is part of a class definition. +An \firstuse{equation} is part of a class definition. A scalar equation relates scalar variables, i.e., constrains the values that these variables can take simultaneously. When $n$-1 variables of an equation containing $n$ variables are known, the value of the $n$th variable can be inferred (solved for). In contrast to an algorithm section, there is no order between the equations in an equation section and they can be solved separately. @@ -16,7 +16,7 @@ \section{Equation Categories}\label{equation-categories} \item Modification equations\index{modification equation|hyperpageit}, which are commonly used to modify attributes of classes (\cref{modifications}). \item - \firstuse{Binding equations}\index{binding equation}, which include both declaration equations and element modification for the value of the variable itself. + \firstuse[binding equation]{Binding equations}, 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 @@ -545,12 +545,12 @@ \section{Synchronous Data-flow Principle and Single Assignment Rule}\label{synch \end{nonnormative} \item There must exist a perfect matching of variables to equations after flattening, where a variable can only be matched to equations that can contribute to solving for the variable -(\firstuse{perfect matching rule}\index{perfect matching rule} -- previously called \emph{single assignment rule}\index{single assignment rule|see{perfect matching rule}}); see also globally balanced \cref{balanced-models}. +(\firstuse{perfect matching rule} -- previously called \emph{single assignment rule}\index{single assignment rule|see{perfect matching rule}}); see also globally balanced \cref{balanced-models}. \end{enumerate} \section{Events and Synchronization}\label{events-and-synchronization} -An \firstuse{event}\index{event} is something that occurs instantaneously at a specific time or when a specific condition occurs. +An \firstuse{event} is something that occurs instantaneously at a specific time or when a specific condition occurs. Events are for example defined by the condition occurring in a \lstinline!when!-clause, \lstinline!if!-equation, or \lstinline!if!-expression. The integration is halted and an event occurs whenever an event generation expression, e.g.\ \lstinline!x > 2! o or \lstinline!floor(x)!, changes its value. @@ -690,7 +690,7 @@ \section{Events and Synchronization}\label{events-and-synchronization} \section{Initialization, initial equation, and initial algorithm}\label{initialization-initial-equation-and-initial-algorithm} Before any operation is carried out with a Modelica model (e.g., simulation or linearization), initialization takes place to assign consistent values for all variables present in the model. -During this phase, called the \firstuse{initialization problem}\index{initialization problem}, also the derivatives (\lstinline!der!), and the pre-variables (\lstinline!pre!), are interpreted as unknown algebraic variables. +During this phase, called the \firstuse{initialization problem}, also the derivatives (\lstinline!der!), and the pre-variables (\lstinline!pre!), are interpreted as unknown algebraic variables. The initialization uses all equations and algorithms that are utilized in the intended operation (such as simulation or linearization). The equations of a \lstinline!when!-clause are active during initialization, if and only if they are explicitly enabled with \lstinline!initial()!, and only in one of the two forms \lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then! (and similarly for \lstinline!elsewhen! and algorithms see below). diff --git a/chapters/functions.tex b/chapters/functions.tex index b651b3fa2..074bdef98 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -4,7 +4,7 @@ \chapter{Functions}\label{functions} \section{Function Declaration}\label{function-declaration} -A Modelica \firstuse{function}\index{function} is a specialized class (\cref{function-as-a-specialized-class}) using the keyword \lstinline!function!. +A Modelica \firstuse{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!. @@ -748,7 +748,7 @@ \subsection{Initialization and Binding Equations of Components in Functions}% When a function is called, components of the function do not have \lstinline!start!-attributes. However, a binding equation\index{binding equation!in function} (\lstinline!= expression!) with an expression may be present for a component. \begin{nonnormative} -\firstuse{Declaration assignments}\index{declaration assignment (deprecated)} of the form \lstinline!:= expression! are deprecated, but otherwise identical to binding equations. +\firstuse[declaration assignment (deprecated)]{Declaration assignments} of the form \lstinline!:= expression! are deprecated, but otherwise identical to binding equations. \end{nonnormative} A binding equation for a non-input component initializes the @@ -1260,7 +1260,7 @@ \section{Derivatives and Inverses of Functions}\label{derivatives-and-inverses-o The \lstinline!derivative! annotation can influence simulation time and accuracy, can be applied to both functions written in Modelica and to external functions, and may be used several times for the same function declaration. -Each use of the \lstinline!derivative! annotation points to another \firstuse{derivative-function}\index{derivative-function} that expresses a derivative of the declared function, and the annotation can state that it is only valid under certain restrictions on the input arguments. +Each use of the \lstinline!derivative! annotation points to another \firstuse{derivative-function} that expresses a derivative of the declared function, and the annotation can state that it is only valid under certain restrictions on the input arguments. These restrictions are defined using the optional attributes \lstinline!order!, \lstinline!noDerivative!, and \lstinline!zeroDerivative!. The \lstinline!order! may be specified at most once for each \lstinline!derivative! annotation, must be at least 1, and defaults to 1. Specifying \lstinline!order! is only considered a restriction if $\text{\lstinline!order!} > 1$. diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 85c813e72..832d165cf 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -8,8 +8,8 @@ \chapter{Inheritance, Modification, and Redeclaration}\label{inheritance-modific \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!. +The class \lstinline!A! is called a \firstuse{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} of \lstinline!A!, or as \lstinline!B! being \firstuse{derived from} \lstinline!A!. This relation is specified by an \lstinline!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. @@ -239,7 +239,7 @@ \subsection{Restrictions on Base Classes and Constraining Types to be Transitive \section{Modifications}\label{modifications} -A \firstuse{modification}\index{modification} is part of an element. +A \firstuse{modification} is part of an element. It modifies the instance generated by that element. A modification contains \willintroduce{element modifications} (e.g., \lstinline!vcc(unit = "V") = 1000!) and \willintroduce{element-redeclarations} (e.g., \lstinline!redeclare type Voltage = Real(unit="V")!). @@ -256,7 +256,7 @@ \section{Modifications}\label{modifications} A modifier modifies one or more declarations from a class by changing some aspect(s) of the declarations. The most common kind of modifier just changes the \emph{default value} or the \lstinline!start!-attribute in a binding equation; the value and/or \lstinline!start!-attribute should be compatible with the variable according to \cref{type-compatible-expressions}. -An \firstuse{element modification}\index{element modification} overrides the declaration equation in the class used by the instance generated by the modified element. +An \firstuse{element modification} overrides the declaration equation in the class used by the instance generated by the modified element. \begin{example} Modifying the default \lstinline!start! value of the \lstinline!altitude! variable: @@ -265,7 +265,7 @@ \section{Modifications}\label{modifications} \end{lstlisting} \end{example} -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. +A modification (e.g., \lstinline!C1 c1(x = 5)!) is called a \firstuse{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 @@ -274,7 +274,7 @@ \section{Modifications}\label{modifications} \end{nonnormative} A more dramatic change is to modify the \emph{type} and/or the \emph{prefixes} and possibly the \emph{dimension sizes} of a declared element. -This kind of modification is called an \firstuse{element-redeclaration}\index{element-redeclaration}\index{redeclaration!element} (\cref{redeclaration}) and requires the special keyword \lstinline!redeclare! to be used in the modifier in order to reduce the risk for accidental modeling errors. +This kind of modification is called an \firstuse{element-redeclaration}\index{redeclaration!element} (\cref{redeclaration}) and requires the special keyword \lstinline!redeclare! to be used in the modifier in order to reduce the risk for accidental modeling errors. In most cases a declaration that can be redeclared must include the prefix \lstinline!replaceable!\indexinline{replaceable} (\cref{redeclaration}). The modifier value (and class for redeclarations) is found in the context in which the modifier occurs, see also \cref{simple-name-lookup}. @@ -312,7 +312,7 @@ \subsection{Syntax of Modifications and Redeclarations}\label{syntax-of-modifica \subsection{Modification Environment}\label{modification-environment} -The \firstuse{modification environment}\index{modification environment} of a class contains arguments which modify elements of the class (e.g., parameter changes) when the class is flattened. +The \firstuse{modification environment} of a class contains arguments which modify elements of the class (e.g., parameter changes) when the class is flattened. The modification environment is built by merging class modifications, where outer modifications override inner modifications. \begin{nonnormative} @@ -660,7 +660,7 @@ \subsection{The class extends Redeclaration Mechanism}\label{the-class-extends-r \end{nonnormative} % 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. +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}, 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 diff --git a/chapters/interface.tex b/chapters/interface.tex index e654f2eca..9e18822c4 100644 --- a/chapters/interface.tex +++ b/chapters/interface.tex @@ -41,7 +41,7 @@ \section{Interface Terminology}\label{interface-terminology} \end{nonnormative*} \end{definition} -If \lstinline!A! is a subtype of \lstinline!B!, then \lstinline!B! is said to be a \firstuse{supertype}\index{supertype} of \lstinline!A!. +If \lstinline!A! is a subtype of \lstinline!B!, then \lstinline!B! is said to be a \firstuse{supertype} of \lstinline!A!. \begin{definition}[Restricted subtype \emph{or} plug compatible interface]\index{restricted subtype}\index{subtype!restricted}\index{plug compatible interface}\index{interface!plug compatible} \lstinline!A! is a restricted subtype of \lstinline!B!, or equivalently, the interface of \lstinline!A! is plug compatible to the interface of \lstinline!B!, if \lstinline!A! is a subtype of @@ -127,7 +127,7 @@ \section{The Concepts of Type, Interface and Subtype}\label{the-concepts-of-type \section{Interface or Type}\label{interface-or-type} Based on a flattened class or component we can construct an interface for that flattened class or component. -The \firstuse{interface}\index{interface} or \firstuse{type}\index{type} (the terms \emph{interface} and \emph{type} are equivalent and can be used interchangeably, and are different from \emph{inheritance interface} and \emph{class type}) is defined as the following information about the flattened element itself: +The \firstuse{interface} or \firstuse{type} (the terms \emph{interface} and \emph{type} are equivalent and can be used interchangeably, and are different from \emph{inheritance interface} and \emph{class type}) is defined as the following information about the flattened element itself: \begin{itemize} \item Whether it is replaceable or not. @@ -205,7 +205,7 @@ \subsection{Transitively non-Replaceable}\label{transitively-non-replaceable} Such classes are defined as \willintroduce{transitively non-replaceable}. \end{nonnormative} -A class reference is \firstuse{transitively non-replaceable}\index{transitively non-replaceable} iff (i.e.\ \emph{if and only if}) all parts of the name satisfy the following: +A class reference is \firstuse{transitively non-replaceable} iff (i.e.\ \emph{if and only if}) all parts of the name satisfy the following: \begin{itemize} \item If the class definition is long it is transitively non-replaceable if @@ -224,7 +224,7 @@ \subsection{Inheritance Interface or Class Type}\label{inheritance-interface-or- For inheritance, the interface also must include protected elements; this is the only change compared to above. -Based on a flattened class we can construct an \firstuse{inheritance interface}\index{inheritance interface}\index{interface!inheritance} or \firstuse{class type}\index{class type}\index{type!class} for that flattened class. +Based on a flattened class we can construct an \firstuse{inheritance interface}\index{interface!inheritance} or \firstuse{class type}\index{type!class} for that flattened class. The inheritance interface or class type is defined as the following information about the flattened element itself: \begin{itemize} \item diff --git a/chapters/introduction.tex b/chapters/introduction.tex index b53aea21c..e0148aae0 100644 --- a/chapters/introduction.tex +++ b/chapters/introduction.tex @@ -13,7 +13,7 @@ \section{Scope of the Specification}\label{scope-of-the-specification} rules for translating any class described in the Modelica language to a flat Modelica structure. -A class (of specialized class \lstinline!model!, \lstinline!class! or \lstinline!block!) intended to be simulated on its own is called a \firstuse{simulation model}\index{simulation model}. +A class (of specialized class \lstinline!model!, \lstinline!class! or \lstinline!block!) intended to be simulated on its own is called a \firstuse{simulation model}. The flat Modelica structure is also defined for other cases than simulation models; including functions (can be used to provide diff --git a/chapters/lexicalstructure.tex b/chapters/lexicalstructure.tex index 134ab1e56..778a43212 100644 --- a/chapters/lexicalstructure.tex +++ b/chapters/lexicalstructure.tex @@ -64,7 +64,7 @@ \section{Identifiers, Names, and Keywords}\label{identifiers-names-and-keywords} \subsection{Identifiers}\label{identifiers} -Modelica \firstuse{identifiers}\index{identifier}, used for naming classes, variables, constants, and other items, are of two forms. +Modelica \firstuse[identifier]{identifiers}, used for naming classes, variables, constants, and other items, are of two forms. The first form always starts with a letter or underscore (`\_'), followed by any number of letters, digits, or underscores. Case is significant, i.e., the identifiers \lstinline!Inductor! and \lstinline!inductor! are different. The second form (\lstinline[language=grammar]!Q-IDENT!) starts with a single quote, followed by a sequence of any printable ASCII character, where single-quote must be preceded by backslash, and terminated by a single quote, e.g.\ \lstinline!'12H'!, \lstinline!'13\'H'!, \lstinline!'+foo'!. @@ -88,7 +88,7 @@ \subsection{Identifiers}\label{identifiers} \subsection{Names}\label{names} -A \firstuse{name}\index{name} is an identifier with a certain interpretation or meaning. +A \firstuse{name} is an identifier with a certain interpretation or meaning. For example, a name may denote an \lstinline!Integer! variable, a \lstinline!Real! variable, a function, a type, etc. A name may have different meanings in different parts of the code, i.e., different scopes. The interpretation of identifiers as names is described in more detail in \cref{scoping-name-lookup-and-flattening}. @@ -98,7 +98,7 @@ \subsection{Names}\label{names} A name: \lstinline!Ele.Resistor! \end{example} -A \firstuse{component reference}\index{component!reference} is an expression containing a sequence of identifiers and indices. +A \firstuse[component!reference]{component reference} is an expression containing a sequence of identifiers and indices. A component reference is equivalent to the referenced object, which must be a component. A component reference is resolved (evaluated) in the scope of a class (\cref{component-declarations}), or expression for the case of a local iterator variable (\cref{slice-operation}). @@ -108,7 +108,7 @@ \subsection{Names}\label{names} \subsection{Modelica Keywords}\label{modelica-keywords} -The following Modelica \firstuse{keywords}\index{keyword} are reserved words and shall not be used as identifiers, except as listed in \cref{lexical-conventions}: +The following Modelica \firstuse[keyword]{keywords} are reserved words and shall not be used as identifiers, except as listed in \cref{lexical-conventions}: \begin{center} \begin{tabular}{l l l l l} \lstinline!algorithm! & \lstinline!discrete! & \lstinline!false! & \lstinline!loop! & \lstinline!pure!\\ \hline @@ -128,7 +128,7 @@ \subsection{Modelica Keywords}\label{modelica-keywords} \section{Literal Constants}\label{literal-constants} -\firstuse{Literals}\index{literal} (or \emph{literal constants}) are unnamed constants used to build expressions, and have different forms depending on their type. +\firstuse[literal (constant)]{Literals} (or \firstuse[---]{literal constants}) are unnamed constants used to build expressions, and have different forms depending on their type. Each of the predefined types in Modelica has a way of expressing unnamed constants of the corresponding type, which is presented in the ensuing subsections. Additionally, array literals and record literals can be expressed. diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index f2492d931..b1e661055 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -1,6 +1,6 @@ \chapter{Operators and Expressions}\label{operators-and-expressions} -The lexical units are combined to form even larger building blocks such as \firstuse{expressions}\index{expression} according to the rules given by the \lstinline[language=grammar]!expression! part of the Modelica grammar in \cref{modelica-concrete-syntax}. +The lexical units are combined to form even larger building blocks such as \firstuse[expression]{expressions} according to the rules given by the \lstinline[language=grammar]!expression! part of the Modelica grammar in \cref{modelica-concrete-syntax}. For example, they can be built from operators, function references, components, or component references (referring to components) and literals. Each expression has a type and a variability. @@ -1319,7 +1319,7 @@ \subsection{Event-Related Operators with Function Syntax}\label{event-related-op \section{Variability of Expressions}\label{variability-of-expressions} -The concept of \firstuse{variability of an expression}\index{expression variability}\index{variability!expression|see{expression variability}} indicates to what extent the expression can vary over time. +The concept of \firstuse[expression variability]{variability of an expression}\index{variability!expression|see{expression variability}} indicates to what extent the expression can vary over time. See also \cref{component-variability-prefixes-discrete-parameter-constant} regarding the concept of variability. % It seems wrong to not mention 'clocked discrete-time' here. There are four levels of variability of expressions, starting from the least variable: @@ -1487,7 +1487,7 @@ \subsection{Discrete-Time Expressions}\label{discrete-time-expressions} For a scalar or array equation \lstinline!expr1 = expr2! where neither expression is of base type \lstinline!Real!, both expressions must be discrete-time expressions. For a record equation, the rule applies recursively to each of the components of the record. -This is called the \firstuse{discrete-valued equation variability rule}\index{discrete-valued equation variability rule}. +This is called the \firstuse{discrete-valued equation variability rule}. \begin{nonnormative} For a scalar equation, the rule follows from the observation that a discrete-valued equation does not provide sufficient information to solve for a continuous-valued variable. @@ -1536,4 +1536,4 @@ \subsection{Discrete-Time Expressions}\label{discrete-time-expressions} \subsection{Continuous-Time Expressions}\label{continuous-time-expressions} All expressions are continuous-time expressions\index{continuous-time!expression}\index{expression variability!continuous-time} including constant, parameter and discrete expressions. -The term \firstuse{non-discrete-time expression}\index{non-discrete-time expression}\index{expression variability!non-discrete-time} refers to expressions that are neither constant, parameter nor discrete-time expressions. +The term \firstuse{non-discrete-time expression}\index{expression variability!non-discrete-time} refers to expressions that are neither constant, parameter nor discrete-time expressions. diff --git a/chapters/scoping.tex b/chapters/scoping.tex index 96c56ccdb..d8771e260 100644 --- a/chapters/scoping.tex +++ b/chapters/scoping.tex @@ -55,7 +55,7 @@ \section{Static Name Lookup}\label{static-name-lookup} \subsection{Simple Name Lookup}\label{simple-name-lookup} % Not adding 'encapsulated' as normal word to index; the keyword variant seems sufficient -A class declared with the keyword \lstinline!encapsulated!\indexinline{encapsulated} (see \lstinline[language=grammar]!class-definition! in the grammar) is called an \firstuse{encapsulated} class. +A class declared with the keyword \lstinline!encapsulated!\indexinline{encapsulated} (see \lstinline[language=grammar]!class-definition! in the grammar) is called an \firstuse[---]{encapsulated} class. By restricting name lookup inside a restricted class in ways defined in this chapter, the meaning of the class is made independent of where it is placed in a package hierarchy. When an element, equation, or section is flattened, any simple name (not composed using dot notation) is first looked up sequentially among iteration variables (if any; see below), and then looked up sequentially in each member of the ordered set \emph{of instance scopes (see \cref{the-class-tree}) corresponding to lexically enclosing classes} until a match is found or an enclosing class is encapsulated. @@ -73,7 +73,7 @@ \subsection{Simple Name Lookup}\label{simple-name-lookup} Among declared named elements (\lstinline!class-definition! and \lstinline!component-declaration!) of the class (including elements inherited from base classes). \item Among the import names of qualified \lstinline!import!-clauses in the \emph{instance} scope. - The \firstuse{import name}\index{import name} of \lstinline!import A.B.C!; is \lstinline!C! and the import name of \lstinline!import D = A.B.C;! is \lstinline!D!. + The \firstuse{import name} of \lstinline!import A.B.C!; is \lstinline!C! and the import name of \lstinline!import D = A.B.C;! is \lstinline!D!. \item Among the public members of packages imported via unqualified \lstinline!import!-clauses in the \emph{instance} scope. It is an error if this step produces matches from several unqualified imports. @@ -337,7 +337,7 @@ \section{Simultaneous Inner/Outer Declarations}\label{simultaneous-inner-outer-d \section{Flattening Process}\label{flattening-process} -In order to guarantee that elements can be used before they are declared and that elements do not depend on the order of their declaration (\cref{declaration-order-and-usage-before-declaration}) in the enclosing class, the \firstuse{flattening}\index{flattening} proceeds in the following two major steps: +In order to guarantee that elements can be used before they are declared and that elements do not depend on the order of their declaration (\cref{declaration-order-and-usage-before-declaration}) in the enclosing class, the \firstuse{flattening} proceeds in the following two major steps: \begin{enumerate} \item Instantiation process @@ -365,7 +365,7 @@ \subsection{Instantiation}\label{instantiation} \subsubsection{The Class Tree}\label{the-class-tree} -All necessary libraries including the model which is to be instantiated are loaded from e.g.\ file system and form a so called \firstuse{class tree}\index{class tree}. +All necessary libraries including the model which is to be instantiated are loaded from e.g.\ file system and form a so called \firstuse{class tree}. This tree represents the syntactic information from the class definitions. It contains also all modifications at their original locations in syntactic form. The builtin classes are put into the unnamed root of the class tree. @@ -379,7 +379,7 @@ \subsubsection{The Class Tree}\label{the-class-tree} \subsubsection{The Instance Tree}\label{the-instance-tree} -The output of the instantiation process is an \firstuse{instance tree}\index{instance tree}. +The output of the instantiation process is an \firstuse{instance tree}. The instance tree consists of nodes representing the elements of a class definition from the class tree. For a component the subtree of a particular node is created using the information from the class of the \lstinline[language=grammar]!component-clause! and a new modification environment as result of merging the current modification environment with the modifications from the current element declaration (see \cref{merging-of-modifications}). @@ -438,7 +438,7 @@ \subsubsection{Steps of Instantiation}\label{steps-of-instantiation} \paragraph*{The element itself}\label{the-element-itself} -A \firstuse{partially instantiated}\index{partially instantiated} class or component is an element that is ready to be instantiated; a partially instantiated element (i.e.\ class or component) is comprised of a reference to the original element (from the class tree) and the modifiers for that element (including a possible redeclaration). +A \firstuse{partially instantiated} class or component is an element that is ready to be instantiated; a partially instantiated element (i.e.\ class or component) is comprised of a reference to the original element (from the class tree) and the modifiers for that element (including a possible redeclaration). The possible redeclaration of the element itself takes effect. diff --git a/chapters/statemachines.tex b/chapters/statemachines.tex index e9ec0f44b..13e5df3ec 100644 --- a/chapters/statemachines.tex +++ b/chapters/statemachines.tex @@ -87,7 +87,7 @@ \section{Transitions}\label{transitions} This operator defines a transition from instance $\mathit{from}$ to instance $\mathit{to}$. The $\mathit{from}$ and $\mathit{to}$ instances become states of a state machine. -The transition fires when $\mathit{condition} = \text{\lstinline!true!}$ if $\mathit{imm} = \text{\lstinline!true!}$ (this is called an \firstuse{immediate transition}\index{immediate transition}\index{transition!immediate}) or \lstinline!previous($\mathit{condition}$)! when $\mathit{imm} = \text{\lstinline!false!}$ (this is called a \firstuse{delayed transition}\index{delayed transition}\index{transition!delayed}). +The transition fires when $\mathit{condition} = \text{\lstinline!true!}$ if $\mathit{imm} = \text{\lstinline!true!}$ (this is called an \firstuse{immediate transition}\index{transition!immediate}) or \lstinline!previous($\mathit{condition}$)! when $\mathit{imm} = \text{\lstinline!false!}$ (this is called a \firstuse{delayed transition}\index{transition!delayed}). Argument \lstinline!priority! defines the priority of firing when several transitions could fire. In this case the transition with the smallest value of \lstinline!priority! fires. It is required that $\mathit{prio} \geq 1$ and that for all transitions from the same state, the priorities are different. If $\mathit{reset} = \text{\lstinline!true!}$, the states of the target state are reinitialized, i.e.\ state machines are restarted in initial state and state variables are reset to their start values. diff --git a/chapters/statements.tex b/chapters/statements.tex index 1fd06dd52..bdcbd8af2 100644 --- a/chapters/statements.tex +++ b/chapters/statements.tex @@ -7,7 +7,7 @@ \chapter{Statements and Algorithm Sections}\label{statements-and-algorithm-secti \section{Algorithm Sections}\label{algorithm-sections} -An \firstuse{algorithm section}\index{algorithm!section} is a part of a class definition comprised of the keyword \lstinline!algorithm!\index{algorithm@\robustinline{algorithm}} followed by a sequence of statements. +An \firstuse[algorithm!section]{algorithm section} is a part of a class definition comprised of the keyword \lstinline!algorithm!\index{algorithm@\robustinline{algorithm}} followed by a sequence of statements. The formal syntax is as follows: \begin{lstlisting}[language=grammar] algorithm-section : @@ -101,7 +101,7 @@ \section{Statements}\label{statements} \subsection{Simple Assignment Statements}\label{simple-assignment-statements} -The syntax of \firstuse{simple assignment statement}\index{assignment statement!simple} is as follows: +The syntax of \firstuse[assignment statement!simple]{simple assignment statement} is as follows: \begin{lstlisting}[language=grammar] component-reference ":=" expression \end{lstlisting} diff --git a/chapters/stream.tex b/chapters/stream.tex index c7014c4e9..db61c2aac 100644 --- a/chapters/stream.tex +++ b/chapters/stream.tex @@ -12,7 +12,7 @@ \chapter{Stream Connectors}\label{stream-connectors} \section{Definition of Stream Connectors}\label{definition-of-stream-connectors} -If at least one variable in a connector has the \lstinline!stream!\indexinline{stream} prefix, the connector is called \firstuse{stream connector}\index{stream!connector} and the corresponding variable is called \firstuse{stream variable}\index{stream!variable}. +If at least one variable in a connector has the \lstinline!stream!\indexinline{stream} prefix, the connector is called \firstuse[stream!connector]{stream connector} and the corresponding variable is called \firstuse[stream!variable]{stream variable}. The following definitions hold: \begin{itemize} \item @@ -65,7 +65,7 @@ \section{Stream Operator inStream and Connection Equations}\label{stream-operato by a flow of matter. \lstinline!inStream(v)! is only allowed on stream variables \lstinline!v! and is informally the value the stream variable has, assuming that the flow is from the connection point into the component. -This value is computed from the \firstuse{stream connection equations}\index{stream connection equations}\index{connection equations!stream} of the flow variables and of the stream variables. +This value is computed from the \firstuse{stream connection equations}\index{connection equations!stream} of the flow variables and of the stream variables. For the following definition it is assumed that $N$ inside connectors \lstinline!$m_{j}$.c! ($j = 1, 2, \ldots, N$) and $M$ outside connectors diff --git a/chapters/synchronous.tex b/chapters/synchronous.tex index cd204cfe1..3f4c8c07c 100644 --- a/chapters/synchronous.tex +++ b/chapters/synchronous.tex @@ -162,7 +162,7 @@ \subsection{Clocks and Clocked Variables}\label{clocks-and-clocked-variables} %\end{figure} In \cref{discrete-time-expressions} the term \emph{discrete-time} Modelica expression and in \cref{continuous-time-expressions} the term \emph{continuous-time} Modelica expression is defined. -In this chapter, two additional kinds of discrete-time expressions/variables are defined that are associated to clocks and are therefore called \firstuse{clocked discrete-time}\index{clocked!discrete-time expression}\index{expression variability!clocked discrete-time} expressions. +In this chapter, two additional kinds of discrete-time expressions/variables are defined that are associated to clocks and are therefore called \firstuse[clocked!discrete-time expression]{clocked discrete-time}\index{expression variability!clocked discrete-time} expressions. The different kinds of discrete-time variables in Modelica are defined below. \begin{definition}[Piecewise-constant variable]\index{piecewise-constant variable} @@ -223,7 +223,7 @@ \subsection{Clocks and Clocked Variables}\label{clocks-and-clocked-variables} \subsection{Base-Clock and Sub-Clock Partitions}\label{base-clock-and-sub-clock-partitions} -There are two kinds of \firstuse{clock partitions}\index{clock!partition}: +There are two kinds of \firstuse[clock!partition]{clock partitions}: \begin{definition}[Base-clock partition]\index{base-clock partition}\index{clock!partition!base-clock} A base-clock partition identifies a set of equations and a set of variables which must be executed together in one task. Different base-clock partitions can be associated to separate tasks for @@ -318,7 +318,7 @@ \section{Clock Constructors}\label{clock-constructors} Clock() \end{lstlisting}\end{synopsis} \begin{semantics} -\firstuse{Inferred clock}\index{inferred clock}. +\firstuse[inferred clock]{Inferred clock}. The operator returns a clock that is inferred. \begin{example} @@ -340,7 +340,7 @@ \section{Clock Constructors}\label{clock-constructors} Clock(intervalCounter=$\mathit{intervalCounter}$, resolution=$\mathit{resolution}$) \end{lstlisting}\end{synopsis} \begin{semantics} -\firstuse{Rational interval clock}\index{rational interval clock}. +\firstuse[rational interval clock]{Rational interval clock}. The first input argument, $\mathit{intervalCounter}$, is a clocked component expression (\cref{def:component-expression}) or a parameter expression of type \lstinline!Integer! with \lstinline!min = 0!. The optional second argument $\mathit{resolution}$ (defaults to 1) is a parameter expression of type \lstinline!Integer! with \lstinline!min = 1! and \lstinline!unit = "Hz"!. If $\mathit{intervalCounter}$ is a parameter expression with value zero, the period of the clock is derived by clock inference, see \cref{sub-clock-inferencing}. @@ -389,7 +389,7 @@ \section{Clock Constructors}\label{clock-constructors} Clock(interval=$\mathit{interval}$) \end{lstlisting}\end{synopsis} \begin{semantics} -\firstuse{Real interval clock}\index{real interval clock}. +\firstuse[real interval clock]{Real interval clock}. The input argument, $\mathit{interval}$, is a clocked component expression (\cref{def:component-expression}) or a parameter expression. The $\mathit{interval}$ must be strictly positive ($\mathit{interval} > 0$) of type \lstinline!Real! with \lstinline!unit = "s"!. The result is of base type \lstinline!Clock! that ticks when \lstinline!time! becomes $t_{\mathrm{start}}$, $t_{\mathrm{start}} + \mathit{interval}_{1}$, $t_{\mathit{start}} + \mathit{interval}_{1} + \mathit{interval}_{2}$, \@\ldots{} @@ -409,7 +409,7 @@ \section{Clock Constructors}\label{clock-constructors} Clock(condition=$\mathit{condition}$, startInterval=$\mathit{startInterval}$) \end{lstlisting}\end{synopsis} \begin{semantics} -\firstuse{Event clock}\index{event clock}. +\firstuse[event clock]{Event clock}. The first input argument, $\mathit{condition}$, is a continuous-time expression of type \lstinline!Boolean!. The optional $\mathit{startInterval}$ argument (defaults to 0) is the value returned by \lstinline!interval()! at the first tick of the clock, see \cref{initialization-of-clocked-partitions}. The result is of base type \lstinline!Clock! that ticks when \lstinline!edge($\mathit{condition}$)! becomes \lstinline!true!. @@ -435,7 +435,7 @@ \section{Clock Constructors}\label{clock-constructors} Clock(c=$c$, solverMethod=$\mathit{solverMethod}$) \end{lstlisting}\end{synopsis} \begin{semantics} -\firstuse{Solver clock}\index{solver clock}. +\firstuse[solver clock]{Solver clock}. The first input argument, $c$, is a clock and the operator returns this clock. The returned clock is associated with the second input argument $\mathit{solverMethod}$ of type \lstinline!String!. The meaning of $\mathit{solverMethod}$ is defined in \cref{solver-methods}. @@ -534,7 +534,7 @@ \section{Clocked State Variables}\label{clocked-state-variables} \end{tabular} \end{center} -A variable to which \lstinline!previous! has been applied is called a \firstuse{clocked state variable}\index{clocked!state variable}\index{state variable!clocked}. +A variable to which \lstinline!previous! has been applied is called a \firstuse[clocked!state variable]{clocked state variable}\index{state variable!clocked}. \begin{operatordefinition}[previous] \begin{synopsis}\begin{lstlisting} @@ -841,9 +841,9 @@ \section{Clock Partitioning}\label{clock-partitioning} After model flattening, every equation in an equation section, every expression and every algorithm section is either continuous-time, or it is uniquely associated with exactly one clock. % Warning: The uses of \firstuse below aren't the first time these terms are used. -In the latter case it is called a \firstuse{clocked equation}\index{clocked!equation}\index{equation!clocked}, a \willintroduce{clocked expression} or \firstuse{clocked algorithm}\index{clocked!algorithm}\index{algorithm!clocked} section respectively. +In the latter case it is called a \firstuse[clocked!equation]{clocked equation}\index{equation!clocked}, a \willintroduce{clocked expression} or \firstuse[clocked!algorithm]{clocked algorithm}\index{algorithm!clocked} section respectively. The associated clock is either explicitly defined by a \lstinline!when!-clause, see \cref{sub-clock-conversion-operators}, or it is implicitly defined by the requirement that a clocked equation, a clocked expression and a clocked algorithm section must have the same clock as the variables used in them with exception of the expressions used as first arguments in the conversion operators of \cref{partitioning-operators}. -\firstuse{Clock inference}\index{clock!inference} means to infer the clock of a variable, an equation, an expression or an algorithm section if the clock is not explicitly defined and is deduced from the required properties in the previous two paragraphs. +\firstuse[clock!inference]{Clock inference} means to infer the clock of a variable, an equation, an expression or an algorithm section if the clock is not explicitly defined and is deduced from the required properties in the previous two paragraphs. All variables in an expression without clock conversion operators must have the same clock to infer the clocks for each variable and @@ -904,7 +904,7 @@ \subsection{Base-clock Partitioning}\label{base-clock-partitioning} The resulting set of connected components, is the partitioning of the equations and variables, $B_{i} = \left\langle E_{i},\, V_{i} \right\rangle$, according to base-clocks and continuous-time partitions. -The base-clock partitions are identified as \firstuse{clocked}\index{clocked!base-clock partition}\index{base-clock partition!clocked} or as \firstuse{continuous-time partitions}\index{continuous-time!base-clock partition}\index{base-clock partition!continuous-time} according to the following properties: +The base-clock partitions are identified as \firstuse[clocked!base-clock partition]{clocked}\index{base-clock partition!clocked} or as \firstuse[continuous-time!base-clock partition]{continuous-time partitions}\index{base-clock partition!continuous-time} according to the following properties: A variable \lstinline!u! in \lstinline!sample(u)!, a variable \lstinline!y! in \lstinline!y = hold(ud)!, and a variable \lstinline!b! in \lstinline!Clock(b, startInterval=$\ldots$)! where the \lstinline!Boolean! \lstinline!b! is in a continuous-time partition. @@ -919,7 +919,7 @@ \subsection{Base-clock Partitioning}\label{base-clock-partitioning} Equations in a clocked \lstinline!when!-clause are also in a clocked partition. Other partitions where none of the variables in the partition are associated with any of the operators above have an unspecified partition kind and are considered continuous-time partitions. -All continuous-time partitions are collected together and form \firstuse{the continuous-time partition}\index{continuous-time!partition@partition, \emph{the}}. +All continuous-time partitions are collected together and form \firstuse[continuous-time!partition@partition, \emph{the}]{the continuous-time partition}. \begin{example} \begin{lstlisting}[language=modelica] @@ -1069,17 +1069,17 @@ \subsection{Clocked Discrete-Time and Clocked Discretized Continuous-Time Partit Additionally to the variability of expressions defined in \cref{variability-of-expressions}, an orthogonal concept \willintroduce{clocked variability} is defined in this section. If not explicitly stated otherwise, an expression with a variability such as \emph{continuous-time} or \emph{discrete-time} means that the expression is inside a partition that is not associated to a clock. -If an expression is present in a partition that is not a continuous-time partition, it is a \firstuse{clocked expression}\index{clocked!expression}\index{expression!clocked} and has \firstuse{clocked variability}\index{clocked!variability}\index{expression variability!clocked}. +If an expression is present in a partition that is not a continuous-time partition, it is a \firstuse[clocked!expression]{clocked expression}\index{expression!clocked} and has \firstuse[clocked!variability]{clocked variability}\index{expression variability!clocked}. After sub-clock inferencing, see \cref{sub-clock-inferencing}, every partition that is associated to a clock has to be categorized as \willintroduce{clocked discrete-time} or \willintroduce{clocked discretized continuous-time} partition. -If a clocked partition contains no operator \lstinline!der!, \lstinline!delay!, \lstinline!spatialDistribution!, no event related operators from \cref{event-related-operators-with-function-syntax} (with exception of \lstinline!noEvent!), and no \lstinline!when!-clause with a \lstinline!Boolean! condition, it is a \firstuse{clocked discrete-time}\index{clocked!discrete-time partition}\index{partition!clocked discrete-time} partition. +If a clocked partition contains no operator \lstinline!der!, \lstinline!delay!, \lstinline!spatialDistribution!, no event related operators from \cref{event-related-operators-with-function-syntax} (with exception of \lstinline!noEvent!), and no \lstinline!when!-clause with a \lstinline!Boolean! condition, it is a \firstuse[clocked!discrete-time partition]{clocked discrete-time}\index{partition!clocked discrete-time} partition. \begin{nonnormative} That is, the clocked discrete-time partition is a standard sampled data system that is described by difference equations. \end{nonnormative} -If a clocked partition is not a \emph{clocked discrete-time} partition, it is a \firstuse{clocked discretized continuous-time}\index{clocked!discretized continuous-time partition}\index{partition!clocked discretized continuous-time} partition. +If a clocked partition is not a \emph{clocked discrete-time} partition, it is a \firstuse[clocked!discretized continuous-time partition]{clocked discretized continuous-time}\index{partition!clocked discretized continuous-time} partition. Such a partition has to be solved with a \emph{solver method} of \cref{solver-methods}. When \lstinline!previous(x)! is used on a continuous-time state variable \lstinline!x!, then \lstinline!previous(x)! uses the start value of \lstinline!x! as value for the first clock tick. diff --git a/preamble.tex b/preamble.tex index 4e8291a31..9e1bde803 100644 --- a/preamble.tex +++ b/preamble.tex @@ -223,12 +223,31 @@ } % Like \emph, but marking this as the place where new terminology is introduced. -% In the future, we can change this to something that will automatically add this -% to an index/glossary. -\newcommand{\firstuse}[1]{\emph{#1}} +% By default, the argument is added to the document index as is, but this can be overridden using the optional argument. +\makeatletter% As long as this file isn't a normal package included with \usepackage... +\newcommand{\firstuse}[2][\@nil]{% + \emph{#2}% + \def\tmp{#1}% + \def\skipindex{---}% Special string for saying "don't add to index" + \ifx\tmp\@nnil + % Default case: Use mandatory argument also for document index. + \index{#2}DEFAULT% + \else + \ifx\tmp\skipindex + % Don't add anything to document index; \firstuse is only used for purposes of typesetting. + NOTHING% + \else + % Add custom entry to document index. + \index{#1}CUSTOM% + \fi% + \fi% +} +\makeatother% As long as this file isn't a normal package included with \usepackage... + % Like \firstuse, but when speaking of a term that hasn't been introduced. -\newcommand{\willintroduce}[1]{\emph{#1}} +% Produces same appearance as \firstuse, but doesn't add anything to the index. +\newcommand{\willintroduce}[1]{\firstuse[---]{#1}} % Formatting of table headings. \newcommand{\tablehead}[1]{\textit{#1}} @@ -243,7 +262,7 @@ {\bfseries} % HEADFONT {.} % HEADPUNCT {.75em} % HEADSPACE - {#1~#2. \firstuse{#3}} % CUSTOM-HEAD-SPEC + {#1~#2. \firstuse[---]{#3}} % CUSTOM-HEAD-SPEC \theoremstyle{mlsdefinition} % In order to show where the definition ends, we put a \qed at the end. This can't be done using \newtheoremstyle, % so instead we make the 'definition' environment a wrapper around the amsthm-base environment.