LIBRARY
Continuous.Tests.LimPIDWithoutI
Test bench for a limited PID controller with the integral part structurally removed (with_I = false), acting as a PD controller.
Usage
BlockComponents.Continuous.Tests.LimPIDWithoutI()
Behavior
Source
dyad
"""
Test bench for a limited PID controller with the integral part structurally
removed (`with_I = false`), acting as a PD controller.
"""
test component LimPIDWithoutI
"Limited PD controller (integral part structurally removed)"
pid = BlockComponents.Continuous.LimPID(with_I = false, Td = 0.1, y_max = 1, y_min = -1, wp = 1, wd = 0, Nd = 10, k_ff = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 340, "y1": 60, "x2": 440, "y2": 160, "rot": 0}
}
}
}
"Plant model to be controlled"
plant = BlockComponents.Continuous.Plant() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 50, "y1": 170, "x2": 150, "y2": 270, "rot": 0}
}
}
}
"Step input signal used as setpoint for the controller"
signal = BlockComponents.Sources.Step(height = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 10, "x2": 140, "y2": 110, "rot": 0}
}
}
}
"Constant signal for feedforward control"
signal_ff = BlockComponents.Sources.Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": -140, "x2": 140, "y2": -40, "rot": 0}
}
}
}
relations
"Initial condition for the first state of the plant"
initial plant.x1 = 0
"Initial condition for the plant output"
initial plant.y = 0
connect(signal.y, pid.u_s) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(plant.y, pid.u_m) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(pid.y, plant.u) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(pid.u_ff, signal_ff.y) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 10,
"atol": {"plant.y": 0.0001, "pid.y": 0.0001},
"expect": {"signals": ["plant.y", "pid.y"]}
}
}
}
}
endFlattened Source
dyad
"""
Test bench for a limited PID controller with the integral part structurally
removed (`with_I = false`), acting as a PD controller.
"""
test component LimPIDWithoutI
"Limited PD controller (integral part structurally removed)"
pid = BlockComponents.Continuous.LimPID(with_I = false, Td = 0.1, y_max = 1, y_min = -1, wp = 1, wd = 0, Nd = 10, k_ff = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 340, "y1": 60, "x2": 440, "y2": 160, "rot": 0}
}
}
}
"Plant model to be controlled"
plant = BlockComponents.Continuous.Plant() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 50, "y1": 170, "x2": 150, "y2": 270, "rot": 0}
}
}
}
"Step input signal used as setpoint for the controller"
signal = BlockComponents.Sources.Step(height = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 10, "x2": 140, "y2": 110, "rot": 0}
}
}
}
"Constant signal for feedforward control"
signal_ff = BlockComponents.Sources.Constant(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": -140, "x2": 140, "y2": -40, "rot": 0}
}
}
}
relations
"Initial condition for the first state of the plant"
initial plant.x1 = 0
"Initial condition for the plant output"
initial plant.y = 0
connect(signal.y, pid.u_s) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(plant.y, pid.u_m) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(pid.y, plant.u) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
connect(pid.u_ff, signal_ff.y) {"Dyad": {"edges": [{"S": 1, "E": 2}]}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {
"stop": 10,
"atol": {"plant.y": 0.0001, "pid.y": 0.0001},
"expect": {"signals": ["plant.y", "pid.y"]}
}
}
}
}
endTest Cases
Test Case case1
julia
pltjulia
plt