Clarify events in algorithms, and add examples.#3837
Clarify events in algorithms, and add examples.#3837HansOlsson wants to merge 4 commits intomodelica:masterfrom
Conversation
| \begin{lstlisting}[language=modelica] | ||
| model AlgorithmEvent2 | ||
| Real x[n](start = 2:4); | ||
| parameter Integer n = 3 annotation(Evaluate=true); | ||
| Boolean b[n]; | ||
| equation | ||
| der(x) = -2*x; | ||
| algorithm | ||
| for i in 1:n loop | ||
| b[i] := x[i] > 1; | ||
| end for; | ||
| end AlgorithmEvent2; | ||
| \end{lstlisting} | ||
| Here we get one crossing function for each element of \lstinline!x!, three in total. |
There was a problem hiding this comment.
Should we really make such a big point of how a for-statement works when we don't have an example with a for-equation? For me, it would make more sense to just split the example in two, and make the second one primarily about for-equations, possibly also mentioning that for-statements are similar.
There was a problem hiding this comment.
I see reasons for making a big point about for-statements, but I wouldn't mind a for-equation example.
The reason is that traditionally for-equations were normally expanded, and adding crossing functions to expanded equations seems kind of trivial. For-statements are different (as they are not expanded), so one "line" in the source-code leads to multiple crossing functions. Both as a user and implementor I find that significant enough to have a special example.
There was a problem hiding this comment.
Split into two example-sections, and add that for-equation text in second example-section.
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
No description provided.