Skip to content

Commit 79d1193

Browse files
committed
add not implemented test/fix for continuous MPC
1 parent 2f3ca18 commit 79d1193

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

control/tests/optimal_test.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_discrete_lqr():
117117
assert np.any(np.abs(res1.inputs - res2.inputs) > 0.1)
118118

119119

120-
def test_mpc_iosystem():
120+
def test_mpc_iosystem_aircraft():
121121
# model of an aircraft discretized with 0.2s sampling time
122122
# Source: https://www.mpt3.org/UI/RegulationProblem
123123
A = [[0.99, 0.01, 0.18, -0.09, 0],
@@ -171,6 +171,21 @@ def test_mpc_iosystem():
171171
xout[0:sys.nstates, -1], xd, atol=0.1, rtol=0.01)
172172

173173

174+
def test_mpc_iosystem_continuous():
175+
# Create a random state space system
176+
sys = ct.rss(2, 1, 1)
177+
T, _ = ct.step_response(sys)
178+
179+
# provide penalties on the system signals
180+
Q = np.eye(sys.nstates)
181+
R = np.eye(sys.ninputs)
182+
cost = opt.quadratic_cost(sys, Q, R)
183+
184+
# Continuous time MPC controller not implemented
185+
with pytest.raises(NotImplementedError):
186+
ctrl = opt.create_mpc_iosystem(sys, T, cost)
187+
188+
174189
# Test various constraint combinations; need to use a somewhat convoluted
175190
# parametrization due to the need to define sys instead the test function
176191
@pytest.mark.parametrize("constraint_list", [

0 commit comments

Comments
 (0)