You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The four line points $P_{1}$, \ldots{}, $P_{4}$ result in two quadratic splines and two straight line segments.
936
-
}\label{fig:smooth-bezier}
938
+
}
939
+
\label{fig:smooth-bezier}
937
940
\end{figure}
938
941
939
942
The \lstinline!smooth! attribute specifies that a line can be drawn as straight line segments (\lstinline!None!) or using a spline (\lstinline!Bezier!), where the line's points specify control points of a quadratic Bezier curve, see \cref{fig:smooth-bezier}.
A button can be represented by a rectangle changing color depending on a \lstinline!Boolean! variable \lstinline!on! and toggles the
1365
-
variable when the rectangle is clicked on:
1367
+
A button can be represented by a rectangle changing color depending on a \lstinline!Boolean! variable \lstinline!on! and toggles the variable when the rectangle is clicked on:
If \lstinline!connectorSizing = true!, the corresponding variable must be declared with the \lstinline!parameter! prefix, must be a subtype of a scalar \lstinline!Integer! and must have a literal default value of zero.
1733
1735
1734
1736
\begin{nonnormative}
1735
-
The reason why \lstinline!connectorSizing! must be given a literal value is that if the value is an expression,
1736
-
the \lstinline!connectorSizing! functionality is conditional and this will then lead easily to wrong models.
1737
+
The reason why \lstinline!connectorSizing! must be given a literal value is that if the value is an expression, the \lstinline!connectorSizing! functionality is conditional and this will then lead easily to wrong models.
1737
1738
1738
1739
The default value of the variable must be zero since this annotation is designed for a parameter that is used as vector dimension, and the dimension of the vector should be zero when the component is dragged or redeclared.
1739
1740
Furthermore, when a tool does not support the \lstinline!connectorSizing! annotation, dragging will still result in a correct model.
This ensures that for example \lstinline!Modelica.SIunits.Length! is converted to \lstinline!Modelica.Units.SI.Length!
1967
-
and \lstinline!Modelica.SIunits.Icons! is converted to \lstinline!Modelica.Units.Icons!.
1967
+
This ensures that for example \lstinline!Modelica.SIunits.Length! is converted to \lstinline!Modelica.Units.SI.Length! and \lstinline!Modelica.SIunits.Icons! is converted to \lstinline!Modelica.Units.Icons!.
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.
645
-
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
646
-
enclosing class for all classes.
645
+
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.
647
646
648
647
The object generated by a class is called an \firstuse{instance}.
649
648
An instance contains zero or more components (i.e., instances), equations, algorithms, and local classes.
Copy file name to clipboardExpand all lines: chapters/connectors.tex
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,9 @@ \subsection{Inside and Outside Connectors}\label{inside-and-outside-connectors}
77
77
\begin{center}
78
78
\includegraphics{innerouterconnector}
79
79
\end{center}
80
-
\caption{Example for inside and outside connectors.}
80
+
\caption{
81
+
Example for inside and outside connectors.
82
+
}
81
83
\end{figure}
82
84
The figure visualizes the following \lstinline!connect!-equations to the connector \lstinline!c! in the models \lstinline!m!$i$.
83
85
Consider the following \lstinline!connect!-equations found in the model for component \lstinline!m0!:
@@ -426,8 +428,7 @@ \section{Generation of Connection Equations}\label{generation-of-connection-equa
426
428
427
429
The bold-face $\mathbf{0}$ represents an array or scalar zero of appropriate dimensions (i.e., the same size as $z$).
428
430
429
-
For an \lstinline!operator record! type this uses the operator \lstinline!'0'! -- which must be defined in the operator record -- and all of the flow variables for the \lstinline!operator record!
430
-
must be of the same \lstinline!operator record! type.
431
+
For an \lstinline!operator record! type this uses the operator \lstinline!'0'! -- which must be defined in the operator record -- and all of the flow variables for the \lstinline!operator record! must be of the same \lstinline!operator record! type.
431
432
This implies that in order to have flow variables of an \lstinline!operator record! type the \lstinline!operator record! must define addition, negation, and \lstinline!'0'!; and these operations should define an additive group.
432
433
433
434
In order to generate equations for flow variables (using the \lstinline!flow!\indexinline{flow} prefix), the sign used for the connector variable $z_{i}$ above is +1 for inside connectors and -1 for outside connectors ($z_{3}$ in the example above).
If there are multiple \lstinline!reinit! for a variable inside the same \lstinline!when!- or \lstinline!elsewhen!-clause, they must appear in different branches of an \lstinline!if!-equation (in order that at most one \lstinline!reinit! for the variable is active at any event).
450
450
In case of \lstinline!reinit! active during initialization (due to \lstinline!when initial()!), see \cref{initialization-initial-equation-and-initial-algorithm}.
451
451
452
-
\lstinline!reinit! does not break the single assignment rule, because \lstinline!reinit(x, expr)! in equations evaluates \lstinline!expr! to a value,
453
-
then at the end of the current event iteration step it assigns this value to \lstinline!x! (this copying from values to reinitialized state(s) is done after all other evaluations of the model and before copying \lstinline!x! to \lstinline!pre(x)!).
452
+
\lstinline!reinit! does not break the single assignment rule, because \lstinline!reinit(x, expr)! in equations evaluates \lstinline!expr! to a value, then at the end of the current event iteration step it assigns this value to \lstinline!x! (this copying from values to reinitialized state(s) is done after all other evaluations of the model and before copying \lstinline!x! to \lstinline!pre(x)!).
454
453
455
454
\begin{example}
456
455
If a higher index system is present, i.e., constraints between state variables, some state variables need to be redefined to non-state variables.
@@ -558,12 +557,10 @@ \section{Synchronous Data-Flow Principle and Single Assignment Rule}\label{synch
558
557
Modelica is based on the synchronous data flow principle and the single assignment rule, which are defined in the following way:
559
558
\begin{enumerate}
560
559
\item Discrete-time variables keep their values until these variables are explicitly changed.
561
-
Differentiated variables have \lstinline!der(x)! corresponding to the time-derivative of \lstinline!x!,
562
-
and \lstinline!x! is continuous, except when \lstinline!reinit! is triggered, see \cref{reinit}.
560
+
Differentiated variables have \lstinline!der(x)! corresponding to the time-derivative of \lstinline!x!, and \lstinline!x! is continuous, except when \lstinline!reinit! is triggered, see \cref{reinit}.
563
561
Variable values can be accessed at any time instant during continuous integration and at event instants.
564
562
565
-
\item At every time instant, during continuous integration and at event instants,
566
-
the equations express relations between variables which have to be fulfilled concurrently.
563
+
\item At every time instant, during continuous integration and at event instants, the equations express relations between variables which have to be fulfilled concurrently.
567
564
568
565
\item Computation and communication at an event instant does not take time.
569
566
\begin{nonnormative}
@@ -728,8 +725,7 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali
728
725
\begin{nonnormative}
729
726
If a \lstinline!when!-clause equation \lstinline!v = expr;! is not active during the initialization phase, the equation \lstinline!v = pre(v)! is added for initialization.
730
727
This follows from the mapping rule of \lstinline!when!-clause equations.
731
-
If the condition of the \lstinline!when!-clause contains \lstinline!initial()!,
732
-
but not in one of the specific forms, the \lstinline!when!-clause is not active during initialization: \lstinline!when not initial() then print("simulation started"); end when;!
728
+
If the condition of the \lstinline!when!-clause contains \lstinline!initial()!, but not in one of the specific forms, the \lstinline!when!-clause is not active during initialization: \lstinline!when not initial() then print("simulation started"); end when;!
733
729
\end{nonnormative}
734
730
735
731
The algorithmic statements within a \lstinline!when!-statement 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!.
@@ -738,8 +734,7 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali
738
734
An active \lstinline!when!-clause inactivates the following \lstinline!elsewhen! (similarly as for \lstinline!when!-clauses during simulation), but apart from that the first \lstinline!elsewhen initial() then! or \lstinline!elsewhen {$\ldots$, initial(), $\ldots$} then! is similarly active during initialization as \lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then!.
739
735
740
736
\begin{nonnormative}
741
-
That means that any subsequent \lstinline!elsewhen initial()! has no effect,
742
-
similarly as \lstinline!when false then!.
737
+
That means that any subsequent \lstinline!elsewhen initial()! has no effect, similarly as \lstinline!when false then!.
743
738
\end{nonnormative}
744
739
745
740
\begin{nonnormative}
@@ -755,8 +750,7 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali
755
750
\item
756
751
For a continuous-time \lstinline!Real! variable \lstinline!vc!, the equation \lstinline!pre(vc) = vc! is added to the initialization equations.
757
752
\begin{nonnormative}
758
-
If \lstinline!pre(vc)! is not present in the flattened model, a tool may choose not to introduce this equation, or if it was introduced
759
-
it can eliminate it (to avoid the introduction of many dummy variables \lstinline!pre(vc)!).
753
+
If \lstinline!pre(vc)! is not present in the flattened model, a tool may choose not to introduce this equation, or if it was introduced it can eliminate it (to avoid the introduction of many dummy variables \lstinline!pre(vc)!).
760
754
\end{nonnormative}
761
755
\item
762
756
Implicitly by using the \lstinline!start!-attribute for variables with \lstinline!fixed = true!.
0 commit comments