Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add not implemented test/fix for continuous MPC
  • Loading branch information
murrayrm committed Mar 23, 2022
commit 79d11935799b5bfacb5abab3048dc6dd3b93faaa
17 changes: 16 additions & 1 deletion control/tests/optimal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_discrete_lqr():
assert np.any(np.abs(res1.inputs - res2.inputs) > 0.1)


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


def test_mpc_iosystem_continuous():
# Create a random state space system
sys = ct.rss(2, 1, 1)
T, _ = ct.step_response(sys)

# provide penalties on the system signals
Q = np.eye(sys.nstates)
R = np.eye(sys.ninputs)
cost = opt.quadratic_cost(sys, Q, R)

# Continuous time MPC controller not implemented
with pytest.raises(NotImplementedError):
ctrl = opt.create_mpc_iosystem(sys, T, cost)


# Test various constraint combinations; need to use a somewhat convoluted
# parametrization due to the need to define sys instead the test function
@pytest.mark.parametrize("constraint_list", [
Expand Down