Skip to content
Ramp.md

Ramp ​

Generates a linearly increasing signal from an offset to a target value over a specified duration.

The ramp component produces an output signal that starts at the offset value, then increases linearly to reach offset+height over the specified duration. After the duration elapses, the output remains constant at the final value.

y={offset,if t<start_timeoffset+(t−start_time)⋅heightduration,if start_time≤t<start_time+durationoffset+height,if t≥start_time+duration

This component extends from Signal

Usage ​

BlockComponents.Ramp(start_time=0.0, offset=0.0, duration, height)

Parameters: ​

NameDescriptionUnitsDefault value
start_timeTime at which the signal starts changing from its offset values0
offsetConstant value added to the signal output–0
durationDuration of the ramp transitions
heightTotal height (amplitude) of the ramp–

Connectors ​

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

Behavior ​

y(t)=ifelse(start_time<t,ifelse(t<duration+start_time,offset+height(−start_time+t)duration,height+offset),offset)

Source ​

dyad
"""
Generates a linearly increasing signal from an offset to a target value over a specified duration.

The ramp component produces an output signal that starts at the `offset` value, then increases
linearly to reach `offset`+`height` over the specified `duration`. After the `duration` elapses, the
output remains constant at the final value.

math y = \begin{cases} \text{offset}, & \text{if } t < \text{start_time} MarkdownAST.LineBreak()

\text{offset} + (t - \text{start_time}) \cdot \frac{\text{height}}{\text{duration}}, & \text{if } \text{start_time} \leq t < \text{start_time} + \text{duration} MarkdownAST.LineBreak()

\text{offset} + \text{height}, & \text{if } t \geq \text{start_time} + \text{duration} \end

"""
component Ramp
  extends Signal
  "Duration of the ramp transition"
  parameter duration::Time
  "Total height (amplitude) of the ramp"
  parameter height::Real
relations
  y = ifelse(start_time < time, ifelse(time < start_time + duration, offset + (time - start_time) * height / duration, offset + height), offset)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Ramp.svg"}
  }
}
end
Flattened Source
dyad
"""
Generates a linearly increasing signal from an offset to a target value over a specified duration.

The ramp component produces an output signal that starts at the `offset` value, then increases
linearly to reach `offset`+`height` over the specified `duration`. After the `duration` elapses, the
output remains constant at the final value.

math y = \begin{cases} \text{offset}, & \text{if } t < \text{start_time} MarkdownAST.LineBreak()

\text{offset} + (t - \text{start_time}) \cdot \frac{\text{height}}{\text{duration}}, & \text{if } \text{start_time} \leq t < \text{start_time} + \text{duration} MarkdownAST.LineBreak()

\text{offset} + \text{height}, & \text{if } t \geq \text{start_time} + \text{duration} \end

"""
component Ramp
  "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
  "Duration of the ramp transition"
  parameter duration::Time
  "Total height (amplitude) of the ramp"
  parameter height::Real
relations
  y = ifelse(start_time < time, ifelse(time < start_time + duration, offset + (time - start_time) * height / duration, offset + height), offset)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Ramp.svg"}
  }
}
end


Test Cases ​

No test cases defined.