## 2 Methods
### Box Plot Anomaly Detection Mechanism  
The box plot is a statistical tool used to visualize the distribution of data and to identify potential outliers [25]. As shown in Figure 1, the upper and lower boundaries of the box represent the quartiles of the data, while the line within the box indicates the median. The \"whiskers\" extending from the box typically reach 1.5 times the interquartile range (IQR). Any data points outside this range are considered outliers. Given a dataset \(\{x_{1},x_{2},\ldots,x_{n}\}\), assumed to be arranged in ascending order, the first step is to calculate the 25 th percentile, also known as the lower quartile (or first quartile):  
\[Q1=\left\{ \begin{array}{ll}x_{\frac{n+1}{4}},&\text{$n$ is an odd number;}\\ \frac{x_{\frac{n}{4}}+x_{\frac{n}{4}+1}}{2},&\text{$n$ is an even number.} \end{array} \right. \tag{2}\]  
Next, calculate the 75 th percentile, also known as the upper quartile (or third quartile):  
\[Q3=\left\{ \begin{array}{ll}x_{\frac{3(n+1)}{4}},&\text{$\frac{3(n+1)}{4}$ is an integer;}\\ x_{\lfloor\frac{3(n+1)}{4}\rfloor}+\left(\frac{3(n+1)}{4}-\lfloor\frac{3(n+1)}{4 }\rfloor\right)\times(x_{\lceil\frac{3(n+1)}{4}\rceil}-x_{\lfloor\frac{3(n+1)} {4}\rfloor}),&\text{other}\end{array} \right. \tag{3}\]  
Here, \(\lfloor\cdot\rfloor\) and \(\lceil\cdot\rceil\) represent the floor and ceiling functions, respectively. Finally, calculate the IQR, which is the difference between the upper and lower quartiles and is used to measure the spread of the distribution of the data:  
\[\text{IQR}=Q3-Q1. \tag{4}\]  
Based on \(Q_{1}\), \(Q_{3}\), and the IQR, set the lower limit as \((Q1-1.5\times\text{IQR})\) and the upper limit as \((Q3+1.5\times\text{IQR})\). Values outside these two limits are typically considered outliers--that is, when  
\[x<Q1-1.5\times\text{IQR}\quad\text{or}\quad x>Q3+1.5\times\text{IQR} \tag{5}\]  
\(x\) is considered an outlier. The anomaly detection of energy consumption using the box plot mechanism can be divided into the following two steps:  
Step 1: Use the box plot mechanism to detect whether the total energy consumption \(Y\) is anomalous. Step 2: If \(Y\) is detected as anomalous, apply the box plot mechanism to detect anomalies in gas consumption \(y_{1}\), electricity consumption \(y_{2}\), and other energy consumption \(y_{3}\) in order to determine which part of the energy consumption is abnormal. The detection mechanism described above is summarized in Algorithm 1. The algorithm inputs are the total energy consumption per ton of steel \(Y\), as well as gas consumption \(y_{1}\), electricity consumption \(y_{2}\), and other energy consumption \(y_{3}\) for each batch. The output is the anomalous batches' total energy consumption per ton of steel and their corresponding energy sub-consumptions. In the algorithm, the subscript added to Q1 to form \(Q1_{Y}\) indicates that Q1 is calculated for the \(Y\) data, with similar notation for Q3 and IQR. Figure 1: Box plot anomaly detection mechanism. ```
Input: The total energy consumption per ton of steel \(Y\) and the sub-consumptions \(y_{1}\), \(y_{2}\), and \(y_{3}\) calculated for each batch; Output: Anomalous total energy consumption per ton of steel \(Y\) and its corresponding sub-consumptions \(y_{i}\); forThe total energy consumption per ton of steel \(Y\) for each batchdo if\(Y>\text{Q}3_{Y}+1.5\text{IQR}_{Y}\) or \(Y<\text{Q}1_{Y}-1.5\text{IQR}_{Y}\)then  The total energy consumption per ton of steel \(Y\) for this batch is anomalous; forThe sub-consumptions \(y_{1},y_{2},y_{3}\) for this batchdo if\(y_{i}>\text{Q}3_{y_{i}}+1.5\text{IQR}_{y_{i}}\) or \(y_{i}<\text{Q}1_{y_{i}}-1.5\text{IQR}_{y_{i}}\)then  The corresponding sub-consumption \(y_{i}\) is anomalous. end if  end for  end for
```  
**Algorithm 1**Abnormal energy consumption detection mechanism for medium and thick plates based on box plot  
According to (5), anomalies are defined as data points that exceed the defined upper or lower limits. Anomalies are detected using a statistical method based on the IQR derived from box plots.