Skip to content

Commit b881b22

Browse files
committed
initial refactoring of classes and modules
1 parent bfdfbd5 commit b881b22

25 files changed

Lines changed: 809 additions & 1193 deletions

control/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,35 @@
6868

6969
# Import functions from within the control system library
7070
# Note: the functions we use are specified as __all__ variables in the modules
71+
72+
# Input/output system modules
73+
from .iosys import *
74+
from .nlsys import *
75+
from .lti import *
76+
from .statesp import *
77+
from .xferfcn import *
78+
from .frdata import *
79+
7180
from .bdalg import *
7281
from .delay import *
7382
from .descfcn import *
7483
from .dtime import *
7584
from .freqplot import *
76-
from .lti import *
7785
from .margins import *
7886
from .mateqn import *
7987
from .modelsimp import *
80-
from .iosys import *
8188
from .nichols import *
8289
from .phaseplot import *
8390
from .pzmap import *
8491
from .rlocus import *
8592
from .statefbk import *
86-
from .statesp import *
8793
from .stochsys import *
8894
from .timeresp import *
89-
from .xferfcn import *
9095
from .ctrlutil import *
91-
from .frdata import *
9296
from .canonical import *
9397
from .robust import *
9498
from .config import *
9599
from .sisotool import *
96-
from .nlsys import *
97100
from .passivity import *
98101

99102
# Exceptions

control/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def reset_defaults():
123123
from .sisotool import _sisotool_defaults
124124
defaults.update(_sisotool_defaults)
125125

126-
from .iosys import _namedio_defaults
127-
defaults.update(_namedio_defaults)
126+
from .iosys import _iosys_defaults
127+
defaults.update(_iosys_defaults)
128128

129129
from .xferfcn import _xferfcn_defaults
130130
defaults.update(_xferfcn_defaults)
@@ -300,7 +300,7 @@ def use_legacy_defaults(version):
300300
set_defaults('control', default_dt=None)
301301

302302
# changed iosys naming conventions
303-
set_defaults('namedio', state_name_delim='.',
303+
set_defaults('iosys', state_name_delim='.',
304304
duplicate_system_name_prefix='copy of ',
305305
duplicate_system_name_suffix='',
306306
linearized_system_name_prefix='',

control/dtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None,
9696
if `copy_names` is `False`, a generic name <sys[id]> is generated
9797
with a unique integer id. If `copy_names` is `True`, the new system
9898
name is determined by adding the prefix and suffix strings in
99-
config.defaults['namedio.sampled_system_name_prefix'] and
100-
config.defaults['namedio.sampled_system_name_suffix'], with the
99+
config.defaults['iosys.sampled_system_name_prefix'] and
100+
config.defaults['iosys.sampled_system_name_suffix'], with the
101101
default being to add the suffix '$sampled'.
102102
copy_names : bool, Optional
103103
If True, copy the names of the input signals, output

control/flatsys/linflat.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
import numpy as np
3939
import control
4040
from .flatsys import FlatSystem
41-
from ..statesp import LinearIOSystem
41+
from ..statesp import StateSpace
4242

4343

44-
class LinearFlatSystem(FlatSystem, LinearIOSystem):
44+
class LinearFlatSystem(FlatSystem, StateSpace):
4545
"""Base class for a linear, differentially flat system.
4646
4747
This class is used to create a differentially flat system representation
@@ -94,7 +94,7 @@ def __init__(self, linsys, inputs=None, outputs=None, states=None,
9494
"only single input, single output systems are supported")
9595

9696
# Initialize the object as a LinearIO system
97-
LinearIOSystem.__init__(
97+
StateSpace.__init__(
9898
self, linsys, inputs=inputs, outputs=outputs, states=states,
9999
name=name)
100100

@@ -143,10 +143,10 @@ def reverse(self, zflag, params):
143143

144144
# Update function
145145
def _rhs(self, t, x, u):
146-
# Use LinearIOSystem._rhs instead of default (MRO) NonlinearIOSystem
147-
return LinearIOSystem._rhs(self, t, x, u)
146+
# Use StateSpace._rhs instead of default (MRO) NonlinearIOSystem
147+
return StateSpace._rhs(self, t, x, u)
148148

149149
# output function
150150
def _out(self, t, x, u):
151-
# Use LinearIOSystem._out instead of default (MRO) NonlinearIOSystem
152-
return LinearIOSystem._out(self, t, x, u)
151+
# Use StateSpace._out instead of default (MRO) NonlinearIOSystem
152+
return StateSpace._out(self, t, x, u)

control/frdata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
from .lti import LTI, _process_frequency_response
5656
from .exception import pandas_check
57-
from .iosys import NamedIOSystem, _process_namedio_keywords
57+
from .iosys import InputOutputSystem, _process_iosys_keywords
5858
from . import config
5959

6060
__all__ = ['FrequencyResponseData', 'FRD', 'frd']
@@ -212,14 +212,14 @@ def __init__(self, *args, **kwargs):
212212
if self.squeeze not in (None, True, False):
213213
raise ValueError("unknown squeeze value")
214214

215-
# Process namedio keywords
215+
# Process iosys keywords
216216
defaults = {
217217
'inputs': self.fresp.shape[1], 'outputs': self.fresp.shape[0]}
218-
name, inputs, outputs, states, dt = _process_namedio_keywords(
218+
name, inputs, outputs, states, dt = _process_iosys_keywords(
219219
kwargs, defaults, end=True)
220220

221221
# Process signal names
222-
NamedIOSystem.__init__(
222+
InputOutputSystem.__init__(
223223
self, name=name, inputs=inputs, outputs=outputs, dt=dt)
224224

225225
# create interpolation functions

0 commit comments

Comments
 (0)