Large language model driven power system full-automatic intelligent simulation method and system

The fully automated intelligent simulation method for power systems driven by a large language model utilizes a generative adversarial framework to optimize system prompts, solving the problem of automating parameter modification in power system simulation and achieving efficient and flexible power system simulation calculations.

CN120430024BActive Publication Date: 2025-12-26HUAZHONG UNIV OF SCI & TECH

Patent Information

Application Number
CN202510484944.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-12-26
Estimated Expiration
2045-04-17

AI Technical Summary

Technical Problem

In existing power system simulation software, parameter modification requires manual operation, resulting in a waste of human and material resources. Furthermore, large language models are inefficient in optimizing prompts in power system simulations and are difficult to adapt to complex power systems.

Method used

A fully automated intelligent simulation method for power systems driven by a large language model is adopted. In the offline optimization stage, a command generator and a prompt word optimizer are built to form a generative adversarial framework to optimize the system prompt words. In the online application stage, user commands are parsed to modify and verify parameters, thereby automating the simulation calculation.

Benefits of technology

It improves the flexibility and accuracy of power system simulation calculations, reduces the cost of optimizing system prompts, adapts to the automatic simulation needs of complex power systems, and enhances the automation level and intelligent interactive experience of simulation calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120430024B_ABST
    Figure CN120430024B_ABST
Patent Text Reader

Abstract

The application discloses a large language model driven full-automatic intelligent simulation method and system of a power system, and belongs to the field of power system simulation calculation. The simulation method comprises an offline optimization stage and an online application stage. In the offline optimization stage, a simulation parameter file of the power system and a modification range of each parameter are acquired, and a training command pool containing executable and non-executable commands is designed. A command generator and a prompt word optimizer are constructed based on a large language model, forming a generative adversarial framework. The optimization of system prompt words is realized based on the framework, and the optimal prompt words are obtained. In the online application stage, after a natural language command is input by a user, the large language model identifies the command and matches the optimal prompt words, and inputs the command to each parameter modifier to adjust the simulation parameters. Whether the parameters are within the allowed range is verified, and if the verification is passed, the simulation software is called to perform power system simulation calculation. The power system simulation automation level and intelligent interaction experience are significantly improved, and the method has strong practical value.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of power system simulation calculation, and more particularly relates to a large language model driven full-automatic intelligent simulation method and system for a power system. BACKGROUND

[0002] Power system simulation calculation is a basic supporting technology for a power system. Through analysis of simulation calculation results, operation characteristics of the power system can be mined, thereby providing guidance for power grid operation state adjustment, power grid planning, and power grid security defense, etc. This provides a vital guarantee for power grid security and stability.

[0003] Most existing power system simulation calculation software is based on a graphical interface, and each parameter modification needs to be performed manually, which results in a large amount of manpower and material resources being wasted in the repetitive parameter modification process.

[0004] In a traditional power system simulation calculation software parameter intelligent modification system, most of them use regular expressions for matching, which leads to two key problems: 1. Few executable commands are covered: for each parameter, a regular expression needs to be written, and the large amount of power system parameters results in only a part of the parameters being covered, which seriously limits the flexibility of user commands. 2. Low command modification accuracy: since regular expressions can only match specific modification logic, most of the commands randomly given by users cannot be correctly matched, which results in most commands being unable to be modified correctly.

[0005] The powerful language understanding and modeling capability of the large language model well compensates for the inflexibility of the regular expression, but when the large language model executes the parameter modification command, the modification result may not meet the experience of the power system. This requires optimization of the system prompt word to improve the performance of the large language model. However, in the traditional case, the system prompt word of the large language model is manually modified. This results in low efficiency of the system prompt word optimization and high labor cost.

[0006] Therefore, in order to solve the above problems, there is an urgent need for a more flexible, accurate and efficient power system simulation calculation and large language model system prompt word automatic optimization framework to adapt to the increasingly complex power system. SUMMARY

[0007] In view of the defects of the related art, the purpose of the present application is to provide a large language model driven full-automatic intelligent simulation method and system for a power system, which aims to solve the problem that the existing method lacks a framework for automatically optimizing prompt words of a large language model in a power simulation system, and is difficult to adapt to the increasingly complex automatic simulation calculation of a power system.

[0008] To achieve the above object, in a first aspect, the application provides a large language model driven full-automatic intelligent simulation method for power systems, including an offline optimization stage and an online application stage.

[0009] The offline optimization stage includes:

[0010] S1, obtain simulation parameter files of a power system and modification ranges of parameters, design a training command pool containing executable commands and non-executable commands, and form correct results corresponding to execution of each command;

[0011] S2, construct a command generator and a prompt word optimizer based on a large language model, and form a generative adversarial framework by combining the command generator and the prompt word optimizer;

[0012] S3, construct system prompt words, the command generator generates training commands based on the training command pool; based on the generative adversarial framework, each parameter of each simulation parameter file is subjected to generative adversarial training according to the training commands; when a training command is executed correctly, a correct modification feedback signal is obtained, and when a training command is executed incorrectly, an incorrect modification feedback signal and an incorrect modification reason are obtained; and the prompt word optimizer is guided to optimize the corresponding system prompt words by the incorrect modification reason, to obtain optimal system prompt words;

[0013] The online application stage includes:

[0014] S1', input a natural language command input by a user into a large language model to obtain corresponding optimal system prompt words, and input the optimal system prompt words into a parameter modifier corresponding to each parameter file of a simulation parameter file, to obtain modification commands corresponding to each parameter file;

[0015] S2', the parameter modifier modifies each parameter of each parameter file based on the modification commands and the optimal system prompt words;

[0016] S3', verify the modified parameter files based on the modification ranges of the parameters, if the verification is passed, call corresponding simulation software to perform power system simulation calculation, if the verification fails, adjust temperature parameters of the parameter modifier, and return to step S2' to modify the parameters again.

[0017] Optionally, S1 specifically includes:

[0018] S101, obtain simulation parameter files of a power system and modification ranges of parameters;

[0019] S102, based on the modification ranges of the parameters, design corresponding executable commands, non-executable error commands and non-executable incorrect modification commands for each parameter respectively, and sort commands in different parameter files according to command complexity;

[0020] The command complexity ranking rule is: for the same parameter, the unexecutable modification error command is higher than the unexecutable reference error command, and the executable command is higher than the unexecutable modification error command; for different parameters, the complexity of the latter parameter is much higher than that of the former parameter according to the position of the parameter in the file.

[0021] Optionally, S2 specifically comprises:

[0022] S201, constructing a command generator based on a large language model, inputting a fixed prompt word Prompt Creator , a command list old command and a model temperature parameter T into the command generator to obtain a command Command with increasing difficulty;

[0023] Command=Creator Prompt Creator ,list old command ,T

[0024] Wherein, Creator is the command generator;

[0025] S202, constructing a prompt word optimizer based on a large language model, inputting a fixed prompt word Prompt Optimizer , a system prompt word Prompt System_old to be optimized, error reasons Reasons and a model temperature parameter T into the prompt word optimizer to obtain a system prompt word Prompt System to be optimized:

[0026] Prompt System =Optimizer Prompt Optimizer ,Prompt System_old ,Reasons,T

[0027] Wherein, Prompt System_old is the prompt word to be optimized, which is composed of parameter file data format, important parameter modification constraint, important parameter modification example and large language model output format; Reasons are the error reasons of command execution obtained by comparing the command execution result with the correct result; Optimizer is the prompt word optimizer; the optimization content is the constraint and example of modifying the important parameters of the system prompt word;

[0028] S203, forming a generative adversarial framework based on a generative adversarial network and the command generator and the prompt word optimizer.

[0029] Optionally, S3 specifically comprises:

[0030] S301, constructing an initial system prompt word based on the parameter meaning of each simulation parameter file, the generator generating a corresponding training command based on the training command pool;

[0031] S302, inputting the training command and the current system prompt word into a large language model for parameter modification test, repeatedly testing a preset number of times under different large language model temperature parameters; and comparing the test results with the correct modification results, recording the parameter modification accuracy and the cause of command execution error;

[0032] S303, determining whether the parameter modification accuracy is greater than a threshold value, if yes, executing S305, if not, executing S304;

[0033] S304, the prompt word optimizer optimizes the system prompt word based on the cause of the command execution error, obtains an optimized system prompt word, and continues to execute S305;

[0034] S305, the generator improves the complexity of the training command, and returns to S302 for the next round of testing until a preset iteration number is reached, and the optimal system prompt word is obtained.

[0035] Optionally, the parameter modifier includes a command recognition module, a parameter modification module and a parameter verification module;

[0036] The command recognition module and the parameter modification module are both constructed by a large language model;

[0037] The command recognition module is used to extract the sub-commands of each parameter file based on the system prompt word corresponding to each parameter file.

[0038] Optionally, S2' specifically includes:

[0039] S201', the parameter modifier determines whether to use a parallel modification mode according to the size of the parameter file and the parameter amount threshold value; if yes, executing S202', if not, executing S203';

[0040] S202', using a parallel modification mode in the parameter modification process; the parallel modification mode includes mode 1 and mode 2, mode 1: different parameter modification modules simultaneously modify different parameter files in parallel; mode 2: the parameter modification module divides the content in the same parameter file into multiple parts according to the number of lines, and modifies different parts in parallel;

[0041] S203', the parameter modifier directly modifies the parameter file.

[0042] Optionally, the simulation software includes PSASP or PSS / E power system simulation software.

[0043] In a second aspect, the present application also provides a large language model driven full-automatic intelligent simulation system for power systems, comprising an offline optimization module and an online application module.

[0044] The offline optimization module comprises:

[0045] A parameter modification command generation unit is configured to obtain simulation parameter files of the power system and modification ranges of parameters, design a training command pool containing executable commands and non-executable commands, and form correct results corresponding to execution of each command.

[0046] An adversarial framework generation unit is configured to construct a command generator and a prompt word optimizer based on a large language model, and form a generative adversarial framework by combining the command generator and the prompt word optimizer.

[0047] A system prompt word optimization unit is configured to construct system prompt words, the command generator generates training commands based on the training command pool, and based on the generative adversarial framework, each simulation parameter file is subjected to generative adversarial training according to the training commands; when the training command is executed correctly, a feedback signal of correct modification is obtained, when the training command is executed incorrectly, a feedback signal of incorrect modification and a reason for incorrect modification are obtained; and the prompt word optimizer is guided to optimize the corresponding system prompt word in a targeted manner through the reason for incorrect modification, to obtain an optimal system prompt word.

[0048] The online application module comprises:

[0049] A command acceptance unit is configured to obtain corresponding optimal system prompt words by identifying user input natural language commands through a large language model, and input the optimal system prompt words into parameter modifiers corresponding to each parameter file in the simulation parameter files, to obtain modification commands corresponding to each parameter file.

[0050] A parameter modification unit is configured to modify parameters of each parameter file based on the modification commands and the optimal system prompt words by the parameter modifiers.

[0051] A verification and simulation unit is configured to verify the modified parameter files based on the modifiable ranges of the parameters, if the verification is passed, corresponding simulation software is called to perform power system simulation calculation, and if the verification fails, temperature parameters of the parameter modifiers are adjusted, and the parameter modification unit is returned to modify the parameters again.

[0052] In a third aspect, the present application also provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program to execute the method provided in any one of the first aspect.

[0053] Compared with the prior art, the above technical solutions conceived by the present application can achieve the following beneficial effects:

[0054] 1. The application provides a large language model driven power system full-automatic intelligent simulation method, which breaks through the limitation of traditional regular expressions based on semantic analysis of a large language model, supports deep analysis of natural language instructions, can disassemble complex commands into sub-commands of different parameter files, covers the diversity of parameter modification scenarios, and significantly improves the flexibility and executable range of user instructions. Using an adversarial training framework, the generator simulates complex user commands for training, and the prompt word optimizer iteratively optimizes the prompt word content based on accuracy feedback, continuously evolving in dynamic confrontation and adapting to the growth of power system parameter scale and the complexity of user demand. The system prompt word intelligent optimization-automation analysis-modification-simulation closed loop of power system simulation calculation can be realized, and intelligent power system simulation calculation can be realized.

[0055] 2. The application provides a large language model driven power system full-automatic intelligent simulation method, when the parameter modifier modifies the parameter file, when the size of the parameter file is greater than the parameter threshold, a parallel architecture is used to perform a parallel modification mode, saving parameter modification time; the technical scheme of the application is only based on system prompt words, without fine-tuning a large language model, which can reduce cost and only needs hundreds of yuan to optimize the entire framework. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 is a framework structure diagram of a large language model driven power system full-automatic intelligent simulation system provided by the application;

[0057] Figure 2 is an offline system prompt word optimization process provided by the embodiment of the application;

[0058] Figure 3 is a parallel scheme of online application provided by the embodiment of the application;

[0059] Figure 4 is a schematic diagram of the generation adversarial framework and process provided by the embodiment of the application;

[0060] Figure 5 is a comparison of the execution accuracy of the large language model command before and after offline optimization provided by the embodiment of the application. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical scheme and advantages of the application clearer, the application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and do not limit the application. In addition, the technical features involved in each embodiment of the application described below can be combined with each other as long as they do not conflict with each other.

[0062] The above-mentioned contents involved in the embodiments will be described below in combination with a preferred embodiment.

[0063] Embodiment one

[0064] As shown in the figure, a large language model driven power system full-automatic intelligent simulation method includes an offline optimization stage and an online application stage. Figure 1

[0065] The offline optimization stage includes:

[0066] S1, obtain the simulation parameter file and the modification range of each parameter of the power system, design a training command pool containing executable commands and non-executable commands, and form the correct results corresponding to the execution of each command;

[0067] S2, construct a command generator and a prompt word optimizer based on a large language model, and form a generative adversarial framework based on the command generator and the prompt word optimizer;

[0068] S3, construct a system prompt word, the command generator generates a training command based on the training command pool; based on the generative adversarial framework, the parameters of each simulation parameter file are trained in a generative adversarial manner according to the training command; when the training command is executed correctly, a correct modification feedback signal is obtained, and when the training command is executed incorrectly, an incorrect modification feedback signal and an incorrect modification reason are obtained; and the prompt word optimizer is guided to optimize the corresponding system prompt word through the incorrect modification reason, and the optimal system prompt word is obtained;

[0069] The online application stage includes:

[0070] S1', the natural language command input by the user is recognized by a large language model to obtain the corresponding optimal system prompt word, which is input into the parameter modifier corresponding to each parameter file in the simulation parameter file, to obtain the modification command corresponding to each parameter file;

[0071] S2', the parameter modifier modifies the parameters of each parameter file based on the modification command and the optimal system prompt word;

[0072] S3', the modified parameter file is verified based on the modifiable range of each parameter, if the verification is passed, the corresponding simulation software is called to perform power system simulation calculation, if the verification fails, the temperature parameter of the parameter modifier is adjusted, and the parameter is modified again in step S2'.

[0073] The embodiment of the application mainly includes an offline optimization stage and an online application stage.

[0074] ​The embodiment of the application adopts a phased architecture design: (1) The offline optimization stage first constructs a command generator and a prompt word optimizer based on a large language model; second, a generative adversarial framework is constructed based on the command generator and the prompt word optimizer; the system prompt word that can guide the large language model to perform correct semantic analysis and command execution is formed by continuously optimizing the system prompt word through the attack and counterattack operation between the frameworks. (2) The online application stage constructs a closed-loop link of semantic analysis-parameter modification-simulation execution; first, the large language model agent parses the natural language command of the user, extracts the modification command from the corresponding parameter modifier through the corresponding optimal system prompt word, so as to disassemble the user language command into modification commands of different parameter files; second, the large language model agent completes the parameter modification work based on the modification command of the different parameter files and the optimized system prompt word, and carries out verification output; finally, the large language model agent calls the corresponding simulation software to perform power system simulation calculation. The flexibility and intelligence of the power system simulation calculation are realized, and the improvement work of the system prompt word is simplified.

[0075] Optionally, S1 specifically comprises:

[0076] S101, acquiring simulation parameter files of a power system and modification ranges of parameters;

[0077] S102, based on the modification range of the parameter, designing a corresponding executable command, an unexecutable reference error command and an unexecutable modification error command for each parameter respectively, and performing command complexity sorting on different commands in the same parameter file;

[0078] The command complexity sorting rule is: for the same parameter, the unexecutable modification error command is higher than the unexecutable reference error command, and the unexecutable modification error command is higher than the executable command; for different parameters, according to the position of the parameter in the file, the complexity of the latter parameter is much higher than that of the former parameter.

[0079] Taking PSASP software as an example, power flow calculation and transient simulation calculation are the main functions of PSASP. In order to perform power flow calculation, the corresponding parameter file of the power flow calculation needs to be modified. Taking the LF.L6 file as an example, a detailed description is made.

[0080] The LF.L6 parameter file is a file related to the power flow load parameter. The file contains multiple lines of generator parameter data, and each line of data is composed of 19 parameters. Part of the parameters has a specific modification range according to the knowledge of the power system. Taking Meth (the valid flag bit of the data line) as an example, the parameter can only be modified to 1 (the data line is valid) or 0 (the data line is invalid).

[0081] The data that may appear in the LF.L6 file is:

[0082] 1, 151, 0, 1, 1.946670, -1.093880, 1.017280, -44.822400, 0.000000, 0.000000, 0.000000, 0.000000, 0, 0, 0, 0.000000, ”, 15, 'Load_1',

[0083] The first parameter represents Meth, and the last parameter represents the load name.

[0084] For this data, the executable command and the non-executable command are designed as follows:

[0085] Executable command: modify the Meth parameter of the load name Load_1 to 0.

[0086] Non-executable reference error command: modify the Meth parameter of the load name Load_10 to 1.

[0087] Non-executable modification error command: modify the Meth parameter of the load name Load_1 to 0.1.

[0088] After executing the related commands, the execution results include:

[0089] The correct modification result corresponding to the executable command is:

[0090] 0, 151, 0, 1, 1.946670, -1.093880, 1.017280, -44.822400, 0.000000, 0.000000, 0.000000, 0.000000, 0, 0, 0, 0.000000, ”, 15, 'Load_1',

[0091] The correct modification result corresponding to the non-executable reference error command and the non-executable modification error command should remain the original value:

[0092] 1, 151, 0, 1, 1.946670, -1.093880, 1.017280, -44.822400, 0.000000, 0.000000, 0.000000, 0.000000, 0, 0, 0, 0.000000, ”, 15, 'Load_1'.

[0093] When designing the corresponding executable command, non-executable reference error command and non-executable modification error command for each parameter respectively, the command complexity of different commands in the same parameter file is sorted to ensure that the command generator can cover all parameters and all error situations.

[0094] Optionally, S2 specifically includes:

[0095] S201, constructing a command generator based on a large language model, inputting a fixed prompt word Prompt to the command generator Creator , a command list old command and a model temperature parameter T, to obtain a command Command with increasing difficulty;

[0096] Command = Creator Prompt Creator , a command list old command , T

[0097] wherein Creator is the command generator;

[0098] S202, constructing a prompt word optimizer based on a large language model, inputting a fixed prompt word Prompt Optimizer , a system prompt word Prompt to be optimized System_old , error reasons Reasons and a model temperature parameter T to obtain a system prompt word Prompt optimized in a specific direction System :

[0099] Prompt System = Optimizer Prompt Optimizer , Prompt System_old , Reasons, T

[0100] wherein Prompt System_old is a system prompt word to be optimized, composed of parameter file data format, important parameter modification constraints, important parameter modification examples and large language model output format; Reasons are error reasons of command execution obtained by comparing command execution results with correct results; Optimizer is the prompt word optimizer; the optimization content is the constraints and examples of modifying important parameters of the system prompt word;

[0101] S203, forming a generative adversarial framework based on a generative adversarial network and the command generator and the prompt word optimizer.

[0102] Still taking the file LF.L6 parameter file related to the load flow parameter as an example, a fixed prompt word of a command generator includes the following contents:

[0103] Role setting is performed by a large language model, which is set as:

[0104] An expert in power system simulation, responsible for handling parameter adjustment commands for power system simulation software (PSASP) load flow calculation

LF.L6 file

[0105] The core capabilities include:

[0106] 1. LF.L6 file data format memory

[0107] LF.L6 file is composed of multiple lines of load-related parameters, each line corresponding to a load parameter.

[0108] The data format of each line of LF.L6 file is as follows:

[0109] Mark, Bs_No, ID_No, Type, Pl, Ql, V0, θ, Qmax, Qmin, Pmax, Pmin, PL, CB, CL, VQP, 'Name_Ctrl', Type_Ctrl, 'IDName',

[0110] 2. LF.L6 file parameter understanding capability

[0111] The meanings of each parameter of LF.L6 file are as follows:

[0112] Field Data format Description

[0113] Mark INT(3) Valid flag (0: invalid, 1: valid)

[0114] 3. LF.L6 file parameter modification boundary

[0115] The modification limits of each parameter of the file are as follows:

[0116] ① Mark (valid flag for given load, INT, note that only [0, 1] is allowed: 0: invalid; 1: valid)

[0117] The tasks to be performed include:

[0118] As an LF.L6 file modification command generator, create LF.L6 modification commands based on 【2. LF.L6 file parameter understanding capability】 and 【3. LF.L6 file parameter modification boundary】.

[0119] Modification command requirements:

[0120] ① Modification command consists of two parts A+B

[0121] ② Part A includes three types of commands: executable commands, commands that exceed the modifiable range of parameters, and modification commands that exceed data references;

[0122] ③ Part B includes four different data reference commands, i.e., four different load data reference methods: bus number reference, load number reference, load name reference, and specific location reference;

[0123] ④ Modification command gives order (from easy to difficult): ① executable command + 4 different data reference ways, ② secondly, the command beyond the parameter modification range + 4 different data reference ways, ③ finally, the modification command beyond the data reference + 4 different data reference ways.

[0124] Input the previously successful command: list old command The command generator generates a modified combined command.

[0125] Similarly, taking the LF.L6 parameter file as an example, a fixed prompt word of a prompt word optimizer includes:

[0126] Through the role setting of a large language model, set it as a prompt word engineer proficient in power system; analyze the error reasons of command execution, improve the original prompt, and return the improved prompt word.

[0127] The data format of each line of content in the original file:

[0128] Mark, Bs_No, ID_No, Type, Pl, Ql, V0, θ, Qmax, Qmin, Pmax, Pmin, PL, CB, CL, VQP, 'Name_Ctrl', Type_Ctrl, 'IDName',

[0129] Original command and error reason: Reasons

[0130] Original prompt word: Prompt System_old

[0131] The optimization principle of the prompt word optimizer:

[0132] ① Analyze the error reasons and the defects of the original prompt, and use the scheme of adding constraints and examples to improve the original prompt;

[0133] ② If the error reason of command execution is that the value domain exceeds the available range, the command should remain unchanged, and no modification should be made (θ parameter is subject to its own constraints);

[0134] ② If the error reason of command execution is that the reference exceeds the existing range, guide the prompt word to ignore the command.

[0135] The tasks to be performed include:

[0136] Step 1: Optimize the content in "4. Modification constraints"

[0137] Step 2: Add the content of "Interactive examples"

[0138] Step 3: Output in the specified format (strictly follow the Json format).

[0139] The output format of the constrained large language model is:

[0140] "new_prompt_modify_constraints":"Optimized 4. Modify the content of the constraints",

[0141] "new_prompt_example":"New examples in the interactive example",

[0142] "reasons":"Reasons for optimization".

[0143] Based on the above embodiment, still taking the LF.L6 parameter file as an example, the system prompt word Prompt System_old to be optimized is obtained through the prompt word optimizer System .

[0144] Optionally, S3 specifically includes:

[0145] S301, based on the parameter meaning of each simulation parameter file, an initial system prompt word is constructed, and the generator generates corresponding training commands based on the training command pool;

[0146] S302, input the training commands and the current system prompt word into the large language model for parameter modification test, repeat the test a preset number of times under different large language model temperature parameters; and compare the test results with the correct modification results, record the parameter modification accuracy and the reasons for command execution errors;

[0147] S303, determine whether the parameter modification accuracy is greater than a threshold value, if yes, execute S305, if not, execute S304;

[0148] S304, the prompt word optimizer optimizes the system prompt word based on the reasons for command execution errors, obtains an optimized system prompt word, and continues to execute S305;

[0149] S305, the generator increases the complexity of the command, and returns to S302 for the next round of testing until a preset iteration number is reached, and the optimal system prompt word is obtained.

[0150] Based on the parameter meaning of each simulation parameter file, an initial system prompt word is constructed, taking the LF.L6 parameter file as an example, the initial system prompt word Prompt System_old is as follows:

[0151] Set the role through the large language model, set it as:

[0152] A power system simulation expert, responsible for processing the parameter adjustment of the power flow calculation of the power system simulation software (PSASP) LF.L6 file. Proficient in IEEE power system standards and able to accurately execute parameter modification requests.

[0153] The core competencies include:

[0154] 1. LF.L6 file data format memory

[0155] The LF.L6 file consists of multiple lines of load-related parameters, with each line corresponding to the parameters of a load.

[0156] The data format of each line in the LF.L6 file is as follows:

[0157] Mark, Bs_No, ID_No, Type, Pl, Ql, V0, θ, Qmax, Qmin, Pmax, Pmin, PL, CB, CL, VQP, 'Name_Ctrl', Type_Ctrl, 'IDName'

[0158] 2. LF.L6 file parameter understanding ability

[0159] The meanings of the parameters in the LF.L6 file are as follows:

[0160] Field Data format Description

[0161] Mark INT(3) Valid flag (0: invalid, 1: valid)

[0162] 3. LF.L6 file parameter identification ability

[0163] The following ten modifiable parameters can be identified:

[0164] ① Mark (valid flag for given load, INT, note that only [0, 1] is allowed: 0: invalid; 1: valid).

[0165] 4. Modification constraints

[0166] Strict value range verification is performed on the Mark and Type parameters;

[0167] Strict unit verification is performed on the Pl, Ql, V0, θ, Qmax, Qmin, Pmax, and Pmin parameters;

[0168] All numerical values must conform to the declared format.

[0169] 5. Request processing flow

[0170] (1) Analyze user command → (2) Modify corresponding parameters → (3) Return modified data in the same format as the original file

[0171] The output format of the large language model is:

[0172] "modified_content":"modified LF.L6 file complete new content",

[0173] "modification_instructions":"modification instructions for LF.L6 file"

[0174] For example, an interactive example is as follows:

[0175] User input: Modify the data line where IDName is Load_1, and modify Mark in this line to 0;

[0176] Original file content of parameter file:

[0177] 1,151,1,1,1.946670,-1.093880,1.017280,-44.822400,0.000000,0.000000,0.000000,0.000000,0,0,0,0.000000,”,15,'Load_1',

[0178] The execution result is:

[0179] 0,151,1,1,1.946670,-1.093880,1.017280,-44.822400,0.000000,0.000000,0.000000,0.000000,0,0,0,0.000000,”,15,'Load_1',

[0180] Prescribed number of iterations to obtain optimal system prompt word, taking LF.L6 parameter file as an example, the optimal system prompt word Prompt System is as follows:

[0181] Set the role through the large language model, which is set to:

[0182] A power system simulation expert, specializing in handling the parameter adjustment of power system simulation software (PSASP) load flow calculation

LF.L6 file

[0183] The core capabilities include:

[0184] 1. LF.L6 file data format memory

[0185] LF.L6 file is composed of multiple lines of load-related parameters, each of which corresponds to a load parameter.

[0186] The data format of each line of LF.L6 file is as follows:

[0187] Mark, Bs No, ID No, Type, Pl, Ql, V0, θ, Qmax, Qmin, Pmax, Pmin, PL, CB, CL, VQP, 'Name Ctrl', Type Ctrl, 'ID Name',

[0188] 2. LF.L6 file parameter understanding ability

[0189] The meanings of parameters of LF.L6 file are as follows:

[0190] Field Data format Description

[0191] Mark INT(3) Validity flag (0: invalid, 1: valid)

[0192] 3. LF.L6 file parameter identification ability

[0193] The following ten modifiable parameters can be identified:

[0194] ① Mark (validity flag of given load, INT, note that only [0, 1] is allowed: 0: invalid; 1: valid)

[0195] 4. Modification constraints

[0196] Parameter modification must strictly follow the five-level verification process:

[0197] ① Parameter value type verification (INT / DOUBLE)→

[0198] ② Unit conversion verification (unit value needs to be converted to p.u.)→

[0199] ③ Parameter value range verification (Mark ∈ [0, 1], Type ∈ {-3, -2, -1, 0, 1})→

[0200] ④ Numerical boundary verification (V0 ∈ [0.700000, 1.300000])→

[0201] ⑤ Inter-parameter logic verification (Type = 0 → θ = 0)

[0202] Exception handling rules:

[0203] ① Pl / Qmax / Pmax negative value: revert to original value + mark [violate non-negative constraint]

[0204] ​​​​​​​​②V0 out of limit: compare to 6 decimal places (1.300000), if out of limit, keep the original value + mark [voltage out of limit]

[0205] ③Type=0 when θ≠0: force θ=0.000000 + mark [logic correction]

[0206] ④Unit conversion error: keep the original value + mark [unit conversion error]

[0207] ⑤Verification process is strictly serial, any link failure will terminate subsequent inspection

[0208] 5. Request processing flow

[0209] (1) parse user command → (2) modify corresponding parameters → (3) return modified data with the same format as the original file

[0210] The output format of the large language model is:

[0211] "modified_content":"modified LF.L6 file complete new content",

[0212] "modification_instructions":"modification instructions of LF.L6 file"

[0213] For example, an example of an added interaction is as follows:

[0214] User input: ① modify the data line where IDName is Load_1, and modify the Mark in this line to 0.5;

[0215] Original file content of parameter file:

[0216] 1,151,1,1,1.946670,-1.093880,1.017280,-44.822400,0.000000,0.000000,0.000000,0.000000,0,0,0,0.000000,”,15,'Load_1',

[0217] Based on the constraints, the modification cannot be made, so the output result is still:

[0218] 1,151,1,1,1.946670,-1.093880,1.017280,-44.822400,0.000000,0.000000,0.000000,0.000000,0,0,0,0.000000,”,15,'Load_1',

[0219] For example Figure 4As shown, the S3 step specifically includes: first, initialization, based on experience, the initial system prompt word of the parameter modifier corresponding to each parameter file, and the fixed prompt word of the prompt optimizer, based on experience and the fixed prompt word of the command generator in the command pool, the command generator generates a parameter modification command. Second, attack operation, the command parameter modifier modifies the parameter file based on the command and the initial system prompt word, and checks the correctness of the modification result after the modification is completed. Then based on the correctness of the check, the operation is carried out. If the check is passed, the command generator is returned a signal to generate a more complex command according to the command difficulty; if the check fails, the prompt optimizer is returned a signal to direct the optimization of the initial system prompt word based on the error reason; then the attack and counterattack operation is performed until all parameters are covered.

[0220] Optionally, S2' specifically includes:

[0221] S201', the parameter modifier determines whether to use a parallel modification mode according to the size of the parameter file and the parameter quantity threshold value; if yes, S202' is executed, and if no, S203' is executed;

[0222] S202', the parallel modification mode is used in the parameter modification process; the parallel modification mode includes mode 1 and mode 2, mode 1: different parameter files correspond to different parameter modifiers, and the different parameter modifiers modify different parameter files in parallel; mode 2: the parameter modifier divides the content in the same parameter file into multiple parts according to the number of lines, and modifies different parts in parallel;

[0223] S203', the parameter modifier directly modifies the parameter file.

[0224] The parameter modifier includes a command recognition module, a parameter modification module and a parameter verification module;

[0225] The command recognition module and the parameter modification module are constructed by a large language model;

[0226] The command recognition module is used to extract the sub-commands of each parameter file based on the system prompt word corresponding to each parameter file.

[0227] The parameter verification module sets a safety threshold range constraint based on power system knowledge for part of the key parameters, that is, the modification range of each parameter in the foregoing. For example, the LF.L6 file is checked whether the Meth parameter is 1 (valid) or 0 (invalid). In addition, the safety threshold range constraint can include voltage amplitude constraint, generator power upper and lower limit constraint, etc.

[0228] The parameter modifier needs to modify the large language model output format in Prompt System to:

[0229] The output format of the large language model is:

[0230] "need_modify":"true / false",

[0231] "modified_command":"when the LF.L6 file needs to be modified, give the modification instruction related to the LF.L6 file; when the LF.L6 file does not need to be modified, return the original modification instruction",

[0232] Among them, for example, the parameter quantity threshold is 10 lines of data, when the data size of the parameter file exceeds 10 lines of data, then the parallel modification mode is carried out.

[0233] Reference Figure 3 As shown in the figure, in mode 1, the LF.L0 and LF.L6 files can be modified simultaneously, and there is no conflict between the two; for example, in mode 2, taking the LF.L6 file as an example, if the LF.L6 file has 30 lines of data, it can be divided into 3 sub-data blocks of 10 lines, and these sub-data blocks can be modified simultaneously based on the modification command.

[0234] Figure 5 The execution pass rate of the system prompt word before and after offline optimization in the LF.L6 file task is compared, and the offline optimization using the present application improves the success probability of the large language model executing the task from 78.33% to 99.17%.

[0235] Optionally, the simulation software includes PSASP or PSS / E power system simulation software.

[0236] The technical scheme of the present application supports the adaptation of mainstream simulation software such as PSASP, PSS / E, etc., for example, in the embodiment of the present application, PSASP power system simulation software is used to construct the framework of the large language model+PSASP. It can significantly improve the automation level and intelligent interaction experience of power system simulation, and has strong practical value

[0237] In the offline optimization stage, the embodiment of the application constructs a command generator and a prompt word optimizer based on a large language model, forms a generative adversarial framework, and performs generative adversarial training on the parameters of each simulation parameter file based on the generative adversarial framework. When the command execution is incorrect, the prompt word optimizer is guided to optimize the corresponding system prompt word by modifying the error cause. In the online application stage, the natural language command input by the user is parsed based on the large language model, the optimal system prompt word is called, the parameters are modified using the parameter modifier, and the power system simulation calculation is performed based on the modified parameters that have passed the verification. The semantic analysis based on the large language model breaks through the limitation of traditional regular expressions and supports deep analysis of natural language instructions. Complex commands can be disassembled into sub-commands of different parameter files. The adversarial training framework is adopted to simulate complex user commands for training. The prompt word optimizer iteratively optimizes the prompt word content based on the accuracy feedback, and continuously evolves in dynamic confrontation to adapt to the growth of the power system parameter scale and the complexity of user demand. The technical problems that the existing methods lack a framework for automatically optimizing the prompt word of the large language model in the power simulation system and are difficult to adapt to the automatic simulation calculation of the increasingly complex power system are solved, and the beneficial effects of significantly improving the power system simulation automation level and intelligent interaction experience are achieved.

[0238] Embodiment two

[0239] The application further provides a large language model driven full-automatic intelligent power system simulation system, comprising an offline optimization module and an online application module.

[0240] The offline optimization module comprises:

[0241] A parameter modification command generation unit is configured to obtain simulation parameter files of a power system and modification ranges of parameters, design a training command pool containing executable commands and non-executable commands, and form correct results corresponding to execution of each command.

[0242] An adversarial framework generation unit is configured to construct a command generator and a prompt word optimizer based on a large language model, and form a generative adversarial framework by combining the command generator and the prompt word optimizer.

[0243] A system prompt word optimization unit is configured to construct system prompt words. The command generator generates training commands based on the training command pool. Based on the generative adversarial framework, the parameters of each simulation parameter file are subjected to generative adversarial training according to the training commands. When the training commands are executed correctly, a modification correct feedback signal is obtained. When the training commands are executed incorrectly, a modification error feedback signal and a modification error cause are obtained. The prompt word optimizer is guided to optimize the corresponding system prompt word based on the modification error cause, and the optimal system prompt word is obtained.

[0244] The online application module comprises:

[0245] The command receiving unit is used for inputting the natural language command input by the user into the parameter modifier corresponding to each parameter file in the simulation parameter file through the large language model recognition to obtain the modification command corresponding to each parameter file.

[0246] The parameter modification unit is used for modifying the parameters of each parameter file based on the modification command and the optimal system prompt word by the parameter modifier.

[0247] The verification and simulation unit is used for verifying the modified parameter file based on the modifiable range of each parameter, and if the verification is passed, the corresponding simulation software is called to perform the power system simulation calculation, and if the verification fails, the temperature parameter of the parameter modifier is adjusted, and the parameter modification unit is returned to modify the parameters again.

[0248] The large language model driven power system full-automatic intelligent simulation system provided by the application is used for executing the large language model driven power system full-automatic intelligent simulation method provided by any embodiment of the application, and has corresponding function modules and beneficial effects.

[0249] Embodiment three

[0250] An electronic device, comprising: a memory and a processor, the memory stores a computer program, and the processor executes the computer program to execute the method provided in any one of the embodiments.

[0251] Those skilled in the art can easily understand that the above description is only the preferred embodiment of the present application, and is not intended to limit the present application, and any modification, equivalent replacement and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A large language model driven full-automatic intelligent simulation method for power systems, characterized in that, The method comprises an offline optimization stage and an online application stage. The offline optimization stage comprises: S1, obtaining simulation parameter files of a power system and modification ranges of parameters, designing a training command pool containing executable commands and non-executable commands, and forming correct results corresponding to execution of each command; S2, constructing a command generator and a prompt word optimizer based on a large language model, and forming a generative adversarial framework by combining the command generator and the prompt word optimizer; S2 specifically comprises: S201、Based on a large language model, a command generator is constructed, and a fixed prompt word is input to the command generator , command and model temperature parameters , get the command with increasing difficulty : wherein is a command generator; S202, constructing a prompt word optimizer based on a large language model, inputting a fixed prompt word to the prompt word optimizer , a system prompt word to be optimized , an error reason , and a model temperature parameter , obtaining a system prompt word optimized in a targeted manner : wherein, is the system prompt word to be optimized, which consists of a parameter file data format, an important parameter modification constraint, an important parameter modification example and a large language model output format; is the command execution error reason obtained by comparing the command execution result with the correct result; is the prompt word optimizer; the optimization content is the constraint and example of modifying the important parameters of the system prompt word; S203, forming a generative adversarial framework by combining the command generator and the prompt word optimizer based on a generative adversarial network; S3, constructing system prompt words, the command generator generating training commands based on the training command pool; based on the generative adversarial framework, performing generative adversarial training on parameters of each simulation parameter file according to the training commands; when a training command is executed correctly, a correct modification feedback signal is obtained, and when a training command is executed incorrectly, an incorrect modification feedback signal and an incorrect modification reason are obtained; and the prompt word optimizer is guided to optimize the corresponding system prompt word in a targeted manner through the incorrect modification reason, to obtain an optimal system prompt word; The online application stage comprises: S1', identifying corresponding optimal system prompt words from natural language commands input by a user through a large language model, and inputting the optimal system prompt words into parameter modifiers corresponding to each parameter file in a simulation parameter file to obtain modification commands corresponding to each parameter file; S2', modifying parameters of each parameter file based on the modification commands and the optimal system prompt words by the parameter modifier; S3', verifying the modified parameter files based on the modification ranges of the parameters, and if the verification is passed, calling corresponding simulation software to perform power system simulation calculation, and if the verification fails, adjusting temperature parameters of the parameter modifier and returning to step S2' to modify the parameters again.

2. The method of claim 1, wherein, S1 specifically comprises: S101, obtaining simulation parameter files of a power system and modification ranges of parameters; S102, based on the modification ranges of the parameters, designing corresponding executable commands, non-executable reference error commands and non-executable modification error commands for each parameter respectively, and performing command complexity sorting on different commands in the same parameter file; The command complexity sorting rule is: for the same parameter, the non-executable modification error command is higher than the non-executable reference error command, and the executable command is the lowest; for different parameters, the complexity of a later parameter is much higher than that of an earlier parameter according to the position of the parameter in the file.

3. The method of claim 1, wherein, S3 specifically comprises: S301, constructing initial system prompt words based on the meanings of the parameters of each simulation parameter file, and the generator generating corresponding training commands based on the training command pool; S302, inputting the training commands and the current system prompt words into a large language model for parameter modification testing, repeatedly testing a preset number of times under different temperature parameters of the large language model, and comparing the test results with correct modification results to record the parameter modification accuracy and the reasons for command execution errors; S303, determining whether the parameter modification accuracy is greater than a threshold value, if yes, performing S305, and if no, performing S304. S304, the word optimizer prompts the system prompt word based on the reason for the command execution error, obtains an optimized system prompt word, and continues to execute S305; S305, the generator increases the complexity of the training command, and returns to S302 for the next round of testing until a preset iteration number is reached, and an optimal system prompt word is obtained.

4. The method of claim 1, wherein, The parameter modifier includes a command identification module, a parameter modification module, and a parameter verification module; The command identification module and the parameter modification module are both constructed by a large language model; The command identification module is configured to extract sub-commands of each parameter file based on system prompt words corresponding to the parameter files.

5. The method of claim 4, wherein, S2' specifically includes: S201', the parameter modifier determines whether to use a parallel modification mode according to the size of the parameter file and the parameter quantity threshold value; if yes, S202' is executed, and if no, S203' is executed; S202', the parallel modification mode is used in the parameter modification process; the parallel modification mode includes mode 1 and mode 2, mode 1: different parameter modification modules simultaneously modify different parameter files in parallel; mode 2: the parameter modification module divides the content in the same parameter file into multiple parts according to the number of lines, and modifies different parts in parallel; S203', the parameter modifier directly modifies the parameter file.

6. The method of claim 1, wherein, The simulation software includes PSASP or PSS / E power system simulation software.

7. A large language model driven power system full-automatic intelligent simulation system, characterized in that, It includes: an offline optimization module and an online application module; The offline optimization module includes: a parameter modification command generation unit configured to obtain simulation parameter files and modification ranges of parameters of a power system, design a training command pool containing executable commands and non-executable commands, and form correct results corresponding to execution of each command; an adversarial framework generation unit configured to construct a command generator and a prompt word optimizer based on a large language model, and form a generative adversarial framework by combining the command generator and the prompt word optimizer; The adversarial framework generation unit is configured to specifically execute the following steps: S201、Based on a large language model, a command generator is constructed, and a fixed prompt word is input to the command generator , command , and model temperature parameters , get the command with increasing difficulty : wherein is a command generator; S202, constructing a prompt word optimizer based on a large language model, inputting a fixed prompt word to the prompt word optimizer , a system prompt word to be optimized , an error reason , and a model temperature parameter , obtaining a system prompt word optimized in a targeted manner : wherein, is a system prompt to be optimized, composed of a parameter file data format, an important parameter modification constraint, an important parameter modification example, and a large language model output format; is a command execution error reason obtained by comparing the command execution result with the correct result; is a prompt optimizer; the optimization content is the constraint and example of modifying the important parameters of the system prompt; S203, form a generative adversarial framework by combining the command generator and the prompt word optimizer based on a generative adversarial network; a system prompt word optimization unit configured to construct a system prompt word, the command generator generates a training command based on the training command pool; based on the generative adversarial framework, the parameters of each simulation parameter file are trained in a generative adversarial manner; when the training command is executed correctly, a feedback signal indicating correct modification is obtained, when the training command is executed incorrectly, a feedback signal indicating incorrect modification and a reason for incorrect modification are obtained; and the prompt word optimizer is guided to optimize the corresponding system prompt word based on the reason for incorrect modification, and an optimal system prompt word is obtained; The online application module includes: a command acceptance unit configured to identify a corresponding optimal system prompt word from a natural language command input by a user through a large language model, and input the optimal system prompt word into a parameter modifier corresponding to each parameter file in a simulation parameter file to obtain a modification command corresponding to each parameter file; a parameter modification unit configured to modify parameters of each parameter file based on the modification command and the optimal system prompt word by the parameter modifier. The check and simulation unit is configured to check the modified parameter file based on the modifiable range of each parameter, and if the check passes, call corresponding simulation software to perform power system simulation calculation, and if the check fails, adjust the temperature parameter of the parameter modifier and return the parameter modification unit to modify the parameters again.

8. An electronic device, comprising: The method comprises the steps of: A memory and a processor, the memory stores a computer program, and the processor executes the computer program to execute the method provided in any one of claims 1-6.

Citation Information

Patent Citations

  • Network attack processing method and device and electronic equipment

    CN119094231A

  • Aircraft concept scheme design method and system based on generative artificial intelligence

    CN119150458A

Cited By

  • New energy, energy storage power station electromechanical transient artificial intelligence modeling simulation method and system

    CN122616357A