GeezerVison is showing github.com — fixed bug in calculation of percent overshoot by sawyerbfuller · Pull Request #555 · python-control/python-control
Conversation
Now it gives the correct result even if the transfer function is not strictly proper.
Other changes:
- step_info now calculates overshoot with respect to dcgain rather than the final (edit: numeric) value of the (computed) step response.
- adjusted the length of the step response to go for a little longer, to within 0.1% rather than 1% of steady-state, to improve precision of
step_info (and updated unit tests)
a remark: sys.dcgain() now always returns a complex number because it evaluates at a frequency of zero (1 for DT systems) (as a result of #542?). This returns a real-valued complex number. I think there is a reasonable argument that it should be cast to a float because currently we assume system parameters are real-valued.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…proper transfer functions.
|

Coverage remained the same at 88.861% when pulling b36d053 on sawyerbfuller:fix-stepinfo into 66d4a53 on python-control:master.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Is #337 also addressed, by chance?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
sorry, didn't have a chance to get to that one on this PR
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Dear @sawyerbfuller, the solution could have problem with systems with initial condition different of zero. I want to contribute , but at the moment, I don't now how test the last version.
I maked this example, to explain:
import numpy as np
import control as ctrl
import matplotlib.pyplot as plt
A = [[0,1,0],[0,0,1],[-1,-2,-3]]
B = [[0],[0],[1]]
C = [1,0,0]
D = 0
sys=ctrl.ss(A,B,C,D)
t= np.linspace(0,20,1000)
t1,y1 =ctrl.step_response(sys,t,[-1,0,2])
plt.plot(t1,y1)
ctrl.step_info(sys)
new_overshoot = 100. * (y1.max() - sys.dcgain()) / sys.dcgain()
print('new_overshoot =', new_overshoot)
{'RiseTime': 2.616832783582626,
'SettlingTime': 9.555404558233526,
'SettlingMin': 0.8926922608222024,
'SettlingMax': 1.1446150537879327,
'Overshoot': 15.77739060863902,
'Undershoot': 0.0,
'Peak': 1.1446150537879327,
'PeakTime': 6.06629418012336,
'SteadyStateValue': 0.9886343506022361}
new_overshoot = 38.34913836051592
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
But ctrl.step_info(sys) does not have any initial conditions. It does know nothing of the step_response() call.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
step_info overshoot error
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|