WOLFRAM SYSTEM MODELER

'Clock()'

Clock()

Wolfram Language

In[1]:=
SystemModel["ModelicaReference.Operators.'Clock()'"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Generates clocks as part of the synchronous language elements.

Examples

  Clock c=Clock(2, 1000); // Defines a clock variable
  Real interval1(start=2e-3);
equation
  when Clock() then
    // Inferred Clock
    x=A*previous(x)+B*u;
  end when;
  when Clock(2,1000) then
    // periodic clock that ticks at 0, 0.002, 0.004, ...
    // Could also use when c then
    y1 = previous(y1) + 1;
  end when;
  when Clock(interval1) then
    // Clock with a Real interval
    // The clock starts at the start of the simulation, tstart, or when the controller is switched on.
    // Here the next clock tick is scheduled at previous(interval1)=interval1.start=2e-3
    // At the second clock tick at tstart+interval1.start the next clock tick is scheduled at
    // previous(interval1)=5e-3
    interval1=previous(interval1)+3e-3;
  end when;
  when Clock(angle>0, 0.1) then
    // clock with a boolean interval, triggers when angle>0 becomes true.
    y2 = previous(y2) + 1;
  end when;
  when Clock(c, "ImplicitTrapezoid") then
    // Solver Clock
    // Ticks at the same rate as c but uses the ImplicitTrapezoid method to solve the differential equations
    der(x)=x;
  end when;