Opened 9 years ago

Closed 9 years ago

#3752 closed enhancement (fixed)

Add simulation parameter for setting default clock period

Reported by: Bernhard Thiele Owned by: Rüdiger Franke
Priority: high Milestone: Future
Component: Run-time Version: v1.9.4-dev-nightly
Keywords: synchronous Cc: Lennart Ochel, Rüdiger Franke, Niklas Worschech

Description

The MLS mentions a default clock at page 195:

A default clock, if neither a Real interval, nor a Rational interval nor a Boolean clock is associated with a base partition. In this case the default clock is associated with the fastest sub-clock partition. [Typically, a tool will use Clock(1.0) as a default clock and will raise a warning, that it selected a default clock.]

My proposal is to add a parameter, e.g., --defaultClockPeriod=1.0, with a default value of 1.0s to set the default clock period used in the C/Cpp runtime.

Change History (8)

comment:1 by Bernhard Thiele, 9 years ago

Resolution: fixed
Status: newclosed

comment:2 by Bernhard Thiele, 9 years ago

Resolution: fixed
Status: closedreopened

The last comment accidentally did go the wrong ticket. Ignore it.

comment:3 by Rüdiger Franke, 9 years ago

Owner: changed from somebody to Rüdiger Franke
Status: reopenedaccepted

Following the Modelica spec cited above, it should be implemented in the module SynchronousFeatures.

comment:4 by Rüdiger Franke, 9 years ago

On the other side one might explicitly want an inferred clock, e.g. when exporting an FMU -- meaning that the code generation is the best place for inserting a default sample period into a simulator.

comment:5 by Lennart Ochel, 9 years ago

How is it currently handled in the cpp runtime?

in reply to:  3 comment:6 by Bernhard Thiele, 9 years ago

Replying to rfranke:

Following the Modelica spec cited above, it should be implemented in the module SynchronousFeatures.

This would correspond to set the default clock at compile time, rather than at run time. I have no strong opinion about it. Setting it at run time adds some flexibility, but doing it at compile time might have other advantages.

comment:7 by Rüdiger Franke, 9 years ago

Both the C and the Cpp templates currently call the frontend function Expression.getClockInterval. It returns 0.0 for an unknown (inferred) clock.

The FMI export does not call this function, but generates a different modelDescription.xml for each possible clock type (integer, real, inferred, ...).

I think that the place where the CodegenC/Cpp.tpl call getClockInterval is where a default clock should be introduced.

comment:8 by Rüdiger Franke, 9 years ago

Resolution: fixed
Status: acceptedclosed

4dbbfd4/OMCompiler and 4832d7a4/OMCompiler introduce a the default Clock(1.0) and raise a warning as proposed in the Modelica spec (see above).

Note: See TracTickets for help on using tickets.