Controller
IconController
Usage
Controller(kp, ki, kd, y0)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
kp | – | ||
ki | – | ||
kd | – | ||
y0 | Initial value of the output | – |
Connectors
err_input
- This connector represents a real signal as an input to a component (RealInput
)ctr_output
- This connector represents a real signal as an output from a component (RealOutput
)
Variables
Name | Description | Units |
---|---|---|
x | – | |
dx | – | |
ddx | – | |
y | – | |
dy | – |
Behavior
\[ \begin{align} \frac{\mathrm{d} x\left( t \right)}{\mathrm{d}t} &= \mathtt{dx}\left( t \right) \\ \frac{\mathrm{d} \mathtt{dx}\left( t \right)}{\mathrm{d}t} &= \mathtt{ddx}\left( t \right) \\ \frac{\mathrm{d} y\left( t \right)}{\mathrm{d}t} &= \mathtt{dy}\left( t \right) \\ \mathtt{err\_input}\left( t \right) &= x\left( t \right) \\ \mathtt{ctr\_output}\left( t \right) &= y\left( t \right) \\ \mathtt{dy}\left( t \right) &= \left( \mathtt{dx}\left( t \right) + \mathtt{kd} \mathtt{ddx}\left( t \right) + \mathtt{ki} x\left( t \right) \right) \mathtt{kp} \end{align} \]
Source
component Controller
err_input = RealInput() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "error_input", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
}
}]
ctr_output = RealOutput() [{
"JuliaSim": {
"placement": {
"icon": {"iconName": "control_output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}
}
}
}]
parameter kp::Real
parameter ki::Real
parameter kd::Real
# Initial value of the output
parameter y0::Real
variable x::Real
variable dx::Real
variable ddx::Real
variable y::Real
variable dy::Real
relations
initial y = y0
der(x) = dx
der(dx) = ddx
der(y) = dy
err_input = x
ctr_output = y
dy = kp*(dx+ki*x+kd*ddx)
metadata {
"JuliaSim": {"icons": {"default": "jsml://JuliaSimExampleComponents/controller.svg"}}
}
end
Flattened Source
component Controller err_input = RealInput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "error_input", "x1": -50, "y1": 450, "x2": 50, "y2": 550}} } }] ctr_output = RealOutput() [{ "JuliaSim": { "placement": { "icon": {"iconName": "control_output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550} } } }] parameter kp::Real parameter ki::Real parameter kd::Real # Initial value of the output parameter y0::Real variable x::Real variable dx::Real variable ddx::Real variable y::Real variable dy::Real relations initial y = y0 der(x) = dx der(dx) = ddx der(y) = dy err_input = x ctr_output = y dy = kp*(dx+ki*x+kd*ddx) metadata { "JuliaSim": {"icons": {"default": "jsml://JuliaSimExampleComponents/controller.svg"}} } end
Test Cases
Related
- Examples
- Experiments
- Analyses