Sources.Tests.ExpSineModes
Verifies all operating modes of the ExpSine source against analytically known values.
Four ExpSine instances share amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = π/4 (so 2π·frequency·start_time = π, half a cycle) and differ only in the continuous and shift_time parameters:
sig_default: new parameters left at their defaults (continuous = true,shift_time = start_time). Confirms the default reproduces the legacy value-continuous behavior (no breaking change).sig_gated:continuous = false,shift_time = start_time— output holds atoffsetbeforestart_time.sig_gated_abs:continuous = false,shift_time = 0— gated output with absolute time reference.sig_hold_abs:continuous = true,shift_time = 0— value-continuous output with absolute time reference.
The exponential damping envelope always uses (time - start_time), so the decay is identical across modes; only the sinusoidal phase reference and the pre-start value differ. Each signal feeds an integrator so the test checks both the instantaneous output and the accumulated integral.
Usage
BlockComponents.Sources.Tests.ExpSineModes()
Behavior
Source
"""
Verifies all operating modes of the ExpSine source against analytically known values.
Four `ExpSine` instances share `amplitude = 2`, `damping = 0.5`, `frequency = 1`,
`start_time = 0.5`, `offset = 1`, `phase = π/4` (so `2π·frequency·start_time = π`, half a
cycle) and differ only in the `continuous` and `shift_time` parameters:
- `sig_default` : new parameters left at their defaults (`continuous = true`, `shift_time = start_time`).
Confirms the default reproduces the legacy value-continuous behavior (no breaking change).
- `sig_gated` : `continuous = false`, `shift_time = start_time` — output holds at `offset` before `start_time`.
- `sig_gated_abs`: `continuous = false`, `shift_time = 0` — gated output with absolute time reference.
- `sig_hold_abs` : `continuous = true`, `shift_time = 0` — value-continuous output with absolute time reference.
The exponential damping envelope always uses `(time - start_time)`, so the decay is
identical across modes; only the sinusoidal phase reference and the pre-start value differ.
Each signal feeds an integrator so the test checks both the instantaneous output and the
accumulated integral.
"""
test component ExpSineModes
sig_default = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4)
sig_gated = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = false)
sig_gated_abs = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = false, shift_time = 0)
sig_hold_abs = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = true, shift_time = 0)
int_default = BlockComponents.Continuous.Integrator()
int_gated = BlockComponents.Continuous.Integrator()
int_gated_abs = BlockComponents.Continuous.Integrator()
int_hold_abs = BlockComponents.Continuous.Integrator()
relations
connect(sig_default.y, int_default.u)
connect(sig_gated.y, int_gated.u)
connect(sig_gated_abs.y, int_gated_abs.u)
connect(sig_hold_abs.y, int_hold_abs.u)
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 2,
"abstol": 1e-8,
"reltol": 1e-8,
"atol": {
"sig_default.y": 0.01,
"sig_gated.y": 0.01,
"sig_gated_abs.y": 0.01,
"sig_hold_abs.y": 0.01,
"int_default.x": 0.01,
"int_gated.x": 0.01,
"int_gated_abs.x": 0.01,
"int_hold_abs.x": 0.01
},
"expect": {
"initial": {
"sig_default.y": 2.4142,
"sig_gated.y": 1,
"sig_gated_abs.y": 1,
"sig_hold_abs.y": -0.4142
},
"signals": ["sig_default.y", "sig_gated.y", "sig_gated_abs.y", "sig_hold_abs.y"],
"final": {
"sig_default.y": 0.332,
"sig_gated.y": 0.332,
"sig_gated_abs.y": 1.668,
"sig_hold_abs.y": 1.668,
"int_default.x": 3.0626,
"int_gated.x": 2.3555,
"int_gated_abs.x": 1.6445,
"int_hold_abs.x": 0.9374
}
}
}
}
}
}
endFlattened Source
"""
Verifies all operating modes of the ExpSine source against analytically known values.
Four `ExpSine` instances share `amplitude = 2`, `damping = 0.5`, `frequency = 1`,
`start_time = 0.5`, `offset = 1`, `phase = π/4` (so `2π·frequency·start_time = π`, half a
cycle) and differ only in the `continuous` and `shift_time` parameters:
- `sig_default` : new parameters left at their defaults (`continuous = true`, `shift_time = start_time`).
Confirms the default reproduces the legacy value-continuous behavior (no breaking change).
- `sig_gated` : `continuous = false`, `shift_time = start_time` — output holds at `offset` before `start_time`.
- `sig_gated_abs`: `continuous = false`, `shift_time = 0` — gated output with absolute time reference.
- `sig_hold_abs` : `continuous = true`, `shift_time = 0` — value-continuous output with absolute time reference.
The exponential damping envelope always uses `(time - start_time)`, so the decay is
identical across modes; only the sinusoidal phase reference and the pre-start value differ.
Each signal feeds an integrator so the test checks both the instantaneous output and the
accumulated integral.
"""
test component ExpSineModes
sig_default = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4)
sig_gated = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = false)
sig_gated_abs = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = false, shift_time = 0)
sig_hold_abs = BlockComponents.Sources.ExpSine(amplitude = 2, damping = 0.5, frequency = 1, start_time = 0.5, offset = 1, phase = pi / 4, continuous = true, shift_time = 0)
int_default = BlockComponents.Continuous.Integrator()
int_gated = BlockComponents.Continuous.Integrator()
int_gated_abs = BlockComponents.Continuous.Integrator()
int_hold_abs = BlockComponents.Continuous.Integrator()
relations
connect(sig_default.y, int_default.u)
connect(sig_gated.y, int_gated.u)
connect(sig_gated_abs.y, int_gated_abs.u)
connect(sig_hold_abs.y, int_hold_abs.u)
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 2,
"abstol": 1e-8,
"reltol": 1e-8,
"atol": {
"sig_default.y": 0.01,
"sig_gated.y": 0.01,
"sig_gated_abs.y": 0.01,
"sig_hold_abs.y": 0.01,
"int_default.x": 0.01,
"int_gated.x": 0.01,
"int_gated_abs.x": 0.01,
"int_hold_abs.x": 0.01
},
"expect": {
"initial": {
"sig_default.y": 2.4142,
"sig_gated.y": 1,
"sig_gated_abs.y": 1,
"sig_hold_abs.y": -0.4142
},
"signals": ["sig_default.y", "sig_gated.y", "sig_gated_abs.y", "sig_hold_abs.y"],
"final": {
"sig_default.y": 0.332,
"sig_gated.y": 0.332,
"sig_gated_abs.y": 1.668,
"sig_hold_abs.y": 1.668,
"int_default.x": 3.0626,
"int_gated.x": 2.3555,
"int_gated_abs.x": 1.6445,
"int_hold_abs.x": 0.9374
}
}
}
}
}
}
endTest Cases
Test Case case1
pltpltpltpltRelated
Examples
Experiments
Analyses
Tests