MIMO Model Identification

Learning outcomes

  • Write the multivariable ARX, finite impulse response and step-response forms and compute the steady-state gain matrix from each.
  • Explain in outline how subspace identification finds the model order and a state-space model from data.
  • Design an identification test with pseudo-random binary sequences and uncorrelated input moves.

Book chapter: Process Dynamics, Modeling, and Identification (Volume 1), Chapter 12, Multivariable Plant Identification Workbench with Exact Structural Zeros (PDF).
Practice in 15 minutes: 4 · A Multivariable Model From Records Alone, 16 · A First MPC, and a Model That Goes Stale
Model: Data-driven linear multivariable models (ARX, FIR, step response, state space) identified from input and output records.
Decision: The fit chooses the model coefficients; the identified model then becomes the prediction model of a linear MPC.
Learning: Identification is how a controller learns its plant; the input design decides what it can learn.

Multiple Input, Multiple Output (MIMO) systems can be empirically described by several linear dynamic system models. MIMO systems are more complicated than Single Input, Single Output (SISO) systems because of several factors including multivariate interaction, potential co-linearity of inputs, and large data processing requirements. Some common MIMO model forms include:

  • Discrete transfer functions (z or q - Time series)
  • Continuous transfer functions (s - Laplace variables)
  • State space (A,B,C,D - time domain, linear differential equations)

Model identification in these forms typically involves fitting unknown coefficients in the model followed by an analysis to determine how many parameters are statistically significant.

Multivariable Model Forms

With `n_u` inputs `u_k` and `n_y` outputs `y_k` sampled at a fixed interval, the multivariable ARX model has matrix coefficients `A_i` (`n_y \times n_y`) and `B_j` (`n_y \times n_u`) and a constant `c`:

$$y_k = \sum_{i=1}^{n_a} A_i\, y_{k-i} + \sum_{j=1}^{n_b} B_j\, u_{k-j} + c$$

A finite impulse response (FIR) model drops the output terms and needs enough input lags `n_h` to cover the settling time. Summing its impulse coefficients `H_i` gives the step-response coefficients `S_j` used by dynamic matrix control, in terms of input moves `\Delta u_k = u_k - u_{k-1}`:

$$\begin{gathered} y_k = \sum_{j=1}^{n_h} H_j\, u_{k-j}, \\ S_j = \sum_{i=1}^{j} H_i, \\ y_k = \sum_{j=1}^{n_h - 1} S_j\, \Delta u_{k-j} + S_{n_h}\, u_{k-n_h} \end{gathered}$$

The steady-state gain matrix, which the exercise asks for, follows from either form:

$$G = S_{n_h} = \sum_{j=1}^{n_h} H_j \qquad \text{or} \qquad G = \Big(I - \sum_{i=1}^{n_a} A_i\Big)^{-1} \sum_{j=1}^{n_b} B_j$$

Entry `G_{ij}` is the final change in output `i` per unit step in input `j`.

Subspace identification in outline. Arrange the records in block Hankel matrices of past and future inputs and outputs. Project the future outputs onto the past data, removing the part explained by future inputs. The singular values of that projection drop sharply after the true model order, which picks the number of states; the singular vectors give the observability matrix and from it `A` and `C`; least squares then gives `B` and `D`. No iterative search is needed, and the result is a good start for a prediction-error fit.

Input design. A pseudo-random binary sequence (PRBS) switches each input between two levels at random multiples of the sample time, which spreads the excitation over the frequencies the model must capture. Move each input independently of the others: if two inputs always move together, their separate gains cannot be told apart. Keep the shortest hold well below the dominant time constant and the record several settling times long.

The identify app fits ARX, FIR, transfer function and state-space models to records like these and exports the fitted model as a self-contained GEKKO script, the bridge from this page to the MPC pages.

Exercise

The following data set was generated in class from two voltage inputs (u) that changed the temperature (x) of two thermistors from the Arduino Lab.

Determine a linear dynamic model that best describes the input to output relationship between voltage and temperature. Compute the steady state gain for each input to output relationship. Data and example script files are posted above in Excel and MATLAB.

Solution (Excel, MATLAB, Python)

Solution (GEKKO Python)

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)

# 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()

from gekko import GEKKO
import numpy as np
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)

# system identification
na = 3 # output coefficients
nb = 4 # input coefficients
yp,p,K = m.sysid(t,u,y,na,nb)

plt.figure()
plt.subplot(2,1,1)
plt.plot(t,u)
plt.legend([r'$H_1$',r'$H_2$'])
plt.ylabel('MVs')
plt.subplot(2,1,2)
plt.plot(t,y)
plt.plot(t,yp)
plt.legend([r'$T_{1meas}$',r'$T_{2meas}$',\
            r'$T_{1pred}$',r'$T_{2pred}$'])
plt.ylabel('CVs')
plt.xlabel('Time')
plt.savefig('sysid.png')

# step test model
yc,uc = m.arx(p)

# steady state initialization
m.options.IMODE = 1
m.solve(disp=False)

# dynamic simulation (step tests)
m.time = np.linspace(0,240,241)
m.options.TIME_SHIFT=0
m.options.IMODE = 4
m.solve(disp=False)

plt.figure()

# step for first MV (Heater 1)
uc[0].value = np.zeros(len(m.time))
uc[0].value[5:] = 100
uc[1].value = np.zeros(len(m.time))
m.solve(disp=False)

plt.subplot(2,2,1)
plt.title('Step Test 1')
plt.plot(m.time,uc[0].value,'b-',label=r'$H_1$')
plt.plot(m.time,uc[1].value,'r-',label=r'$H_2$')
plt.ylabel('Heater (%)')
plt.legend()
plt.subplot(2,2,3)
plt.plot(m.time,yc[0].value,'b--',label=r'$T_1$')
plt.plot(m.time,yc[1].value,'r--',label=r'$T_2$')
plt.ylabel('Temperature (K)')
plt.xlabel('Time (sec)')
plt.legend()

# step for second MV (Heater 2)
uc[0].value = np.zeros(len(m.time))
uc[1].value = np.zeros(len(m.time))
uc[1].value[5:] = 100
m.solve(disp=False)
plt.subplot(2,2,2)
plt.title('Step Test 2')
plt.plot(m.time,uc[0].value,'b-',label=r'$H_1$')
plt.plot(m.time,uc[1].value,'r-',label=r'$H_2$')
plt.ylabel('Heater (%)')
plt.legend()
plt.subplot(2,2,4)
plt.plot(m.time,yc[0].value,'b--',label=r'$T_1$')
plt.plot(m.time,yc[1].value,'r--',label=r'$T_2$')
plt.ylabel('Temperature (K)')
plt.xlabel('Time (sec)')
plt.legend()

plt.show()

Generative AI Learning

"For a two-heater, two-temperature lab, write a multivariable ARX model with one output lag and one input lag, and give the steady-state gain matrix in terms of its coefficient matrices. Then tell me which entries of the gain matrix my data can determine if I only ever moved both heaters together."

Check the answer: The gain matrix is G = (I - A1)^-1 B1. With both heaters always moved together, only the sum of each row's two gains is determined. Check it: fit your model on a record where both heaters move together, then on one where they move separately, and compare the off-diagonal gains and their standard errors.

References

  • Nikbakhsh, S., Hedengren, J.D., Darby, M., Udy, J., Constrained Model Identification Using Open-Equation Nonlinear Optimization, AIChE Spring Meeting, Houston, TX, April 2016. Presentation Abstract

Course Information

TCLab

Project

Applications

Advanced Control Exercises

Exams

Modeling

Machine Learning

Estimation

Control

Reinforcement Learning

Related Courses

Admin