From 26d81b2a8c7a454f0b894379eb1a835dd0275b79 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:14:06 +0100 Subject: [PATCH 1/9] Require order of 'smooth' to be evaluable --- chapters/operatorsandexpressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index 70fa601bb..d75909a66 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -1397,7 +1397,7 @@ \subsection{Event-Related Operators with Function Syntax}\label{event-related-op \end{lstlisting}\end{synopsis} \begin{semantics} If $p \geq 0$ \lstinline!smooth($p$, $\mathit{expr}$)! returns $\mathit{expr}$ and states that $\mathit{expr}$ is $p$ times continuously differentiable, i.e., $\mathit{expr}$ is continuous in all \lstinline!Real! variables appearing in the expression and all partial derivatives with respect to all appearing real variables exist and are continuous up to order $p$. -The argument $p$ should be a scalar \lstinline!Integer! parameter expression. +The argument $p$ shall be a scalar \lstinline!Integer! evaluable expression. The only allowed types for $\mathit{expr}$ in \lstinline!smooth! are: \lstinline!Real! expressions, arrays of allowed expressions, and records containing only components of allowed expressions. \lstinline!smooth! should be used instead of \lstinline!noEvent! in order to avoid events for efficiency reasons. From 2ee1a4b1632b041121750b5251864bd96acf25b5 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:15:29 +0100 Subject: [PATCH 2/9] Require that 'cat' dimension argument is evaluable --- chapters/arrays.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/arrays.tex b/chapters/arrays.tex index b410712fa..84060ade7 100644 --- a/chapters/arrays.tex +++ b/chapters/arrays.tex @@ -819,7 +819,7 @@ \subsection{Concatenation}\label{array-concatenation}\label{concatenation} The maximally expanded types should be equivalent. \lstinline!Real! and \lstinline!Integer! subtypes can be mixed resulting in a \lstinline!Real! result array where the \lstinline!Integer! numbers have been transformed to \lstinline!Real! numbers. \item - $k$ has to characterize an existing dimension, i.e., $1 \leq k \leq \text{\lstinline!ndims(A)!} = \text{\lstinline!ndims(B)!} = \text{\lstinline!ndims(C)!}$; $k$ shall be a parameter expression of \lstinline!Integer! type. + $k$ has to characterize an existing dimension, i.e., $1 \leq k \leq \text{\lstinline!ndims(A)!} = \text{\lstinline!ndims(B)!} = \text{\lstinline!ndims(C)!}$; $k$ shall be an evaluable expression of \lstinline!Integer! type. \item Size matching: Arrays \lstinline!A!, \lstinline!B!, \lstinline!C!, \ldots must have identical array sizes with the exception of the size of dimension $k$, i.e., \lstinline!size(A, $j$)! = \lstinline!size(B, $j$)!, for $1 \leq j \leq \text{\lstinline!ndims(A)!}$ and $j \neq k$. \end{itemize} From 88ca7eaff72b5837fac4fe02aee54b458d6e405a Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:30:16 +0100 Subject: [PATCH 3/9] Tidy up presentation of component condition Besides some general cleanup, this fixes an issue with the wrong variability for the component condition. --- chapters/classes.tex | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/chapters/classes.tex b/chapters/classes.tex index 286c1e8a7..a7d5a58a5 100644 --- a/chapters/classes.tex +++ b/chapters/classes.tex @@ -87,8 +87,7 @@ \section{Component Declarations}\label{component-declarations} Component declarations are described in this section. 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 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 condition. A component declaration may be overridden by an element-redeclaration. A \firstuse{component} or \firstuse{variable} is an instance (object) generated by a component declaration. @@ -354,7 +353,7 @@ \subsection{Acyclic Bindings of Constants and Parameters}\label{acyclic-bindings \subsection{Conditional Component Declaration}\label{conditional-component-declaration} -A component declaration can have a \lstinline!condition-attribute!: \lstinline!if!~\emph{expression}. +A component declaration can have a \lstinline[language=grammar]!condition-attribute! of the form \lstinline!if $\mathit{condition}$!. \begin{example} \begin{lstlisting}[language=modelica] @@ -374,7 +373,7 @@ \subsection{Conditional Component Declaration}\label{conditional-component-decla \end{lstlisting} \end{example} -The \emph{expression} must be a \lstinline!Boolean! scalar expression, and must be an evaluable expression. +The $\mathit{condition}$ must be a scalar \lstinline!Boolean! evaluable expression. \begin{nonnormative} An evaluable expression is required since it shall be evaluated at compile time. @@ -383,10 +382,10 @@ \subsection{Conditional Component Declaration}\label{conditional-component-decla A redeclaration of a component shall not include a condition attribute; and the condition attribute is kept from the original declaration (see \cref{interface-compatibility-or-subtyping}). -If the \lstinline!Boolean! expression is \lstinline!false!, the component (including its modifier) is removed from the flattened DAE, and connections to/from the component are removed. +If $\mathit{condition}$ is \lstinline!false!, the component (including its modifier) is removed from the flattened DAE, and connections to/from the component are removed. Such a component can only be modified, used in connections, and/or used in a modifier of another conditional component with a \lstinline!false! condition. -There are no restrictions on the component if the \lstinline!Boolean! expression is \lstinline!true!. +There are no restrictions on the component if $\mathit{condition}$ is \lstinline!true!. \begin{nonnormative} Adding the component and then removing it ensures that the component is valid. From 965ccdc786f2734860ad25f6b9c08da5c777e3c1 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:32:16 +0100 Subject: [PATCH 4/9] Fix variability in comment of ArrayVariants example --- chapters/classes.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/classes.tex b/chapters/classes.tex index a7d5a58a5..9eb7f4134 100644 --- a/chapters/classes.tex +++ b/chapters/classes.tex @@ -181,7 +181,7 @@ \subsection{Static Semantics}\label{component-declaration-static-semantics} parameter Real b[2, 0] = ones(2, 0); // Size 0 is allowed parameter Real c[:] = ones(0); // Unspecified size for variable parameter Integer n = 0; - Real z[n*2] = cat(1, ones(n), zeros(n));// Parameter expressions are allowed + Real z[n*2] = cat(1, ones(n), zeros(n));// Evaluable expressions are allowed Boolean notV[Boolean] = {true, false}; // Indexing with type end ArrayVariants; \end{lstlisting} From 0841f3beef4167800590e277137e8c57f155d117 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:50:38 +0100 Subject: [PATCH 5/9] Skip last part of Connections.root non-normative sentence This change is part of a sweep of addressing incorrect use of parameter variability. In this case, speaking of parameter variability in the example was technically not incorrect, but speaking of a particular expression variability seemed more confusing than helpful. --- chapters/connectors.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/connectors.tex b/chapters/connectors.tex index b20e50a5d..0d1dcbf9e 100644 --- a/chapters/connectors.tex +++ b/chapters/connectors.tex @@ -864,7 +864,7 @@ \subsection{Connection Graphs and Their Operators}\label{overconstrained-equatio The overdetermined type or record instance \lstinline!R! in connector instance \lstinline!a! is a \firstuse[definite root node]{(definite) 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. +This definition shall be used if in a model with connector \lstinline!a!, the overdetermined record \lstinline!a.R! is (consistently) assigned. \end{nonnormative} \end{semantics} \end{operatordefinition} From 15fc83640faefc8c3d313c9b9e669afe7d167017 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:53:13 +0100 Subject: [PATCH 6/9] Change parameter -> evaluable in rule for if-equation inside when-equation --- chapters/equations.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/equations.tex b/chapters/equations.tex index 5f1ff0e35..1e605da6a 100644 --- a/chapters/equations.tex +++ b/chapters/equations.tex @@ -312,7 +312,7 @@ \subsubsection{Equations within When-Equations}\label{restrictions-on-equations- The different branches of \lstinline!when!/\lstinline!elsewhen! must have the same set of component references on the left-hand side. Here, the destination variable of a \lstinline!reinit! (including when inside a \lstinline!when!-clause activated with \lstinline!initial()!) is not considered a left-hand side, and hence \lstinline!reinit! is unaffected by this requirement (as are \lstinline!assert! and \lstinline!terminate!). \item - The branches of an \lstinline!if!-equation inside \lstinline!when!-equations must have the same set of component references on the left-hand side, unless all switching conditions of the \lstinline!if!-equation are parameter expressions. + The branches of an \lstinline!if!-equation inside \lstinline!when!-equations must have the same set of component references on the left-hand side, unless all switching conditions of the \lstinline!if!-equation are evaluable expressions. \item Any left-hand side reference, (\lstinline!v!, \lstinline!out1!, \ldots), in a \lstinline!when!-clause must be a component reference, and any indices must be evaluable expressions. \end{itemize} From a03bd40e484c35c141e542b1e035a9272a709d03 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:54:17 +0100 Subject: [PATCH 7/9] Require evaluable expression for array size inside functions --- chapters/functions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/functions.tex b/chapters/functions.tex index f91c8620b..10f485e3d 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -169,7 +169,7 @@ \section{Function as a Specialized Class}\label{function-as-a-specialized-class} \item There are many Modelica built-in operators that are not allowed to be used in functions, including \lstinline!der!, \lstinline!initial!, \lstinline!terminal!, \lstinline!sample!, \lstinline!pre!, \lstinline!edge!, \lstinline!change!, \lstinline!reinit!, \lstinline!delay!, \lstinline!cardinality!, \lstinline!inStream!, \lstinline!actualStream!, the operators of the built-in package \lstinline!Connections!, the operators defined in \cref{synchronous-language-elements} and \cref{state-machines}. \item - The dimension \emph{sizes} not declared with colon (\lstinline!:!) of each array result or array local variable (i.e., a non-input component) of a function must be either given by the input formal parameters, or given by constant or parameter expressions, or by expressions containing combinations of those (\cref{initialization-and-binding-equations-of-components-in-functions}). + The dimension \emph{sizes} not declared with colon (\lstinline!:!) of each array result or array local variable (i.e., a non-input component) of a function must be either given by the input formal parameters, or given by constant or evaluable expressions, or by expressions containing combinations of those (\cref{initialization-and-binding-equations-of-components-in-functions}). \item For initialization of local variables of a function see \cref{initialization-and-binding-equations-of-components-in-functions}). \item From 177b95b7b1068965baf5fd0a29e5a02e420089bf Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:55:05 +0100 Subject: [PATCH 8/9] Require subscripts inside pre(...) to be evaluable --- chapters/operatorsandexpressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index d75909a66..08ffd9fc3 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -1443,7 +1443,7 @@ \subsection{Event-Related Operators with Function Syntax}\label{event-related-op Returns the \emph{left limit} $y(t^{-})$ of variable $y(t)$ at a time instant $t$. At an event instant, $y(t^{-})$ is the value of $y$ after the last event iteration at time instant $t$ (see comment below). % Warning "component expression" is a term defined for synchronous operator argument restrictions; this seems to conflict with also defining the present argument restriction below. -Any subscripts in the component expression $y$ must be parameter expressions. +Any subscripts in the component expression $y$ must be evaluable expressions. The operator is not allowed inside \lstinline!function! classes. \lstinline!pre! can be applied to the variable $y$ only if $y$ is a discrete-time expression and $y$ is either a subtype of a simple type or is a record component. \begin{nonnormative} From f0e5ab18c140740cf3f7df3d594c0c9cdf6917c2 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Fri, 27 Mar 2026 22:56:04 +0100 Subject: [PATCH 9/9] Require evaluable if-conditions around transitions --- chapters/statemachines.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/statemachines.tex b/chapters/statemachines.tex index 7f93834bc..07747a61a 100644 --- a/chapters/statemachines.tex +++ b/chapters/statemachines.tex @@ -51,7 +51,7 @@ \section{Transitions}\label{transitions} \end{tabular} \end{center} -The \lstinline!transition!- and \lstinline!initialState!-equations can only be used in equations, and cannot be used inside \lstinline!if!-equations with conditions that are not parameter expressions, or in \lstinline!when!-equations. +The \lstinline!transition!- and \lstinline!initialState!-equations can only be used in equations, and cannot be used inside \lstinline!if!-equations with conditions that are not evaluable expressions, or in \lstinline!when!-equations. The operators listed below are used to query the status of the state machine. None of these operators are allowed inside \lstinline!function! classes.