SecondOrderTest ​
Second-order system test with constant input.
Tests a second-order dynamic system by applying a constant input and verifying the expected step response. The second-order system is configured with a gain of 1.0, natural frequency of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system should eventually reach the steady-state output value matching the input constant.
Usage ​
BlockComponents.SecondOrderTest()
Behavior ​
Source ​
dyad
"""
Second-order system test with constant input.
Tests a second-order dynamic system by applying a constant input and verifying the expected
step response. The second-order system is configured with a gain of 1.0, natural frequency
of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system
should eventually reach the steady-state output value matching the input constant.
"""
test component SecondOrderTest
"Constant source block that provides a fixed value of 1 as input"
c = Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 120, "x2": 170, "y2": 220, "rot": 0}
}
}
}
"Second-order transfer function block with specified dynamics parameters"
pt2 = SecondOrder(k = 1.0, w = 1.0, d = 0.5) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 290, "y1": 120, "x2": 390, "y2": 220, "rot": 0}
}
}
}
relations
"Connects the constant output to the input of the second-order system"
connect(c.y, pt2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
initial pt2.x = 0
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"initial": {"pt2.xd": 0},
"atol": {"pt2.y": 0.01},
"expect": {"final": {"pt2.y": 1}, "signals": ["pt2.y"]}
}
}
}
}
endFlattened Source
dyad
"""
Second-order system test with constant input.
Tests a second-order dynamic system by applying a constant input and verifying the expected
step response. The second-order system is configured with a gain of 1.0, natural frequency
of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system
should eventually reach the steady-state output value matching the input constant.
"""
test component SecondOrderTest
"Constant source block that provides a fixed value of 1 as input"
c = Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 120, "x2": 170, "y2": 220, "rot": 0}
}
}
}
"Second-order transfer function block with specified dynamics parameters"
pt2 = SecondOrder(k = 1.0, w = 1.0, d = 0.5) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 290, "y1": 120, "x2": 390, "y2": 220, "rot": 0}
}
}
}
relations
"Connects the constant output to the input of the second-order system"
connect(c.y, pt2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
initial pt2.x = 0
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"initial": {"pt2.xd": 0},
"atol": {"pt2.y": 0.01},
"expect": {"final": {"pt2.y": 1}, "signals": ["pt2.y"]}
}
}
}
}
endTest Cases ​
Test Case case1 ​
julia
pltRelated ​
Examples
Experiments
Analyses
Tests