Skip to content

Commit 021e34c

Browse files
committed
Add TF add, sub, radd, rsub tests
1 parent 508bc8b commit 021e34c

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

control/tests/xferfcn_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,32 @@ def test_pow(self):
409409
with pytest.raises(ValueError):
410410
TransferFunction.__pow__(sys1, 0.5)
411411

412+
def test_add_sub_mimo_siso(self):
413+
for op in [
414+
TransferFunction.__add__,
415+
TransferFunction.__radd__,
416+
TransferFunction.__sub__,
417+
TransferFunction.__rsub__,
418+
]:
419+
tf_mimo = TransferFunction(
420+
[
421+
[[1], [1]],
422+
[[1], [1]],
423+
],
424+
[
425+
[[10, 1], [20, 1]],
426+
[[20, 1], [30, 1]],
427+
],
428+
)
429+
tf_siso = TransferFunction([1], [5, 0])
430+
tf_arr = ct.split_tf(tf_mimo)
431+
expected = ct.combine_tf([
432+
[op(tf_arr[0, 0], tf_siso), op(tf_arr[0, 1], tf_siso)],
433+
[op(tf_arr[1, 0], tf_siso), op(tf_arr[1, 1], tf_siso)],
434+
])
435+
result = op(tf_mimo, tf_siso)
436+
assert _tf_close_coeff(expected.minreal(), result.minreal())
437+
412438
@pytest.mark.parametrize(
413439
"left, right, expected",
414440
[

0 commit comments

Comments
 (0)