LIBRARY
Examples.LinearMPCBinaryExample ​
Hybrid MPC of a first-order plant with an on/off actuator: the control is declared binary and takes only the values umin and umax, so the mixed-integer QP is solved at every tick.
Usage ​
MPCComponents.Examples.LinearMPCBinaryExample()
Variables ​
| Name | Description | Units |
|---|---|---|
y1 | Plant output | – |
u1 | Control signal | – |
Behavior ​
Behavior of this component cannot be rendered because it includes path variables.
Source ​
dyad
"""
Hybrid MPC of a first-order plant with an on/off actuator: the control is declared binary and
takes only the values `umin` and `umax`, so the mixed-integer QP is solved at every tick.
"""
example component LinearMPCBinaryExample
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {}
plant = BlockComponents.Continuous.FirstOrder(k = 1.0, T = 0.5, x(initial = 0)) {}
s1 = DiscreteComponents.Sampler() {}
sr = DiscreteComponents.Sampler() {}
zoh = DiscreteComponents.ZeroOrderHold() {}
ref = BlockComponents.Sources.Constant(k = 0.5) {}
mpc = MPCComponents.LinearMPCController(dynamics = plant, inputs = ["u"], outputs = ["y"], state_variables = ["x"], Ts = 0.1, Q1 = [1.0], Q2 = [0.001], umin = [0.0], umax = [1.0], binary_controls = [1], Np = 5, R1 = [0.01], R2 = [0.01]) {}
"Plant output"
variable y1::Real
"Control signal"
variable u1::Real
relations
y1 = plant.y
u1 = mpc.u[1]
connect(zoh.y, plant.u)
connect(plant.y, s1.u)
connect(s1.y, mpc.y[1], periodicclock.y)
connect(ref.y, sr.u)
connect(sr.y, mpc.r[1])
connect(mpc.u[1], zoh.u)
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}, "doc": {"behavior": false}}}
endFlattened Source
dyad
"""
Hybrid MPC of a first-order plant with an on/off actuator: the control is declared binary and
takes only the values `umin` and `umax`, so the mixed-integer QP is solved at every tick.
"""
example component LinearMPCBinaryExample
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {}
plant = BlockComponents.Continuous.FirstOrder(k = 1.0, T = 0.5, x(initial = 0)) {}
s1 = DiscreteComponents.Sampler() {}
sr = DiscreteComponents.Sampler() {}
zoh = DiscreteComponents.ZeroOrderHold() {}
ref = BlockComponents.Sources.Constant(k = 0.5) {}
mpc = MPCComponents.LinearMPCController(dynamics = plant, inputs = ["u"], outputs = ["y"], state_variables = ["x"], Ts = 0.1, Q1 = [1.0], Q2 = [0.001], umin = [0.0], umax = [1.0], binary_controls = [1], Np = 5, R1 = [0.01], R2 = [0.01]) {}
"Plant output"
variable y1::Real
"Control signal"
variable u1::Real
relations
y1 = plant.y
u1 = mpc.u[1]
connect(zoh.y, plant.u)
connect(plant.y, s1.u)
connect(s1.y, mpc.y[1], periodicclock.y)
connect(ref.y, sr.u)
connect(sr.y, mpc.r[1])
connect(mpc.u[1], zoh.u)
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}, "doc": {"behavior": false}}}
endTest Cases ​
Test Case case1 ​
Related ​
Examples
Experiments
Analyses