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 , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The last comment accidentally did go the wrong ticket. Ignore it.
follow-up: 6 comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | reopened → accepted |
Following the Modelica spec cited above, it should be implemented in the module SynchronousFeatures
.
comment:4 by , 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:6 by , 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 , 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 , 9 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
4dbbfd4/OMCompiler and 4832d7a4/OMCompiler introduce a the default Clock(1.0) and raise a warning as proposed in the Modelica spec (see above).
Should be fixed by https://github.com/OpenModelica/OMCompiler/commit/0e016dc235f2d72d19081e52ac2a3db276b5c6c0