Skip to content
ContinuousClock.md

ContinuousClock

Generates a continuous time signal that starts counting from a specified time.

A clock component that outputs a continuously increasing signal starting from a specified time. The output equals the offset value until the simulation time reaches start_time, after which it increases linearly with time. The output value is calculated as offset + (time - start_time) when time exceeds start_time, otherwise it remains at the offset value.

Signal

Usage

ContinuousClock(start_time=0.0, offset=0.0)

Parameters:

NameDescriptionUnitsDefault value
start_timeTime at which the signal starts changing from its offset values0
offsetConstant value added to the signal output0

Connectors

  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

y(t)=ifelse(start_time<t,offsetstart_time+t,offset)

Source

dyad
# Generates a continuous time signal that starts counting from a specified time.
#
# A clock component that outputs a continuously increasing signal starting from a
# specified time. The output equals the `offset` value until the simulation time
# reaches `start_time`, after which it increases linearly with time. The output
# value is calculated as `offset` + (`time` - `start_time`) when `time` exceeds
# `start_time`, otherwise it remains at the `offset` value.
component ContinuousClock
  extends Signal
relations
  # Output equals `offset` if `time` < `start_time`, otherwise increases with time
  y = if start_time<time then offset+time-start_time else offset
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/ContinuousClock.svg"}}}
end
Flattened Source
dyad
# Generates a continuous time signal that starts counting from a specified time.
#
# A clock component that outputs a continuously increasing signal starting from a
# specified time. The output equals the `offset` value until the simulation time
# reaches `start_time`, after which it increases linearly with time. The output
# value is calculated as `offset` + (`time` - `start_time`) when `time` exceeds
# `start_time`, otherwise it remains at the `offset` value.
component ContinuousClock
  # Real-valued output connector for the component
  y = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
  # Time at which the signal starts changing from its offset value
  parameter start_time::Time = 0.0
  # Constant value added to the signal output
  parameter offset::Real = 0.0
relations
  # Output equals `offset` if `time` < `start_time`, otherwise increases with time
  y = if start_time<time then offset+time-start_time else offset
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/ContinuousClock.svg"}}}
end


Test Cases

No test cases defined.