|
8 | 8 | """ |
9 | 9 |
|
10 | 10 | import math |
11 | | -from typing import Callable |
12 | 11 | from warnings import warn |
13 | 12 |
|
14 | 13 | import numpy as np |
15 | 14 | from numpy import abs, real |
16 | 15 |
|
17 | | -import control |
18 | | - |
19 | 16 | from . import config |
20 | 17 | from .iosys import InputOutputSystem |
21 | 18 |
|
@@ -64,7 +61,7 @@ def damp(self): |
64 | 61 | return wn, zeta, poles |
65 | 62 |
|
66 | 63 | def feedback(self, other=1, sign=-1): |
67 | | - """Feedback interconnection between two input/output systems.""" |
| 64 | + """Feedback interconnection between two input/output systems. |
68 | 65 |
|
69 | 66 | Parameters |
70 | 67 | ---------- |
@@ -238,30 +235,100 @@ def ispassive(self): |
238 | 235 | from control.passivity import ispassive |
239 | 236 | return ispassive(self) |
240 | 237 |
|
241 | | - # convenience aliases |
242 | | - # most function are only forward declaraed and patched in the __init__.py to avoid circular imports |
243 | | -
|
244 | | - # conversions |
245 | | - #: Convert to :class:`StateSpace` representation; see :func:`ss` |
246 | | - to_ss: Callable |
247 | | - #: Convert to :class:`TransferFunction` representation; see :func:`tf` |
248 | | - to_tf: Callable |
249 | | -
|
250 | | - # freq domain plotting |
251 | | - #: Bode plot; see :func:`bode_plot` |
252 | | - bode_plot: Callable |
253 | | - #: Nyquist plot; see :func:`nyquist_plot` |
254 | | - nyquist_plot: Callable |
255 | | - #: Nichols plot; see :func:`nichols_plot` |
256 | | - nichols_plot: Callable |
257 | | -
|
258 | | - # time domain simulation |
259 | | - #: Forced response; see :func:`forced_response` |
260 | | - forced_response = control.timeresp.forced_response |
261 | | - #: Impulse response; see :func:`impulse_response` |
262 | | - impulse_response = control.timeresp.impulse_response |
263 | | - #: Step response; see :func:`step_response` |
264 | | - step_response = control.timeresp.step_response |
| 238 | + # |
| 239 | + # Convenience aliases for conversion functions |
| 240 | + # |
| 241 | + # Allow conversion between state space and transfer function types |
| 242 | + # as methods. These are just pass throughs to factory functions. |
| 243 | + # |
| 244 | + # Note: in order for docstrings to created, these have to set these up |
| 245 | + # as independent methods, not just assigned to ss() and tf(). |
| 246 | + # |
| 247 | + # Imports are done within the function to avoid circular imports. |
| 248 | + # |
| 249 | + def to_ss(self, *args, **kwargs): |
| 250 | + """Convert to state space representation. |
| 251 | +
|
| 252 | + See `ss` for details. |
| 253 | + """ |
| 254 | + from .statesp import ss |
| 255 | + return ss(self, *args, **kwargs) |
| 256 | + |
| 257 | + def to_tf(self, *args, **kwargs): |
| 258 | + """Convert to transfer function representation. |
| 259 | +
|
| 260 | + See `tf` for details. |
| 261 | + """ |
| 262 | + from .xferfcn import tf |
| 263 | + return tf(self, *args, **kwargs) |
| 264 | + |
| 265 | + # |
| 266 | + # Convenience aliases for plotting and response functions |
| 267 | + # |
| 268 | + # Allow standard plots to be generated directly from the system object |
| 269 | + # in addition to standalone plotting and response functions. |
| 270 | + # |
| 271 | + # Note: in order for docstrings to created, these have to set these up as |
| 272 | + # independent methods, not just assigned to plotting/response functions. |
| 273 | + # |
| 274 | + # Imports are done within the function to avoid circular imports. |
| 275 | + # |
| 276 | + |
| 277 | + def bode_plot(self, *args, **kwargs): |
| 278 | + """Generate a Bode plot for the system. |
| 279 | +
|
| 280 | + See `bode_plot` for more information. |
| 281 | + """ |
| 282 | + from .freqplot import bode_plot |
| 283 | + return bode_plot(self, *args, **kwargs) |
| 284 | + |
| 285 | + def nichols_plot(self, *args, **kwargs): |
| 286 | + """Generate a Nichols plot for the system. |
| 287 | +
|
| 288 | + See `nichols_plot` for more information. |
| 289 | + """ |
| 290 | + from .nichols import nichols_plot |
| 291 | + return nichols_plot(self, *args, **kwargs) |
| 292 | + |
| 293 | + def nyquist_plot(self, *args, **kwargs): |
| 294 | + """Generate a Nyquist plot for the system. |
| 295 | +
|
| 296 | + See `nyquist_plot` for more information. |
| 297 | + """ |
| 298 | + from .freqplot import nyquist_plot |
| 299 | + return nyquist_plot(self, *args, **kwargs) |
| 300 | + |
| 301 | + def forced_response(self, *args, **kwargs): |
| 302 | + """Generate the forced response for the system. |
| 303 | +
|
| 304 | + See `forced_response` for more information. |
| 305 | + """ |
| 306 | + from .timeresp import forced_response |
| 307 | + return forced_response(self, *args, **kwargs) |
| 308 | + |
| 309 | + def impulse_response(self, *args, **kwargs): |
| 310 | + """Generate the impulse response for the system. |
| 311 | +
|
| 312 | + See `impulse_response` for more information. |
| 313 | + """ |
| 314 | + from .timeresp import impulse_response |
| 315 | + return impulse_response(self, *args, **kwargs) |
| 316 | + |
| 317 | + def initial_response(self, *args, **kwargs): |
| 318 | + """Generate the initial response for the system. |
| 319 | +
|
| 320 | + See `initial_response` for more information. |
| 321 | + """ |
| 322 | + from .timeresp import initial_response |
| 323 | + return initial_response(self, *args, **kwargs) |
| 324 | + |
| 325 | + def step_response(self, *args, **kwargs): |
| 326 | + """Generate the step response for the system. |
| 327 | +
|
| 328 | + See `step_response` for more information. |
| 329 | + """ |
| 330 | + from .timeresp import step_response |
| 331 | + return step_response(self, *args, **kwargs) |
265 | 332 |
|
266 | 333 |
|
267 | 334 | def poles(sys): |
|
0 commit comments