LimiterTest
Test harness for the Limiter component that constrains signals to specified bounds.
This test component creates a signal chain that feeds a high-amplitude sine wave through an integrator and then into a limiter with bounds at -3 and 3. The limiter constrains the integrated sine wave output to stay within the specified bounds, demonstrating how signal limiting works in practice. The test includes verification of expected output values.
Usage
BlockComponents.LimiterTest()
Behavior
Source
dyad
"""
Test harness for the Limiter component that constrains signals to specified bounds.
This test component creates a signal chain that feeds a high-amplitude sine wave through
an integrator and then into a limiter with bounds at -3 and 3. The limiter constrains the
integrated sine wave output to stay within the specified bounds, demonstrating how signal
limiting works in practice. The test includes verification of expected output values.
"""
test component LimiterTest
"Limiter block that constraints signals between -3 and 3"
limiter = Limiter(y_max = 3, y_min = -3) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 380, "y2": 120, "rot": 0}
}
}
}
"Integrator block that accumulates the input signal"
integrator = Integrator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
}
}
}
"Sine wave generator with large amplitude to drive the system"
sine = Sine(amplitude = 4 * π, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
}
}
}
relations
"Connect sine output to integrator input"
connect(sine.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
"Connect integrator output to limiter input"
connect(integrator.y, limiter.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 1,
"atol": {"limiter.y": 0.000001},
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": 0}}
}
}
}
}
endFlattened Source
dyad
"""
Test harness for the Limiter component that constrains signals to specified bounds.
This test component creates a signal chain that feeds a high-amplitude sine wave through
an integrator and then into a limiter with bounds at -3 and 3. The limiter constrains the
integrated sine wave output to stay within the specified bounds, demonstrating how signal
limiting works in practice. The test includes verification of expected output values.
"""
test component LimiterTest
"Limiter block that constraints signals between -3 and 3"
limiter = Limiter(y_max = 3, y_min = -3) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 280, "y1": 20, "x2": 380, "y2": 120, "rot": 0}
}
}
}
"Integrator block that accumulates the input signal"
integrator = Integrator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
}
}
}
"Sine wave generator with large amplitude to drive the system"
sine = Sine(amplitude = 4 * π, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
}
}
}
relations
"Connect sine output to integrator input"
connect(sine.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
"Connect integrator output to limiter input"
connect(integrator.y, limiter.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 1,
"atol": {"limiter.y": 0.000001},
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": 0}}
}
}
}
}
endTest Cases
Test Case case1
julia
pltRelated
Examples
Experiments
Analyses
Tests