LIBRARY
Examples.TestUnitDelay ​
Test component that validates the UnitDelay component.
This component tests a UnitDelay with a PeriodicClock at dt=0.1s and initial_condition=1.0. A step input changes from 0 to 5 at t=0.5s. The UnitDelay (z^-1) should output the previous sample value, delayed by one sample period. The test verifies that the output matches the input delayed by exactly one time step, with the first output being the initial condition.
Usage ​
DiscreteComponents.Examples.TestUnitDelay()
Behavior ​
Behavior of this component cannot be rendered because it includes path variables.
Source ​
dyad
"""
Test component that validates the UnitDelay component.
This component tests a UnitDelay with a PeriodicClock at dt=0.1s and initial_condition=1.0.
A step input changes from 0 to 5 at t=0.5s. The UnitDelay (z^-1) should output the previous
sample value, delayed by one sample period. The test verifies that the output matches the
input delayed by exactly one time step, with the first output being the initial condition.
"""
test component TestUnitDelay
step = BlockComponents.Sources.Step(start_time = 0.41, offset = 0.0, height = 5.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -60, "y1": 50, "x2": 40, "y2": 150, "rot": 0}
},
"tags": []
}
}
delay = DiscreteComponents.UnitDelay(initial_condition = 1.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 295, "y1": 50, "x2": 395, "y2": 150, "rot": 0}
},
"tags": []
}
}
terminator = BlockComponents.Routing.Terminator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 431, "y1": 50, "x2": 531, "y2": 150, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 110, "y1": 50, "x2": 210, "y2": 150, "rot": 0}
},
"tags": []
}
}
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 110, "y1": 200, "x2": 210, "y2": 300, "rot": 0}
},
"tags": []
}
}
relations
connect(delay.y, terminator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(step.y, sampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(sampler.y, delay.u, periodicclock.y) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {
"Dyad": {
"tests": {"case1": {"stop": 2, "expect": {"signals": ["step.y", "delay.y"]}}},
"doc": {"behavior": false}
}
}
endFlattened Source
dyad
"""
Test component that validates the UnitDelay component.
This component tests a UnitDelay with a PeriodicClock at dt=0.1s and initial_condition=1.0.
A step input changes from 0 to 5 at t=0.5s. The UnitDelay (z^-1) should output the previous
sample value, delayed by one sample period. The test verifies that the output matches the
input delayed by exactly one time step, with the first output being the initial condition.
"""
test component TestUnitDelay
step = BlockComponents.Sources.Step(start_time = 0.41, offset = 0.0, height = 5.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -60, "y1": 50, "x2": 40, "y2": 150, "rot": 0}
},
"tags": []
}
}
delay = DiscreteComponents.UnitDelay(initial_condition = 1.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 295, "y1": 50, "x2": 395, "y2": 150, "rot": 0}
},
"tags": []
}
}
terminator = BlockComponents.Routing.Terminator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 431, "y1": 50, "x2": 531, "y2": 150, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 110, "y1": 50, "x2": 210, "y2": 150, "rot": 0}
},
"tags": []
}
}
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 110, "y1": 200, "x2": 210, "y2": 300, "rot": 0}
},
"tags": []
}
}
relations
connect(delay.y, terminator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(step.y, sampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(sampler.y, delay.u, periodicclock.y) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {
"Dyad": {
"tests": {"case1": {"stop": 2, "expect": {"signals": ["step.y", "delay.y"]}}},
"doc": {"behavior": false}
}
}
endTest Cases ​
Test Case case1 ​
julia
pltjulia
pltRelated ​
Examples
Experiments
Analyses
Tests