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
allow naming of linearized system signals
  • Loading branch information
murrayrm committed Jan 1, 2021
commit fa041b695f021b4baf60b495ea9fd3ff29c9922e
24 changes: 21 additions & 3 deletions control/iosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ def feedback(self, other=1, sign=-1, params={}):
# Return the newly created system
return newsys

def linearize(self, x0, u0, t=0, params={}, eps=1e-6):
def linearize(self, x0, u0, t=0, params={}, eps=1e-6,
name=None, copy=False, **kwargs):
"""Linearize an input/output system at a given state and input.

Return the linearization of an input/output system at a given state
Expand Down Expand Up @@ -547,8 +548,20 @@ def linearize(self, x0, u0, t=0, params={}, eps=1e-6):
D[:, i] = (self._out(t, x0, u0 + du) - H0) / eps

# Create the state space system
linsys = StateSpace(A, B, C, D, self.dt, remove_useless=False)
return LinearIOSystem(linsys)
linsys = LinearIOSystem(
StateSpace(A, B, C, D, self.dt, remove_useless=False),
name=name, **kwargs)

# Set the names the system, inputs, outputs, and states
if copy:
linsys.ninputs, linsys.input_index = self.ninputs, \
self.input_index.copy()
linsys.noutputs, linsys.output_index = \
self.noutputs, self.output_index.copy()
linsys.nstates, linsys.state_index = \
self.nstates, self.state_index.copy()

return linsys

def copy(self, newname=None):
"""Make a copy of an input/output system."""
Expand Down Expand Up @@ -1759,6 +1772,11 @@ def linearize(sys, xeq, ueq=[], t=0, params={}, **kw):
params : dict, optional
Parameter values for the systems. Passed to the evaluation functions
for the system as default values, overriding internal defaults.
copy : bool, Optional
If `copy` is True, copy the names of the input signals, output signals,
and states to the linearized system.
name : string, optional
Set the name of the linearized system.

Returns
-------
Expand Down