SlewRateLimiterTest
Test component that validates SlewRateLimiter behavior with a sinusoidal input.
This test component connects a sine wave generator to a slew rate limiter and verifies the expected output value after simulation. The slew rate limiter restricts how quickly the output signal can change, with separate limits for rising and falling rates. The sine input provides a continuously changing signal that exercises both the rising and falling rate limits.
Usage
SlewRateLimiterTest()
Behavior
Source
dyad
# Test component that validates SlewRateLimiter behavior with a sinusoidal input.
#
# This test component connects a sine wave generator to a slew rate limiter and verifies the expected
# output value after simulation. The slew rate limiter restricts how quickly the output signal can change,
# with separate limits for rising and falling rates. The sine input provides a continuously changing signal
# that exercises both the rising and falling rate limits.
test component SlewRateLimiterTest
# Slew rate limiter instance with rising/falling limits and small time delay
limiter = SlewRateLimiter(rising=1, falling=-1, td=0.001)
# Sine wave generator producing a 2Hz signal with amplitude 2
sine = Sine(amplitude=2, frequency=2)
relations
# Connects the sine wave output to the slew rate limiter input
connect(sine.y, limiter.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": -0.040594643}}
}
}
}
}
end
Flattened Source
dyad
# Test component that validates SlewRateLimiter behavior with a sinusoidal input.
#
# This test component connects a sine wave generator to a slew rate limiter and verifies the expected
# output value after simulation. The slew rate limiter restricts how quickly the output signal can change,
# with separate limits for rising and falling rates. The sine input provides a continuously changing signal
# that exercises both the rising and falling rate limits.
test component SlewRateLimiterTest
# Slew rate limiter instance with rising/falling limits and small time delay
limiter = SlewRateLimiter(rising=1, falling=-1, td=0.001)
# Sine wave generator producing a 2Hz signal with amplitude 2
sine = Sine(amplitude=2, frequency=2)
relations
# Connects the sine wave output to the slew rate limiter input
connect(sine.y, limiter.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 1,
"expect": {"signals": ["limiter.y"], "final": {"limiter.y": -0.040594643}}
}
}
}
}
end
Test Cases
Test Case case1
julia
plt
Related
Examples
Experiments
Analyses
Tests