Skip to content
Pulse.md

Pulse

Single pulse generator with configurable amplitude, duration, and start time.

Generates a single rectangular pulse that starts at start_time and lasts for duty_cycle × period duration. The signal stays at amplitude value during the pulse duration and at offset value otherwise. Unlike a periodic pulse train, this component generates only one pulse.

y(t)={amplitude,if t>start_time and tstart_time+duty_cycle×periodoffset,otherwise

This component extends from Signal

Usage

BlockComponents.Pulse(start_time=0.0, offset=0.0, amplitude, duty_cycle, period)

Parameters:

NameDescriptionUnitsDefault value
start_timeTime at which the signal starts changing from its offset values0
offsetConstant value added to the signal output0
amplitudeMaximum value of the pulse signal
duty_cycleFraction of the period during which output equals amplitude (between 0 and 1)
periodDuration parameter used with duty_cycle to determine pulse widths

Connectors

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

Behavior

y(t)=ifelse(t>start_time,ifelse(tstart_time+duty_cycleperiod,amplitude,offset),offset)

Source

dyad
# Single pulse generator with configurable amplitude, duration, and start time.
#
# Generates a single rectangular pulse that starts at start_time and lasts for duty_cycle × period duration.
# The signal stays at amplitude value during the pulse duration and at offset value otherwise.
# Unlike a periodic pulse train, this component generates only one pulse.
#
# ```math
# y(t) = \begin{cases}
# \text{amplitude}, & \text{if } t > \text{start\_time} \text{ and } t \leq \text{start\_time} + \text{duty\_cycle} \times \text{period} \\
# \text{offset}, & \text{otherwise}
# \end{cases}
# ```
component Pulse
  extends Signal
  # Maximum value of the pulse signal
  parameter amplitude::Real
  # Fraction of the period during which output equals amplitude (between 0 and 1)
  parameter duty_cycle::Real
  # Duration parameter used with duty_cycle to determine pulse width
  parameter period::Time
relations
  y = ifelse(time > start_time, ifelse(time <= start_time + duty_cycle * period, amplitude, offset), offset)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Pulse.svg"}
  }
}
end
Flattened Source
dyad
# Single pulse generator with configurable amplitude, duration, and start time.
#
# Generates a single rectangular pulse that starts at start_time and lasts for duty_cycle × period duration.
# The signal stays at amplitude value during the pulse duration and at offset value otherwise.
# Unlike a periodic pulse train, this component generates only one pulse.
#
# ```math
# y(t) = \begin{cases}
# \text{amplitude}, & \text{if } t > \text{start\_time} \text{ and } t \leq \text{start\_time} + \text{duty\_cycle} \times \text{period} \\
# \text{offset}, & \text{otherwise}
# \end{cases}
# ```
component Pulse
  # Real-valued output connector for the component
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  # 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
  # Maximum value of the pulse signal
  parameter amplitude::Real
  # Fraction of the period during which output equals amplitude (between 0 and 1)
  parameter duty_cycle::Real
  # Duration parameter used with duty_cycle to determine pulse width
  parameter period::Time
relations
  y = ifelse(time > start_time, ifelse(time <= start_time + duty_cycle * period, amplitude, offset), offset)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Pulse.svg"}
  }
}
end


Test Cases

No test cases defined.