Skip to content
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
Run autopep8.
  • Loading branch information
Mark-Yeatman committed Jun 14, 2022
commit cf0eac302a71897424ba8eeffd6b591cfbe1cde0
4 changes: 2 additions & 2 deletions control/passivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def make_LMI_matrix(P):
# crunch feasibility solution
cvx.solvers.options['show_progress'] = False
sol = cvx.solvers.sdp(c,
Gs=[cvx.matrix(coefficents)],
hs=[cvx.matrix(constants)])
Gs=[cvx.matrix(coefficents)],
hs=[cvx.matrix(constants)])

return (sol["x"] is not None)
19 changes: 11 additions & 8 deletions control/tests/passivity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,23 @@ def test_ispassive():

assert(not passivity.ispassive(sys))


A_d = numpy.array([[-2, 0], [0, 0]])
A = numpy.array([[-3, 0], [0, -2]])
B = numpy.array([[0], [1]])
C = numpy.array([[-1, 2]])
D = numpy.array([[1.5]])


@cvxoptonly
@pytest.mark.parametrize(
"test_input,expected",
[((A,B,C,D*0.0), True),
((A_d,B,C,D), True),
((A*1e12,B,C,D*0), True),
((A,B*0,C*0,D), True),
((A*0,B,C,D), True),
((A*0,B*0,C*0,D*0), True)])
"test_input,expected",
[((A, B, C, D*0.0), True),
((A_d, B, C, D), True),
((A*1e12, B, C, D*0), True),
((A, B*0, C*0, D), True),
((A*0, B, C, D), True),
((A*0, B*0, C*0, D*0), True)])
def test_ispassive_edge_cases(test_input, expected):

# strictly proper
Expand All @@ -47,4 +50,4 @@ def test_ispassive_edge_cases(test_input, expected):
C = test_input[2]
D = test_input[3]
sys = ss(A, B, C, D)
assert(passivity.ispassive(sys)==expected)
assert(passivity.ispassive(sys) == expected)