Skip to content
Prev Previous commit
inherit _rhs and _out methods rather than duplicate them in LinearIOS…
…ystem
  • Loading branch information
sawyerbfuller committed Nov 8, 2022
commit 9baafd5b759a5ee20722479b76f941e81510bf5d
14 changes: 3 additions & 11 deletions control/iosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,17 +679,9 @@ def _update_params(self, params={}, warning=True):
if params and warning:
warn("Parameters passed to LinearIOSystems are ignored.")

def _rhs(self, t, x, u, params={}):
# Convert input to column vector in case A, B are numpy matrix
output = self.A @ np.reshape(x, (-1, 1)) \
+ self.B @ np.reshape(u, (-1, 1))
return np.array(output).reshape((-1,)) # change output to 1D array

def _out(self, t, x, u, params={}):
# Convert input to column vector in case A, B are numpy matrix
y = self.C @ np.reshape(x, (-1, 1)) \
+ self.D @ np.reshape(u, (-1, 1))
return np.array(y).reshape((-1,)) # change output to 1D array
# inherit methods as necessary
_rhs = StateSpace._rhs
_out = StateSpace._out

def __repr__(self):
# Need to define so that I/O system gets used instead of StateSpace
Expand Down