Skip to content

Commit

Permalink
Slightly modify example on prevention of external function evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Dec 18, 2020
1 parent 5fb971a commit 399f530
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions chapters/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,17 @@ \subsection{Component Variability Prefixes discrete, parameter, constant}\label{
parameter Integer n = length("Hello"); /* Structural parameter */
parameter Integer p = length("Hello")
annotation(Evaluate = false); /* Normal parameter */
parameter Boolean b = false;
parameter Boolean b = false; /* Structural parameter */

/* Fulfillment of acyclic binding rule might cause evaluation of n: */
parameter Real x = if b and n > 3 then 1 - x else 0;
/* Fulfillment of acyclic binding rule might cause evaluation of n;
* to break the cycle, a tool might evaluate either b, n, or both:
*/
parameter Real x = if b and n < 3 then 1 - x else 0;

/* Fulfillment of acyclic binding rule cannot cause evaluation of p: */
parameter Real y = if b and p > 3 then 1 - y else 0;
/* Fulfillment of acyclic binding rule cannot cause evaluation of p;
* to break the cycle, evaluation of b is the only option:
*/
parameter Real y = if b and p < 3 then 1 - y else 0;
\end{lstlisting}
\end{example}

Expand Down

0 comments on commit 399f530

Please sign in to comment.