Clocks

class Clocks "Clocks"
    extends Modelica.Icons.Information;

    annotation (Documentation(info = "<html>\n<p>\nA central element of the Modelica.Clocked library is a <strong>clock</strong>.\nBelow, the most important information for clocks is summarized.\nFor more details, see the Modelica Language Specification,\nChapter 16 (for Modelica Language Version &ge; 3.3).\n</p>\n\n<p>\nA <strong>Clock</strong> type is a base data type (introduced in Modelica 3.3, additionally to Real, Integer, Boolean, String) that defines when a particular partition consisting of a set of equations is active. Starting with Modelica Language Version 3.3, every variable and every equation is either continuous-time or is associated exactly to one clock. 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. A clocked variable has only a value when the corresponding clock is active:\n</p>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Clocked/Clocks/clockSignals.png\" alt=\"Clock variables and clocked variables\">\n</p>\n\n<p>\nSimilarly to RealInput, RealOutput etc., clock input and output connectors, called ClockInput and ClockOutput, are defined in sublibrary\n<a href=\"modelica://Modelica.Clocked.ClockSignals.Interfaces\">ClockSignal.Interfaces</a>\nin order to propagate clocks via connections. A clock signal can be generated with\none of the blocks of sublibrary\n<a href=\"modelica://Modelica.Clocked.ClockSignals.Clocks\">ClockSignals.Clocks</a>:\n</p>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Clocked/Clocks/clocks.png\" alt=\"Sublibrary ClockSignals.Clocks\">\n</p>\n\n<p>\nThe output signals of the blocks in the above figure are clock signals,\nby default visualized with dotted grey lines.\n</p>\n\n<p>\nWith the blocks of sublibrary\n<a href=\"modelica://Modelica.Clocked.ClockSignals.Sampler\">ClockSignals.Sampler</a>\na clock signal can be sub-sampled, super-sampled, or shift-sampled to generate\na new clock signal. For example, with the following model, a periodic clock signal of 0.1 s\nis sub-sampled with a factor 3 and therefore a clock signal with a period of 0.3 s\nis generated:\n</p>\n\n<p>\n<img src=\"modelica://Modelica/Resources/Images/Clocked/Clocks/subSampledClockExample.png\" alt=\"Sub-sample example model\"><br>\n<img src=\"modelica://Modelica/Resources/Images/Clocked/Clocks/subSampledClockResult.png\" alt=\"Sub-sample example plot\">\n</p>\n\n<p>\nAs usual in synchronous languages, a clock is represented by a <strong>true</strong> value\nwhen the clock is active. The relationship between such derived\nclocks is <strong>exact</strong>, so it is guaranteed that at every 3rd tick of clock\n\"periodicRealClock.y\", the clock \"subSample.y\" is active.\n</p>\n\n<p>\nIf a clock is associated to a clocked continuous-time partition, then an <strong>integrator</strong>\nhas to be defined that is used to integrate the partition from the previous\nto the current clock tick. This is performed by setting parameter <strong>useSolver</strong>\n= <strong>true</strong> and defining the integration method as String with\nparameter <strong>solver</strong>. Both parameters are in tab <strong>Advanced</strong>\nof one of the clock signal generating blocks.\nThe possible integration methods are tool dependent. It is expected that\nat least the solvers \"External\" (= use the integrator selected in the\nsimulation environment) and \"ExplicitEuler\" (= explicit Euler method)\nare supported by every tool. For an example, see\n<a href=\"modelica://Modelica.Clocked.Examples.Systems.ControlledMixingUnit\">Examples.Systems.ControlledMixingUnit</a>.\n</p>\n\n<p>\nA clocked partition is a set of equations that depend\non each other and where the boundary variables are marked\nwith sample and hold operators.\nIf a clocked partition contains no operator <strong>der</strong>, <strong>delay</strong>,\n<strong>spatialDistribution</strong>, no event related operators (with exception of <strong>noEvent</strong>(&hellip;)),\nand no <strong>when</strong>-clause with a Boolean condition, it is a <strong>clocked discrete-time</strong>\npartition, that is, it is a standard sampled data system that is described by difference equations.\nIf a clocked partition is <strong>not</strong> a <strong>clocked discrete-time</strong> partition and\nit contains neither operator <strong>previous</strong> nor operator\n<strong>interval</strong>, it is a\n<strong>clocked discretized continuous-time</strong> partition.\nSuch a partition has to be solved with a <strong>solver</strong> method.\nIt is an error, if none of the two properties hold, e.g., if operators\n<strong>previous</strong> and <strong>der</strong> are both used in the same partition.\nIn a clocked discrete-time partition all event generating mechanisms\ndo no longer apply. Especially neither relations, nor one of the built-in event\ntriggering operators will trigger an event.\n</p>\n</html>"));
end Clocks;