Skip to content

Commit 27487a9

Browse files
author
Mark
committed
Address edge case of stricly proper systems.
1 parent c57b928 commit 27487a9

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

control/passivity.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
except ImportError as e:
1111
cvx = None
1212

13+
lmi_epsilon = 1e-12
1314

1415
def is_passive(sys):
1516
'''
@@ -30,6 +31,10 @@ def is_passive(sys):
3031
C = sys.C
3132
D = sys.D
3233

34+
#account for strictly proper systems
35+
[n,m] = D.shape
36+
D = D + np.nextafter(0,1)*np.eye(n,m)
37+
3338
def make_LMI_matrix(P):
3439
V = np.vstack((
3540
np.hstack((A.T @ P + P@A, P@B)),
@@ -59,6 +64,7 @@ def make_LMI_matrix(P):
5964
c = cvx.matrix(0.0, (number_of_opt_vars, 1))
6065

6166
# crunch feasibility solution
67+
cvx.solvers.options['show_progress'] = False
6268
sol = cvx.solvers.sdp(c,
6369
Gs=[cvx.matrix(coefficents)],
6470
hs=[cvx.matrix(constants)])

control/tests/passivity_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ def test_is_passive():
1515
D = numpy.array([[1.5]])
1616
sys = ss(A, B, C, D)
1717

18+
# happy path is passive
1819
assert(passivity.is_passive(sys))
1920

21+
# happy path not passive
2022
D = -D
2123
sys = ss(A, B, C, D)
2224

2325
assert(not passivity.is_passive(sys))
2426

27+
#edge cases of D=0 boundary condition
28+
B *= 0
29+
C *= 0
30+
D *= 0
31+
sys = ss(A, B, C, D)
32+
assert(passivity.is_passive(sys))
33+
34+
A = A*1e12
35+
sys = ss(A, B, C, D)
36+
assert(passivity.is_passive(sys))

0 commit comments

Comments
 (0)