Modelica.Clocked.UsersGuide Modelica.Clocked.UsersGuide

Library Modelica.Clocked is a Modelica package to precisely define and synchronize sampled data systems with different sampling rates. This package contains the user's guide for the library and has the following content:

  1. Getting started contains an introduction to the most important features and how to use them.
  2. Literature provides references that have been used to design and implement this library.
  3. Release Notes summarizes the differences between different versions of this library.
  4. Requirements sketches the requirements on a Modelica tool, in order that this library can be utilized.
  5. Contact provides information about the authors of the library as well as acknowledgments.

Extends from Modelica.Icons.Information (Icon for general information packages).

Package Content

Name Description
Modelica.Clocked.UsersGuide.GettingStarted GettingStarted Getting started
Modelica.Clocked.UsersGuide.Clocks Clocks Clocks
Modelica.Clocked.UsersGuide.Literature Literature Literature
Modelica.Clocked.UsersGuide.ReleaseNotes ReleaseNotes Release notes
Modelica.Clocked.UsersGuide.Requirements Requirements Requirements
Modelica.Clocked.UsersGuide.Contact Contact Contact

Modelica.Clocked.UsersGuide.GettingStarted Modelica.Clocked.UsersGuide.GettingStarted

Please explore the Examples, which provide simple models for a broad variety of applications.

A central element of the Modelica.Clocked library is a clock. For an introduction to clocks see UsersGuide.Clocks.

Extends from Modelica.Icons.Information (Icon for general information packages).

Modelica.Clocked.UsersGuide.Clocks Modelica.Clocked.UsersGuide.Clocks

A central element of the Modelica.Clocked library is a clock. Below, the most important information for clocks is summarized. For more details, see the Modelica Language Specification, Chapter 16 (for Modelica Language Version ≥ 3.3).

The Clock type is a base data type introduced in Modelica 3.3 (additionally to Real, Boolean…) which can be understood as a specialized Boolean type: Clock variables are either true (also called "active") or false ("inactive"). It is specialized in the sense that each Clock variable generates a partition consisting of a set of equations which gets activated when the clock is active. In fact, every variable and every equation of a Modelica model (starting with Modelica Language Version 3.3) is assigned to a partition:

This feature is visualized in the figure below where c(ti) is a clock that is active at particular time instants ti and r(ti) is a variable that is associated to this clock. Notice that a clocked variable has only a value when the corresponding clock is active:

Clock variables and clocked variables

Clock blocks and connectors

The Clock type introduced above is a base type of the Modelica language and it is mostly intended for textual model description. The Clocked library encapsulates this base type and allows for graphical modeling thanks to the clock blocks and connectors it provides.

Similarly to RealInput, RealOutput etc., clock input and output connectors, called ClockInput and ClockOutput, are defined in sublibrary ClockSignal.Interfaces in order to propagate clocks via connections.

A clock signal can be generated with one of the blocks of sublibrary ClockSignals.Clocks:

Sublibrary ClockSignals.Clocks

The output signals of the blocks in the above figure are clock signals, by default visualized with dotted grey lines.

Derived clocks (sub/super/shift-sampling)

With the blocks of sublibrary ClockSignals.Sampler a clock signal can be sub-sampled, super-sampled, or shift-sampled to generate a new clock signal. For example, with the following model, a periodic clock signal of 0.1 s is sub-sampled with a factor 3 and therefore a clock signal with a period of 0.3 s is generated:

Sub-sample example model
Sub-sample example plot

The relationship between such derived clocks is exact, so it is guaranteed that at every 3rd tick of clock "periodicRealClock.y", the clock "subSample.y" is active.

The two types of clocked partitions

A clocked partition is a set of equations that depend on each other and where the boundary variables are marked with sample and hold operators (boundary with other clocked partitions or with the global continuous-time partition). A sub-clock partition is a part of clock partition that use a specific derived clock, separated from other sub-clock partitions by operators like subSample and superSample. All equations within a sub-clock partition are active at the same time.

There are two types of sub-clock partitions:

Notice that it is an error if a partition doesn't fall into one of these two categories, e.g., if operators previous and der are both used in the same partition. This means it is not allowed to mix continuous time and discrete-time operators in a clocked partition (unlike in the global continuous time partition).

Also notice that in a clocked discrete-time partition all event-generating mechanisms do no longer apply. Especially neither relations, nor one of the built-in event triggering operators will trigger an event.

Solver for clocked discretized continuous-time partitions

If a clock is associated to a clocked continuous-time partition, then an integrator has to be defined that is used to integrate the partition from the previous to the current clock tick. This is performed by setting, for the corresponding clock signal generating block, parameter useSolver = true and defining the integration method as String with parameter solver. Both parameters are to be found in tab Advanced of clock signal generating blocks. The possible integration methods are tool dependent. It is expected that at least the solvers "External" (= use the integrator selected in the simulation environment) and "ExplicitEuler" (= explicit Euler method) are supported by every tool. For an example, see Examples.Systems.ControlledMixingUnit.

Extends from Modelica.Icons.Information (Icon for general information packages).

Modelica.Clocked.UsersGuide.Literature Modelica.Clocked.UsersGuide.Literature

This library is based on the following references:

[Astrom2008] K.J. Aström, B. Wittenmark, Computer Controlled Systems: Theory and Design, 3rd ed.: Prentice Hall, 1997.
[Elmqvist2012] H. Elmqvist, M. Otter, S.E. Mattsson, "Fundamentals of Synchronous Control in Modelica," In Proceedings of 9th International Modelica Conference, Munich, Germany, Sep. 3-5, 2012. DOI:10.3384/ecp1207615.
[Otter2012] M. Otter, B. Thiele, S.E. Mattsson, "A Library for Synchronous Control Systems in Modelica," In Proceedings of 9th International Modelica Conference, Munich, Germany, Sep. 3-5, 2012. DOI:10.3384/ecp1207627.
[Walther2002] N. Walther, "Praxisgerechte Modelica-Bibliothek für Abtastregler," Diplomarbeit, HTWK Leipzig, Fachbereich Elektro- und Informationstechnik, supervised by Prof. Müller (HWTK) and Prof. Martin Otter (DLR), 12 Nov. 2002.

The synchronous Modelica language elements allow for the first time to utilize a continuous-time, nonlinear, inverse model in a Modelica sampled-data system, by automatically discretizing this model and providing it as a clocked partition. This allows a convenient definition of certain nonlinear control systems, see example Examples.Systems.ControlledMixingUnit. Several practical details to use nonlinear inverse plant models in a control system are discussed in the following reference:

[Looye2005] G. Looye, M. Thümmel, M. Kurze, M. Otter, and J. Bals, "Nonlinear Inverse Models for Control", In Proceedings of 4th International Modelica Conference, Hamburg, Germany, Mar. 7-8, 2005. Download.

The synchronous Modelica language elements used in this library are based on the clock calculus and inference system proposed by [Colaco2003] and implemented in Lucid Synchrone version 2 and 3 [Pouzet2006]. However, the Modelica approach also uses multi-rate periodic clocks based on rational arithmetic introduced by [Forget2008], as an extension of the Lucid Synchrone semantics. These approaches belong to the class of synchronous languages [Benveniste2003]:

[Benveniste2003] A. Benveniste, P. Caspi, S.A. Edwards, N. Halbwachs, P. Le Guernic, and R. Simone, "The Synchronous Languages Twelve Years Later," In Proceedings of the IEEE, Vol., 91, No. 1, 2003. Download.
[Colaco2003] J.-L. Colaco, and M. Pouzet, "Clocks as First Class Abstract Types," In Third International Conference on Embedded Software (EMSOFT'03), Philadelphia, Pennsylvania, USA, October 2003. Download.
[Forget2008] J. Forget, F. Boniol, D. Lesens, C. Pagetti, "A Multi-Periodic Synchronous Data-Flow Language," In 11th IEEE High Assurance Systems Engineering Symposium (HASE'08), pp. 251-260, Nanjing, China, Dec. 3-5, 2008. Download.
[Pouzet2006] M. Pouzet, "Lucid Synchrone, Version 3.0, Tutorial and Reference Manual". Download.

Extends from Modelica.Icons.References (Icon for external references).

Modelica.Clocked.UsersGuide.Requirements Modelica.Clocked.UsersGuide.Requirements

This library is basically a graphical user interface to conveniently operate with the Modelica 3.3 language elements of Chapter 16 "Synchronous Language Elements" of the Modelica Language Specification 3.3. Every tool that supports these language elements, as well as basic language elements of Modelica 3.1, should be able to support this library.

Extends from Modelica.Icons.Information (Icon for general information packages).

Modelica.Clocked.UsersGuide.Contact Modelica.Clocked.UsersGuide.Contact

Main authors

Martin Otter
email: Martin.Otter@dlr.de
Bernhard Thiele
email: Bernhard.Thiele@dlr.de
Address
Deutsches Zentrum für Luft- und Raumfahrt (DLR)
Institut für Systemdynamik und Regelungstechnik (SR)
Münchener Straße 20
D-82234 Weßling
Germany

Acknowledgements

Extends from Modelica.Icons.Contact (Icon for contact information).

Automatically generated Tue Feb 24 16:59:01 2026.