Changes between Initial Version and Version 1 of Ticket #6260, comment 11
- Timestamp:
- 2021-02-18T00:27:51Z (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #6260, comment 11
initial v1 1 1 @franco, I checked [https://specification.modelica.org/maint/3.5/synchronous-language-elements.html Chapter 16] of the Modelica Specification. As I understand, discrete and clocked variables have a different variability. Discrete variables change at discrete event, but they are well defined (and remain constant) in-between. Clocked variables exist only at clock events, and are not defined elsewhere; if you want to use them together with continuous or discrete variables, you need to use the {{{sample()}}} and {{{hold()}}} operators. 2 2 3 That said, clocked variables are either explicitly declared as such, or they can be inferred to be clocked because they show up in clocked equations. In all examples of the Specification, this happens with continuous time Real variables. However, as clocked variables can also be Boolean, Integer and String (which are discrete by definition), there is no reason why they couldn't be discrete as well.3 That said, clocked variables are either explicitly declared as such, or they can be inferred to be clocked because they show up in clocked equations. In all examples of the Specification, this happens with continuous time Real variables. However, as clocked variables can also be Boolean, Integer and String (which are discrete by definition), there is no reason why they couldn't be discrete Real as well. 4 4 5 5 Summing up, I don't see the point of declaring x as discrete, since it will automatically get its clocked discrete-time status from the equation {{{x = sample(time,clk)}}}. But it shouldn't be illegal.