Skip to content

fix discrete-time simulation time output#286

Merged
repagh merged 2 commits intopython-control:masterfrom
murrayrm:timeresp-timevec
Apr 11, 2019
Merged

fix discrete-time simulation time output#286
repagh merged 2 commits intopython-control:masterfrom
murrayrm:timeresp-timevec

Conversation

@murrayrm
Copy link
Copy Markdown
Member

@murrayrm murrayrm commented Apr 10, 2019

This PR fixes the non-intuitive time-domain simulation behavior for discrete time systems identified in issue #239. In this version:

  • The values of the output argument T always matches the times at which the corresponding outputs Y are obtained. This is consistent with the idea that you plot the outputs of a simulation function by using commands of the form
t, y = step_response(sys)
plot(t, y)
  • If you pass an explicit set of sampling times for a discrete time system, the time increment must be an integer multiple of the system sampling time (with dt=True allowing any time increment). If not, a ValueError exception is raised.

  • If you omit the sampling time, the value of T will be determined based on either the input signal (for forced_response() or the time constants coming from the system dynamics. In either case, the difference between time points will be equal to the sampling time of the system (or 1 if dt=True). (Note: net yet clear whether the time constant calculation is correct for discrete time systems; will create a new issue to track this.)

Unit tests are included to make sure all of the statements above are checked.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.08%) to 78.269% when pulling 14261cc on murrayrm:timeresp-timevec into 3738718 on python-control:master.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.08%) to 78.269% when pulling 14261cc on murrayrm:timeresp-timevec into 3738718 on python-control:master.

@murrayrm murrayrm added this to the 0.8.2 milestone Apr 11, 2019
@repagh repagh merged commit 1254ccb into python-control:master Apr 11, 2019
@repagh
Copy link
Copy Markdown
Member

repagh commented Apr 11, 2019

Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants