A power system cascading failure scenario generation method based on simulation feedback and direct preference optimization

CN122926985APending Publication Date: 2026-10-16WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610937283.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-26
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0003]受连锁故障强稀有性、强偶然性的特征限制,工程中可获取的实测故障样本极度匮乏,无法为相关研究提供足量可靠的数据支撑

Benefits of technology

[0051] (1) By constructing a diffusion generation model, the high-value chain failure scenario is generated in a targeted manner, avoiding the computation of a large number of worthless scenarios caused by completely random sampling. This significantly saves time and resource costs for time-domain dynamic simulation and breaks through the core bottleneck of low efficiency in traditional Monte Carlo random sampling simulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122926985A_ABST
    Figure CN122926985A_ABST
Patent Text Reader

Abstract

The application provides a power system cascading failure scenario generation method based on simulation feedback and direct preference optimization, and relates to the technical field of power systems, comprising: constructing a mechanism simulation model and performing simulation, screening out effective samples that can trigger cascading failures according to the simulation results to form an original data set; constructing an initial scenario feature vector including operation mode information and initial disturbance information; constructing a diffusion generation model and pre-training; inputting the scenario feature vectors generated by the pre-trained diffusion generation model and the to-be-optimized model into the mechanism simulation model for simulation verification, and adjusting the parameters of the to-be-optimized model according to the verification results by using a direct preference optimization algorithm; inputting standard Gaussian noise into the to-be-optimized model after parameter adjustment, generating a target scenario feature vector through a reverse denoising process, and obtaining a cascading failure scenario after inverse normalization. The cascading failure scenario with high value and high physical fidelity and diversity can be efficiently generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system technology, and in particular to a method for generating power system cascading failure scenarios. It is applicable to power supply systems such as 750 kV and above AC transmission, large-scale power grid security and defense systems, and intelligent dispatching systems. Specifically, it relates to a method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization. Background Technology

[0002] Cascading failures are a core cause of major power system blackouts, seriously threatening national energy security and social stability. The high proportion of renewable energy integrated into the grid significantly exacerbates the uncertainty of power system operation, weakens system inertia and disturbance resilience, and substantially increases the probability of cascading failures, posing a severe challenge to the safe and stable operation of the power system. Therefore, risk assessment, accurate prediction, and proactive prevention of cascading failures have become key research areas for both academia and industry.

[0003] Due to the highly rare and random nature of cascading failures, the number of measured failure samples available in engineering is extremely limited, making it impossible to provide sufficient and reliable data support for related research. Currently, the mechanism analysis, prediction model construction, and blocking strategy design of cascading failures all heavily rely on simulation methods to generate data. However, existing simulation methods suffer from fundamental efficiency bottlenecks: on the one hand, time-domain dynamic simulations involve enormous computational costs; on the other hand, Monte Carlo-based completely random sampling strategies are difficult to target high-value cascading failure scenarios, resulting in a large number of worthless scenarios being sampled and simulated, causing a serious waste of computational resources and time.

[0004] In recent years, deep generative models have provided new ideas for scene generation. Generative adversarial networks and variational autoencoders have been applied in the field of power system scene generation. However, these methods are highly dependent on high-quality training sets and are difficult to adapt to scenarios with scarce cascading failure samples. Although diffusion generative models are less dependent on historical data, traditional noise prediction paradigms have two major drawbacks when dealing with cascading failure scenarios: first, the curse of dimensionality in high-dimensional space, where neural networks with limited capacity struggle to fit the noise distribution across the entire space; second, physical distortion, where generated samples are prone to exceeding numerical limits, and post-processing truncation can destroy the original data distribution characteristics. In addition, purely data-driven generative paradigms cannot guarantee the physical compliance of samples, making it difficult to meet the stringent requirements of power system security analysis. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention proposes a method for generating cascading fault scenarios in power systems based on simulation feedback and direct preference optimization. This method deeply embeds mechanistic simulation into the generative model training process, enabling physical mechanisms to guide data-driven generation throughout the entire process, and efficiently generating high-value cascading fault scenarios that combine physical fidelity and diversity.

[0006] To achieve the above objectives, the specific technical solution of the present invention is as follows:

[0007] In a first aspect, the present invention provides a method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization, comprising:

[0008] Construct a mechanistic simulation model and perform simulation. Based on the simulation results, select effective samples that can trigger cascading failures to form the original dataset.

[0009] Based on the original dataset, an initial scene feature vector is constructed, including operation mode information and initial disturbance information;

[0010] Construct a diffusion generation model, using the initial scene feature vector with added noise and the current diffusion step as input, and the predicted noiseless original scene feature vector as output for pre-training;

[0011] The scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized are respectively input into the mechanistic simulation model for simulation verification. Based on the verification results, the parameters of the model to be optimized are adjusted using the direct preference optimization algorithm.

[0012] Standard Gaussian noise is input into the optimized model after parameter adjustment. The target scene feature vector is generated through the inverse denoising process and then inversely normalized to obtain the cascading failure scenario.

[0013] Furthermore, the construction of the mechanistic simulation model includes:

[0014] Establish the differential algebraic equations of the power system and configure the component parameters and protection parameters, wherein the differential algebraic equations include an algebraic part and a differential part.

[0015] Furthermore, cascading failure simulation is performed in the following manner:

[0016] S1, construct the current fault;

[0017] S2, determine whether the current fault has caused the power system to be disconnected. If so, generate each subsystem and use each subsystem as the current system; otherwise, use the power system as the current system.

[0018] S3, Solve the differential-algebraic equation based on the current system, and determine whether the solution converges; if the solution converges, proceed to S4, otherwise proceed to S7;

[0019] S4, calculate the relay protection logic equation and determine whether there is a protection action; if there is a protection action, update the corresponding component status and the current time, and return to S2; otherwise, execute S5.

[0020] S5, increase the simulation step size and determine the relationship between the current simulation duration and the preset dynamic simulation termination time; if the current simulation duration is greater than the preset dynamic simulation termination time, then execute S6; otherwise, update the current time and return to S3.

[0021] S6, determine whether a cascading failure has occurred in the current simulation; if a cascading failure has occurred, record all information and form a valid sample; otherwise, return to S1;

[0022] S7: Determine if the current simulation step size is greater than the minimum step size; if the current simulation step size is greater than the minimum step size, halve the current step size and return to S3; otherwise, determine that the current system is unstable, cut off all loads and end the simulation of the current system.

[0023] Furthermore, the current fault is constructed as follows:

[0024] Given the total load level of each node in the power system, the optimal power flow is calculated with the goal of minimizing network loss, and the optimal output command of each generator unit is obtained. The injected power of the generator unit is determined based on the optimal output command.

[0025] Based on the injected power and nodal load of the unit, the AC power flow is solved, and the state variables of the differential algebraic equation are initialized.

[0026] Two transmission lines were randomly selected as the current faults, and the fault clearing time was determined by normal distribution sampling.

[0027] Furthermore, the differential algebraic equations are solved in the following manner:

[0028] Update the admittance matrix of the current system and solve the algebraic part;

[0029] Based on the solution results of the algebraic part, the implicit trapezoidal rule is used to solve the differential algebraic equations simultaneously.

[0030] Furthermore, the operating mode information includes the active and reactive power demand of each node in the power system, the output ratio of new energy units, and the generator start-up mode; the initial disturbance information includes the initial fault location, fault type, and fault duration.

[0031] Furthermore, the construction of the diffusion generation model, using the noisy initial scene feature vector and the current diffusion step number as input, and the predicted noiseless original scene feature vector as output, is pre-trained, including:

[0032] Based on the preset total number of diffusion steps, a monotonically increasing noise variance sequence is generated, and the cumulative product parameter is calculated.

[0033] Based on the noise variance sequence and cumulative product parameters, forward diffusion noise addition is performed on the initial scene feature vector to obtain the noise-added initial scene feature vectors under different diffusion steps.

[0034] A diffusion generation model is constructed, and a prediction target and a loss function are set. The prediction target is set as a noiseless original scene feature vector, and the mean squared error is used as the loss function.

[0035] The initial scene feature vectors after adding noise and the corresponding number of diffusion steps under different diffusion steps are used as training samples and input into the diffusion generation model. The batch size and training generation are set, the loss value is calculated based on the loss function, and the model parameters are iteratively updated based on the loss value using the backpropagation algorithm and gradient descent optimizer.

[0036] Further, the step of inputting the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification, and adjusting the parameters of the model to be optimized using the direct preference optimization algorithm based on the verification results, includes:

[0037] Scene feature vectors are generated based on the pre-trained diffusion generation model and the model to be optimized, respectively.

[0038] The generated feature vectors of each scenario are input into the mechanistic simulation model for simulation verification. If the simulation result triggers a chain failure, it is marked as a preferred sample; otherwise, it is marked as a non-preferred sample.

[0039] Based on the preferred samples and the non-preferred samples, the parameters of the model to be optimized are adjusted using the direct preference optimization algorithm;

[0040] Repeat the above process iteratively until the model converges.

[0041] Furthermore, the loss function of the direct preference optimization algorithm is:

[0042]

[0043] in, S represents the loss function; w S represents the set of preference samples; l represents the set of unbiased samples; β represents the temperature coefficient; σ(·) represents the Sigmoid function; Indicates the model to be optimized; This represents the pre-trained diffusion generation model.

[0044] In a first aspect, the present invention provides a power system cascading fault scenario generation system based on simulation feedback and direct preference optimization, comprising:

[0045] The data preparation module is used to build a mechanistic simulation model and perform simulation. Based on the simulation results, it selects valid samples that can trigger cascading failures to form the original dataset.

[0046] The vector construction module is used to construct an initial scene feature vector, including operation mode information and initial perturbation information, based on the original dataset.

[0047] The pre-training module is used to build a diffusion generation model. It takes the initial scene feature vector with added noise and the current diffusion step as input and the predicted noiseless original scene feature vector as output for pre-training.

[0048] The fine-tuning module is used to input the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification, and to adjust the parameters of the model to be optimized using the direct preference optimization algorithm based on the verification results.

[0049] The generation module is used to input standard Gaussian noise into the optimized model after parameter adjustment, generate the target scene feature vector through the reverse denoising process, and obtain the cascading failure scene after inverse normalization.

[0050] Compared with the prior art, the advantages of the present invention are:

[0051] (1) By constructing a diffusion generation model, the high-value chain failure scenario is generated in a targeted manner, avoiding the computation of a large number of worthless scenarios caused by completely random sampling. This significantly saves time and resource costs for time-domain dynamic simulation and breaks through the core bottleneck of low efficiency in traditional Monte Carlo random sampling simulation.

[0052] (2) By using the results of mechanistic simulation as binary preference labels for the direct preference optimization algorithm, the physical operation law of the power system is integrated into the model parameter update process. The model can be optimized without the need to build an additional reward model, ensuring that the generated samples meet the physical constraints of the power system and that the fault event triggering logic and protection settings are completely consistent. This solves the problem of insufficient physical fidelity of the pure data-driven generated model.

[0053] (3) The sample prediction paradigm is adopted to set the prediction target as the noiseless original scene feature vector, which effectively avoids the dimensionality curse and numerical distortion in high-dimensional space. Combined with the normalization of the initial scene feature vector and the closed-loop design of the hard constraint of the output value range of the diffusion generation model, the generated samples have both excellent physical fidelity and scene diversity, providing efficient and reliable sample support for power system cascading fault risk assessment, prediction model training and active blocking strategy design. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 A flowchart illustrating a method for generating cascading fault scenarios in a power system based on simulation feedback and direct preference optimization, as provided in an embodiment of the present invention.

[0056] Figure 2 A flowchart for simulating a conventional cascading failure is provided for an embodiment of the present invention;

[0057] Figure 3 This is a modified IEEE 39-node system topology diagram provided in an embodiment of the present invention.

[0058] Figure 4 The dynamic response curve of the rate of change of frequency (RoCoF) at the fault node during a cascading failure is provided in an embodiment of the present invention; wherein, Figure 4 Figure (a) shows the RoCoF time-domain response of distributed power nodes DG 8, DG 20, and DG 29 after the N-2 fault; Figure 4 Figure (b) shows the RoCoF time-domain response of distributed power nodes DG 4, DG 15, and DG 24 after the N-2 fault;

[0059] Figure 5 The dynamic response curve of the load rate at the faulty line during a cascading fault is provided in an embodiment of the present invention; wherein, Figure 5 Figure (a) shows the load variation of line 10-13; Figure 5 Figure (b) shows the load variation of line 13-14;

[0060] Figure 6 The dynamic response curve of the voltage at the fault node during a cascading fault is provided in an embodiment of the present invention.

[0061] Figure 7 The curve showing the change of the pre-training loss function of the diffusion generation model provided in this embodiment of the invention;

[0062] Figure 8 The accuracy change curve of the diffusion generation model fine-tuning process provided in the embodiments of the present invention;

[0063] Figure 9 The dynamic response curve of the frequency at the fault node during the cascading failure period provided in the embodiments of the present invention;

[0064] Figure 10The dynamic response curve of the frequency at the fault node during the cascading failure period provided in this embodiment of the invention; wherein, Figure 10 Figure (a) shows the dynamic response curve of the load rate of line 2-25; Figure 10 Figure (b) shows the dynamic response curve of the load rate of line 5-6; Figure 10 Figure (c) shows the dynamic response curve of the load rate of line 10-13; Figure 10 Figure (d) shows the dynamic response curve of the load rate of line 13-14;

[0065] Figure 11 The dynamic response curve of the voltage at the fault node during a cascading fault, provided for embodiments of the present invention;

[0066] Figure 12 The dynamic response curve of the rate of frequency change at the fault node during a cascading failure is provided in this embodiment of the invention; wherein, Figure 12 Figure (a) shows the RoCoF time-domain response of distributed power nodes such as DG 4, DG 15, and DG 20 in the generation scenario; Figure 12 Figure (b) shows the RoCoF time-domain response of the DG 8 distributed power node in the generation scenario; Figure 12 Figure (c) shows the RoCoF time-domain response of the DG 24 and DG 29 distributed power nodes in the generation scenario. Detailed Implementation

[0067] To enable those skilled in the art to clearly and completely understand the technical solution of the present invention, the present invention will be further described in detail below with reference to embodiments. Obviously, the embodiments described herein are only for explaining the present invention and are not intended to limit the scope of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0068] To address the problems of dimensionality curse and physical distortion in high-dimensional space in traditional noise prediction paradigms when handling cascading failure scenarios, this invention provides a method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization. First, a hybrid differential-algebraic equation mechanistic dynamic simulation model incorporating new energy and all types of protection logic is constructed to prepare the original dataset for cascading failures. Then, a vectorized representation method for the initial cascading failure scenarios is defined, equivalently transforming the high-dimensional scenario generation problem into a low-dimensional feature vector optimization problem. Further, a diffusion generation model based on a sample prediction paradigm is constructed, embedding hard constraints on the physical domain at the network output to ensure the physical compliance of the generated samples from a structural perspective. A direct preference optimization training framework integrating mechanistic simulation feedback is designed, using simulation discrimination results as binary preference labels to achieve targeted model optimization. Finally, efficient and accurate generation of high-value cascading failure scenarios is achieved. This invention overcomes the core bottlenecks of low efficiency in traditional random sampling simulation and insufficient physical fidelity of pure data-driven generation models. It can improve the accuracy of cascading fault scenario generation to over 90%, and the generated samples have both excellent fidelity and diversity, providing efficient and reliable sample support for power system cascading fault risk assessment, prediction model training, and active blocking strategy design.

[0069] Example 1

[0070] This invention proposes a method for generating cascading fault scenarios in power systems based on simulation feedback and direct preference optimization. (See reference...) Figure 1 ,include:

[0071] S1. Mechanistic dynamic simulation of cascading failures and preparation of the original dataset: Construct a mechanistic simulation model and perform simulation. Based on the simulation results, select effective samples that can trigger cascading failures to form the original dataset.

[0072] In step S1 above, constructing a mechanistic simulation model includes: establishing the differential-algebraic equations of the power system and configuring component parameters and protection parameters. The differential-algebraic equations include an algebraic part describing network power flow constraints and a differential part describing generator rotor motion and control system dynamics. Then, based on... Figure 2 The flowchart shown illustrates repeated simulations of cascading faults in the power system to identify valid samples that can trigger cascading faults, thus forming the original dataset.

[0073] Specifically, cascading failure simulation is performed in the following manner:

[0074] S11. Construct the current fault. Construct the current fault as follows:

[0075] S111. Given the total load level of each node in the power system, calculate the optimal power flow with the goal of minimizing network losses, and obtain the optimal output command for each generator unit. Use the optimal output command to determine the injected power of the generator units. It is worth noting that while randomly giving the total load level of each node, the maximum available output of new energy generator units (or the penetration rate of new energy) can also be randomly given to determine the output ceiling of new energy generator units. When calculating the optimal power flow, distributed generation outputs power according to a fixed proportion of the load size of its node and is not used as a decision variable in the optimal power flow problem.

[0076] S112. Based on the injected power and nodal loads, solve the AC power flow problem, and initialize the state variables (including dynamic variables such as generator rotor angle, speed, and governor output) of the differential-algebraic equations according to the power flow results. Additionally, initialize the current time... Set the simulation step size to 0s. (e.g., set to 0.01s), freely specify the maximum simulation duration. That is, the dynamic simulation termination time.

[0077] S113. Randomly select two transmission lines to be disconnected as the current fault (i.e., Figure 2 The initial fault in the simulation is used to simulate an N-2 fault scenario with a severity higher than the N-1 criterion. Normal distribution sampling is used to determine the fault clearing time. For example, the mean of the normal distribution is 0.15s and the standard deviation is 0.1s.

[0078] S12. Determine whether the current fault has caused the power system to be disconnected, that is, determine whether the system has split into multiple isolated subsystems that have lost electrical connection after the fault. If so, generate each subsystem and its corresponding data (including admittance matrix and operating parameters, etc.), and use each subsystem as the current system to independently execute the complete transient simulation process of steps S13 to S17 until the subsystem reaches the preset number of simulations or is determined to be unstable. After all subsystems have completed the simulation, summarize all the results of this simulation and return to step S11 to start the next simulation; otherwise, use the power system as the current system.

[0079] S13. Solve the differential algebraic equation based on the current system and determine whether the solution is convergent; if the solution is convergent, execute S14, otherwise execute S17.

[0080] In step S13 above, the differential algebraic equations are solved in the following manner: First, the admittance matrix of the current system (i.e., the complex matrix describing the electrical connection relationship and component parameters of each node in the system, used to calculate node voltage and branch power flow) is updated and the algebraic part is solved. When the line is in an open state, the component of the corresponding branch is directly removed from the admittance matrix of the current system. Then, based on the solution results of the algebraic part, the implicit trapezoidal rule is used to solve the differential algebraic equations simultaneously.

[0081] S14. Calculate the relay protection logic equation and determine whether a protection action exists. Specifically, calculate the relay protection logic equation based on the current system operating status (including electrical quantities such as node voltage amplitude, line transmission power, and frequency change rate), update the protection trigger status, and determine whether a protection action exists based on the protection logic. If a protection action exists, update the corresponding component status (such as disconnecting the line, disconnecting the generator, or disconnecting the load) and the current time (update the current time to...). If the current quantity exceeds the corresponding protection setting, the protection will proceed to S12; otherwise, S15 will be executed. The decision rule for the relay protection logic equation is as follows: if any electrical quantity (including but not limited to node frequency, node voltage, and line load rate) exceeds the corresponding protection setting, the protection will be deemed to operate; otherwise, no protection operation will be deemed to occur. Protection parameters must include at least overload protection settings, RoCoF protection settings, underfrequency load shedding settings, and undervoltage load shedding settings.

[0082] S15. If no protection action is performed, it indicates that no new discrete events have occurred in the current time. Increase the simulation step size (for example, the current simulation step size can be doubled). This improves simulation efficiency and compares the current simulation duration (i.e., the current moment) with the preset dynamic simulation termination time. The relationship; if the current simulation duration is longer than the preset dynamic simulation termination time. If the condition is met, then execute S16; otherwise, update the current time (update the current time to...). ), and return to S13;

[0083] S16. Determine whether a cascading failure has occurred in the current simulation, that is, whether a cascading event has occurred in which two or more components successively exit the operation in this simulation; if a cascading failure has occurred, record all information and form a valid sample; otherwise, return to S11.

[0084] S17. Determine the current simulation step size. Is it greater than the minimum step size? If the current simulation step size is greater than the minimum step size, then halve the current step size. If the current system is unstable, the simulation will return to S13; otherwise, the current system will be determined to be unstable, all loads will be disconnected, and the simulation of the current system will end. Furthermore, if the current system is the entire power system, the entire simulation will be terminated; if the current system is a subsystem after disconnection, only the simulation of that subsystem will be terminated, and other subsystems will continue to execute this process independently.

[0085] The simulation is repeated until the preset number of simulations is reached. Based on all the simulation results, the valid samples of cascading faults are selected, and the operating mode information and initial disturbance information are recorded to form the original dataset. The operating mode information includes the active and reactive power demand of each node in the power system, the output ratio of new energy units, and the generator start-up mode; the initial disturbance information includes the initial fault location, fault type, and fault duration.

[0086] Compared to traditional Monte Carlo random sampling methods, this invention constructs a diffusion generation model and performs repeated simulations. It uses N-2 faults as the initial disturbance and initializes the operating state based on optimal power flow, ensuring that the simulation starting point conforms to the actual operating laws of the power grid and has sufficient fault severity. This avoids blind sampling of a large number of invalid and minor fault scenarios, effectively preventing the resource waste problem of traditional random methods. Furthermore, the solution of differential algebraic equations is introduced during the simulation process, making the simulation process follow the physical operating laws of the power system, resulting in a more accurate original dataset. Through repeated simulations, cascading fault scenarios are generated based on a small number of valid samples, significantly reducing invalid simulation calculations, solving the problem of low efficiency in traditional random sampling simulations, and improving data preparation efficiency.

[0087] S2. Based on the original dataset, construct an initial scene feature vector including operation mode information and initial disturbance information: For each sample in the original dataset, extract the core features (including operation mode information and initial disturbance information) to construct the initial scene feature vector, transform the high-dimensional cascading failure scenario generation problem into a low-dimensional feature vector optimization problem, and complete the feature normalization process.

[0088] In step S2 above, core features are extracted to construct the initial scene feature vector, which can be done through the following steps:

[0089] S21. Define the initial scene feature vector S, which is derived from the running mode vector V. op It consists of the disturbance vector D and the operating mode vector V. op The system includes information on the active and reactive power demand of each node in the power system, the output ratio of renewable energy units, and the operating mode of generator units. The disturbance vector D includes initial disturbance information such as the initial fault location, fault type, and fault duration. Discrete variables such as fault location, fault type, and generator unit operating mode are mapped to continuous values ​​using numerical encoding and then incorporated into the vector. Continuous variables such as load size, renewable energy ratio, and fault duration are directly incorporated into the vector using their original values.

[0090] S22. Perform min-max normalization on all continuous variables in the initial scene feature vector S. That is, for each feature dimension, scale it linearly according to the maximum and minimum values ​​in its historical samples and map the values ​​to the interval [0, 1] to eliminate the interference of the difference in scale on the subsequent model training, and make the normalized value range consistent with the output range of the Sigmoid activation function of the output layer of the subsequent diffusion generation model.

[0091] S3. Construction and pre-training of the diffusion generation model.

[0092] Traditional denoising diffusion probability models typically employ a noise prediction paradigm, which involves training a neural network to predict the Gaussian noise added at each step and then gradually denoising to recover the original sample. However, in generating cascading fault scenarios in power systems, the noise prediction paradigm suffers from two drawbacks: First, the noise distribution in the feature vector space of high-dimensional scenarios is extremely complex, making it difficult for neural networks with limited capacity to accurately fit the data, resulting in training difficulties and unstable sample quality. Second, the denoising process in noise prediction is prone to numerical deviations, with generated samples often exceeding physically reasonable ranges. Post-processing truncation further disrupts the original data distribution characteristics, causing physical distortion.

[0093] Therefore, in step S3 above, a diffusion generation model is constructed, with the initial scene feature vector after adding noise and the current diffusion step number as input, and the predicted noiseless original scene feature vector as output. A multilayer perceptron is used as a denoising neural network, and a sigmoid activation function is embedded at the network output as a hard constraint on the physical value range for pre-training.

[0094] Specifically, the process of constructing and pre-training a diffusion generative model can include the following steps:

[0095] S31. Perform the forward diffusion process to progressively add noise to the initial scene feature vector. The forward diffusion process refers to the process of progressively adding Gaussian noise to the original data according to a preset Markov chain until it degenerates into approximately pure noise data. This process provides training samples for inverse denoising learning.

[0096] S311. Based on a preset total number of diffusion steps T (for example, T=500), generate a monotonically increasing noise variance sequence β. t , where t=1,2,...,T, and each β t The value range is limited to the interval (0, 1), and the cumulative product parameter is calculated. Specifically, the intermediate parameter is calculated based on the noise variance sequence, and the corresponding cumulative product parameter is calculated for each step t. It can be represented as:

[0097] (1)

[0098] Then the cumulative product parameter at any step t It can be represented as:

[0099] (2)

[0100] S312. Based on the noise variance sequence and cumulative product parameters, perform forward diffusion noise addition on the initial scene feature vector to obtain the noisy initial scene feature vectors at different diffusion steps. Specifically, for each initial scene feature vector x0 in the original dataset, Gaussian noise is added sequentially from step 1 to step T. The noisy initial scene feature vector x0 at step t is obtained. t The following formula is used to calculate:

[0101] (3)

[0102] In the above formula (3), This represents random Gaussian noise that follows a standard normal distribution N(0,1).

[0103] S313. After completing all T-step noise addition operations, the final pure noise data x is obtained. T The data approximately follows a standard Gaussian distribution.

[0104] S32. Construct a diffusion generation model, set the prediction target and loss function, where the prediction target is set as the noiseless original scene feature vector x0, and the mean squared error is used as the loss function.

[0105] In this embodiment, the diffusion generation model includes a denoising neural network based on the sample prediction paradigm. The sample prediction paradigm (also known as x0 prediction or data prediction) refers to setting the prediction target of the denoising neural network directly as the noise-free original sample, rather than the noise term in the traditional paradigm. A multilayer perceptron is used to construct the denoising neural network, with the network structure consisting of an input layer, a first hidden layer, a second hidden layer, and an output layer. The dimension of the input layer is set to be the same as the dimension of the initial scene feature vector S. The number of neurons in the hidden layers is set (in this embodiment, the number of neurons in both hidden layers is set to 1024). The dimension of the output layer is the same as the dimension of the input layer. ReLU activation functions are used for nonlinear transformations between the input layer and the first hidden layer, and between the first hidden layer and the second hidden layer. By connecting a Sigmoid activation function at the end of the output layer, the continuous values ​​of the network output are forcibly mapped to the interval [0, 1], which is consistent with the normalized value range in step S22. As a result, the network output naturally satisfies the normalized physical value range constraint, and can be directly denormalized to the physical scene without post-processing truncation, thus eliminating physical distortion caused by numerical exceeding the limit from the model structure level.

[0106] S321. Set the prediction target of the denoising neural network to the noiseless original scene feature vector x0;

[0107] S322. Define the input of the network as the initial scene feature vector x after adding noise at step t. t Given the current diffusion step number t, the network output is a prediction value x for the original noise-free scene. θ (x t ,t), where θ are the learnable parameters of the network;

[0108] S323. Selecting the mean squared error as the loss function in the model pre-training stage allows for the calculation of the loss value for each batch of training data during subsequent pre-training processes using the following formula. :

[0109] (4)

[0110] In the above formula (4), Represents the mathematical expectation operation; This represents L2 norm operations.

[0111] S33. The initial scene feature vectors after adding noise and the corresponding number of diffusion steps under different diffusion steps are used as training samples to the diffusion generation model. Set the batch size (i.e., the number of training samples used for each parameter update, set to 64 in this embodiment) and the number of training generations (i.e., the number of rounds to traverse all training samples, set to 50 in this embodiment). Calculate the loss value based on the loss function, and use the backpropagation algorithm and gradient descent optimizer to iteratively update the model parameters based on the loss value, that is, update the learnable parameters θ of the above network.

[0112] Compared to the diffusion generation model of the traditional noise prediction paradigm, this embodiment uses a denoising neural network based on the sample prediction paradigm to construct the diffusion generation model. By directly setting the prediction target as the feature vector of the noiseless original scene, it avoids the fitting problem of complex noise distribution in high-dimensional space, significantly reduces the difficulty of model training, and improves the stability of generated samples.

[0113] S4. Input the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification. Based on the verification results, use the direct preference optimization algorithm to adjust the parameters of the model to be optimized. Specifically, this may include the following steps:

[0114] S41. Generate scene feature vectors based on the pre-trained diffusion generation model and the model to be optimized. Copy the pre-trained diffusion generation model as the model to be optimized; this model will be the target of subsequent optimization, and its parameters can be updated. The pre-trained diffusion generation model serves as the reference model, and its parameters remain fixed and will not be optimized further. Let the reference model and the model to be optimized be π. θ Generate a batch of scene feature vectors respectively.

[0115] S42. Input the generated feature vectors of each scenario into the mechanistic simulation model for simulation verification. If the simulation result triggers a chain failure, it is marked as a preferred sample; otherwise, it is marked as a non-preferred sample.

[0116] S43. Based on preferred and unpreferred samples, the Direct Preference Optimization (DPO) algorithm is used to adjust the parameters of the model to be optimized. The DPO algorithm constructs a loss function based on the Bradley-Terry model. The expression of the loss function is shown in Equation (5) below. The difference in the log probability ratio of the generated samples between the reference model and the model to be optimized is used as the optimization objective. By maximizing the generation probability of preferred samples relative to unpreferred samples, the model is optimized in a targeted manner.

[0117] The loss function of the direct preference optimization algorithm is:

[0118] (5)

[0119] In the above formula (5), S represents the loss function; w S represents the set of preference samples; l represents the set of unbiased samples; β represents the temperature coefficient, which can be set to 0.5 for example; σ(·) represents the Sigmoid function; Indicates the model to be optimized; This represents the pre-trained diffusion generation model.

[0120] S44. Iterate through steps S41-S43 until the model converges. Here, the convergence criterion is: if the accuracy change is less than a preset threshold in multiple consecutive training rounds, the model's generation accuracy is considered to be stable.

[0121] S5. Generation and Validation of High-Value Chain Fault Scenarios: Standard Gaussian noise is input into the optimized model after parameter adjustment. The target scenario feature vector is generated through the inverse denoising process. After inverse normalization, the chain fault scenario is obtained. The chain fault scenario can be directly used for simulation, and the effectiveness of the generated sample is verified through mechanistic simulation.

[0122] Compared to traditional reinforcement learning fine-tuning methods based on reward models and PPO, this embodiment uses the direct preference optimization algorithm to adjust the parameters of the model to be optimized without the need to build an additional reward model. It directly uses the mechanistic simulation results as binary preference labels (i.e., preferred samples and non-preferred samples), avoiding the fitting error of the reward model to the physical laws of complex power systems and significantly reducing training complexity and resource consumption. Furthermore, the mechanistic simulation is embedded into the training process of the model to be optimized, and the physical operating laws reflected by the mechanistic simulation directly guide the adjustment of model parameters. This ensures that the cascading fault scenarios obtained from the optimized model after parameter adjustment can conform to the physical constraints of the power system, effectively solving the problem of insufficient physical fidelity of purely data-driven generated models.

[0123] For example, to verify the effectiveness of the present invention, simulation verification was performed on the modified IEEE 39-node system. The capacity of the synchronous generator at node 34 in the original system was replaced with a centralized photovoltaic power plant, and the capacity of the synchronous generators at nodes 36 and 37 was replaced with a centralized wind farm. Distributed photovoltaic power, corresponding to 10% of the load level of each node, was connected at nodes 4, 8, 15, 20, 24, and 29. In the modified system, the installed capacity of new energy sources accounted for 27.45%, and the capacity of distributed power sources was approximately 10% of the load capacity. The system topology and the locations of new energy connections are as follows. Figure 3 As shown, Figure 3 The modified IEEE 39-node system topology is shown, including the node types (synchronous generators, renewable energy plants, load nodes) and critical line connections.

[0124] 1) Dataset Preparation

[0125] Following the method described in step S1, Python was used as the simulation platform to establish a mechanistic dynamic simulation model. Considering that actual power grids generally meet the N-1 safety criterion, a single component failure is unlikely to trigger a cascading failure; therefore, the N-2 failure scenario was set as the initial disturbance. Tens of thousands of cascading failure simulations were performed according to the procedures described in steps S11-S17, and 1000 valid samples that could trigger cascading failures were selected to form the original dataset. The failure chains of typical cascading failure samples are shown in Table 1 below. Table 1 shows the timing and triggering logic of each protection action during the cascading failure.

[0126] Table 1 Examples of cascading failure samples obtained based on dynamic simulation

[0127]

[0128] The dynamic response process of system electrical quantities related to the fault chain is as follows: Figure 4-6 shown. Specifically, Figure 4The dynamic response curve of the rate of change of frequency (RoCoF) at the fault node during a cascading failure is shown, where, Figure 4 Figure (a) shows the RoCoF time-domain response of distributed power nodes DG 8, DG 20, and DG 29 after the N-2 fault. Figure 4 Figure (b) shows the RoCoF time-domain response of distributed power nodes DG 4, DG 15, and DG 24 after the N-2 fault. Figure 4 Figure (a) and Figure 4 As shown in Figure (b), after the fault occurred, each node experienced a severe negative impact on RoCoF, exceeding the RoCoF protection setting (red dashed line). After a 0.5s delay, the distributed power supply protections activated in succession, causing the distributed power supply to be cascaded and disconnected. This reflects the dynamic process of rapid frequency drop and protection cascading triggering during the cascading fault.

[0129] Figure 5 The dynamic response curves of the load rate at the faulted line during a cascading fault are shown, representing the time-domain load rate response of different faulted lines after the N-2 fault. Figure 5 Figure (a) shows the load variation of line 10-13. Figure 5 Figure (b) shows the load change of lines 13-14. After the fault, the load rate of both lines rose rapidly and exceeded the overload protection setting (red dashed line). After a 5-second delay, the overload protection of the lines was activated and the lines were disconnected. This reflects the cascading propagation process caused by the line power exceeding the limit and the protection delay during the cascading fault.

[0130] Figure 6 The dynamic response curve of the voltage at the fault node during a cascading fault is shown, specifically the time-domain voltage response of the fault node after the N-2 fault. Figure 6 As can be seen, the node voltage drops rapidly after the fault occurs, then rises briefly. When the voltage is lower than the low-voltage load shedding protection setting (red dashed line) and remains below it for 0.2 seconds, the low-voltage load shedding protection activates, and the load is disconnected. This reflects the dynamic process of voltage instability and low-voltage load shedding protection triggering during the cascading fault, leading to the cascading disconnection of the load.

[0131] 2) Model training and comparative validation

[0132] The initial scene feature vector is constructed according to the method described in step S2. Then, according to the method described in step S3, a diffusion generation model based on the sample prediction paradigm is constructed and forward diffusion noise addition and inverse denoising pre-training are performed. The diffusion generation model converges after 50 pre-training iterations, and the loss value tends to stabilize. Figure 7The diagram shows the change in the loss function with training epochs during the pre-training of the diffusion generative model. The red curve represents the mean loss after 20 repeated experiments, and the gray shaded area represents the fluctuation range of the loss value. The pre-training loss decreases rapidly in the initial stage, stabilizes after about 10 epochs, and converges to a stable value after 50 epochs, indicating that the model has initially learned the distribution characteristics of cascading failure scenarios. It can be seen that the loss value stabilizes after about 50 epochs, indicating that the model has initially learned the distribution characteristics of cascading failure scenarios.

[0133] We directly used the pre-trained model to generate 200 samples for simulation verification. The average number of correct samples in 20 repeated experiments was 150.5, with an average accuracy of approximately 75%. However, the sample variance was large (236.68), indicating insufficient model stability. Table 2 below shows the number of correct samples in 20 repeated experiments, demonstrating that the accuracy generated by the pre-trained model fluctuates significantly and lacks stability.

[0134] Table 2. Number of correct samples in the scene samples generated by the model after pre-training.

[0135]

[0136] Following the method described in step S4, the model is fine-tuned using the direct preference optimization method that integrates simulation feedback, with the temperature coefficient β set to 0.5, and the model is trained 70 times. Figure 8 The curves showing the change in generation accuracy with training epochs during the fine-tuning of the diffusion generation model are illustrated. The red curve represents the mean accuracy of 20 repeated experiments, while the gray shaded area represents the fluctuation range of accuracy. Initially, the accuracy was approximately 75%, gradually increasing with each training epoch, converging to approximately 94% by the 70th epoch. The sample variance decreased to 513.6, and the coefficient of variation decreased from 10.2% to 2.41%. This indicates that the direct preference optimization algorithm incorporating simulation feedback effectively improved the directional generation capability of high-value chain failure scenarios. It is evident that the accuracy gradually improved with direct preference optimization training and eventually stabilized, significantly enhancing model stability. Table 3 below shows the number of correct samples in the 20 repeated experiments. It can be seen that after fine-tuning, the number of correct samples in each experiment is concentrated around 940, with a significantly reduced fluctuation range.

[0137] Table 3. Number of correct samples in the scene samples generated by the model after fine-tuning

[0138]

[0139] 3) Verification of the physical fidelity of generated samples

[0140] Following the method described in step S5, standard Gaussian noise is input into the fine-tuned diffusion generation model to generate cascading fault scenarios. The generated scenario feature vectors are then denormalized and input into the mechanistic simulation model for validity verification. Scenarios generated by the fine-tuned model are randomly selected for simulation, and the resulting complete fault chains are shown in Table 4. Table 4 shows the cascading fault chains and protection action timings corresponding to the generated samples. The dynamic response process of the system electrical quantities related to the fault chains is as follows: Figure 9-12 As shown, the fault event triggering logic perfectly matches the protection settings, proving that the generated sample has good physical fidelity.

[0141] Specifically, Figure 9 The dynamic response curve of the frequency at the fault node during the generated cascading fault is shown. During the period of 13.62s–13.92s, the frequency of each node successively drops below the low-frequency load shedding protection setting (red dashed line). After a time delay of 0.2s, the low-frequency load shedding protection operates, the load is cut off, and the frequency gradually recovers. This dynamic response process is highly consistent with the frequency variation characteristics of the real cascading fault sample, proving that the generated sample has good physical fidelity.

[0142] Figure 10 The dynamic response curves at the frequency of the fault node during the generated cascading failure are shown. Figure 10 Figure (a) shows the dynamic response curve of the load rate of line 2-25. After the fault, the load rate rose rapidly and exceeded the overload protection setting (110%). After a 5-second delay, it was cleared at 8.08 seconds. Figure 10 (Figure b) Figure 10 Figure (c) in the middle and Figure 10 Figure (d) shows the dynamic response curves of the load rate for lines 5-6, 10-13, and 13-14. The load rate exceeded the limit at 8.55s and was cleared at 13.55s after a 5s delay. It can be seen that the action sequence and delay characteristics of the overload protection of each line in the generated sample are consistent with the real cascading fault sample, proving that the generated scenario has good physical fidelity.

[0143] Figure 11 The dynamic response curves of the voltage at the fault node during the generated cascading fault are shown. The voltage time-domain response of multiple load nodes (nodes 3, 4, 7, 8, 12, and 31) in the generated scenario is shown. During the period of 13.82s–14.07s, the voltage of each node successively drops below the low-voltage load shedding protection setting (red dashed line), and the low-voltage load shedding protection operates successively, and the load is disconnected. This dynamic response process is highly consistent with the voltage instability characteristics of the real cascading fault sample, proving that the generated sample has good physical fidelity.

[0144] Figure 12 The dynamic response curve of the rate of frequency change at the fault node during the generated cascading failure is shown. Figure 12 Figure (a) shows the time-domain response of RoCoF for distributed power nodes such as DG 4, DG 15, and DG 20 in the generated scenario. After the fault, RoCoF has a negative impact and exceeds the protection setting. After a delay, the distributed power protection is activated, corresponding to the RoCoF protection activation at nodes 4, 15, and 20 in Table 4 (1.16s). Figure 12 Figure (b) shows the time-domain response of the DG 8 distributed power node to the RoCoF in the generation scenario. The protection action is triggered after the RoCoF exceeds the protection setting, which corresponds to the RoCoF protection action of the distributed power source at node 8 in Table 4 (1.18s). Figure 12 Figure (c) shows the RoCoF time-domain response of distributed power nodes DG 24 and DG 29 in the generation scenario. During the subsequent chain propagation process, RoCoF deteriorated again and triggered protection, corresponding to the RoCoF protection action of distributed power at nodes 24 and 29 in Table 4 (8.58s).

[0145] The above Figures 9-12 and Figures 4-6 The dynamic response characteristics of the generated samples are highly consistent with those of the real samples, and the fault event triggering logic is completely consistent with the protection settings, proving that the generated samples have good physical fidelity.

[0146] Table 4. Examples of cascading failure scenarios generated by the diffusion generation model.

[0147]

[0148] This invention proposes a method for generating cascading fault scenarios in power systems based on simulation feedback and direct preference optimization. By deeply embedding mechanistic simulation into the generative model training process, it achieves full guidance of data-driven generation by physical mechanisms. Compared with existing technologies, this method has the following advantages:

[0149] First, this invention employs a sample prediction diffusion architecture to replace the traditional noise prediction paradigm, effectively avoiding the curse of dimensionality and physical distortion problems in high-dimensional spaces, and ensuring the physical compliance of generated samples from a structural perspective. Traditional noise prediction paradigms require neural networks to fit complex noise distributions in high-dimensional spaces. Networks with limited capacity struggle to achieve this, and the denoising process is prone to numerical deviations exceeding limits; post-processing truncation further disrupts the original data distribution characteristics. This invention directly sets the prediction target of the denoising neural network as the noise-free original scene feature vector, avoiding the difficulty of fitting complex noise distributions and significantly reducing training difficulty. Simultaneously, with the output layer's Sigmoid hard constraint, the network output is forced to map to a numerical range consistent with the normalized data, allowing direct denormalization to the physical scene without post-processing truncation, thus eliminating physical distortion caused by numerical deviations exceeding limits at the model structure level.

[0150] Furthermore, this invention constructs a training framework that deeply integrates mechanistic simulation and diffusion-generative models, using time-domain dynamic simulation results as model preference feedback to compensate for the lack of physical meaning in purely data-driven models. Purely data-driven generative paradigms cannot guarantee that samples conform to the physical operating laws of power systems, making it difficult to meet the stringent requirements of security analysis. This invention deeply embeds mechanistic simulation into the generative model training process, using the power system dynamic simulation discrimination results as binary preference labels. This allows physical operating laws (including power flow constraints, protection action logic, and cascading fault propagation mechanisms) to directly guide the direction of model parameter updates, ensuring that the fault event triggering logic of the generated samples completely matches the protection settings. This achieves full-process guidance of data-driven generation by physical mechanisms.

[0151] Finally, this invention introduces a direct preference optimization algorithm to achieve targeted model optimization. Based on the binary preference labels obtained from simulation, parameter fine-tuning is completed without the need to construct an additional reward model, significantly improving the generation efficiency and accuracy of cascading failure scenarios. Compared to the complex process in traditional RLHF, which requires constructing an additional reward model and performing multiple rounds of interactive training using algorithms such as PPO, the direct preference optimization algorithm of this invention can achieve policy optimization through a single round of gradient updates, significantly reducing training complexity and resource consumption. Experimental results show that the model generation accuracy can be improved from approximately 75% in the pre-training stage to over 90% after fine-tuning, while the coefficient of variation decreases from 10.2% to 2.41%, effectively maintaining sample diversity while improving targeted generation capabilities.

[0152] In summary, this invention overcomes the core bottlenecks of low efficiency in traditional random sampling simulations and insufficient physical fidelity in purely data-driven generative models. On the one hand, it achieves targeted generation of high-value cascading failure scenarios through generative models, solving the problem of traditional Monte Carlo random sampling failing to hit effective scenarios and causing serious waste of computational resources. On the other hand, it integrates mechanistic simulation feedback into the model training process, ensuring that the generated samples conform to the physical operating laws of the power system. The generated samples possess both excellent fidelity and diversity, providing efficient and reliable sample support for power system cascading failure risk assessment, prediction model training, and active blocking strategy design.

[0153] Example 2

[0154] Based on the same inventive concept, this invention proposes a power system cascading fault scenario generation system based on simulation feedback and direct preference optimization, comprising:

[0155] The data preparation module is used to build a mechanistic simulation model and perform simulation. Based on the simulation results, it selects valid samples that can trigger cascading failures to form the original dataset.

[0156] The vector construction module is used to construct an initial scene feature vector based on the original dataset, including information on the operating mode and initial perturbation.

[0157] The pre-training module is used to build a diffusion generation model. It takes the initial scene feature vector with added noise and the current diffusion step as input and the predicted noiseless original scene feature vector as output for pre-training.

[0158] The fine-tuning module is used to input the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification. Based on the verification results, the direct preference optimization algorithm is used to adjust the parameters of the model to be optimized.

[0159] The generation module is used to input standard Gaussian noise into the optimized model after parameter adjustment, generate the target scene feature vector through the reverse denoising process, and obtain the cascading failure scene after inverse normalization.

[0160] The power system cascading fault scenario generation system based on simulation feedback and direct preference optimization provided in this embodiment of the invention has a similar implementation principle and technical effect to that of Embodiment 1, and will not be repeated here.

[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating cascading failure scenarios in power systems based on simulation feedback and direct preference optimization, characterized in that, include: Construct a mechanistic simulation model and perform simulation. Based on the simulation results, select effective samples that can trigger cascading failures to form the original dataset. Based on the original dataset, an initial scene feature vector is constructed, including operation mode information and initial disturbance information; Construct a diffusion generation model, using the initial scene feature vector with added noise and the current diffusion step as input, and the predicted noiseless original scene feature vector as output for pre-training; The scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized are respectively input into the mechanistic simulation model for simulation verification. Based on the verification results, the parameters of the model to be optimized are adjusted using the direct preference optimization algorithm. Standard Gaussian noise is input into the optimized model after parameter adjustment. The target scene feature vector is generated through the inverse denoising process and then inversely normalized to obtain the cascading failure scenario.

2. The method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization according to claim 1, characterized in that, The construction of the mechanistic simulation model includes: Establish the differential algebraic equations of the power system and configure the component parameters and protection parameters, wherein the differential algebraic equations include an algebraic part and a differential part.

3. The method for generating power system cascading fault scenarios based on simulation feedback and direct preference optimization according to claim 2, characterized in that, The following method is used to simulate cascading failures: S1, construct the current fault; S2, determine whether the current fault has caused the power system to be disconnected. If so, generate each subsystem and use each subsystem as the current system. Otherwise, the power system described above shall be used as the current system; S3, Solve the differential-algebraic equation based on the current system, and determine whether the solution converges; If the solution converges, execute S4; otherwise, execute S7. S4, calculate the relay protection logic equation and determine whether there is a protection action; if there is a protection action, update the corresponding component status and the current time, and return to S2; otherwise, execute S5. S5, increase the simulation step size and determine the relationship between the current simulation duration and the preset dynamic simulation termination time; If the current simulation duration is longer than the preset dynamic simulation termination time, then execute S6; otherwise, update the current time and return to S3. S6, determine whether a cascading failure has occurred in the current simulation; If a cascading failure occurs, record all information and form a valid sample; otherwise, return to S1. S7, determine whether the current simulation step size is greater than the minimum step size; If the current simulation step size is greater than the minimum step size, then halve the current step size and return to S3; otherwise, determine that the current system is unstable, remove all loads, and end the simulation of the current system.

4. The method for generating power system cascading fault scenarios based on simulation feedback and direct preference optimization according to claim 3, characterized in that, The current fault is constructed in the following manner: Given the total load level of each node in the power system, the optimal power flow is calculated with the goal of minimizing network loss, and the optimal output command of each generator unit is obtained. The injected power of the generator unit is determined based on the optimal output command. Based on the injected power and nodal load of the unit, the AC power flow is solved, and the state variables of the differential algebraic equation are initialized. Two transmission lines were randomly selected as the current faults, and the fault clearing time was determined by normal distribution sampling.

5. The method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization according to claim 4, characterized in that, Solve the differential algebraic equations in the following manner: Update the admittance matrix of the current system and solve the algebraic part; Based on the solution results of the algebraic part, the implicit trapezoidal rule is used to solve the differential algebraic equations simultaneously.

6. The method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization according to claim 1, characterized in that, The operating mode information includes the active and reactive power demand of each node in the power system, the output ratio of new energy units, and the generator start-up mode; the initial disturbance information includes the initial fault location, fault type, and fault duration.

7. The method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization according to claim 1, characterized in that, The construction of the diffusion generation model, using the noisy initial scene feature vector and the current diffusion step number as input, and the predicted noiseless original scene feature vector as output, is pre-trained, including: Based on the preset total number of diffusion steps, a monotonically increasing noise variance sequence is generated, and the cumulative product parameter is calculated. Based on the noise variance sequence and cumulative product parameters, forward diffusion noise addition is performed on the initial scene feature vector to obtain the noise-added initial scene feature vectors under different diffusion steps. A diffusion generation model is constructed, and a prediction target and a loss function are set. The prediction target is set as a noiseless original scene feature vector, and the mean squared error is used as the loss function. The initial scene feature vectors after adding noise and the corresponding number of diffusion steps under different diffusion steps are used as training samples and input into the diffusion generation model. The batch size and training generation are set, the loss value is calculated based on the loss function, and the model parameters are iteratively updated based on the loss value using the backpropagation algorithm and gradient descent optimizer.

8. The method for generating power system cascading failure scenarios based on simulation feedback and direct preference optimization according to claim 1, characterized in that, The step of inputting the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification, and adjusting the parameters of the model to be optimized using the direct preference optimization algorithm based on the verification results, includes: Scene feature vectors are generated based on the pre-trained diffusion generation model and the model to be optimized, respectively. The generated feature vectors of each scenario are input into the mechanistic simulation model for simulation verification. If the simulation result triggers a chain failure, it is marked as a preferred sample; otherwise, it is marked as a non-preferred sample. Based on the preferred samples and the non-preferred samples, the parameters of the model to be optimized are adjusted using the direct preference optimization algorithm; Repeat the above process iteratively until the model converges.

9. The method for generating power system cascading fault scenarios based on simulation feedback and direct preference optimization according to claim 1 or 8, characterized in that, The loss function of the direct preference optimization algorithm is: in, S represents the loss function; w S represents the set of preference samples; l represents the set of unbiased samples; β represents the temperature coefficient; σ(·) represents the Sigmoid function; Indicates the model to be optimized; This represents the pre-trained diffusion generation model.

10. A power system cascading failure scenario generation system based on simulation feedback and direct preference optimization, characterized in that, include: The data preparation module is used to build a mechanistic simulation model and perform simulation. Based on the simulation results, it selects valid samples that can trigger cascading failures to form the original dataset. The vector construction module is used to construct an initial scene feature vector, including operation mode information and initial perturbation information, based on the original dataset. The pre-training module is used to build a diffusion generation model. It takes the initial scene feature vector with added noise and the current diffusion step as input and the predicted noiseless original scene feature vector as output for pre-training. The fine-tuning module is used to input the scene feature vectors generated by the pre-trained diffusion generation model and the model to be optimized into the mechanistic simulation model for simulation verification, and to adjust the parameters of the model to be optimized using the direct preference optimization algorithm based on the verification results. The generation module is used to input standard Gaussian noise into the optimized model after parameter adjustment, generate the target scene feature vector through the reverse denoising process, and obtain the cascading failure scene after inverse normalization.