## 4 Proposed Hybrid Model of NLMPC and Data-Driven Approach
### Implementation  
The combined NMPC with a data-driven approach can be implemented as follows:  
* Prediction Horizon (\(N\)): an appropriate horizon length \(N\) is chosen based on the dynamics of the system. * Sampling Time (\(T_{s}\)): the sampling time \(T_{s}\) is determined based on the system's fastest dynamics. * Data-Driven Model Training: The model \(\hat{\epsilon}_{i}(\boldsymbol{x}_{i},\boldsymbol{u}_{i})\) is trained using historical and real-time data. The proposed approach offers enhanced predictive accuracy and adaptability, making it suitable for complex, nonlinear power systems where traditional modeling may fall short. The following Algorithm 1 outlines the procedural stages of the proposed hybrid data-driven and Nonlinear Model Predictive Control (NLMPC) approach for controlling a multimachine system. Each step is designed to systematically implement the method, ensuring effective and optimized control performance across the system. ``` Start
1. Initialization Phase: \(\bullet\) Initialize system parameters and state-space model \(\bullet\) Initialize control input constraints, state constraints, and output constraints \(\bullet\) Initialize data-driven model (e.g., neural network) with initial training data \(\bullet\) Set prediction horizon N and sampling time \(T_{s}\) \(\bullet\) Set weighting factors \(\alpha_{C},\ \alpha_{V},\ \alpha_{V},\alpha_{f},\ \alpha_{f}\) for the objective function 2. For \(t=1:\ T_{s}\): \(t\) simulation: 2.1. Measurement and Data Acquisition: \(\bullet\) Measure current state vector \(\mathbf{x}_{i}(t)\) for each generator \(i\) \(\bullet\) Measure current control inputs \(\mathbf{u}_{i}(t)\) and outputs \(y_{i}(t)\) 2.2. Update Data-Driven Model (Learning Phase) If sufficient new data are available THEN  Update data-driven model \(\varepsilon_{i}(\mathbf{x}_{i},\mathbf{u}_{i})\) using latest data Endif 2.3. Predict Future States (Prediction Phase) FOR \(k=0\) to N\(-1\) DO \(\bullet\) Predict future states using the combined model \(\mathbf{x}_{i}(t+k+1)=f_{i}(\mathbf{x}_{i}(t+k),\mathbf{u}_{i}(t+k))+\varepsilon_{i}(\mathbf{x }_{i}(t+k),\mathbf{u}_{i}(t+k))\) \(\bullet\) Predict future outputs \(\mathbf{y}_{i}(t+k)=g_{i}(\mathbf{x}_{i}(t+k),\mathbf{u}_{i}(t+k))\) ENDFOR
2.4. Optimize Control Inputs (Control Phase) \(\bullet\) Solve the optimization problem: \(\underset{\mathbf{u}(t+k),\ldots,\mathbf{u}(t+k+N-1)}{min}\) \(\underset{\mathbf{u}(t+k),\ldots,\mathbf{u}(t+k+N-1)}{



simulations and analyses presented in this paper were conducted using MATLAB/Simulink 2023a. The IEEE 11-bus (two-area Kundur test system) and IEEE 9-bus test networks were used in the study to carry out this investigation. ### IEEE 9-Bus Test System

The IEEE 9-bus system, which consists of nine transmission lines and three generators, is illustrated in Figure 2 and described in full in reference [40]. Using Generator 1\({}^{\prime}\)s rotor angle as the study's reference angle throughout, the simulation is run at a time step of 0.0001 s.

In this study, the first disturbance scenario involves a deliberate fault causing a line outage between bus 6 and bus 9 at 20 s. This scenario is used to evaluate and compare various technical and economic parameters of the system, such as generation costs, turbine temperature, and voltage and frequency deviations. The performance of the proposed approach is benchmarked against other methods, including standard MPC and Adaptive MPC, with a focus on ensuring accuracy and speed. Figures 3 and 4 illustrate the system's generation costs and the turbine temperature of the synchronous generator at the slack bus, both before and after the disturbance. As shown in Figure 2, the proposed hybrid method, which combines NLMPC with a data-driven approach for centralized automatic generation control, achieves the lowest generation costs in both the pre- and post-disturbance periods. In contrast, other methods result in higher operational costs.