Skip to content

Commit

Permalink
Add comma (modelica#3329)
Browse files Browse the repository at this point in the history
* Search and replace fixes.
Closes modelica#3235
* Additional ones.
Note that I replaced the use of colon before an example with ",".
Clearly "e.g.,:" would seem excessive, and it wasn't clear that "e.g.:" is really correct (and it is at least rare).
https://en.wikipedia.org/wiki/Colon_(punctuation) indicates that the part before colon should be a complete sentence and these abbrevs. aren't.
* Update chapters/classes.tex
* Apply suggestions from code review
Restore case
* Add it to the style guide as well.
* Comma Before according to review
* One more missing comma before
* Better explanation of when to use comma
* Apply suggestions from code review
* Additional missing comma before.
Note that one sentence was rewritten to add a parenthesis around the example-text.

Co-authored-by: Elena Shmoylova <eshmoylova@users.noreply.github.com>
  • Loading branch information
HansOlsson and eshmoylova committed Jan 31, 2023
1 parent b1348ab commit 7f9cb19
Show file tree
Hide file tree
Showing 22 changed files with 144 additions and 139 deletions.
20 changes: 10 additions & 10 deletions chapters/annotations.tex
Expand Up @@ -567,7 +567,7 @@ \section{Graphical Objects}\label{annotations-for-graphical-objects}\label{graph
is no mechanism for defining an array of heterogeneous objects in Modelica.
\end{nonnormative}

These \lstinline!Icon!, \lstinline!Diagram!, and \lstinline!Documentation! annotations are only allowed directly in classes (e.g.\ not on components or connections).
These \lstinline!Icon!, \lstinline!Diagram!, and \lstinline!Documentation! annotations are only allowed directly in classes (e.g., not on components or connections).
The allowed annotations for a short class definition is the union of the allowed annotations in classes and on \lstinline!extends!-clauses.

\subsection{Common Definitions}\label{common-definitions}
Expand Down Expand Up @@ -613,7 +613,7 @@ \subsubsection{Coordinate Systems}\label{coordinate-systems}
application may use a different default value of \lstinline!initialScale!.

The attribute \lstinline!grid! specifies the spacing between grid points which can
be used by tools for alignment of points in the coordinate system, e.g.\ ``snap-to-grid''.
be used by tools for alignment of points in the coordinate system, e.g., ``snap-to-grid''.
Its use and default value is tool-dependent.

\begin{lstlisting}[language=modelica]
Expand All @@ -630,7 +630,7 @@ \subsubsection{Coordinate Systems}\label{coordinate-systems}
\begin{lstlisting}[language=modelica]
CoordinateSystem(extent = {{-10, -10}, {10, 10}});
\end{lstlisting}
i.e.\ a coordinate system with width 20 units and height 20 units.
i.e., a coordinate system with width 20 units and height 20 units.
\end{example}

The coordinate systems for the icon and diagram layers are by default defined as follows; where the array of \lstinline!GraphicItem! represents an ordered list of graphical primitives.
Expand Down Expand Up @@ -1666,15 +1666,15 @@ \subsubsection{Conversion Rules}\label{conversion-rules}
corresponding to the old version.

\begin{nonnormative}
Whenever possible tools should preserve the original style of the model, e.g.\ use of imports.
Whenever possible tools should preserve the original style of the model, e.g., use of imports.
Conversions should be applied in all places where named element are used in code, including Modelica URIs (for example, in \lstinline!Documentation! annotations).
\end{nonnormative}

These functions can be called with literal strings or array of strings
and vectorize according to \cref{scalar-functions-applied-to-array-arguments}.

All of these convert-functions only use inheritance among user models, and not in the library that is used for the conversion -- thus conversions of base classes will require multiple conversion calls; this ensures that the conversion is independent of the new library structure.
The name of the class used as argument to \lstinline!convertElement! and \lstinline!convertModifiers! is similarly the old name of the class, i.e.\ the name before it is possibly converted by \lstinline!convertClass!.
The name of the class used as argument to \lstinline!convertElement! and \lstinline!convertModifiers! is similarly the old name of the class, i.e., the name before it is possibly converted by \lstinline!convertClass!.

\begin{nonnormative}
Specifying conversions using the old name of a class allows the conversion to be done without access to the old
Expand Down Expand Up @@ -1708,7 +1708,7 @@ \subsubsection{Conversion Rules}\label{conversion-rules}

The old element should be of a \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String!, or enumeration
type and the match is based on the literal value of the modifier.
For string elements the value argument to \lstinline!convertClassIf! shall be up-quoted, e.g.\ \lstinline!"\"My String\""!,
For string elements the value argument to \lstinline!convertClassIf! shall be up-quoted, e.g., \lstinline!"\"My String\""!,
and for enumeration literals only the enumeration literal part of the old value matters, e.g., \lstinline!red!
for \lstinline!"Colors.red"!.

Expand Down Expand Up @@ -1796,7 +1796,7 @@ \subsubsection{Conversion Rules}\label{conversion-rules}
connector \lstinline!B! is connected, there will be a parameter for enabling connector \lstinline!B!, and the conversion ensures that
each component of model \lstinline!A! will have this parameter set accordingly.

In case a parameter is simply renamed it is preferable to use \lstinline!convertElement!, since that also handles e.g.\ binding equations
In case a parameter is simply renamed it is preferable to use \lstinline!convertElement!, since that also handles, e.g., binding equations
using the parameter.
\end{nonnormative}

Expand Down Expand Up @@ -1973,7 +1973,7 @@ \subsection{Version Date and Build Information}\label{version-date-and-build-inf
\end{nonnormative}
\item
\lstinline!revisionId! is a tool specific revision identifier
possibly generated by a source code management system (e.g.\ Subversion
possibly generated by a source code management system (e.g., Subversion
or CVS). This information exactly identifies the library
source code in the source code management system.
\end{itemize}
Expand Down Expand Up @@ -2020,7 +2020,7 @@ \section{Access Control to Protect Intellectual Property}\label{annotations-for-
\end{definition}

\begin{definition}[Obfuscation]\index{obfuscation!access control}
Changing a Modelica class or generated code so that it is difficult to inspect by a user (e.g.\ by automatically renaming variables to non-meaningful names).
Changing a Modelica class or generated code so that it is difficult to inspect by a user (e.g., by automatically renaming variables to non-meaningful names).
\end{definition}

\begin{definition}[Encryption]\index{encryption!access control}
Expand Down Expand Up @@ -2183,7 +2183,7 @@ \subsection{Licensing}\label{licensing}

record License
String licensee = "" "Optional string to show information about the licensee";
String id[:] "Unique machine identifications, e.g.\ MAC addresses";
String id[:] "Unique machine identifications, e.g., MAC addresses";
String features[:] = fill("", 0) "Activated library license features";
String startDate = "" "Optional start date in UTCformat YYYY-MM-DD";
String expirationDate = "" "Optional expiration date in UTCformat YYYY-MM-DD";
Expand Down
12 changes: 6 additions & 6 deletions chapters/arrays.tex
Expand Up @@ -40,7 +40,7 @@ \section{Array Declarations}\label{array-declarations}
The following table shows the two possible forms of declarations and defines the terminology.
% Is the use of "class" here meant to exclude types defined as array aliases (see comment in table below)?
\lstinline!C! is a placeholder for any class, including the built-in type classes \lstinline!Real!, \lstinline!Integer!, \lstinline!Boolean!, \lstinline!String!, and enumeration types.
The type of a dimension upper bound expression, e.g.\ $n$, $m$, $p$, \ldots in the table below, need to be a subtype of \lstinline!Integer! or \lstinline!EB! for a class \lstinline!EB! that is an enumeration type or subtype of the \lstinline!Boolean! type.
The type of a dimension upper bound expression, e.g., $n$, $m$, $p$, \ldots in the table below, need to be a subtype of \lstinline!Integer! or \lstinline!EB! for a class \lstinline!EB! that is an enumeration type or subtype of the \lstinline!Boolean! type.

Colon (\lstinline!:!) indicates that the dimension upper bound is unknown and is a subtype of \lstinline!Integer!.
The size of such a variable can be determined from its binding equation, or the size of any of its array attributes, see also \cref{flexible-array-sizes-and-resizing-of-arrays-in-functions}.
Expand All @@ -51,7 +51,7 @@ \section{Array Declarations}\label{array-declarations}
An array indexed by \lstinline!Boolean! or enumeration type can only be used in the following ways:
\begin{itemize}
\item
Subscripted using expressions of the appropriate type (i.e.\ \lstinline!Boolean! or the enumerated type).
Subscripted using expressions of the appropriate type (i.e., \lstinline!Boolean! or the enumerated type).
\item
Binding equations of the form \lstinline!x1 = x2! are allowed for arrays independent of whether the index types of dimensions are subtypes of \lstinline!Integer!, \lstinline!Boolean!, or enumeration types.
\end{itemize}
Expand Down Expand Up @@ -227,7 +227,7 @@ \section{Built-in Array Functions}\label{built-in-array-functions}

The argument $n$ must be a constant that can be evaluated during translation, as it determines the number of dimensions of the returned array.
\begin{nonnormative}
An $n$ that is not a constant that can be evaluated during translation for \lstinline!promote! complicates matrix handling as it can change matrix-equations in subtle ways (e.g.\ changing inner products to matrix multiplication).
An $n$ that is not a constant that can be evaluated during translation for \lstinline!promote! complicates matrix handling as it can change matrix-equations in subtle ways (e.g., changing inner products to matrix multiplication).
\end{nonnormative}
\end{semantics}
\end{operatordefinition}
Expand Down Expand Up @@ -860,7 +860,7 @@ \subsubsection{Concatenation along First and Second Dimensions}\label{array-conc
\item
\lstinline![A] = promote(A, max(2, ndims(A)))!, i.e., \lstinline![A] = A!, if \lstinline!A! has 2 or more dimensions, and it is a matrix with the elements of \lstinline!A!, if \lstinline!A! is a scalar or a vector.
\item
There must be at least one argument (i.e.\ \lstinline![]! is not defined).
There must be at least one argument (i.e., \lstinline![]! is not defined).
\end{itemize}

\begin{example}
Expand Down Expand Up @@ -1312,7 +1312,7 @@ \subsection{Element-wise Exponentiation}\label{element-wise-exponentiation}
2.^[1, 2; 3, 4] // error; same as 2.0 ^ [1, 2; 3, 4]
2 .^[1, 2; 3, 4] // fine; element-wise exponentiation
\end{lstlisting}
This is a consequence of the parsing rules, i.e.\ since \lstinline!2.! could be a lexical unit it seen as a lexical unit; using a space after
This is a consequence of the parsing rules, i.e., since \lstinline!2.! could be a lexical unit it seen as a lexical unit; using a space after
literals solves the problem.
\end{example}

Expand Down Expand Up @@ -1343,7 +1343,7 @@ \subsection{Slice Operation}\label{slice-operation}
\item
If \lstinline!m! is also an array component, the slice operation is valid only if \lstinline!size(a[1].m)! = \lstinline!size(a[2].m)! = \ldots
\item
The slicing operation can be combined with indexing, e.g.\ \lstinline!a.m[1]!. It returns the array of components \lstinline!{a[1].m[1], a[2].m[1], $\ldots$}!,
The slicing operation can be combined with indexing, e.g., \lstinline!a.m[1]!. It returns the array of components \lstinline!{a[1].m[1], a[2].m[1], $\ldots$}!,
and does not require that \lstinline!size(a[1].m) = size(a[2].m)!. The number of subscripts on \lstinline!m! must not be greater than the number of array dimension
for \lstinline!m! (the number can be smaller, in which case the missing trailing indices are assumed to be `\lstinline!:!'), and is only valid if
\lstinline!size(a[1].m[$\ldots$]) = size(a[2].m[$\ldots$])!.
Expand Down
20 changes: 10 additions & 10 deletions chapters/classes.tex
Expand Up @@ -46,7 +46,7 @@ \section{Access Control -- Public and Protected Elements}\label{access-control-p
\end{example}

All elements defined under the heading \lstinline!protected! are regarded as protected. All other elements (i.e., defined
under the heading \lstinline!public!, without headings or in a separate file) are public (i.e.\ not protected). Regarding
under the heading \lstinline!public!, without headings or in a separate file) are public (i.e., not protected). Regarding
inheritance of protected and public elements, see \cref{inheritance-of-protected-and-public-elements}.


Expand Down Expand Up @@ -130,7 +130,7 @@ \subsection{Syntax}\label{component-declaration-syntax}\label{syntax-and-example

\begin{nonnormative}
The declaration of a component states the type, access, variability, data flow, and other properties of the component.
A \lstinline[language=grammar]!component-clause! i.e., the whole declaration, contains type prefixes followed by a \lstinline[language=grammar]!type-specifier! with optional \lstinline[language=grammar]!array-subscripts! followed by a \lstinline[language=grammar]!component-list!.
A \lstinline[language=grammar]!component-clause!, i.e., the whole declaration, contains type prefixes followed by a \lstinline[language=grammar]!type-specifier! with optional \lstinline[language=grammar]!array-subscripts! followed by a \lstinline[language=grammar]!component-list!.

There is no semantic difference between variables declared in a single declaration or in multiple declarations.
For example, regard the following single declaration (\lstinline[language=grammar]!component-clause!) of two matrix variables:
Expand Down Expand Up @@ -464,7 +464,7 @@ \subsection{Component Variability Prefixes}\label{component-variability-prefixes
A constant variable is similar to a parameter with the difference
that constants cannot be changed after translation and usually not
changed after they have been given a value. It can be used to represent
mathematical constants, e.g.
mathematical constants, e.g.:
\begin{lstlisting}[language=modelica]
final constant Real PI = 4*atan(1);
\end{lstlisting}
Expand Down Expand Up @@ -926,7 +926,7 @@ \section{Balanced Models}\label{balanced-models}
redeclaration cannot lead to an unbalanced model any more.
\end{nonnormative}

The restrictions below apply after flattening -- i.e.\ inherited components are included -- possibly modified. The corresponding restrictions on connectors and connections are in
The restrictions below apply after flattening -- i.e., inherited components are included -- possibly modified. The corresponding restrictions on connectors and connections are in
\cref{restrictions-of-connections-and-connectors}.

\begin{definition}[Local number of unknowns]\index{local number of unknowns}
Expand Down Expand Up @@ -957,7 +957,7 @@ \section{Balanced Models}\label{balanced-models}
The local equation size of a \lstinline!model! or \lstinline!block! class is the sum of the following numbers:
\begin{itemize}
\item
The number of equations defined locally (i.e.\ not in any \lstinline!model! or \lstinline!block! component), including binding equations, and equations generated from \lstinline!connect!-equations.
The number of equations defined locally (i.e., not in any \lstinline!model! or \lstinline!block! component), including binding equations, and equations generated from \lstinline!connect!-equations.
\begin{nonnormative}
This includes the proper count for \lstinline!when!-clauses (see \cref{when-equations}), and algorithms (see \cref{algorithm-sections}), and is also used for
the flat Hybrid DAE formulation (see \cref{modelica-dae-representation}).
Expand Down Expand Up @@ -1006,7 +1006,7 @@ \section{Balanced Models}\label{balanced-models}
\begin{definition}[Globally balanced]\index{globally balanced}\index{balanced!globally}
Similarly as locally balanced, but including all unknowns and equations
from all components. The global number of unknowns is computed by
expanding all unknowns (i.e.\ excluding parameters and constants) into a
expanding all unknowns (i.e., excluding parameters and constants) into a
set of scalars of primitive types. This should match the global equation
size defined as:
\begin{itemize}
Expand All @@ -1027,7 +1027,7 @@ \section{Balanced Models}\label{balanced-models}
\item
In a non-partial \lstinline!model! or \lstinline!block!, all non-connector inputs of \lstinline!model! or \lstinline!block! components must have binding equations.
\begin{nonnormative}
E.g.\ if the model contains a component, \lstinline!firstOrder! (of specialized class \lstinline!model!) and \lstinline!firstOrder! has
E.g., if the model contains a component, \lstinline!firstOrder! (of specialized class \lstinline!model!) and \lstinline!firstOrder! has
\lstinline!input Real u! then there must be a binding equation for \lstinline!firstOrder.u!.
Note that this also applies to components inherited from a partial base-class provided the current class is non-partial.
\end{nonnormative}
Expand Down Expand Up @@ -1097,7 +1097,7 @@ \section{Balanced Models}\label{balanced-models}
\end{align*}
and 2 equations corresponding to the 2 flow variables \lstinline!p.i! and \lstinline!n.i!.

These are 5 equations in 5 unknowns (locally balanced model). A more detailed analysis would reveal that this is structurally non-singular, i.e.\ that
These are 5 equations in 5 unknowns (locally balanced model). A more detailed analysis would reveal that this is structurally non-singular, i.e., that
the hybrid DAE will not contain a singularity independent of actual values.

If the equation \lstinline!u = p.v - n.v! would be missing in the \lstinline!Capacitor! model, there would be 4 equations in 5 unknowns and the model
Expand Down Expand Up @@ -1397,7 +1397,7 @@ \section{Predefined Types and Classes}\label{predefined-types-and-classes}
\end{nonnormative}

\begin{nonnormative}
It also follows that the only way to declare a subtype of e.g.\ \lstinline!Real! is to use the \lstinline!extends! mechanism.
It also follows that the only way to declare a subtype of, e.g., \lstinline!Real! is to use the \lstinline!extends! mechanism.
\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.
Expand Down Expand Up @@ -1696,7 +1696,7 @@ \subsection{Attributes start, fixed, nominal, and unbounded}\label{attributes-st

The attributes \lstinline!start! and \lstinline!fixed! define the initial conditions for a variable. \lstinline!fixed = false! means an initial guess, i.e., value may be changed by static analyzer. \lstinline!fixed = true! means a required value. The resulting consistent set of values for \emph{all} model variables is used as initial values for the analysis to be performed.

The attribute \lstinline!nominal! gives the nominal value for the variable. The user need not set it even though the standard does not define a default value. The lack of default allows the tool to propagate the nominal attribute based on equations, and if there is no value to propagate the tool should use a non-zero value, it may use additional information (e.g.\ \lstinline!min! attribute) to find a suitable value, and as last resort use 1. If \lstinline!unbounded = true! it indicates that the state may grow without bound, and the error in absolute terms shall be controlled.
The attribute \lstinline!nominal! gives the nominal value for the variable. The user need not set it even though the standard does not define a default value. The lack of default allows the tool to propagate the nominal attribute based on equations, and if there is no value to propagate the tool should use a non-zero value, it may use additional information (e.g., \lstinline!min! attribute) to find a suitable value, and as last resort use 1. If \lstinline!unbounded = true! it indicates that the state may grow without bound, and the error in absolute terms shall be controlled.

\begin{nonnormative}
The nominal value can be used by an analysis tool to determine appropriate tolerances or epsilons, or may be used for scaling. For example, the tolerance for an integrator could be computed as \lstinline!tol * (abs(nominal) + (if x.unbounded then 0 else abs(x)))!. A default value is not provided in order that in cases such as \lstinline!a = b!, where \lstinline!b! has a nominal value but not \lstinline!a!, the nominal value can be propagated to the other variable).
Expand Down

0 comments on commit 7f9cb19

Please sign in to comment.