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

BlockComponents.ExpSineTest()

Behavior

[connect(signal+y(t),integrator+u(t))dintegrator.x(t)dt=integrator.kintegrator.u(t)integrator.y(t)=integrator.x(t)signal.y(t)=signal.offset+signal.amplitudeifelse(tsignal.start_time,esignal.damping(signal.start_time+t)sin(signal.phase+6.2832signal.frequency(signal.start_time+t)),sin(signal.phase))]

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() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
      }
    }
  }
  "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 = pi / 4) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the exponentially damped sine output to the integrator input"
  connect(signal.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 7,
        "atol": {"signal.y": 0.001, "integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 1.207},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 0.527, "integrator.x": 3.91}
        }
      }
    }
  }
}
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() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
      }
    }
  }
  "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 = pi / 4) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the exponentially damped sine output to the integrator input"
  connect(signal.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 7,
        "atol": {"signal.y": 0.001, "integrator.x": 0.001},
        "expect": {
          "initial": {"signal.y": 1.207},
          "signals": ["signal.y", "integrator.x"],
          "final": {"signal.y": 0.527, "integrator.x": 3.91}
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt