DerivativeIntegratorTerminatorTest
Test component that demonstrates the chained behavior of differentiation and integration of a sine signal.
This component connects a sine source through a derivative block to an integrator and finally to a terminator, demonstrating that differentiating and then integrating a signal approximately recovers the original signal. The derivative block approximates the mathematical operation d/dt, while the integrator performs the operation ∫dt. When applied in sequence to a sine wave, the output should theoretically match the input with some phase shift.
Usage
DerivativeIntegratorTerminatorTest()
Behavior
Source
dyad
# Test component that demonstrates the chained behavior of differentiation and integration of a sine signal.
#
# This component connects a sine source through a derivative block to an integrator and finally to a terminator,
# demonstrating that differentiating and then integrating a signal approximately recovers the original signal.
# The derivative block approximates the mathematical operation d/dt, while the integrator performs the operation ∫dt.
# When applied in sequence to a sine wave, the output should theoretically match the input with some phase shift.
test component DerivativeIntegratorTerminatorTest
# Approximates the derivative of the input signal with configured gain and time constant
derivative = Derivative(k=1, T=0.001)
# Integrates the input signal with specified gain
integrator = Integrator(k=1)
# Terminates the signal path, consuming the input without producing an output
terminator = Terminator()
# Generates a sinusoidal signal with 1 Hz frequency and unit amplitude
source = Sine(amplitude=1, frequency=1)
relations
# Connects the sine wave output to the derivative block input
connect(source.y, derivative.u)
# Connects the derivative output to the integrator input
connect(derivative.y, integrator.u)
# Connects the integrator output to the terminator input
connect(integrator.y, terminator.u)
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"atol": {"integrator.y": 0.01, "terminator.u": 0.01},
"expect": {
"final": {"integrator.y": 0, "terminator.u": 0},
"signals": ["integrator.y", "terminator.u"]
}
}
}
}
}
end
Flattened Source
dyad
# Test component that demonstrates the chained behavior of differentiation and integration of a sine signal.
#
# This component connects a sine source through a derivative block to an integrator and finally to a terminator,
# demonstrating that differentiating and then integrating a signal approximately recovers the original signal.
# The derivative block approximates the mathematical operation d/dt, while the integrator performs the operation ∫dt.
# When applied in sequence to a sine wave, the output should theoretically match the input with some phase shift.
test component DerivativeIntegratorTerminatorTest
# Approximates the derivative of the input signal with configured gain and time constant
derivative = Derivative(k=1, T=0.001)
# Integrates the input signal with specified gain
integrator = Integrator(k=1)
# Terminates the signal path, consuming the input without producing an output
terminator = Terminator()
# Generates a sinusoidal signal with 1 Hz frequency and unit amplitude
source = Sine(amplitude=1, frequency=1)
relations
# Connects the sine wave output to the derivative block input
connect(source.y, derivative.u)
# Connects the derivative output to the integrator input
connect(derivative.y, integrator.u)
# Connects the integrator output to the terminator input
connect(integrator.y, terminator.u)
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"atol": {"integrator.y": 0.01, "terminator.u": 0.01},
"expect": {
"final": {"integrator.y": 0, "terminator.u": 0},
"signals": ["integrator.y", "terminator.u"]
}
}
}
}
}
end
Test Cases
Test Case case1
julia
plt
julia
plt
Related
Examples
Experiments
Analyses
Tests