Skip to content
ExpSineTest.md

ExpSineTest

Test component that connects an exponentially damped sine wave to an integrator for validation.

This component instantiates an ExpSine signal generator with configurable parameters and connects its output to an Integrator block to test the integration of a damped sinusoidal signal. The ExpSine generates a signal according to:

y=offset+amplitudeedamping(tstart_time)sin(frequency(tstart_time)+phase)

Usage

ExpSineTest()

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,signal.offset+signal.amplitudeesignal.damping(signal.start_time+t)sin(signal.phase+6.2832signal.frequency(signal.start_time+t)),signal.offset)

Source

dyad
# Test component that connects an exponentially damped sine wave to an integrator for validation.
#
# This component instantiates an ExpSine signal generator with configurable parameters and connects
# its output to an Integrator block to test the integration of a damped sinusoidal signal. The ExpSine
# generates a signal according to:
#
# ```math
# y = offset + amplitude \cdot e^{-damping \cdot (t-start\_time)} \cdot \sin(frequency \cdot (t-start\_time) + phase)
# ```
test component ExpSineTest
  # Integrator block that accumulates the input signal
  integrator = Integrator()
  # Exponentially damped sine wave generator with specified parameters
  signal = ExpSine(amplitude=1, damping=0.5, frequency=2, start_time=0.5, offset=0.5, phase=3.14)
relations
  # Connects the exponentially damped sine output to the integrator input
  connect(signal.y, integrator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 7,
        "atol": {"signal.y": 0.001, "integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 0.50006, "integrator.x": 3.41826}
        }
      }
    }
  }
}
end
Flattened Source
dyad
# Test component that connects an exponentially damped sine wave to an integrator for validation.
#
# This component instantiates an ExpSine signal generator with configurable parameters and connects
# its output to an Integrator block to test the integration of a damped sinusoidal signal. The ExpSine
# generates a signal according to:
#
# ```math
# y = offset + amplitude \cdot e^{-damping \cdot (t-start\_time)} \cdot \sin(frequency \cdot (t-start\_time) + phase)
# ```
test component ExpSineTest
  # Integrator block that accumulates the input signal
  integrator = Integrator()
  # Exponentially damped sine wave generator with specified parameters
  signal = ExpSine(amplitude=1, damping=0.5, frequency=2, start_time=0.5, offset=0.5, phase=3.14)
relations
  # Connects the exponentially damped sine output to the integrator input
  connect(signal.y, integrator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 7,
        "atol": {"signal.y": 0.001, "integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 0.50006, "integrator.x": 3.41826}
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt