A method, system and storage medium for automatic generation and inspection of simulation code for complex products

The automatic simulation code generation and verification method developed in X language, utilizing generative large models and compiler script libraries, solves the time-consuming and labor-intensive problems of traditional simulation model development, achieves efficient and high-quality simulation model code generation and verification, and improves the efficiency and simulation accuracy of complex product design.

CN119512518BActive Publication Date: 2025-09-16BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411589239.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-09-16
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

Traditional simulation model development is time-consuming and labor-intensive, and it is difficult to meet the needs of rapid changes and technological iteration and upgrading in complex product design. In particular, there are significant challenges in model accuracy and verification efficiency, and it is unable to meet the requirements of high-efficiency and high-quality simulation model code generation and verification.

Method used

An automatic simulation code generation method was developed using the X language. Simulation model code was automatically generated from a generative large model. This code was then verified using an X language compiler and computer scripts. Errors were fed back for correction. The generative large model was fine-tuned using a low-adaptive-rank method to ensure efficient and high-quality simulation model code generation.

Benefits of technology

It improves the efficiency and quality of complex product simulation model code generation, meets the needs of design iteration speed and innovation efficiency, and enhances the performance, reliability and security of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512518B_ABST
    Figure CN119512518B_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, and storage medium for automatically generating and verifying simulation code for complex products, relating to the field of digital design and manufacturing. The method comprises: parsing user requirements and constructing prompt words based on the parsed user requirements, X-language modeling specifications, domain specifications, and demonstration models in the X-language model library; automatically generating simulation model code and annotations based on the prompt words using a generative large model; and verifying the simulation model code using an X-language compiler and computer scripts. Error prompt words are generated based on the verification results and fed back to the generative large model to correct the simulation model code. This invention provides a highly efficient and high-quality method for automatically generating and verifying simulation code for complex products, addressing the inefficiency of manual coding and the difficulty of coping with design requirement changes and technology upgrades, thereby increasing the speed of design iterations and the efficiency of product innovation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of digital design and manufacturing technology, and more particularly to a method, system and storable medium for automatically generating and inspecting simulation codes for complex products. Background Art

[0002] At present, in the field of digital design and manufacturing technology, with the growing demand for the research and development of complex products such as spacecraft, high-end mechanical equipment, and large-scale transportation vehicles, higher requirements are placed on the generation and verification of simulation model codes.

[0003] In traditional simulation model development, model construction and verification rely primarily on the experience of professionals through manual coding and verification. This is not only time-consuming and labor-intensive, but also particularly clumsy and inefficient when faced with rapidly changing requirements and iterative technology upgrades in complex product designs. Traditional methods face significant challenges, especially in terms of model accuracy and verification efficiency, which limits the speed of design iterations and the efficiency of product innovation. As the design of complex systems becomes more sophisticated and highly integrated, the requirements for simulation models are also increasing. This requires not only functional simulation but also high-precision simulation of performance, reliability, and safety. However, due to inherent limitations, manual coding and traditional model verification methods cannot meet the dual requirements of high efficiency and high quality in the development of simulation model code for complex products.

[0004] Therefore, how to provide a high-efficiency and high-quality method for automatically generating and verifying simulation codes for complex products is an urgent problem that needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the present invention provides a method, system and storage medium for automatically generating and verifying simulation code for complex products. An automatic simulation code generation method is developed for X language, and the simulation code is verified, thereby obtaining complex product simulation model code with high efficiency and high quality.

[0006] In order to achieve the above object, the present invention provides the following technical solutions:

[0007] The present invention discloses a method for automatically generating and verifying simulation codes for complex products, and the specific steps are as follows:

[0008] Parse user needs and construct prompt words based on the parsed results, X language modeling specifications, domain specifications, and demonstration models in the X language model library;

[0009] Automatically generate simulation model code and annotations using a generative large model according to the prompt words;

[0010] The simulation model code is checked by using an X language compiler and a computer script, and error prompt words are obtained according to the check results and fed back to the generative large model to correct the simulation model code.

[0011] Furthermore, the prompt word includes three parts: Task, Introduction, and Input; wherein the Input part is the user demand, the Task part is the X language simulation model generated according to the Input part, and the Introduction part includes the X language modeling specification, domain specification, and X language demonstration case.

[0012] Furthermore, the construction prompt words specifically include:

[0013] Determining model parameters and model functions of the simulation model according to the analysis results;

[0014] Sampling a demonstration model from the X language model library according to the model parameters and the model function, and generating a corresponding simulation model;

[0015] Determining parameter type definitions according to the X language modeling specification and the model parameters; determining instruction definitions according to the X language modeling specification and the model functions;

[0016] Determining parameter constraints of the model parameters and logical constraints of the model functions according to the domain specifications to which the simulation model belongs;

[0017] The prompt word is constructed by combining the simulation model, the model parameters for determining type definition and parameter constraints, and the model functions for determining instruction definition and logic constraints.

[0018] Furthermore, the generative large model is obtained by fine-tuning the open source generative large model, specifically including:

[0019] The model in the X language model library is used as the answer, the natural language description corresponding to the model is used as the question, and the question-answer pair is used as a sample to construct a dataset;

[0020] 80% of the samples in the dataset are used as training dataset, 10% of the samples are used as validation dataset, and 10% of the samples are used as test dataset;

[0021] The parameters of the open source generative large model are fine-tuned using a low adaptive rank method, and the open source generative large model is fine-tuned using the training dataset.

[0022] Furthermore, the low adaptive rank method obtains the approximate parameters of the open source generative large model by introducing a low rank decomposition matrix. During the fine-tuning process, only the parameters in the low rank decomposition matrix are updated, and the parameters in the remaining layers of the open source generative large model are fixed.

[0023] Furthermore, the checking of the simulation model code includes:

[0024] Using an X language compiler to check the simulation model code, obtaining error prompts based on the check results and feeding them back to the generative large model, and correcting the simulation model code until all compilation errors are eliminated;

[0025] The computer script in the script library is used to test the code that has been tested and corrected by the X language compiler, and an error prompt word is obtained according to the test result and fed back to the generative large model, and the simulation model code is corrected to obtain the final simulation model code.

[0026] Furthermore, the simulation model code is checked using the X language compiler, specifically including: detecting whether the simulation model code has spelling errors, wherein the spelling errors include instruction spelling errors and illegal characters in parameter names;

[0027] Check whether the simulation model code has simulation logic errors, including sequence and logic errors of each step, as well as the inequality between the number of equations and the number of parameters in the X language continuous class and the presence of jump instructions in the infinite duration stage.

[0028] Furthermore, the script library includes common sense check scripts and domain standard check scripts corresponding to the domain specifications; the common sense check scripts are used to detect whether the model parameters conform to the common sense constraints of real-world physical theorems; the domain standard check scripts are used to detect whether the model parameters conform to the domain constraints of the corresponding domain physical quantities.

[0029] The present invention also discloses a system for automatically generating and verifying simulation codes for complex products, comprising:

[0030] Prompt word construction module: parses user needs and constructs prompt words based on the parsed results, X language modeling specifications, domain specifications, and models in the model library;

[0031] Simulation code generation module: according to the prompt words, using the generative large model to automatically generate simulation model code and annotations;

[0032] Model verification module: uses X language compiler and computer script to verify the simulation model code, obtains error prompt words according to the verification results and feeds them back to the generative large model, and corrects the simulation model code.

[0033] The present invention also discloses a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method for automatically generating and verifying simulation code for a complex product as described above is implemented.

[0034] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses a method, system and storable medium for automatic generation and verification of simulation code for complex products, and provides a high-efficiency and high-quality method for automatic generation and verification of simulation code for complex products, which solves the problems of low efficiency of manual coding and difficulty in coping with changes in design requirements and technical upgrades, improves the speed of design iteration and the efficiency of product innovation, meets the simulation requirements of complex system design model performance, reliability and security, and has certain application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0036] Figure 1 Schematic diagram of the overall process of the method according to the embodiment of the present invention.

[0037] Figure 2 Schematic diagram of the system structure of an embodiment of the present invention.

[0038] Figure 3 Schematic diagram of the aircraft simulation model architecture according to an embodiment of the present invention.

[0039] Figure 4 The figure is a schematic diagram of the aircraft simulation model code verification process according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0041] The embodiment of the present invention discloses a method for automatically generating and verifying simulation codes for complex products. Figure 1 The specific steps are as follows:

[0042] Parse user needs and construct prompt words based on the parsed results, X language modeling specifications, domain specifications, and demonstration models in the X language model library;

[0043] Based on the prompt words, the generative large model is used to automatically generate simulation model code and annotations;

[0044] The simulation model code is tested using an X language compiler and computer scripts. Error prompts are obtained based on the test results and fed back to the generative large model to correct the simulation model code.

[0045] The X language uses the X language modeling specification, which includes the definition of application scenario classes, syntax, and application cases. Engineers with a foundation in simulation modeling can master the X language through this specification. The X language fully supports model-based systems engineering, providing standardized graphical modeling descriptions during the product concept design phase. It also automatically compiles standardized graphical models into text-based underlying simulation models. Driven by the simulation engine, it supports seamless integrated simulation across the entire system, process, and multiple perspectives, achieving unified, integrated description and simulation from conceptual model design, system architecture design, multi-physics domain models, and simulation models.

[0046] In a specific embodiment, the prompt word includes three parts: Task, Introduction, and Input. The Input part is the user requirement, the Task part is the X language simulation model generated based on the Input part, and the Introduction part includes the X language modeling specification, domain specification, and X language demonstration case.

[0047] Specifically, the X language modeling specification is a grammar file for the X language in the BNF format that conforms to the BNF format. The X language's BNF format defines the language's grammatical structure through productions, enabling language designers to clearly describe grammatical rules and compiler developers to implement parsers based on these grammatical rules. The BNF format is an important tool for understanding and implementing programming languages. The X language's BNF format provides specific definitions of key concepts such as the overall storage framework, class definitions, class prefixes, class structure, components, definition modules, ports, components, value variables, plans, states, statements and expressions, lexical elements, and more. These definitions collectively constitute the grammatical rules of the X language, detailing how to write code that conforms to the X language specification, including class structure, state machine behavior, equation writing, and input and output processing.

[0048] Field specifications refer to the main specifications in different fields, such as aviation field specifications (1. The flight altitude of civil aircraft must be greater than 8,800 meters; 2. The speed of the aircraft cannot exceed the maximum structural speed; 3...);

[0049] X language demonstration cases refer to multiple sets of model descriptions and model X language codes in the X language model library.

[0050] In a specific embodiment, constructing the prompt word specifically includes:

[0051] Determine the model parameters and model functions of the simulation model according to the analysis results;

[0052] According to the model parameters and model functions, sample demonstration models from the X language model library and generate corresponding simulation models;

[0053] Determine the type definition of parameters according to the X language modeling specification and model parameters; determine the instruction definition according to the X language modeling specification and model functions;

[0054] Determine the parameter constraints of the model parameters and the logical constraints of the model functions according to the domain specifications to which the simulation model belongs;

[0055] The prompt words are constructed by combining the simulation model, the model parameters that determine the type definition and parameter constraints, and the model functions that determine the instruction definition and logic constraints.

[0056] Specifically, model functionality refers to the design of a system or tool, or the specific operations and capabilities of a program, describing its execution and performance within a specific task or domain. Model parameters are variables that describe system properties, such as mass, length, and elasticity. These parameters are adjusted to simulate and analyze system behavior. For the X language modeling specification, both type definitions and instruction definitions are required. Type definitions are specifications for declaring and describing data types, defining the properties and methods of variables or objects. Types in the X language include couple, discrete, and continuous classes. Instruction definitions are instructions for specific operations, including commands, parameters, and execution steps, to implement specific functionality within the program. For domain specifications, both parameter constraints and logical constraints are required. Parameter constraints are restrictions and regulations on function or model inputs, ensuring that inputs meet specific conditions to ensure system stability and correctness. Logical constraints are regulations on the relationships between events, behaviors, or conditions within a system or problem, ensuring that they follow a certain logical order and are rational. The above content and demonstration cases sampled from the X language model library are combined to construct sample learning prompts. Below is a simple example of a constructed prompt. The constructed prompt for few-shot learning consists of three parts: Task, Introduction, and Input. The specific format is as follows: Task: "Please generate a simulation model in language X based on the Input." Introduction: Modeling specifications for language X, domain specifications, and examples of language X. Input: "This is an aircraft takeoff model. The aircraft should be able to receive tower signals and take off normally. The landing gear should be retracted during takeoff, and the takeoff speed should be greater than 180 knots."

[0057] In a specific embodiment, the generative big model is obtained by fine-tuning and training an open source generative big model, specifically including:

[0058] The model in the X language model library is used as the answer, the natural language description corresponding to the model is used as the question, and the question-answer pair is used as a sample to construct a dataset. Without affecting the meaning of the language, the wording of the question is randomized to reduce the homogeneity of the corpus and increase the number of samples.

[0059] 80% of the samples in the dataset are used as training datasets to fine-tune the model parameters; 10% of the samples are used as validation datasets to tune the model training process; and 10% of the samples are used as test datasets to finally evaluate the performance of the model.

[0060] The parameters of the open source generative large model are fine-tuned through the low adaptive rank method, and the open source generative large model is fine-tuned using the training dataset.

[0061] In a specific embodiment, the low adaptive rank method obtains the approximate parameters of the open source generative large model by introducing a low rank decomposition matrix. During the fine-tuning process, only the parameters in the low rank decomposition matrix are updated, and the parameters in the remaining layers of the open source generative large model are fixed.

[0062] In a specific embodiment, the low-rank decomposition method approximates the original parameters by decomposing the original model parameter matrix into the product of two low-rank matrices. This method can significantly reduce the number of parameters that need to be updated in the model, thereby reducing the training and computational burden. First, the weight matrix in the self-attention layer of the model is selected. Take a weight matrix W as an example, assuming its dimension is d×d′. We want to decompose it into two low-rank matrices U and V, where the dimension of U is d×r and the dimension of V is r×d′, where r is the rank of the low rank (much smaller than d and d′). The weight matrix in the model is decomposed using the low-rank decomposition method, and the weight matrix W is decomposed into W=UV. During the fine-tuning process, all parameters in the original model except the low-rank decomposition matrix are first fixed. That is, during fine-tuning, the rest of the model is not updated, and only the low-rank decomposition matrices U and V are trained. The standard gradient descent method is used to optimize the model's loss function to update U and V. During training, the gradient is calculated using the backpropagation algorithm, and the parameters of U and V are adjusted to minimize the loss function.

[0063] The low adaptive rank method is a highly parameter-efficient fine-tuning method. It approximates the model's parameters by introducing a set of low-rank decomposition matrices, thereby reducing the number of parameters that need to be updated during fine-tuning and improving fine-tuning efficiency. During fine-tuning, certain layers of the model are fixed, and the parameters in the low-rank decomposition matrices are updated. This allows for targeted adjustments to the model while retaining the majority of the knowledge from the open-source generative large model, making it more suitable for X language code generation tasks. During fine-tuning, the model's performance is regularly evaluated using a validation set. When the model's performance on the validation set reaches a preset threshold, fine-tuning is stopped, resulting in a new model, the generative large model used in this embodiment.

[0064] In a specific embodiment, verifying the simulation model code includes:

[0065] Use the X language compiler to check the simulation model code, get error prompts based on the test results and feed them back to the generative large model, and correct the simulation model code until all compilation errors are eliminated;

[0066] The X compiler is a text compiler for the X language. It checks for syntax and logic errors in X language text and compiles X language into C++. The X compiler detects syntax errors by identifying model code structure through specific identifiers, such as "connection," "end," and "state." If a specific identifier is not detected or is incorrectly positioned, an error message is generated, stating "missing specific identifier or misspelled identifier." If a parameter name in the identified model code contains illegal characters, such as "+" or "=", an error message is generated, stating "illegal characters in parameter name." The X compiler checks for syntax errors as follows: Because X requires that the number of equations in a continuous model must be equal to the number of parameters, the X compiler calculates the number of equations in the equation section and the number of parameters in the value and port sections. If the two are not equal, the compiler reports the error "Number of equations not equal to number of parameters." Because states in discrete models have state durations, if a statehold(infinite) instruction is detected in a state without a transition() instruction, the compiler reports the error "Infinite state duration and no jump instruction."

[0067] The computer scripts in the script library are used to test the code that has been tested and corrected by the X language compiler. Error prompt words are obtained according to the test results and fed back to the generative large model to correct the simulation model code and obtain the final simulation model code.

[0068] In a specific embodiment, the simulation model code is checked using an X language compiler, specifically including: detecting whether the simulation model code has spelling errors, spelling errors including instruction spelling errors and illegal characters in parameter names;

[0069] Check the simulation model code for simulation logic errors. These errors include errors in the order and logic of steps, errors in the number of equations and parameters in the X language continuous class, errors in infinite state duration, and errors in the absence of jump instructions.

[0070] In one specific embodiment, the script library includes common sense check scripts and domain standard check scripts corresponding to domain specifications. Common sense check scripts are used to check whether model parameters comply with common sense constraints based on real-world physical theorems, such as the gravity parameter in a simulation should be equal to 9.8. Domain standard check scripts are used to check whether model parameters comply with domain constraints for corresponding domain physical quantities, such as the aircraft's flight speed cannot exceed the maximum structural velocity. Common sense constraints and domain constraints can be distinguished as follows: domain constraints are constraints within a specific domain, based on the domain's expertise and standards, and apply to specific types of models, while common sense constraints apply to all physical models. The following is a specific script example that checks whether an aircraft's speed complies with domain standard constraints. Suppose we have an aircraft model with a current speed of 550 m / s and a maximum allowable speed of 300 m / s (domain constraint). The script traverses the aircraft model program to find parameters related to the aircraft's speed and compares them with the domain constraint. In this case, the aircraft's flight speed exceeds the domain constraint, so the script will generate an error stating "Speed ​​exceeds domain constraint."

[0071] In a specific embodiment, the model code generation and verification is explained by taking an aircraft as an example. An aircraft is a typical complex system, and its design involves multiple interrelated components and subsystems, including the airframe structure, power system, navigation system, flight control, etc. These parts interact with each other to form a highly coordinated whole. Complex aerodynamics, mechanical engineering and electronic systems are integrated together, requiring engineers to consider various factors in design and maintenance. Through the analysis of existing public data and aircraft models, the following is obtained: Figure 3 The aircraft model architecture diagram shown here describes the various functions and connections between the aircraft's subsystems. The central control system calculates the control variables of the aircraft's control elements (engines, elevators, etc.) based on trajectory input. The control system calculates the forces and moments acting on the aircraft at that attitude. The airframe system then calculates the aircraft's flight state based on these forces and moments, ultimately generating the aircraft's flight trajectory over time.

[0072] By describing the functions and parameters of the aircraft model, the fine-tuned generative model is used to generate simulation code for the aircraft model. The simulation code is then tested using the X language compiler. The code is found to contain logical errors, and the output of the detector is fed back to the generative model as a prompt until the simulation code passes the X language compiler test. The aircraft model code that has passed the X language compiler is then tested using a specific computer script. It is detected that its wing parameters do not conform to aerodynamics. This result and related aerodynamic formulas are fed back to the generative model as prompts. The regenerated model must then be tested again by the X language compiler and the specific computer script. The aircraft simulation model code testing process is as follows: Figure 4 Finally, the models that pass the verification of the X language compiler and computer script will be added to the X language model library and can also be used as prompts to generate other models when necessary.

[0073] The embodiment of the present invention also discloses a system for automatically generating and verifying simulation codes for complex products, such as Figure 2 As shown, including:

[0074] Prompt word construction module: parses user needs and constructs prompt words based on the parsed results, X language modeling specifications, domain specifications, and models in the model library;

[0075] Simulation code generation module: Based on prompt words, it uses the generative large model to automatically generate simulation model code and annotations;

[0076] Model verification module: Use X language compiler and computer script to test the simulation model code, obtain error prompts based on the test results and feed them back to the generative large model to correct the simulation model code.

[0077] An embodiment of the present invention further discloses a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method for automatically generating and verifying simulation code for a complex product according to any one of the above embodiments is implemented.

[0078] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0079] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for automatically generating and verifying simulation code for complex products, characterized in that: The specific steps are as follows: Parse user needs and construct prompt words based on the parsed results, X language modeling specifications, domain specifications, and demonstration models in the X language model library; Automatically generate simulation model code and annotations using a generative large model according to the prompt words; Using an X language compiler and a computer script, the simulation model code is tested, and error prompts are obtained according to the test results and fed back to the generative large model to correct the simulation model code; The prompt word includes three parts: Task, Introduction, and Input. The Input part is the user's needs, the Task part is the X language simulation model generated based on the Input part, and the Introduction part includes the X language modeling specification, domain specification, and X language demonstration case. The construction prompt words specifically include: Determining model parameters and model functions of the simulation model according to the analysis results; Sampling a demonstration model from the X language model library according to the model parameters and the model function, and generating a corresponding simulation model; Determining parameter type definitions according to the X language modeling specification and the model parameters; determining instruction definitions according to the X language modeling specification and the model functions; Determining parameter constraints of the model parameters and logical constraints of the model functions according to the domain specifications to which the simulation model belongs; The prompt word is constructed by combining the simulation model, the model parameters for determining type definition and parameter constraints, and the model functions for determining instruction definition and logic constraints.

2. The method for automatically generating and verifying simulation code for a complex product according to claim 1, characterized in that: The generative large model is obtained by fine-tuning the open source generative large model, specifically including: The model in the X language model library is used as the answer, the natural language description corresponding to the model is used as the question, and the question-answer pair is used as a sample to construct a dataset; 80% of the samples in the dataset are used as training dataset, 10% of the samples are used as validation dataset, and 10% of the samples are used as test dataset; The parameters of the open source generative large model are fine-tuned using a low adaptive rank method, and the open source generative large model is fine-tuned using the training dataset.

3. The method for automatically generating and verifying simulation code for a complex product according to claim 2, characterized in that: The low adaptive rank method obtains the approximate parameters of the open source generative large model by introducing a low rank decomposition matrix. During the fine-tuning process, only the parameters in the low rank decomposition matrix are updated, and the parameters in the remaining layers of the open source generative large model are fixed.

4. The method for automatically generating and verifying simulation code for a complex product according to claim 1, characterized in that: The checking of the simulation model code includes: Using an X language compiler to check the simulation model code, obtaining error prompts based on the check results and feeding them back to the generative large model, and correcting the simulation model code until all compilation errors are eliminated; The computer script in the script library is used to test the code that has been tested and corrected by the X language compiler, and an error prompt word is obtained according to the test result and fed back to the generative large model, and the simulation model code is corrected to obtain the final simulation model code.

5. The method for automatically generating and verifying simulation code for a complex product according to claim 4, characterized in that: Using the X language compiler, the simulation model code is checked, specifically including: detecting whether the simulation model code has spelling errors, wherein the spelling errors include instruction spelling errors and illegal characters in parameter names; Check whether the simulation model code has simulation logic errors, including sequence and logic errors of each step, as well as the inequality between the number of equations and the number of parameters in the X language continuous class and the presence of jump instructions in the infinite duration stage.

6. The method for automatically generating and verifying simulation code for a complex product according to claim 4, characterized in that: The script library includes common sense check scripts and domain standard check scripts corresponding to the domain specifications; the common sense check scripts are used to detect whether the model parameters conform to the common sense constraints of real-world physical theorems; the domain standard check scripts are used to detect whether the model parameters conform to the domain constraints of the corresponding domain physical quantities.

7. A system for automatically generating and verifying simulation codes for complex products, characterized in that: include: Prompt word construction module: parses user needs and constructs prompt words based on the parsed results, X language modeling specifications, domain specifications, and models in the model library; Simulation code generation module: according to the prompt words, using the generative large model to automatically generate simulation model code and annotations; Model verification module: uses X language compiler and computer script to verify the simulation model code, obtains error prompt words based on the verification results and feeds them back to the generative large model, and corrects the simulation model code; The prompt word includes three parts: Task, Introduction, and Input. The Input part is the user's needs, the Task part is the X language simulation model generated based on the Input part, and the Introduction part includes the X language modeling specification, domain specification, and X language demonstration case. The construction prompt words specifically include: Determining model parameters and model functions of the simulation model according to the analysis results; Sampling a demonstration model from the X language model library according to the model parameters and the model function, and generating a corresponding simulation model; Determining parameter type definitions according to the X language modeling specification and the model parameters; determining instruction definitions according to the X language modeling specification and the model functions; Determining parameter constraints of the model parameters and logical constraints of the model functions according to the domain specifications to which the simulation model belongs; The prompt word is constructed by combining the simulation model, the model parameters for determining type definition and parameter constraints, and the model functions for determining instruction definition and logic constraints.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements a method for automatically generating and verifying simulation code for a complex product according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Coding auxiliary plug-in development system based on large language model

    CN118069109A

  • Garment pattern design system and method based on natural language dialogue

    CN118071885A