I believe it is well understood that the specification doesn't give a correct picture of how event clock partitions need to be handled. First, we have https://specification.modelica.org/master/synchronous-language-elements.html#S5.SS1.SSS1 which claims:
… all base-clock partitions, see section 16.7.3, need not to be sorted with respect to each other. Instead, at an event instant, active base-clock partitions can be evaluated first (and once) in any order. Afterwards, the continuous-time partition is evaluated.
As I understand it, this is not actually the case, as event clocks might tick in any any turn of an event iteration. It seems to me that this is most naturally achieved by evaluating the event clock partitions after the continuous-time partition, generally in every turn of the event iteration. (Of course, one needs to ensure that sample(…) behaves correctly, but more on this below.) Further, it also seems clear that the same event clock may tick several times during an event iteration, which contradicts https://specification.modelica.org/master/synchronous-language-elements.html#rationale-for-clocked-semantics:
- Clocked equations are straightforward to optimize because they are evaluated exactly once at each an event instant.
The lack of clarity regarding evaluation of event clock partitions makes me wonder about the definition of clocked sample(u, clock) in https://specification.modelica.org/master/synchronous-language-elements.html#modelica:clocked-sample:
The operator returns a clocked variable that has clock as associated clock and has the value of the left limit of u when clock is active (that is the value of u just before the event of c is triggered).
Is it the usual mathematical left limit which is meant, or is it the left limit in the sense of pre, https://specification.modelica.org/master/operators-and-expressions.html#modelica:pre?
At an event instant, y(tMinus) is the value of y after the last event iteration at time instant t (see comment below).
I believe it is well understood that the specification doesn't give a correct picture of how event clock partitions need to be handled. First, we have https://specification.modelica.org/master/synchronous-language-elements.html#S5.SS1.SSS1 which claims:
As I understand it, this is not actually the case, as event clocks might tick in any any turn of an event iteration. It seems to me that this is most naturally achieved by evaluating the event clock partitions after the continuous-time partition, generally in every turn of the event iteration. (Of course, one needs to ensure that
sample(…)behaves correctly, but more on this below.) Further, it also seems clear that the same event clock may tick several times during an event iteration, which contradicts https://specification.modelica.org/master/synchronous-language-elements.html#rationale-for-clocked-semantics:The lack of clarity regarding evaluation of event clock partitions makes me wonder about the definition of clocked
sample(u, clock)in https://specification.modelica.org/master/synchronous-language-elements.html#modelica:clocked-sample:Is it the usual mathematical left limit which is meant, or is it the left limit in the sense of
pre, https://specification.modelica.org/master/operators-and-expressions.html#modelica:pre?