Industrial chemical and refining applications are some of the earliest applications of model predictive control. They often use other forms for identification such as ARX
(Auto-Regressive eXogenous inputs), FIR
(Finite Impulse Response), or Transfer Function models. There are good commercial tools for identifying models such as MATLAB System Identification Toolbox, DMC+ (AspenTech), and RMPCT (Honeywell). There are some recent developments with Seeq system identification in Python. The SIPPY package is an alternative but installation of dependency Slycot (recently commercialized) can be a challenge with the required Fortran compilers. Here is a simple MIMO identification from another post on Model Predictive Control that uses gekko available with pip install gekko
.
from gekko import GEKKO
import pandas as pd
import matplotlib.pyplot as plt
# load data and parse into columns
url = 'http://apmonitor.com/do/uploads/Main/tclab_dyn_data2.txt'
data = pd.read_csv(url)
t = data['Time']
u = data[['H1','H2']]
y = data[['T1','T2']]
# generate time-series model
m = GEKKO(remote=False) # remote=True for MacOS
# system identification
na = 2 # output coefficients
nb = 2 # input coefficients
yp,p,K = m.sysid(t,u,y,na,nb,diaglevel=1)
plt.figure()
plt.subplot(2,1,1)
plt.plot(t,u)
plt.legend([r'$u_0$',r'$u_1$'])
plt.ylabel('MVs')
plt.subplot(2,1,2)
plt.plot(t,y)
plt.plot(t,yp)
plt.legend([r'$y_0$',r'$y_1$',r'$z_0$',r'$z_1$'])
plt.ylabel('CVs')
plt.xlabel('Time')
plt.savefig('sysid.png')
plt.show()
There are standard methods to exactly convert an ARX model to state space form. If the intended application is a predictive controller then the ARX model can be used instead of converting to state space form.