Skip to content
RampTest.md

RampTest

Test passing a ramp signal to an integrator for verification purposes.

A test component that connects a Ramp signal generator to an Integrator to verify correct behavior. The ramp starts at an offset value of 0.5, remains constant until the start time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5. The integrator accumulates this signal, and the metadata specifies expected initial and final values for verification purposes.

Usage

RampTest()

Behavior

signal.y(t)=integrator.u(t)dintegrator.x(t)dt=integrator.kintegrator.u(t)integrator.y(t)=integrator.x(t)signal.y(t)=ifelse(signal.start_time<t,ifelse(t<signal.duration+signal.start_time,signal.offset+signal.height(signal.start_time+t)signal.duration,signal.height+signal.offset),signal.offset)

Source

dyad
# Test passing a ramp signal to an integrator for verification purposes.
#
# A test component that connects a Ramp signal generator to an Integrator to verify correct
# behavior. The ramp starts at an offset value of 0.5, remains constant until the start
# time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5.
# The integrator accumulates this signal, and the metadata specifies expected initial and final
# values for verification purposes.
test component RampTest
  # Integrator component that accumulates the input signal
  integrator = Integrator()
  # Ramp signal generator with configurable duration, height, start time and offset
  signal = Ramp(duration=0.7, height=1.0, start_time=0.5, offset=0.5)
relations
  # Connects the ramp output to the integrator input
  connect(signal.y, integrator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 3,
        "atol": {"integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 1.5, "integrator.x": 3.641}
        }
      }
    }
  }
}
end
Flattened Source
dyad
# Test passing a ramp signal to an integrator for verification purposes.
#
# A test component that connects a Ramp signal generator to an Integrator to verify correct
# behavior. The ramp starts at an offset value of 0.5, remains constant until the start
# time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5.
# The integrator accumulates this signal, and the metadata specifies expected initial and final
# values for verification purposes.
test component RampTest
  # Integrator component that accumulates the input signal
  integrator = Integrator()
  # Ramp signal generator with configurable duration, height, start time and offset
  signal = Ramp(duration=0.7, height=1.0, start_time=0.5, offset=0.5)
relations
  # Connects the ramp output to the integrator input
  connect(signal.y, integrator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 3,
        "atol": {"integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 1.5, "integrator.x": 3.641}
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt