# Identification of Crude Distillation Unit: A Comparison between Neural Network and Koopman Operator
## 2 Modeling and Methodology
### Koopman Operator Theory
\]  
To learn the Koopman dynamics jointly with the embedding network, we formulate the following loss function \[\mathcal{L}= \mathcal{L}_{pred}+\alpha\mathcal{L}_{lin}+\beta\mathcal{L}_{L1} \tag{18}\]  
where  
\[\mathcal{L}_{pred}= \left\|x_{k+1}-C_{x}\hat{z}_{k+1}\right\|^{2} \tag{19}\] \[\mathcal{L}_{lin}= \left\|z_{k+1}-\hat{z}_{k+1}\right\|^{2}\] (20) \[\mathcal{L}_{L1}= \left\|A\right\|_{1}+\left\|B\right\|_{1} \tag{21}\]  
where \(\left\|.\right\|^{2}\) represents the Mean Squared Error (MSE), averaged over the data points, then over the number of outputs. The term \(\hat{z}\) denotes the estimated lifted state obtained from Equation (15) if a linear model is used, or from Equation (16) if a bilinear model is employed. The loss term \(\mathcal{L}_{pred}\) represents the one-step prediction error in the nonlinear state-space, which ensures the consistency of the Koopman model with the underlying nonlinear system as it progresses over time. \(\mathcal{L}_{lin}\) represents the one-step prediction error in the lifted space. Additionally, \(\mathcal{L}_{L1}\) encourages sparsity in the Koopman dynamical system, facilitating better generalization and reducing overfitting. The coefficients \(\alpha\) and \(\beta\) determine the weighting of \(\mathcal{L}_{lin}\) and \(\mathcal{L}_{L1}\) with respect to \(\mathcal{L}_{pred}\). The algorithm for training Koopman dynamics is summarized as Algorithm 2, where \(\theta_{\theta}\) are the weights of the embedding network \(\vartheta\). ``` Input Dataset \(D=X,U\) Initialize \(A,B,\theta_{\theta}\) for all epochs do for all batches of \(D\)do  lift the state \(z_{k}\leftarrow[x_{k},\vartheta(x_{k})]\)  lift the state \(z_{k+1}\leftarrow[x_{k+1},\vartheta(x_{k+1})]\)  Forward \(z_{k}\) one step in time to obtain the estimated lifted state \(\hat{z}\)  Compute prediction loss Equation (19)  Compute linear loss Equation (20)  Compute the total loss Equation (18)  Update \(A,B,\theta_{\theta}\) by back propagation endfor endfor

Figure 2: Koopman dynamics based on an NN. ## 3 Application to CDU

### Process Description

The crude distillation unit (CDU) is the initial processing unit in a petroleum refinery, responsible for separating crude oil into various distillate streams that serve as essential raw materials for downstream refining processes. This process can be divided into several units based on the level of output, including the pre-flash unit (PFU), atmospheric distillation unit (ADU), vacuum distillation unit (VDU), splitting unit (SPU), stabilizer unit (SBU), and heat exchanger network (HEN). Figure 3 illustrates a basic representation of the ADU used in this work. In the CDU, crude oil is first heated, and water is injected to dissolve salts. The mixture then undergoes electrostatic precipitation in a desalter drum to separate the salts. The crude oil is subsequently routed to the distillation tower's flash zone, where it is heated in a fired heater to vaporize distillate products. Overflash is added to ensure effective reflux streams within the tower. The heated crude oil enters the fractionation tower in the flash zone, where the distillate vapors ascend the tower, countering a colder liquid reflux stream. Distillate products are then removed from selected trays, stream stripped, and sent to storage [45; 46]. ### Data Collection

The data were generated using a simulated CDU unit under a Model Predictive Controller (MPC) within the Aspen DMC Plus software. The data included three control variables (CVs), three manipulated variables (MVs), and one feedforward (FF) variable, as listed in Table 1. The sampling period was set to 1 min, with a time to steady state of 30 min. A prediction horizon of 30 and a control horizon of 10 were used for the MPC. Various experimental conditions were simulated to depict real-life situations, including gain, delay, and time-constant mismatches, tight constraints, nonlinearities, and poor PID tuning. Each run lasted for 1440 samples, equivalent to 1 day. Table 2 describe the settings for each case.