Skip to content

Some way of stepping a system? #83

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomkcook opened this issue Apr 14, 2016 · 2 comments · Fixed by #558
Closed

Some way of stepping a system? #83

tomkcook opened this issue Apr 14, 2016 · 2 comments · Fixed by #558

Comments

@tomkcook
Copy link

I'm not sure if I'm missing something really obvious here.

I can simulate a system given a complete input time series using control.lsim().

But how can I simulate a system where I get the samples one at a time and want to know the output after each one? For instance, if I'm using it to control something or process audio or whatever?

The best I've come up with so far is to convert it to a state-space representation (if it isn't already), discretise it using the sample() function (again, if it isn't already) and manually run the system equations. Is there not some way of doing this built in?

@cwrowley
Copy link
Contributor

I don't believe there is a ready-made function to do what you are looking for, but I am curious why you want to simulate the system one sample at a time. One reason could be that you're determining the input from some sort of feedback law; in that case, one would normally make a new closed-loop system, for instance using control.feedback, and simulate that, for instance with control.lsim. Another reason could be that you'd like to do something in real time, with actual hardware, and then I think you'd be better off just manually running the system equations, as you describe.

@tomkcook
Copy link
Author

I'm not working in realtime as such, but I am trying to integrate a python.control system into a larger simulation where it forms part of a feedback loop where the rest is non-python and so the samples come one at a time.

It'd be very useful to have a way of 'stepping' a continuous system like this, but I realise there's potentially a lot of work involved - everyone will have their own ideas about which integrator to use and as soon as you get into Runge-Kutta and related methods then you have to think about tolerances, steps backwards in time etc.

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

Successfully merging a pull request may close this issue.

4 participants