๐Ÿ•

Clock

Sources
Run the live example Free ยท no sign-up ยท runs in your browser

Outputs the current simulation elapsed time tt in physical seconds. Acts as an authoritative time source for synthesizing time-dependent waveforms, driving dynamic setpoint trajectories, indexing Look-Up Tables, triggering sequential state events, and providing reference timestamps for logging and telemetry.

Mathematical Model

In continuous-time integration, the clock reflects the current integration timestamp:

y(t)=t,tโ‰ฅ0y(t) = t, \quad t \ge 0

For discrete-time simulations operating at a fixed sample step TsT_s, the output evolves synchronously with the sample index:

y[n]=nโ‹…Ts,nโˆˆ{0,1,2,โ€ฆโ€‰}y[n] = n \cdot T_s, \quad n \in \{0, 1, 2, \dots\}

The output begins strictly at t=0t = 0 (or the simulation start time t0t_0) and increases monotonically throughout execution.

Inputs & Outputs

Direction ID Label Type Status
← Out out Time number Output

Usage Examples

Example 1: Synthesizing Dynamic Chirp Waveforms

To analyze mechanical resonances across a continuous frequency band, connect the Clock output to a Gain block (K=2ฯ€f0K = 2\pi f_0) and a Product block multiplying time by a ramp rate. Passing this instantaneous phase angle ฮธ(t)\theta(t) into a Trigonometric (Sine) block synthesizes an excitation chirp signal that sweeps smoothly from low to high frequency.

Example 2: Scheduled Setpoint Trajectory Generation

For industrial batch processes with scheduled heating, soak, and cooling intervals, connect the Clock signal to a 1D LookupTable. The table interpolates temperature setpoints as a function of elapsed process time, feeding an automated multi-stage profile directly into a feedback temperature controller.

Remarks & Best Practices

  • Master Solver Synchronization: Tracks the exact internal integration timestamp of the solver, reflecting non-uniform step progressions during adaptive variable-step solvers (e.g. RK45, TR-BDF2).
  • Zero Input Requirement: Operates purely as a source block requiring no upstream signal connections.
  • High Numerical Precision: Evaluated using IEEE-754 64-bit floating-point arithmetic (f64), preventing timestamp drift or quantization errors even over long-duration simulations.
  • Complement to Signal Generators: Ideal for building custom analytic drive functions (such as decaying sinusoids eโˆ’atsinโก(ฯ‰t)e^{-at}\sin(\omega t) or polynomial trajectories) by combining with Math and Gain blocks.

Related Components

  • Ramp: Generates a linear signal with configurable start time, initial value, and slope.
  • Step: Generates an abrupt step transition at a designated threshold timestamp.
  • SignalGenerator: Dedicated source block for periodic waveforms (sine, square, triangle).
  • LookupTable: 1D and 2D table interpolation driven by time or arbitrary state inputs.