PulseTest
Generates a pulse signal with configurable parameters and integrates it.
This test component demonstrates the connection of a Pulse signal generator to an Integrator block, showing how the integrated value of a periodic pulse signal evolves over time. The pulse signal alternates between two levels (offset and offset+amplitude) based on the duty cycle and period parameters. The resulting waveform is then integrated over time.
Usage
PulseTest()
Behavior
Source
dyad
# Generates a pulse signal with configurable parameters and integrates it.
#
# This test component demonstrates the connection of a Pulse signal generator to an
# Integrator block, showing how the integrated value of a periodic pulse signal evolves
# over time. The pulse signal alternates between two levels (offset and offset+amplitude)
# based on the duty cycle and period parameters. The resulting waveform is then integrated
# over time.
test component PulseTest
# Integrator that accumulates the pulse signal value over time
integrator = Integrator()
# Pulse signal generator with configurable amplitude, duty cycle, offset, period and start time
signal = Pulse(amplitude=1.5, duty_cycle=0.5, offset=0.75, period=0.75, start_time=0.5)
relations
# Connects the pulse signal output to the integrator input
connect(signal.y, integrator.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 3,
"expect": {
"initial": {"signal.y": 0.75},
"signals": ["signal.y", "integrator.x"],
"final": {"signal.y": 0.75, "integrator.x": 2.24999999}
}
}
}
}
}
end
Flattened Source
dyad
# Generates a pulse signal with configurable parameters and integrates it.
#
# This test component demonstrates the connection of a Pulse signal generator to an
# Integrator block, showing how the integrated value of a periodic pulse signal evolves
# over time. The pulse signal alternates between two levels (offset and offset+amplitude)
# based on the duty cycle and period parameters. The resulting waveform is then integrated
# over time.
test component PulseTest
# Integrator that accumulates the pulse signal value over time
integrator = Integrator()
# Pulse signal generator with configurable amplitude, duty cycle, offset, period and start time
signal = Pulse(amplitude=1.5, duty_cycle=0.5, offset=0.75, period=0.75, start_time=0.5)
relations
# Connects the pulse signal output to the integrator input
connect(signal.y, integrator.u)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 3,
"expect": {
"initial": {"signal.y": 0.75},
"signals": ["signal.y", "integrator.x"],
"final": {"signal.y": 0.75, "integrator.x": 2.24999999}
}
}
}
}
}
end
Test Cases
Test Case case1
julia
plt
julia
plt
Related
Examples
Experiments
Analyses
Tests