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
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)
# Integrator block that accumulates the input signal
integrator = Integrator()
# Sine wave generator with large amplitude to drive the system
sine = Sine(amplitude=4*π, frequency=1)
relations
# Connect sine output to integrator input
connect(sine.y, integrator.u)
# Connect integrator output to limiter input
connect(integrator.y, limiter.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": 0.000086636306}}
}
}
}
}
end
Flattened 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)
# Integrator block that accumulates the input signal
integrator = Integrator()
# Sine wave generator with large amplitude to drive the system
sine = Sine(amplitude=4*π, frequency=1)
relations
# Connect sine output to integrator input
connect(sine.y, integrator.u)
# Connect integrator output to limiter input
connect(integrator.y, limiter.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": 0.000086636306}}
}
}
}
}
end
Test Cases
Test Case case1
julia
plt
Related
Examples
Experiments
Analyses
Tests