# Optimizing CNN-LSTM for the Localization of False Data Injection Attacks in Power Systems
## 2 Power System State Estimation and False Data Injection Attack  
### State Estimation and Bad Data Detection  
State estimation plays a crucial role in power systems. The supervisory control and data acquisition (SCADA) system collects measurement data from the field equipment and utilizes it as input for the state estimator, which determines the actual state of the power systems based on these measurements [22]. Through the accurate estimation of the state estimator, operators can monitor the power system's real-time operation, including key indicators such as voltage, current, and power. These estimates enable operators to identify potential issues and failures, allowing them to promptly implement adjustments and repairs to maintain the power system's stability. Furthermore, state estimation provides reliable data necessary for other applications and systems, facilitating operational strategy optimization and decision-making support. In modern power systems, the adoption of the state estimation technology has become essential for ensuring power supply security and economic operation. An accurate state estimation enhances the operational efficiency of power systems, reduces energy consumption, and supports the integration of renewable energy sources. This paper focuses on state estimation in direct-current (DC) power systems, which offer higher reliability and simpler control compared to alternating-current (AC) grids.  
In the DC model, the relationship between measured values and state variables can be approximately expressed as \(\mathrm{z}=\mathrm{Hx}+\mathrm{e}\), where \(\mathrm{z}=(\mathrm{z}_{1},\mathrm{z}_{2},\ldots,\mathrm{z}_{n})^{\mathrm{T}}\) represents the n-dimensional measured value, \(\mathrm{x}=(\mathrm{x}_{1},\mathrm{x}_{2},\ldots,\mathrm{x}_{n})^{\mathrm{T}}\) represents the m-dimensional state variable, and \(\mathrm{e}=(\mathrm{e}_{1},\mathrm{e}_{2},\ldots,\mathrm{e}_{n})^{\mathrm{T}}\) and \(\mathrm{H}\) represent the measurement noise and Jacobian matrix respectively.  
On this basis, the objective function F(x) for state estimation using linear weighted least squares is obtained:  
\[\mathrm{minF(x)}=(\mathrm{z}-\mathrm{H}\mathrm{x})^{\mathrm{T}}\mathrm{R}^{-1} (\mathrm{z}-\mathrm{H}\mathrm{x}) \tag{1}\]  
where \(\mathrm{R}\) is the error covariance matrix of the measurements.  
By using the weighted least squares method to solve the minimization of the objective function (1), the system state estimate \(\hat{\mathrm{x}}\) is obtained:  
\[\hat{\mathrm{x}}=(\mathrm{H}^{\mathrm{T}}\mathrm{R}^{-1}\mathrm{H})^{-1} \mathrm{H}^{\mathrm{T}}\mathrm{R}^{-1}\mathrm{z} \tag{2}\]  
To ensure the reliability of the state estimation results in power systems, there exists a Bad Data Detection (BDD) mechanism. BDD involves substituting the optimal solution of the state estimation into the measurement model and then calculating the residual between the actual measurement vector and the estimated value, denoted as \(\mathrm{r}=\left\|\mathrm{z}-\mathrm{H}\mathrm{x}\right\|_{2}\). If the residual \(\mathrm{r}\) is less than or equal to the threshold \(\mathrm{\tau}\), there are no bad data in the measurement data. Conversely, if the residual \(\mathrm{r}\) exceeds the threshold, bad data are present in the measurement data.