I implemented a class to identify ARX models in Python. The next step is the calculation of optimal PID parameters based on LQR. Apparently a continuous time model is required and I have the following possibilites:
In Matlab the first two approaches are easily done, but I need them in Python. Does anybody know how Matlab implemented d2c
and has a reference?
There are a few options you can use python-control
package or scipy.signal
module or use harold
(shameless plug: I'm the author).
Here is an example
import harold
G = harold.Transfer(1, [1, 2, 1])
H_zoh = harold.discretize(G, dt=0.1, method='zoh')
H_tus = harold.discretize(G, dt=0.1, method='tustin')
H_zoh.polynomials
Out[5]:
(array([[0.00467884, 0.00437708]]),
array([[ 1. , -1.80967484, 0.81873075]]))
H_tus.polynomials
Out[6]:
(array([[0.00226757, 0.00453515, 0.00226757]]),
array([[ 1. , -1.80952381, 0.8185941 ]]))
Currently zoh
, foh
, tustin
, forward euler
, backward euler
is supported including undiscretizations. The documentation is found at http://harold.readthedocs.io/en/latest/index.html