A visual simulation model automatic construction method based on a large language model

CN122547459APending Publication Date: 2026-08-11TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-15
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0006]然而,现有可视化建模仿真软件尚未形成一种有效的技术方案,能够将大语言模型的语义理解与推理能力与可视化建模环境深度结合,实现从用户提示语出发,自动完成建模方案解析、功能模块选择、参数配置及模型结构构建的全过程自动化

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122547459A_ABST
    Figure CN122547459A_ABST
Patent Text Reader

Abstract

This application discloses an automatic construction method for visual modeling and simulation models based on a large language model. The method includes: constructing a modeling resource set; receiving modeling information and requirements provided by the user, and determining whether existing model files are included; generating a modeling planning scheme based on user requirements or the analysis results of existing models; generating module structure description data and inter-module connection description data; generating simulation configuration data; generating modeling code based on the above data and executing the modeling code to construct a simulation model; verifying the simulation model by running it, determining whether the model runs correctly and whether the simulation results meet preset technical requirements; when requirements are not met, generating feedback error information and adjusting the modeling scheme for iterative construction. This technical solution can automate and optimize the modeling process, improving model construction efficiency and the accuracy of simulation results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method for automatically constructing a visual simulation model based on a large language model. Background Technology

[0002] Visual modeling and simulation software is a type of engineering software that provides users with system-level model building, simulation analysis, and testing capabilities through a graphical user interface. This type of software typically has a rich library of built-in functional modules, allowing users to construct simulation models of the object under study by dragging and dropping modules, setting parameters, and establishing connections between modules. Visual modeling and simulation software, such as Matlab-Simulink and AMESim, has been widely used in technical fields such as control system design.

[0003] In existing technologies, the basic implementation of visual modeling and simulation mainly relies on manual operation. The typical modeling process includes: the user selects the required functional modules from the module library according to the system modeling principle and drags them to the predetermined position in the modeling canvas; then, the user sets the internal parameters of each functional module one by one, and completes the connection between the module ports manually. By adjusting the parameter configuration and structural connection relationship multiple times, a simulation model that meets the design requirements is obtained.

[0004] However, existing manual modeling methods still have the following shortcomings in practical applications: On the one hand, the modeling process heavily relies on the user's professional experience and software operation skills, making it difficult for non-professional users or beginners to learn and operate, resulting in a high learning cost. On the other hand, the model building process requires a large amount of repetitive manual drag-and-drop, parameter input, and connection operations, leading to low modeling efficiency. Furthermore, in complex system modeling scenarios, human error can easily cause errors in model structure or parameter configuration, affecting the reliability of simulation results. In addition, when user modeling needs change, significant manual modifications to the original model are often required, lacking flexible and efficient automated support methods.

[0005] With the development of generative artificial intelligence technology, large language models, possessing large-scale parameters and deep semantic understanding capabilities, have demonstrated strong intelligent assistance capabilities in natural language understanding, logical reasoning, and code generation, providing a new technical path for automating the construction of complex engineering tasks. Existing research and applications show that large language models can understand users' text descriptions to a certain extent and generate corresponding structured information or operational instructions, providing the foundation for automating the process from user requirement description to modeling scheme planning and even model generation.

[0006] However, existing visual modeling and simulation software has not yet developed an effective technical solution that can deeply integrate the semantic understanding and reasoning capabilities of large language models with the visual modeling environment, enabling the entire process of automatically completing modeling scheme analysis, functional module selection, parameter configuration, and model structure construction from user prompts. Therefore, how to introduce large language models into existing visual modeling and simulation software to achieve efficient and accurate automated modeling methods still requires further research and solutions. Summary of the Invention

[0007] Therefore, it is necessary to address the aforementioned technical problems by providing an automatic construction method for visual simulation models based on large language models, and further providing a system and computer-readable storage medium for implementing the method. The automatic construction of simulation models is achieved through structured model representation, semantic modeling planning, and an automatic code generation and execution mechanism.

[0008] Firstly, this application provides a method for automatically constructing a visual simulation model based on a large language model, which includes at least: Construct a modeling resource collection, including at least a modeling module library, a modeling template library, and a modeling case library, to store module function descriptions, parameter attribute definitions, port semantic rules, and historical model structure data; Receive modeling information and modeling requirements provided by users; Determine whether the modeling information contains an existing model file; When an existing model file is included, the existing model file is parsed in a structured manner to extract the module structured description data and structured connection description data, and to generate standardized model expression data. The standardized model expresses data using a unified template structure to describe module type, port attributes, signal direction, and parameter mapping relationships. Based on the modeling requirements and the standardized model representation data, a large language model is invoked to perform semantic understanding and modeling planning, and a target modeling scheme is generated. Determine the module instance set and corresponding parameter configurations based on the target modeling scheme; The large language model is invoked to generate structured connection description data between modules based on port semantic matching rules, wherein the port semantic matching rules include signal type matching rules, direction consistency rules, and signal dimension compatibility rules.

[0009] Generate simulation run configuration data, including at least simulation step size, simulation duration, and solver type; Based on the module structured description data, structured connection description data, and simulation run configuration data, modeling script code is generated and executed in the visual simulation environment to build or update the target simulation model; The generated simulation model is compiled and run for verification, and the running results are obtained. The running results are subjected to error evaluation processing to generate error information; When the running results do not meet the preset accuracy conditions, the error information is fed back to the large language model to trigger model structure adjustment or parameter reconstruction, and the modeling script code is regenerated until the preset technical requirements are met.

[0010] In one embodiment, parsing an existing model file includes at least: Convert the model file into a structured description file; Extract model structure information and simulation configuration parameters; The extracted information is converted into structured text data that conforms to the format of the modeling template library.

[0011] In one embodiment, the modeling module library includes a simple module library and a detailed module library, wherein: A simple module library is used for rapid semantic matching and initial module filtering; The detailed module library is used to obtain module parameter definitions, input and output constraints, and modeling usage instructions.

[0012] In one embodiment, the large language model generates the following based on the modeling requirements text: modeling target parsing results, module selection scheme, initial parameter configuration, and model structure planning information.

[0013] In one embodiment, the module positions generate corresponding coordinate information according to preset spatial layout rules, which include hierarchical arrangement rules between modules, signal flow rules, and module spacing control rules to ensure the readability and consistency of the model structure.

[0014] In one embodiment, the module connection relationship is generated based on port semantic matching and supports one-to-many, many-to-one and multi-level cascaded signal connections; when a semantic conflict is detected, conflict information is automatically output and replanning is triggered.

[0015] In one embodiment, the generated modeling script includes at least module creation instructions, parameter configuration instructions, module connection instructions, and simulation parameter setting instructions. After the script is executed, it automatically completes model construction or updates.

[0016] Secondly, this application provides an automatic construction system for visual modeling and simulation models based on large language models, comprising at least: The modeling resource management module is used to build and maintain a collection of modeling resources, including at least a modeling module library, a modeling template library, and a modeling case library. The model parsing module is used to parse existing models and generate structured descriptive data; The modeling and reasoning module is used to call a large language model to generate a target modeling scheme; The model generation module is used to generate module structure, connection relationships, and simulation configuration; The execution module is used to generate and execute modeling scripts to create or update simulation models, and to verify and process the model running results.

[0017] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the automatic construction method for a visualization simulation model based on a large language model as described in the first aspect. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of an automated modeling process in one embodiment; Figure 2 This is a flowchart illustrating the construction process of a modeling case library in one embodiment. Figure 3 This is a schematic diagram of the input model in one embodiment; Figure 4 This is a flowchart of parsing an existing model file in one embodiment; Figure 5 This is a module structured data flow diagram in one embodiment; Figure 6 This is a flowchart illustrating the generation of structured connection description data in one embodiment; Figure 7 This is a schematic diagram of the model generation result in one embodiment; Figure 8 This is a schematic diagram of the simulation results of the generated model in one embodiment.

[0020] Figure 9 A schematic diagram of a visualization simulation model generation device; Figure 10 This is a schematic diagram of the structure of a computer device. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0022] like Figure 1 The diagram shown illustrates the overall process of an automatic construction method for a visual simulation model based on a large language model, as provided by this invention. This invention achieves automatic construction and iterative optimization of simulation models through a structured model expression mechanism, a semantic modeling planning mechanism, and an automatic code generation and execution verification closed-loop mechanism.

[0023] In this embodiment, to verify the feasibility and effectiveness of the method of the present invention, an anti-saturation integral control model based on a PID controller from the official MATLAB-Simulink modeling examples is used as a specific application scenario. The model includes a PID control module, a controlled object module, a saturation limiting module, and a feedback connection structure.

[0024] This embodiment combines the MATLAB-Simulink visual modeling and simulation environment with a large language model to achieve automated construction of the simulation model, specifically including the following steps: Step 102: Construct a set of modeling resources A modeling module library is constructed to store structured descriptions of callable modeling modules in the visualization modeling software. Each modeling module is stored as a structured data record, which includes at least: The component identifier field (ID) is used to uniquely identify the module; The component name field is used to identify the module type; The basic description field is used to briefly describe the module's functionality; Detailed description fields are used to provide semantic descriptions for module modeling; The internal parameter field is used to record the module's configurable parameters; The parameter meaning field is used to explain the physical or functional meaning of each parameter; The input port field describes the module's input interface; Input semantic fields are used to describe the meaning of the input signals; The output port field describes the module's output interface; Output semantic fields are used to describe the meaning of the output signal; The remarks field is used to record extended descriptions.

[0025] To improve module matching efficiency, the modeling module library includes two structural forms: a simplified module library and a detailed module library. The simplified module library contains only the component identifier field, component name field, and basic description field, which are used for quick retrieval and preliminary matching of modules in the subsequent modeling and planning phase; The detailed module library contains all structured fields, which are used to extract complete modeling semantic information after the module is determined, in order to support parameter configuration generation, port semantic matching and connection relationship construction; In this embodiment, 48 commonly used Simulink modules are selected as the basic module set, and the corresponding module modeling information is extracted from the MATLAB official help documentation and converted into the above structured data format for storage through field mapping rules.

[0026] Taking the Constant module as an example, its structured description in the modeling module library includes: Component identification: b1; Component Name: Constant; Internal parameter: Value; Parameter meaning: Used to specify the constant value of the module output, the default value is "1"; Input port: None; Input semantics: None; Output ports: o1, o2…; Output semantics: Outputs a specified constant value, supporting real or complex scalars, vectors, matrices, or N-dimensional arrays; Notes: None.

[0027] The structured storage method described above enables the modeling module information to be integrated in a unified format and retrieved, providing a standardized data foundation for subsequent module matching, parameter generation, and structural planning of large language models.

[0028] A modeling template library is constructed to define unified modeling description rules used in both the model parsing and model generation phases. This template library standardizes the expression of information such as model structure, module attributes, and module connection relationships, thereby ensuring semantic and structural consistency between the model parsing results and the generated model data.

[0029] Specifically, the modeling template library includes at least: Module parameter description template, used to standardize the names of parameters and the way parameter values ​​are expressed within a module; A module connection relationship description template, used to standardize the representation of port connection relationships; Model hierarchy structure description template, used to define the organizational structure and spatial layout rules of modules in the model; Simulation parameter description templates are used to standardize the expression of simulation time, solver configuration, and numerical accuracy parameters.

[0030] In a preferred embodiment, the modeling template library constructs a unified syntax rule through field type constraints, required field constraints, and field reference relationship constraints, so that any model can satisfy a preset structural paradigm.

[0031] The modeling template library is used in the model parsing stage to convert existing models into standard structured data that conforms to unified syntax rules; in the model generation stage, it is used to constrain the data organization of automatically generated models, so that the generated data conforms to the structural specifications of the visual modeling software, thereby improving the stability and consistency of automated modeling.

[0032] In this embodiment, the modeling template library is defined using a JSON structure to achieve a data organization method that is clear in structure, expandable in fields, and machine-parsable.

[0033] A modeling case library will be built to store verified historical modeling instances, providing a basis for model structure and parameter configuration in subsequent modeling processes. Each modeling case will be stored in structured data format, including at least: a model description; the corresponding model file; and a structured textual representation of the model content.

[0034] The textual description of the model content includes at least the module positional relationships, module parameter configurations, module connection relationships, and model simulation parameter settings.

[0035] The process of building the modeling case library includes steps 202 to 214, wherein: Step 202: Model file preprocessing and unpacking The Simulink model file, which has been modeled and verified through simulation, is selected as input. Preprocessing operations are performed on the model file to convert it into a parsable format. Specifically, this includes: Unpack the original Simulink model file into a collection of structured files; Extract the model's internal structure description file and simulation configuration file; In this embodiment, after unpacking, an XML-formatted model structure file and a simulation configuration file are obtained, providing a basic data source for subsequent information extraction.

[0036] Step 204: Module Information Matching and Detailed Information Acquisition Based on the model structure information obtained from unpacking, all module types contained in the model are identified from the simplified module library, and a module index set is established. Based on the index set, the complete usage method of the corresponding module is retrieved from the detailed module library, including parameter definitions, port semantics and functional descriptions, providing standardized reference data for subsequent structure parsing and semantic conversion.

[0037] Step 206: Extraction of Model Simulation Parameters Identify simulation configuration objects from the parsed model configuration file and extract key simulation parameters, including: Simulation start and end times; Simulation solver type; Simulation solver step size and numerical accuracy.

[0038] Step 208: Extraction of Model Structure Information Extract module structured description data and inter-module structured connection description data from the model structure description file, including: The internal parameters of each module instance; Spatial coordinates of each module instance; The connection relationships between modules; Information irrelevant to modeling is automatically filtered during the extraction process to ensure the validity of the structural data.

[0039] Step 210: Structural Transformation of Model Content Based on the standard format defined by the modeling template library, the XML format text information extracted in steps 206 and 208 is converted into a unified structured expression format. This conversion can be achieved in the following ways: Perform field transformation based on template mapping rules; Perform semantic parsing and structural reconstruction using a large language model.

[0040] In this embodiment, a structured transformation is performed based on template mapping rules, so that the model structure, parameter information and connection relationships are mapped into a unified JSON format, thereby forming parsable module structure description data.

[0041] Step 212: Model Description Generation Based on the structured model data obtained in step 210, a corresponding model description is generated to express the model's function and purpose.

[0042] The description can be generated by user input, document extraction, or automatically by a large language model. In this embodiment, semantic analysis of the structured model data is performed using a large language model to output a concise description of the model's functions, thereby establishing a mapping relationship between the model and the semantic description.

[0043] Step 214: Structured Encapsulation of Modeling Cases The model description, module structure description data, structured connection description data, simulation parameter settings, etc. are uniformly encapsulated into a single modeling case; The modeling cases are stored in a structured format in the modeling case library to support rapid retrieval, structure comparison, and experience reuse in the subsequent modeling process.

[0044] Through the above steps, the validated simulation model can be automatically parsed into structured modeling case data, realizing model structure extraction, semantic induction and standardized encapsulation, thereby establishing a searchable and scalable modeling case library, providing a data foundation and experience support for automatic modeling.

[0045] Step 104: Receive modeling information and requirements from the user. In this embodiment, the system receives the modeling requirement text and modeling information input by the user, which are used as the input basis for subsequent automatic modeling reasoning and model generation; The modeling requirement text can be in the form of natural language description or semi-structured expression to adapt to the input habits of different users; The modeling information refers to the user-built visual simulation model file, used to support structural analysis, modification, or expansion of existing models. This modeling information is optional input. When the user does not provide a model file, the system executes an automatic modeling process based solely on the modeling requirements text. When a model file is provided, the system combines the model analysis results with the requirements text for joint reasoning, thereby enabling model modification or incremental generation.

[0046] In this embodiment, the user-input modeling requirement text is: the controlled object is 1 / (10s+1), requiring the design of an anti-saturation integrator using a PID controller, a simulation duration of 200s, an input signal of a step signal from 10 to 5 with a step time of 80s, and an actuator limiting range of [missing information]. 10~10, and the PID parameters need to be determined.

[0047] Meanwhile, to verify the ability to modify and extend the existing model, the user provides a preliminary Simulink model file test1.slx. This model is not entirely consistent with the current requirements, and its structure is illustrated as follows. Figure 3 As shown.

[0048] The system executes the subsequent automatic modeling process based on the above-mentioned requirement text and existing model information.

[0049] Step 106: Determine whether an existing model is included. In this embodiment, the modeling information received in step 104 is subjected to content recognition processing to determine whether the modeling information contains an existing visualization simulation model file.

[0050] When it is determined that the modeling information contains a model file, step 108 is executed to perform structured parsing processing on the existing model file; When it is determined that the modeling information does not contain a model file, step 110 is executed to enter the modeling scheme planning process.

[0051] In one specific embodiment, the user provides a model file generated based on a graphical simulation platform. The system recognizes the file as a parsable model file type and performs model parsing and update processing.

[0052] Step 108: Parse the existing model file When step 106 determines that the modeling information contains an existing model file, the system performs parsing processing on the model, converting the model structure into textual modeling description information that can be recognized and understood by the large language model, so as to support subsequent modeling reasoning and solution generation based on the large model.

[0053] Specifically, structured parsing is performed on existing model files to extract the following information contained in the model: modeling module information, module parameter information, inter-module connection relationship information, and simulation configuration information, and to generate textual modeling description data that meets the input requirements of large models.

[0054] The following describes the parsing process for the .slx format model file, using the Simulink model provided by the user in step 104 as an example. This includes steps 402 to 408, and the flowchart is shown below. Figure 4 ,in: Step 402: Identification and Preprocessing of Existing Model Files The system first performs format recognition and preprocessing operations on the model file provided by the user, including: Identify the file extension of the model file and confirm that it is a resolvable .slx format; The model file is subjected to structural expansion and basic parsing to obtain a description of the model's internal structure.

[0055] The above processing establishes a standard data foundation for subsequent model information extraction.

[0056] Step 404: Extraction of Model Structure Information and Simulation Configuration Based on the preprocessed module structure description data, the system extracts the module hierarchical structure information, the parameter configuration of each module, the signal connection relationship between modules, the simulation time and solver configuration, and forms a preliminary structured modeling description, realizing the complete structural reconstruction of the existing model, so that it can be further analyzed and processed.

[0057] Step 406: Module semantic recognition and module library matching After structural extraction, the system performs semantic recognition and standardized matching processing on each modeling module in the model, specifically including: Identify all module types in the model; Retrieval matching is performed based on a pre-built library of modeling modules; Establish a mapping relationship between modules and standard module descriptions; Standard module description information includes, but is not limited to: component ID, parameter definition, and input / output port semantics.

[0058] Step 408: Standardization of model structure based on modeling template library The model information extracted in steps 404 and 406 is standardized and converted according to the unified structure specifications in the modeling template library so that the model data is expressed in a consistent format.

[0059] Standardized content includes: module structure, parameter configuration, connection relationships, and simulation settings; In a preferred embodiment, the XML structure can be converted into JSON format to achieve a structured expression of model semantics and provide a unified input for subsequent large model inference.

[0060] Step 110: Planning and Modeling Scheme After completing the analysis of user modeling requirements and the standardization of existing model information, the large language model is invoked to plan the modeling scheme for the target system.

[0061] Specifically, the following information will be provided as input to the large language model: Descriptive information of candidate modules in the modeling module library; Structured constraint rules defined in the modeling template library; Similar modeling case data in the modeling case library; User-inputted modeling requirements; Step 108: Parsed module structure description data (if it exists).

[0062] Guided by preset prompts, the large language model infers from the input information based on modeling principles and background knowledge, and outputs a modeling scheme.

[0063] In this embodiment, for the closed-loop control requirements including a first-order inertial object, a PID controller, and actuator limiting constraints, the large language model automatically generates a set of initial PID parameter suggestions that meet the stability and anti-saturation constraints based on the object's time constant, the actuator limiting range, and the anti-saturation requirements, and determines to adopt a control structure with anti-integral saturation function.

[0064] The output of the large language model includes: Requirements interpretation and modeling objective description; Model structure planning information; Module selection recommendations; Initial parameter configuration set; Control strategies and constraint handling recommendations; Recommended simulation running parameters.

[0065] In a preferred embodiment, the output is represented in a structured format consistent with the modeling template library, so that the generated results can be directly used as input data for subsequent module selection, parameter configuration and connection generation steps.

[0066] Through the above processing, an automatic conversion process is achieved from the user's top-level semantic requirements to the software-level modeling structure and parameter configuration data.

[0067] Step 112: Generate module structured description data After completing the modeling scheme planning, based on user modeling requirements and modeling template rules, the modular structured data of the target model is generated, including steps 502 to 508. See the flowchart below. Figure 5 ,in: Step 502: Module semantic matching and candidate filtering To reduce the complexity of subsequent module instantiation and structure generation, a candidate module screening process is performed on the modeling module library after the modeling scheme is generated.

[0068] Specifically, a large language model is invoked to perform semantic association analysis on the semantic representation of modeling requirements and the functional description information of modules, and a set of candidate modeling modules is generated under the condition of satisfying the modeling structure constraints.

[0069] The input information includes: Module function descriptions in the simplified module library; The modeling scheme generated in step 110; Guided by preset prompts, these prompts are mapped to module function descriptions in the modeling module library. Candidate modules that meet the modeling requirements are then selected through semantic similarity matching or rule constraint matching.

[0070] The output is a set of candidate modeling modules, which is represented as a list of module identifiers.

[0071] Step 504: Retrieve detailed modeling information of candidate module groups from the detailed module library. Based on the set of candidate modules obtained in step 502, the standard modeling information of the corresponding module in the detailed module library is read, and the usage method of each module is obtained. This is used to establish the mapping relationship between the module functional requirements and the module instance attributes, and to provide constraints for subsequent instantiation generation.

[0072] Step 506: Call the large language model generation module parameter configuration For each module instance in the target model, the large language model is invoked to generate the corresponding internal parameter configuration. Specifically, the following information is provided as input to the large language model: Module parameter definition information in the modeling module library; User modeling requirements; Parsed module structure description data (if it exists); Modeling scheme planning results; Detailed modeling attribute information for the candidate module groups; Under the constraints of the preset prompt template and the usage methods of each module, the large language model performs semantic reasoning and parameter estimation on the target module, determines the parameter configuration set of each module in the target model, and represents it in a structured format consistent with the modeling template library.

[0073] Step 508: Determine the spatial coordinates of each module After determining the module instances and generating the parameter configurations, the spatial coordinate information of each module in the target model is determined based on the relationships between modules and the preset spatial arrangement rules. Specifically, the following information is provided as input to the large language model: Module instance collection and module type information; Layout rules and structural constraints in the modeling template library; Canvas size and coordinate range constraints.

[0074] In a preferred embodiment, the large language model determines the spatial coordinates of each module based on the model structure rules and model generation rules in the modeling template library, and outputs a set of module coordinates, which is represented in a structured data format consistent with the modeling template library.

[0075] Step 114: Generate structured connection description data After determining the model module instances and clarifying the port semantics, structured connection data describing the connection relationships between modules is generated, including steps 602 to 604. (See flowchart below.) Figure 6 ,in: Step 602: Generate port sequence identifiers for each module According to the predefined interface naming rules in the modeling template library, the input and output ports of each module are numbered, and the output module port identifier set is generated.

[0076] Step 604: Determine the connection method Structured connection description data is generated based on the set of module instances and the set of port identifiers.

[0077] Specifically, the following information will be input into the large language model: User modeling requirements; Updated modeling structure data; A collection of module instances and their parameter information; Module port identifier set; Modeling case library and modeling knowledge rules.

[0078] Under the constraints of structured connection rules, the large language model inference generates structured circuit connection schemes between modules and outputs structured connection description data.

[0079] The above steps enable the automatic determination of the wiring connection methods between the main system modeling modules.

[0080] Step 116: Determine simulation parameter settings After completing the module instantiation, parameter configuration, and connection relationship generation of the target model, simulation runtime environment parameters are generated based on the model's structural features, enabling the target model to have the runtime conditions for direct simulation execution.

[0081] Specifically, the following information will be provided as input to the large language model: User modeling requirements; Modeling and planning scheme; Structural information and module types of the target model; The dynamic characteristics of the model (continuous / discrete / hybrid); Simulation configuration example data in the modeling template library.

[0082] Guided by the preset simulation parameter generation prompt template, the large language model performs simulation strategy reasoning based on the model structure and user requirements, automatically generating simulation parameter configuration data, including but not limited to: Simulation start time and end time; Solver type; Fixed step size or variable step size strategy; Simulated step size; Relative or absolute error tolerance; Other operating control parameters.

[0083] When the user does not explicitly provide simulation constraints, the large language model automatically generates a default simulation configuration based on the model's structural features and template examples.

[0084] The generated simulation parameters are output in a structured data format for subsequent script loading and simulation execution.

[0085] Step 118: Generate modeling script code based on structured data After generating the modular structured data, module connection relationships, and simulation parameters of the target model, the above structured modeling information is converted into executable modeling script code to achieve automatic model building or updating.

[0086] This step generates script code based on the following input data: Module parameter configuration data; Module spatial coordinate data; Module port identification data; Module connection description data; Simulation parameter configuration data; Existing model information (if it exists).

[0087] Depending on the system implementation, script generation can be achieved using one or a combination of the following methods: (1) Code generation method based on rule mapping Based on the preset interface mapping rules and modeling template specifications, the structured modeling data is mapped to the corresponding API call instructions by field, generating modeling script code.

[0088] (2) Code generation method based on large language model The large language model is invoked to perform code mapping inference on the structured modeling data, generating the API call sequence corresponding to the target modeling software.

[0089] When an existing model exists, the system generates only incremental modification scripts based on the differences between the current model structure and the target structure. If no existing model exists, generate a complete model building script.

[0090] In this embodiment, the generated script adopts the MATLAB / Simulink interface command form, and realizes the creation of model, module addition, parameter setting, connection establishment and simulation parameter configuration by calling the modeling API.

[0091] Step 120: Script Execution and Model Update The modeling script generated in step 118 is loaded into the target visualization modeling software runtime environment for execution, so as to realize the automatic construction or updating of the model. The execution process includes at least one of the following methods: (1) Full build mode When an existing model does not exist or a complete model reconstruction is required, execute the script to: Create or load the target model file; Add module instances according to the target model structure; Set module parameters; Set the module space coordinates; Establish connections between modules; Configure simulation runtime parameters; Save the model.

[0092] (2) Incremental update mode When an existing model exists, execute the script based on the differences between the target structure and the current model: Remove redundant modules or connections; Add missing modules or links; Modify module parameters or properties; Update simulation configuration; Save the model.

[0093] After execution, a runnable simulation model consistent with the target structure is obtained.

[0094] Through the above steps, the structured modeling data is automatically mapped to the software execution actions, thereby automating the model building and modification process and replacing manual modeling operations.

[0095] In this embodiment, the script uses MATLAB / Simulink interface commands to perform model operations by calling the modeling API. After the script is executed, a target model that meets the modeling requirements is obtained.

[0096] Step 122: Determine whether the model is running correctly and whether the simulation results meet the technical requirements. After the modeling script is executed and the target simulation model is generated, the model's running status and simulation results are automatically verified to determine whether the model meets the modeling requirements.

[0097] The verification process includes: Perform target model simulation; Determine whether the simulation ran successfully; Extract the simulation results from the model; The output results are subjected to constraint verification or error evaluation based on preset technical indicators.

[0098] When the simulation runs abnormally or the results do not meet the preset technical requirements, feedback information is generated, and the previous steps are returned in combination with the structured information of the target model. The modeling scheme and model are adjusted, and steps 110 to 120 are re-executed until the verification conditions are met or the preset number of iterations is reached.

[0099] Through the above steps, automatic model verification and iterative optimization are achieved, and an automated modeling process with self-correction capabilities is constructed.

[0100] The target model is generated through the above steps as follows: Figure 7 As shown. After the model is updated, the simulation interface of the visualization modeling software is called to perform automatic simulation on the updated model to verify the correctness of the model structure and the closed-loop control function.

[0101] Simulation results are as follows Figure 8 As shown in the figure. The results show that when the reference input is a step signal, the system output can complete the response within a finite time and stably track the target value. In the initial stage, the output signal rises smoothly under the action of PID control and gradually converges to near the set value without continuous oscillation or numerical divergence, indicating that the constructed closed-loop system has good stability and convergence characteristics.

[0102] When the reference input undergoes a sudden change at approximately 80 seconds, the system output responds promptly to the new target value and maintains continuous and smooth changes during the transition phase. Both overshoot and steady-state error remain within acceptable ranges, indicating that the generated control structure possesses effective dynamic adjustment capabilities. Simultaneously, the actuator saturation circuit limits the amplitude of the control signal, preventing non-physical behaviors caused by excessively large instantaneous outputs, thus verifying the effectiveness of the anti-saturation design.

[0103] The simulation results above demonstrate that the modeling code generated by this implementation method can correctly construct the target control structure and achieve dynamic behavior consistent with the updated modeling information, thus verifying the feasibility and stability of the automatic modeling and model update process.

[0104] Through the above process, the automatic conversion and verification from updating modeling information to the target visualization model is realized, reducing the operational burden of manually writing modeling scripts and manually modifying models, improving the efficiency of model building and iteration, and enhancing the consistency and reliability of the model update process.

[0105] Based on the above method embodiments, this application also provides an automatic construction system for visual modeling and simulation models based on large language models.

[0106] like Figure 9 As shown, the system 900 includes: a user input module 901, a modeling requirements analysis module 902, a modeling scheme planning module 903, a module selection and parameter determination module 904, a model connection generation module 905, a simulation parameter generation module 906, a modeling code generation module 907, a model update and simulation execution module 908, a modeling resource management module 909, and a large language model inference engine 910.

[0107] The user input module 901 is used to receive modeling requirement information or existing model data input by the user. The modeling requirement information includes the target system type, performance indicators, and constraints.

[0108] The modeling requirement parsing module 902 is used to perform semantic parsing on the modeling requirements input by the user, extract the modeling objectives, key parameters and constraint rules, and generate structured requirement data.

[0109] The modeling scheme planning module 903 is used to generate a target model structure planning scheme based on the structured requirement data, and to determine the hierarchical structure of the model and the composition relationship of functional modules.

[0110] The module selection and parameter determination module 904 is used to select candidate modules from the modeling module library, modeling template library and modeling case library managed by the modeling resource management module 909 according to the structural planning scheme, and determine the parameter configuration of each module.

[0111] The model connection generation module 905 is used to automatically generate connection relationship data between modules based on module port semantics and system topology constraints, forming a complete model structure.

[0112] The simulation parameter generation module 906 is used to generate simulation running parameters based on the model's dynamic characteristics and performance requirements, including simulation duration, step size, and solver configuration.

[0113] The modeling code generation module 907 is used to generate an executable modeling script or model file based on the model module structure description data and parameter configuration data.

[0114] The model update and simulation execution module 908 is used to perform model simulation, obtain simulation results, and verify the simulation results based on preset technical indicators; when the simulation results do not meet the requirements, feedback information is generated for iterative adjustment of the model structure or parameters.

[0115] The large language model inference engine 910 is used to provide semantic reasoning and generation support for the process of modeling requirement analysis, model structure planning, module selection and parameter determination, and can generate a corrected modeling scheme based on feedback information.

[0116] The above modules can be implemented in software, hardware, or a combination of both. The modules communicate with each other through a data interface.

[0117] Through the collaborative work of the above modules, the entire process of building an executable simulation model, from user semantic input to automatic optimization, is automated.

[0118] Based on the above method or system embodiments, this application also provides a computer device, such as... Figure 10 As shown, the computer device may include: a processor 1001, a memory 1002, an input / output interface 1003, a communication interface 1004, and a system bus 1005, with each component connected through the system bus 1005.

[0119] The processor 1001 is configured to execute a computer program stored in the memory to implement the method steps described in any of the foregoing embodiments; The processor can be a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or other programmable logic devices.

[0120] Memory 1002 is used to store computer programs and related data; The memory may include volatile memory and / or non-volatile memory, such as random access memory (RAM), read-only memory (ROM), solid-state drive (SSD), flash memory and other non-volatile storage media; In one embodiment, the memory stores a computer program that, when executed by the processor, implements the method according to any one of claims 1 to 8.

[0121] The input / output interface 1003 is used for data interaction with external devices, including but not limited to: keyboard, monitor, mouse, touch device and other input / output terminals.

[0122] Communication interface 1004 is used for data communication with external networks or servers; The communication interface can support wired or wireless communication methods, including but not limited to: Ethernet, Wi-Fi, Bluetooth, and cellular network communication.

[0123] The system bus 1005 is used to connect various functional modules and realize data transmission and control signal interaction.

[0124] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0125] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for automatically constructing a visual modeling and simulation model based on a large language model, characterized in that, At least the following steps are included: Step 102: Construct a set of modeling resources to assist in the automatic generation of models, wherein the set of modeling resources includes at least: (1) Modeling module library, which provides model building units. Each modeling module includes module identification information, parameter attribute information, port semantic information and functional description information; (2) Modeling template library, which provides a unified text expression template for the model. The template is used to define the text description format of module structure, module parameters, module connection relationship and simulation configuration parameters; (3) Modeling case library, which provides structured historical simulation model data and corresponding model description information. Step 104: Receive the modeling information and requirement text provided by the user; Step 106: Determine whether the modeling information provided by the user contains an existing model. If yes, proceed to step 108; otherwise, proceed to step 110. Step 108: Parse the existing model file, extract the module structured description data, structured connection description data and simulation configuration data, and generate the existing model data in text form based on the predefined model expression rules in the modeling template library; Step 110: Based on the modeling requirement text, and when existing model data exists, combine the parsed model data, call the large language model to perform semantic reasoning and modeling planning, and generate a modeling planning scheme for the target model. Step 112: Based on the modeling planning scheme, select the corresponding module type from the modeling module library, determine the parameter configuration and layout position of each module, and generate the module structure description data of the target model; Step 114: Generate port identifiers and port attribute data for each module based on the module port semantic information and the modeling planning scheme information, determine the signal connection relationship between each module, and generate structured connection description data corresponding to the target model; Step 116: Determine the simulation operation parameters based on the modeling requirements and generate the corresponding simulation configuration data; Step 118: Automatically generate modeling script code based on the module structured description data, structured connection description data, and simulation configuration data; Step 120: Call the visualization modeling software interface to execute the modeling script code to generate or update the simulation model; Step 122: Determine whether the model is running correctly and meets the technical requirements. If yes, end the process; otherwise, send error information or simulation optimization information to step 110.

2. The method according to claim 1, characterized in that: The modeling module library mentioned in step 102 includes a simple module library and a detailed module library, wherein: (1) The simplified module library includes module identification information and core semantic feature information for quick module filtering, which are used to generate a set of candidate modules based on the modeling requirements text; (2) The detailed module library includes complete parameter attribute information and modeling rule information corresponding to the candidate module, which is used to obtain the complete modeling data of the corresponding module after the candidate module is determined.

3. The method according to claim 1, characterized in that: Step 108, parsing the existing model file, includes at least: (1) Parse the format of the input modeling file and unpack the data to extract the basic data resources of the model; (2) Search the module library based on the module identifier to obtain the usage method of the corresponding module; (3) Extract model simulation parameter information from the unpacked model file; (4) Extract module structure description data and inter-module connection description data from the unpacked model file; (5) The extracted model simulation parameter information, module structure description data and inter-module connection description data are integrated according to the predefined format in the modeling template library and converted into a unified model data format; (6) Based on the unified model data, call the large language model to generate the corresponding model description; (7) Encapsulate the model description, unified model data and related information and store them in the case library.

4. The method according to claim 1, characterized in that: In step 110, semantic parsing and structural reasoning are performed based on the modeling requirement text, and a large language model is invoked to generate the modeling planning scheme information, which includes at least: (1) Based on the modeling requirement text, retrieve relevant module information from the modeling module library, obtain model organization rules from the modeling template library, and combine them with historical modeling data from the case library; (2) Generate a modeling scheme based on the modeling requirement text, the module information, the model organization rules and historical modeling data.

5. The method according to claim 1, characterized in that: In step 112, the large language model is called according to the preset spatial layout rules to determine the generation location of each module instance, including at least: (1) Based on the modeling and planning scheme, a search is conducted in the simplified module library to determine the candidate module set; (2) For the candidate module set, retrieve the usage method of the corresponding module in the detailed module library; (3) Determine the parameter configuration of each module in the target model based on the target functional requirements and module attribute information; (4) Determine the spatial coordinate information of each module according to the relationship between modules and the preset spatial arrangement rules.

6. The method according to claim 1, characterized in that: Step 114 includes: (1) Based on the predefined interface naming rules in the modeling template library, the input ports and output ports of each module are numbered to generate a set of module port identifiers; (2) Based on the set of module instances and the set of module port identifiers, determine the connection method between modules and generate structured connection description data.

7. The method according to claim 1, characterized in that: In step 118, modeling scripts are automatically generated based on module structured description data, structured connection description data, and simulation configuration data through preset script mapping rules or large language models. The modeling script includes at least: (1) Module creation instructions; (2) Parameter configuration instructions; (3) Module connection instructions; (4) Simulation parameter setting instructions. The modeling script automatically completes model building or updating after execution.

8. The method according to claim 1, characterized in that: In step 122, when the model operation does not meet the technical requirements, the running error information or simulation optimization information that does not meet the performance indicators is fed back to the large language model, and the modeling planning scheme and modeling parameters and other modeling information are iteratively optimized in combination with the error information to regenerate the updated modeling planning scheme.

9. An automatic construction system for visual modeling and simulation models based on large language models, characterized in that, At least including: (1) User input module, used to receive modeling requirement text or existing model file; (2) Modeling resource management module, used to build and maintain modeling module library, modeling template library and modeling case library; (3) Model parsing module, used to parse existing models and generate structured description data; (4) Modeling and reasoning module, including a large language model reasoning engine, used to perform semantic parsing and modeling planning; (5) Model generation module, used to generate module structure, connection relationship and simulation configuration data; (6) Execution module, used to generate and execute modeling scripts to create or update simulation models.

10. A computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the method of any one of claims 1 to 8.