# Identification of Crude Distillation Unit: A Comparison between Neural Network and Koopman Operator
## 2 Modeling and Methodology  
### Nonlinear Autoregressive Exogenous Model  
The Nonlinear AutoRegressive Exogenous model (NARX) was proposed as a novel framework for representing a diverse range of nonlinear systems. The fundamental principle behind this model is the incorporation of past inputs and outputs, which helps to mitigate the effects of both nonlinearities and delays in the output [34]. This model is defined as:  
\[\begin{split} y(k)=F[y(k-1),y(k-2),\dots,y(k-n_{y}),\\ u(k-d),u(k-d-1),\dots,u(k-d-n_{u})]\end{split} \tag{1}\]  
where \(y(k)\) and \(u(k)\) represent the output and the input of the system, respectively, with \(n_{y}\) and \(n_{u}\) the maximum lags for the output and input, whereas \(d\) is the time delay. \(F[.]\) denotes a nonlinear mapping function. In practical applications, there are several methods that can be used to approximate the unknown function \(F[.]\); these include polynomial series, wavelet expansions, Fuzzy Logic, Neural Networks, and many others.  
While the formulation presented in Equation (1) is designed for a Single-Input Single-Output (SISO) system, it is straightforward to extend these models to accommodate Multi-Input Multi-Output (MIMO) systems. For example, consider a generic MIMO scenario with \(r\) inputs \(\{u_{1}(k),u_{2}(k)...,u_{r}(k)\}\) and \(s\) outputs \(\{y_{1}(k),y_{2}(k)...,y_{s}(k)\}\), as given by Equation (2).  
\[\begin{split} u_{i}^{[k-1]}=[u_{i}(k-1),u_{i}(k-2),\dots,u_{i}(k- n_{u})]\\ y_{j}^{[k-1]}=[y_{j}(k-1),y_{j}(k-2),\dots,y_{j}(k-n_{y})]\\ i=1,2,3,\dots,r\;j=1,2,\dots,s\end{split} \tag{2}\]  
The formulation of the NARX model for the MIMO system (2) can be expressed as  
\[\begin{split} y_{1}(k)=F_{1}[y_{1}^{(k-1)},\dots,y_{s}^{(k-1)},u _{1}^{(k-1)},\dots,u_{r}^{(k-1)}]\\ y_{2}(k)=F_{2}[y_{1}^{(k-1)},\dots,y_{s}^{(k-1)},u_{1}^{(k-1)}, \dots,u_{r}^{(k-1)}]\\ \vdots\\ y_{s}(k)=F_{s}[y_{1}^{(k-1)},\dots,y_{s}^{(k-1)},u_{1}^{(k-1)}, \dots,u_{r}^{(k-1)}]\end{split} \tag{3}\]  
where \(F_{1}[.]\), \(F_{2}[.]\),..., \(F_{s}[.]\) are nonlinear functions. ANNs are widely used in signal processing, pattern recognition, data fitting, analysis, and control due to their ability to learn and represent mathematical descriptions of systems [35]. This can be either Single-Layer Networks (SLNs) or Multi-Layer Networks (MLNs). SLNs, in particular, have been extensively applied to reconstruct the mapping function \(F[.]\), resulting in more accurate NARX models in different applications [36; 37; 38; 39]. Therefore, this approach was adopted in our work. Figure 1 depicts the conventional configuration of a NARX\(-\)NN model. Combining the past inputs and outputs into a single vector \(\mathbf{x}(\mathbf{k})\):  
\[\begin{split}\mathbf{x}(\mathbf{k})=[u_{1}(k-1),\dots,u_{1}(k-n_ {u}),\\ u_{r}(k-1),\dots,u_{r}(k-n_{u}),\\ y_{1}(k-1),\dots,y_{1}(k-n_{y}),\\ y_{s}(k-1),\dots,y_{s}(k-n_{y})]^{T}\end{split} \tag{4}\]  
The NARX\(-\)NN model can be mathematically expressed in a matrix form as follows:  
\[\mathbf{y}(\mathbf{k+1})=\phi(\mathbf{W}\mathbf{x}(\mathbf{k})+\mathbf{b}) \tag{5}\]where \(\mathbf{y}(\mathbf{k}+\mathbf{1})\) is the output vector \(\{y_{1}(k+1),\ldots,y_{s}(k+1)\}\), \(\mathbf{W}\) is the weight matrix, \(\mathbf{b}\) is the bias vector, and \(\phi\) is typically a nonlinear activation function applied element-wise (e.g., sigmoid, tanh, ReLU). A pseudo-code for the identification of the NARX\(-\)NN model is presented in Algorithm 1.