FirstOrderTest
Test fixture for evaluating first-order system response to constant input.
This component connects a constant value (1.0) to a first-order system with gain 1.2 and time constant 0.1, allowing observation of the step response. The first-order system is expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds). The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.
Usage
BlockComponents.FirstOrderTest()
Behavior
Source
dyad
# Test fixture for evaluating first-order system response to constant input.
#
# This component connects a constant value (1.0) to a first-order system with gain 1.2 and
# time constant 0.1, allowing observation of the step response. The first-order system is
# expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds).
# The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.
test component FirstOrderTest
# Constant block that provides a unit step input with value k=1
c = Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 110, "x2": 170, "y2": 210, "rot": 0}
}
}
}
# First-order system with gain 1.2 and time constant 0.1 seconds
pt1 = FirstOrder(k = 1.2, T = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 310, "y1": 110, "x2": 410, "y2": 210, "rot": 0}
}
}
}
relations
# Connects the constant output to the first-order system input
connect(c.y, pt1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
initial pt1.y = 0
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"atol": {"pt1.y": 0.001},
"expect": {"final": {"pt1.y": 1.2}, "signals": ["pt1.y"]}
}
}
}
}
endFlattened Source
dyad
# Test fixture for evaluating first-order system response to constant input.
#
# This component connects a constant value (1.0) to a first-order system with gain 1.2 and
# time constant 0.1, allowing observation of the step response. The first-order system is
# expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds).
# The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.
test component FirstOrderTest
# Constant block that provides a unit step input with value k=1
c = Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 110, "x2": 170, "y2": 210, "rot": 0}
}
}
}
# First-order system with gain 1.2 and time constant 0.1 seconds
pt1 = FirstOrder(k = 1.2, T = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 310, "y1": 110, "x2": 410, "y2": 210, "rot": 0}
}
}
}
relations
# Connects the constant output to the first-order system input
connect(c.y, pt1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
initial pt1.y = 0
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"atol": {"pt1.y": 0.001},
"expect": {"final": {"pt1.y": 1.2}, "signals": ["pt1.y"]}
}
}
}
}
endTest Cases
Test Case case1
julia
pltRelated
Examples
Experiments
Analyses
Tests