Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

enhance step_info to MIMO and time series of response data#577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
murrayrm merged 13 commits intopython-control:masterfrombnavigator:mimo-step-info
Mar 20, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
ff960c3
enhance step_info to MIMO
bnavigatorMar 17, 2021
b98008a
remove test function with duplicate name
bnavigatorMar 17, 2021
ed63358
add step_info mimo test (TransferFunction)
bnavigatorMar 17, 2021
35d8eba
fix timevector and list return population for MIMO step_info
bnavigatorMar 17, 2021
468ffbf
apply isort
bnavigatorMar 18, 2021
a1fd47e
step_info from MIMO step_response
bnavigatorMar 18, 2021
238482e
reenable masked timevector test, and really test if we get the tfinal
bnavigatorMar 18, 2021
cc90d8d
include tfinal in auto generated timevector
bnavigatorMar 18, 2021
01ef666
mimo is slycot only
bnavigatorMar 18, 2021
20ed368
Describe MIMO step_info return and add doctest example
bnavigatorMar 19, 2021
43d73f0
support time series of response data in step_info
bnavigatorMar 19, 2021
6587f69
add yfinal parameter to step_info
bnavigatorMar 19, 2021
a878846
include yfinal in matlab.stepinfo call signature
bnavigatorMar 19, 2021
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
69 changes: 46 additions & 23 deletionscontrol/matlab/timeresp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,38 +64,59 @@ def step(sys, T=None, X0=0., input=0, output=None, return_x=False):
transpose=True, return_x=return_x)
return (out[1], out[0], out[2]) if return_x else (out[1], out[0])

def stepinfo(sys, T=None, SettlingTimeThreshold=0.02,

def stepinfo(sysdata, T=None, yfinal=None, SettlingTimeThreshold=0.02,
RiseTimeLimits=(0.1, 0.9)):
'''
"""
Step response characteristics (Rise time, Settling Time, Peak and others).

Parameters
----------
sys: StateSpace, or TransferFunction
LTI system tosimulate

T: array-like ornumber, optional
sysdata: StateSpace or TransferFunction or array_like
The system data. EitherLTI system tosimilate (StateSpace,
TransferFunction), or a time series of step response data.
T : array_like orfloat, optional
Time vector, or simulation time duration if a number (time vector is
autocomputed if not given)

SettlingTimeThreshold: float value, optional
autocomputed if not given).
Required, if sysdata is a time series of response data.
yfinal : scalar or array_like, optional
Steady-state response. If not given, sysdata.dcgain() is used for
systems to simulate and the last value of the the response data is
used for a given time series of response data. Scalar for SISO,
(noutputs, ninputs) array_like for MIMO systems.
SettlingTimeThreshold : float, optional
Defines the error to compute settling time (default = 0.02)

RiseTimeLimits: tuple (lower_threshold, upper_theshold)
RiseTimeLimits : tuple (lower_threshold, upper_theshold)
Defines the lower and upper threshold for RiseTime computation

Returns
-------
S: a dictionary containing:
RiseTime: Time from 10% to 90% of the steady-state value.
SettlingTime: Time to enter inside a default error of 2%
SettlingMin: Minimum value after RiseTime
SettlingMax: Maximum value after RiseTime
Overshoot: Percentage of the Peak relative to steady value
Undershoot: Percentage of undershoot
Peak: Absolute peak value
PeakTime: time of the Peak
SteadyStateValue: Steady-state value
S : dict or list of list of dict
If `sysdata` corresponds to a SISO system, S is a dictionary
containing:

RiseTime:
Time from 10% to 90% of the steady-state value.
SettlingTime:
Time to enter inside a default error of 2%
SettlingMin:
Minimum value after RiseTime
SettlingMax:
Maximum value after RiseTime
Overshoot:
Percentage of the Peak relative to steady value
Undershoot:
Percentage of undershoot
Peak:
Absolute peak value
PeakTime:
time of the Peak
SteadyStateValue:
Steady-state value

If `sysdata` corresponds to a MIMO system, `S` is a 2D list of dicts.
To get the step response characteristics from the j-th input to the
i-th output, access ``S[i][j]``


See Also
Expand All@@ -105,11 +126,13 @@ def stepinfo(sys, T=None, SettlingTimeThreshold=0.02,
Examples
--------
>>> S = stepinfo(sys, T)
'''
"""
from ..timeresp import step_info

# Call step_info with MATLAB defaults
S = step_info(sys, T, None, SettlingTimeThreshold, RiseTimeLimits)
S = step_info(sysdata, T=T, T_num=None, yfinal=yfinal,
SettlingTimeThreshold=SettlingTimeThreshold,
RiseTimeLimits=RiseTimeLimits)

return S

Expand Down
12 changes: 4 additions & 8 deletionscontrol/tests/sisotool_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,8 +68,8 @@ def test_sisotool(self, sys):

# Check the step response before moving the point
step_response_original = np.array(
[0. , 0.021, 0.124, 0.3146, 0.5653, 0.8385, 1.0969, 1.3095,
1.4549, 1.5231])
[0. , 0.0216, 0.1271, 0.3215, 0.5762, 0.8522, 1.1114, 1.3221,
1.4633, 1.5254])
assert_array_almost_equal(
ax_step.lines[0].get_data()[1][:10], step_response_original, 4)

Expand DownExpand Up@@ -113,8 +113,8 @@ def test_sisotool(self, sys):

# Check if the step response has changed
step_response_moved = np.array(
[0. , 0.023, 0.1554, 0.4401, 0.8646, 1.3722, 1.875, 2.2709,
2.4633, 2.3827])
[0. , 0.0237, 0.1596, 0.4511, 0.884, 1.3985, 1.9031, 2.2922,
2.4676, 2.3606])
assert_array_almost_equal(
ax_step.lines[0].get_data()[1][:10], step_response_moved, 4)

Expand DownExpand Up@@ -157,7 +157,3 @@ def test_sisotool_mimo(self, sys222, sys221):
# but 2 input, 1 output should
with pytest.raises(ControlMIMONotImplemented):
sisotool(sys221)




Loading

[8]ページ先頭

©2009-2025 Movatter.jp