Skip to content

Wrong interpretation of real interval clock interval? #3753

@henrikt-ma

Description

@henrikt-ma

I just fixed the System Modeler implementation of real interval clock so that it agrees with the specification for this extremely basic example (with non-parametric interval):

model RealClock2
  Real interval1(start = 0.1);
  Clock c = Clock(interval1);
equation
  when c then
    interval1 = previous(interval1) + 0.1;
  end when;
end RealClock2;

The clock ticks at:

  • 0.0 (the start of simulation): Here previous(interval1) = interval1.start = 0.1, and interval1 becomes 0.2 at this time.
  • 0.1: Here previous(interval1) = 0.2, and interval1 becomes 0.3 at this time.
  • 0.3: Here previous(interval1) = 0.3, and interval1 becomes 0.4 at this time.
  • 0.6: Here previous(interval1) = 0.4, and interval1 becomes 0.5 at this time.
  • and so forth

However, it makes me a bit concerned to see that the clock isn't ticking at the same times with OpenModelica. In OpenModelica it is as if interval1 was used instead of previous(interval1) in the formula for the next clock tick.

Is there something wrong with my interpretation of the specification?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions