A sysml v2 model code ai generation control method and device

By selecting a target model and utilizing natural language information and code correction guidance, semantic and syntactic errors in the generation of SysML v2 model code from a large language model were resolved, resulting in code that conforms to the specifications.

CN122152320APending Publication Date: 2026-06-05BEIJING AERONAUTIC SCI & TECH RES INST OF COMAC +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING AERONAUTIC SCI & TECH RES INST OF COMAC
Filing Date
2026-02-03
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing large language models contain numerous semantic and syntactic errors when generating SysML v2 model code, making the code unusable for engineering practice.

Method used

By selecting a target model from candidate AI large language models, natural language information is established, SysML v2 model code is generated, and errors are corrected through verification and code correction guidance information to ensure that the code conforms to the specifications.

Benefits of technology

It achieves the generation of correct SysML v2 model code from large language models, avoids the illusion problem in code generation, and ensures that the code conforms to the SysML v2 specification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152320A_ABST
    Figure CN122152320A_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a SysML v2 model code AI generation control method, comprising: determining a target model for generating a SysML v2 model code from each candidate AI large language model, and establishing natural language information for describing a SysML v2 model modeling task; making each target model generate a SysML v2 model code according to the natural language information, and acquiring model codes output by each target model; after acquiring the model codes output by each target model each time, verifying whether the model codes acquired this time conform to specifications; if none of the model codes acquired this time conforms to the specifications, generating code correction guide information according to error conditions of the model codes acquired this time, and instructing each target model to generate new SysML v2 model codes according to the code correction guide information; if one or more model codes output by the target model in the model codes acquired at a certain time conform to the specifications, determining a target code corresponding to the SysML v2 model modeling task from the model codes conforming to the specifications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of systems engineering technology, and in particular to a SysML v2 model code AI generation control method and apparatus. Background Technology

[0002] Currently, with the continuous increase in system complexity, the expanding scope of stakeholders, and the extreme compression of schedules and costs due to competition, higher demands are being placed on the methods and means of developing complex systems. To address the technical implementation and organizational management of complex systems, domestic and international complex system development organizations, represented by aerospace, are actively applying model-based systems engineering (MBSE) methods to empower their development work.

[0003] The core output of the MBSE method is a centrally stored, clear, and consistent system model. To support MBSE in enabling the development of complex systems, the International Council on Systems Engineering (INCOSE) and the Object Management Group (OMG) proposed a general standard for systems engineering, "Systems Modeling Language" (SysML), based on the UML unified modeling language. After more than a decade of development and application, the "three pillars" of the MBSE methodology, SysML language, and SysML modeling tools have become one of the standard solutions for applying the MBSE method to the development of complex systems.

[0004] In July 2025, the Object Management Group (OMG) officially approved SysML v2. Compared to v1.x, v2 adds a "Textual Notation" model representation, supporting the construction of SysML models through code, forming a precise semantic syntax based on code, and making up for the shortcomings of SysML v1.x. For ease of understanding, "Textual Notation" will be referred to as "model code" below.

[0005] Currently, with the rapid development of artificial intelligence technology, various large-scale AI models have emerged both domestically and internationally, capable of processing natural language and completing various tasks based on user-written natural language requirements. Among these, the ability to generate code based on natural language, i.e., AI for coding, is a capability possessed by many large-scale models.

[0006] Specifically, large language models (LLMs) are neural networks used to understand, generate, and respond to human-like text. Leveraging their text generation capabilities, LLMs can assist designers of complex systems in generating code for programming languages. Based on LLMs, they understand and process development needs based on natural language, enabling code generation and modification, thus assisting programmers in their work.

[0007] While using large language models to generate code has become a common practice in AI-enabled complex system design processes, such as generating semantically correct Java and Python code, directly requiring large language models to generate SysML v2 model code results in various errors due to the complexity of their inherent logic and semantic syntax. These errors, such as semantic and syntactic errors, render the generated SysML model code unusable in engineering practice.

[0008] For example, the SysML v2 model code generated by the large language model is as follows: Figure 1 As shown, it contains a large number of error messages, such as Figure 2 As shown. Summary of the Invention

[0009] This specification provides a SysML v2 model code AI generation control method and apparatus to solve the technical problem of how to use AI to generate SysML v2 model code.

[0010] To solve the above-mentioned technical problems, the embodiments of this specification provide the following technical solutions: This specification provides an embodiment of a SysML v2 model code AI generation control method, the method comprising: From the candidate AI large language models, the target model for generating SysML v2 model code is determined, and natural language information is established to describe the SysML v2 model modeling task. Each target model generates SysML v2 model code based on the natural language information, and the model code output by each target model is obtained. After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications. If none of the model codes obtained this time conform to the specifications, code correction guidance information will be generated based on the error situation of the model codes obtained this time, and each target model will be instructed to generate new SysML v2 model code according to the code correction guidance information. If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.

[0011] Preferably, the natural language information includes role positioning information, modeling specification information, and modeling requirement information.

[0012] Preferably, the role positioning information is used to define the role of the target model; And / or, The modeling specification information is used to define the modeling specifications that the target model needs to follow; And / or, The modeling requirements information is used to specify the modeling requirements that the target model must follow.

[0013] As a preferred option, the target models selected from the candidate AI large language models for generating SysML v2 model code include: Based on the optimization and / or functional integration and / or usage limitations of each candidate AI large language model, the target model for generating SysML v2 model code is determined from among the candidate AI large language models.

[0014] As a preferred approach, the code correction guidance information generated based on the error characteristics of the model code obtained this time includes: For each error type in the model code obtained this time, corresponding code correction guidance information will be generated.

[0015] Preferably, the code correction guidance information includes code correction prompts and model code examples.

[0016] Preferably, the code correction prompts include errors present in the model code obtained this time.

[0017] Preferably, for each error type in the model code obtained this time, the model code example includes a correct code example corresponding to that error type.

[0018] Preferably, the model code examples are selected from a model code library; The method further includes: Add the model code that conforms to the specifications to the model code library.

[0019] This specification provides an embodiment of a SysML v2 model code AI generation control device, the device comprising: The task representation module is used to determine the target model for generating SysML v2 model code from among the candidate AI large language models, and to establish natural language information to describe the SysML v2 model modeling task. The code control module is used to enable each target model to generate SysML v2 model code based on the natural language information, and to obtain the model code output by each target model. After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications. If none of the model codes obtained this time conform to the specifications, code correction guidance information will be generated based on the error situation of the model codes obtained this time, and each target model will be instructed to generate new SysML v2 model code according to the code correction guidance information. If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.

[0020] The above-described at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects: The above technical solution enables large language models to understand the errors and problems in their generated code, allowing them to quickly correct erroneous code into correct code, minimizing the illusion problem that occurs when large language models generate code, and achieving the generation of correct SysML v2 model code by large language models. Attached Figure Description

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

[0022] Figure 1 This is a schematic diagram of the SysML v2 model code generated by a large language model in the existing technology.

[0023] Figure 2 This is a diagram illustrating errors in SysML v2 model code generated from a large language model in existing technologies.

[0024] Figure 3 This is a flowchart illustrating the SysML v2 model code AI generation control method provided in the first embodiment of this specification. Detailed Implementation

[0025] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments involved in the specific implementation are only a part of the embodiments of this application, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments in the specific implementation without creative effort should fall within the protection scope of this application.

[0026] The first embodiment of this specification (hereinafter referred to as "Embodiment 1") provides a SysML v2 model code AI generation control method. The execution subject of Embodiment 1 includes, but is not limited to, a terminal, a server, an operating system, or an application. That is, the execution subject can be diverse and can be set, used, or changed as needed. In addition, a third-party application can also assist the execution subject in executing Embodiment 1. For example, the SysML v2 model code AI generation control method in Embodiment 1 can be executed by a server, and a corresponding application can be installed on a terminal (which can be held by a user). Data can be transmitted between the terminal or the application and the server, thereby assisting the server in executing the SysML v2 model code AI generation control method in Embodiment 1.

[0027] refer to Figure 3 The SysML v2 model code AI generation control method provided in Example 1 includes: S101: Determine the target model for generating SysML v2 model code from the candidate AI large language models, and establish natural language information to describe the SysML v2 model modeling task; In Example 1, multiple large AI language models can be used as candidate large AI language models for generating SysML v2 model code, and the target model for generating SysML v2 model code can be determined from each candidate large AI language model. The target model may be one or more, as is the case in Example 1.

[0028] The following examples illustrate the available rules for determining the target model: 1. Optimization Status Based on various candidate AI large language models, priority is given to AI large language models optimized for code generation tasks, especially those optimized for code generation tasks in the recent period (the definition of "recent period" is not limited), as the target models. The target models selected in this way have enhanced capabilities in the code generation domain during training and are more suitable for performing code generation tasks than general versions of large models.

[0029] However, Example 1 specifically points out that SysML v2 is currently not included in the pre-training scope of various AI large language models.

[0030] 2. Functional integration status Based on the various candidate AI large language models, the AI ​​large language model integrated with the code development tool is selected as the target model (the "target model" in Example 1 refers to the "AI large language model" used to generate SysML v2 model code, and the "model code" refers to the SysML v2 model text code generated by the AI ​​large language model) in order to improve the quality of code generation.

[0031] 3. Usage restrictions Based on the candidate AI language models, priority is given to selecting AI language models that support uploading multiple model code snippets as attachments and / or support sysml / txt or other text formats as target models to facilitate subsequent uploading of model code examples. Furthermore, priority is given to AI language models that support a large number and size of uploaded files as target models.

[0032] The selection of the target model can adopt one or more of the above rules, or other suitable rules, as is the case in Example 1.

[0033] In Example 1, natural language information can be established to describe the SysML v2 modeling task. Preferably, the natural language information includes role positioning information, modeling specification information, and modeling requirement information, which are explained below: Role positioning information: This defines the role of the target model. Role positioning information helps large language models understand their role in generating SysML v2 model code, enabling them to better perform SysML v2 model code generation tasks. For example, role positioning information could be: You are a systems engineer proficient in the MBSE methodology, or you are a systems engineer using the MBSE method to model complex systems.

[0034] Modeling specification information: This specifies the modeling standards that the target model must follow. Since the target model cannot directly generate correct, compliant SysML v2 model code, modeling specification information is provided to the target model when describing the modeling task, enabling the target model to generate SysML v2 model code based on this information. For example, modeling specification information may include the standard specification document for SysML v2 code—the "SysML v2 Language Specification" (OMG Systems ModelingLanguage™ (SysML®) Version 2.0 Part 1: Language Specification).

[0035] Modeling requirements information: This specifies the modeling requirements that the target model must follow to guide the generation of SysML v2 model code. It can describe the modeling requirements using common terminology from the MBSE methodology and the SysML v2 specification, clearly expressing the types, names, and relationships of the model elements to be built.

[0036] In Example 1, the aforementioned natural language description information can be automatically generated by the generation program. The generation program generates natural language description information describing the SysML v2 model modeling task, interacts with the user, and submits the user-confirmed natural language description information to each target model. Specifically, the generation program pre-collects modeling task description information (e.g., prompt words) provided by the user, and has a built-in task description template that can interact with the AI ​​large language model. The generation program checks the user-provided modeling task description information, including parsing the information, matching the parsed information with the corresponding positions in the task description template, and checking the completeness of the task description. Based on the completeness check results, for parts required in the task description template but missing from the modeling task description information, the generation program prompts the user to supplement them, or the generation program supplements them and the user confirms, then checks the supplemented modeling task description information again. This checking and supplementation process continues until the check passes. For parts that cannot be parsed, the generation program will automatically or prompt the user to place the unparsed parts in the corresponding positions in the task description template, and then check them. If there are any problems during the check, the user can supplement them according to the above process, or the generation program can supplement them and then the user can confirm them, until the check is passed.

[0037] The generation program can display the approved modeling task description information to the user for confirmation. After confirmation, it is used as the aforementioned natural language description information and transmitted to each target model for SysML v2 model code generation. If the user believes there are omissions or modifications are needed, the current version is provided for the user to edit freely. During editing, the program can show or hide built-in prompt templates for the user's reference. After the user completes the editing, the generation program checks again. If any problems are found during the check, the user can supplement them according to the above process, or the generation program can supplement them and then the user can confirm them, until the check is passed. After that, it is used as the aforementioned natural language description information and transmitted to each target model for SysML v2 model code generation.

[0038] The generated natural language description information can be concentrated in a single file (called the modeling task description file), or the modeling task description file can contain descriptions of modeling specification information (such as the descriptions of storage location or specification version below). The specific content of the modeling specification information can be another file (called the modeling specification file), such as a file like the "SysML v2 Language Specification". The modeling specification file can be directly input or automatically generated by the generation program and then uploaded to the target model. Alternatively, the local disk location where the modeling specification file is stored can be described in the natural language description information so that the target model can retrieve the modeling specification file according to its storage location. Or, if the modeling specification file contains standard text, only the specification version of that standard text can be described in the modeling task description file, and the target model can retrieve that specification version online or through other means.

[0039] Below is a template example for using natural language information to describe SysML v2 modeling tasks: Role positioning information and compliance information: You are a systems engineer proficient in MBSE methodology. Please follow the "SysML v2 Language Specification" (OMG Systems Modeling Language™ (SysML®) Version 2.0 Part 1: Language Specification) document provided in the attachment or specified location, and generate model code that conforms to the SysMLv2 specification according to the following requirements.

[0040] Modeling requirements: #Architecture (part) Define the overall architecture of the XXX system / subsystem / or XX object: The architecture should include parts named "AAA", "BBB", ... "ZZZ"; decompose each of the established "AAA", "BBB", ... "ZZZ" parts into different parts.

[0041] #Attribute Define attributes for the XXX system / subsystem / or XX object, including attributes named "a", "b", ..., "z". The unit for attribute "a" is "xx", the unit for attribute "b" is "yy", and so on.

[0042] #action Define actions for the XXX system / subsystem / or XX object, including actions named "xx".

[0043] #State Define the state of the XXX system / subsystem / or XX object.

[0044] Referencing this state, we have instances named "a", "b", ..., "z". State "a" contains sub-states named "a1", ..., "aN". We define properties named "x", "y", ..., "z".

[0045] When in state "a", it first enters sub-state "a1". If attribute "x" is satisfied as a state transition condition, it transitions from sub-state "a1" to sub-state "a2". If attribute "y" is satisfied as a state transition condition, it transitions from sub-state "a2" to sub-state "a3", and so on.

[0046] #Constraint Define constraints for the XXX system / subsystem / or XX object.

[0047] Reference constraint definitions and instantiate constraints named "x", "y", ..., "z".

[0048] #Requirement Define the requirements for the XXX system / subsystem / or XX object.

[0049] Referencing the requirement definition, instantiate requirements named "R1", "R2", ... "RN". These requirements define attributes named "a", "b", ... "z". The unit for attribute "a" is "xx", the unit for attribute "b" is "yy", and so on. This requirement is associated with a constraint named "x".

[0050] #Relationships (interface / port / connection) Define the interface, port, and connection of the XXX system / subsystem / or XX object.

[0051] Referencing the interface definition (interface def), instantiate the interface "a", "b", ... "z" between the XXX system / subsystem / or XX object.

[0052] Referencing the port definition (port def), instantiate ports “a1”, “b1”, …, “z1” on the XXX system / subsystem / or XX object, and instantiate ports “a2”, “b2”, …, “z2” on the YYY system / subsystem / or YY object.

[0053] Referencing the connection definition (connection def), instantiate the connection relationship between the XXX system and the YYY system, connecting port "a1" on the part named "AAA" with port "a2" on the part named "BBB", with the port direction being from "a1" to "a2".

[0054] As shown in the template above, there may be multiple types or items that can be used as modeling requirement information. Depending on the needs of the modeling task, one or more can be selected as the actual modeling requirement information.

[0055] Below are specific examples of natural language information used to describe SysML v2 modeling tasks: Example 1: Natural language information for a SysML v2 modeling task describing the architecture and attributes of a drone, as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the Sysml v2 specification according to the following requirements.

[0056] #Architecture Define the overall architecture of a hydrogen-powered multi-rotor UAV: ​​including the "hydrogen power plant" that embodies the characteristics of hydrogen-powered UAVs, as well as the "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system", and "UAV payload"; #property Define the overall key attributes of the hydrogen-powered multi-rotor drone, including "endurance," "range," "flight altitude," "flight speed," "airframe dimensions," "payload mass," "rate of climb," "reliability," and "economic cost." Note: Specific numerical values ​​and units are not required for the aforementioned attributes; only the attributes themselves are displayed. #relation Each part of the established system, including "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system" and "UAV payload", is decomposed into different parts.

[0057] Example 2: Natural language information for a SysML v2 modeling task describing the architecture, attributes, and interface relationships of a drone. The content is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the Sysml v2 specification according to the following requirements.

[0058] #Architecture Define the overall architecture of the hydrogen-powered multi-rotor UAV: ​​including the "hydrogen power plant" which reflects the characteristics of hydrogen-powered UAVs, as well as the "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system", and "UAV payload". Define the three attributes of each of the above architecture components.

[0059] #interface Based on the architecture definition results, define interface 1 on the "flight control system", interface 2 on the "communication link system", and interface 3 on the "UAV ground station and mission planning system".

[0060] #relation Connect interface 1 to interface 2, connect interface 2 to interface 3, and connect interface 3 to interface 1.

[0061] Example 3: Natural language information for a SysML v2 modeling task describing the state of a drone, as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the Sysml v2 specification according to the following requirements.

[0062] #States and Nesting Define a state named "drone state" (state def); The state definition (state def) of "drone state" is referenced, and the states (state) of "drone stationary" and "drone mission flight" are instantiated (usage). Under the state of "drone mission flight", sub-states named "self-check", "climb", "hover" and "descent" are nested.

[0063] #property Define attributes named "Takeoff and Climb", "Hovering Command", "Descent Command", and "Return Command".

[0064] #State Transition When in the "UAV mission flight" state, it first enters the "self-check" sub-state. If the attribute "take-off and climb" is met as the state transition condition, it transitions from the "self-check" sub-state to the "climb" sub-state; if the attribute "hover command" is met as the state transition condition, it transitions from the "climb" sub-state to the "hover" sub-state; if the attribute "descent command" is met as the state transition condition, it transitions from the "hover" sub-state to the "descent" sub-state; if the attribute "return command" is met as the state transition condition, it transitions from the "descent" sub-state to the "self-check" sub-state.

[0065] Example 4: Natural language information used to describe the SysML v2 modeling task for scientific research and exploration vessels, as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements, and save it as a brand new sysml format file.

[0066] #Architecture and Nesting Define a part def named "Structure of Oceanographic Research Vessel"; The part def of "Oceanographic Research Vessel Architecture" is referenced, and the parts named "Navigation and Positioning System", "Command and Control System", "Ship Power Plant", "Communication Link", "Meteorological Observation Device", "Scientific Research Device", "Crew Living Space", and "Ship Transport Payload" are instantiated. #property Based on the characteristics of each part, including "Navigation and Positioning System", "Command and Control System", "Ship Power Plant", "Communication Link", "Meteorological Observation Device", "Scientific Research Device", "Crew Living Space", and "Ship Transport Load", please define three relevant attributes for each part. Each attribute does not need a unit.

[0067] #port Define a port def named "architectural component port", and define an attribute named "instruction" under port. The port def for “architectural component port” is used to instantiate a port named “command port 1” on the “command and control system” (part), define a port named “command port 2” instantiated on the “ship power plant”, and instantiate a port named “command port 3” on the “communication link” (part).

[0068] #Interface Relationships Define an interface def named "interface relationship", and under this interface: Connect the "Command Port 3" on the "Communication Link" (part) to the "Command Port 3" on the "Command and Control System" (part); Connect the "Command Port 3" on the "Command and Control System" (part) to the "Command Port 2" on the "Ship Propulsion System" (part).

[0069] Example 5: Natural language information for the SysML v2 modeling task used to describe the state of new energy vehicles, the content of which is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements, and save it as a new file.

[0070] #States and Nesting Define a state named "New Energy Vehicle State" (state def); The state definition of "new energy vehicle status" is referenced (state def), and the states of "vehicle parked and stopped" and "vehicle running" are instantiated (usage). Under the "vehicle running" state (state), sub-states named "self-check start", "acceleration running", "turning" and "deceleration running" are nested.

[0071] #property Define attributes named "Acceleration Command", "Brake Deceleration Command", "Steering Command", and "Steering Return to Center".

[0072] #State Transition When the vehicle is in the "vehicle parked and stopped" state, it first enters the "self-check start" sub-state. If the attribute "acceleration command" is met as the state transition condition, it transitions from the "self-check start" sub-state to the "acceleration operation" sub-state. If the attribute "braking deceleration command" is met as the state transition condition, it transitions from the "acceleration operation" sub-state to the "deceleration operation" sub-state. If the attribute "steering command" is met as the state transition condition, it transitions from the "deceleration operation" sub-state to the "turning" sub-state. If the attribute "steering return to center" is met as the state transition condition, it transitions from the "turning" sub-state to the "acceleration operation" sub-state.

[0073] It should be noted that the natural language description information can be created by the user or generated by the execution subject of Implementation Example 1 through user operation.

[0074] S103: Enable each target model to generate SysML v2 model code based on the natural language information, and obtain the model code output by each target model; After constructing natural language information to describe the SysML v2 modeling task, the natural language information can be provided to each target model, enabling each target model to perform modeling based on the natural language information, execute the generation of SysML v2 model code, and then obtain the model code generated or output by each target model.

[0075] If the natural language description information is concentrated in the modeling task description file, the modeling task description file can be directly uploaded to each target model; if a modeling specification file also exists, both the modeling task description file and the modeling specification file can be uploaded to each target model; if the local disk location where the modeling specification file is stored is described in the natural language description information, each target model can obtain the modeling specification file according to the storage location; if only the specification version of the standard text is described in the modeling task description file, each target model can obtain the specification version online or through other means.

[0076] S105: After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications; After obtaining the model code output by each target model, it can be verified whether the obtained model code conforms to the specifications. That is, the model code output by each target model is verified separately to check whether it conforms to the specifications.

[0077] Verifying whether the obtained model code conforms to the specifications may include: verifying whether the semantics of the obtained model code conforms to the specifications.

[0078] For example, a SysML v2 semantic and syntactic validation tool can be created. Once configured, this tool can automatically connect to various target models, automatically obtain the model code output by each target model, and perform semantic and syntactic validation and checks on the output model code of each target model against the tool's built-in SysML v2 language specification. As an example, it can return "pass" for model code that conforms to the specification and "fail" for model code that does not conform, and provide a detailed list of semantic and syntactic errors presented to the user.

[0079] S107: If none of the model codes obtained this time conform to the specifications, then generate code correction guidance information based on the error situation of the model codes obtained this time, and instruct each target model to generate new SysML v2 model code according to the code correction guidance information; If the model code of each target model obtained in this study does not conform to the specifications, then for each target model, the errors in the output model code of that target model will be identified and recorded, and code correction guidance information will be generated based on the errors in the model code.

[0080] In practice, model code may contain various types of errors. Preferably, the code correction guidance information generated based on the error characteristics of the acquired model code includes: generating corresponding code correction guidance information for each type of error in the acquired model code.

[0081] Preferably, the code correction guidance information includes code correction prompts and model code examples.

[0082] The following is a further explanation: As mentioned above, model code can contain various types of errors, such as: #Reference Error: Some model code requires the inclusion of external resource libraries, such as the unit of attributes, etc. The visibility of the referenced files should be clearly defined, such as public for public visibility or private for private visibility.

[0083] #Keyword definition error: This is the most common error when generating code from the target model. Because the target model does not understand the SysML specification, or its understanding of the specification is incomplete, keywords that do not conform to SysML coding standards are used when defining model elements, resulting in fundamental errors in the code and rendering it unusable.

[0084] #Unit definition error: This is a common error when generating attributes in the target model. It occurs because the target model does not understand the SysML specification and uses a definition method that does not conform to SysML coding standards.

[0085] # Nested usage error: Because the target model does not understand the SysML specification, it uses a nested keyword usage method that does not conform to the SysML coding style.

[0086] # Symbol usage error: Because the target model does not understand the SysML specification, it uses symbols that do not conform to the SysML code style.

[0087] 1. For each target model, generate corresponding code correction prompts for each type of error in the generated model code. These prompts should include the specific errors present in the generated model code. For example: For reference errors, the code correction message indicates the error content, whether it is a reference visibility error (such as undefined) or a referenced file error.

[0088] If a keyword definition is incorrect, the code correction message will indicate which keyword definition is incorrect.

[0089] When there is a unit definition error, the code correction message indicates which part of the unit definition has a problem.

[0090] For nesting errors, the code correction prompts indicate which keywords can be nested and which part of the current code contains incorrect keyword nesting.

[0091] For errors in symbol usage, the code correction message indicates which part of the symbol is causing the problem.

[0092] Below is a specific example of using code to correct prompt words: Example 1: The corrective code message indicating "There is an error in the use of state transitions and transition conditions" is as follows: The code you provided contains errors in the use of state transitions and transition conditions. Please refer to the attached file I uploaded, modify the code, and regenerate it.

[0093] Example 2: Point out the corrected code prompts for "part definition and usage, attribute definition and usage", as follows: The code you provided contains errors in the definition and usage of `part` and `attribute`. Please refer to the attached file I uploaded, modify the code, and regenerate it.

[0094] Example 3: Provide corrective code hints for "model definition, state definition, state nesting, and state transitions," as follows: The code you provided contains errors in model definition, state definition, state nesting, and state transition. Please refer to fig3-uav_state_machine.sysml (this is a model code example) to correct and optimize it, regenerate the code, and save the generated code to a new file.

[0095] Example 4: The corrective code message for "part definition keyword error" is as follows: The code you provided contains an error in the keyword used in the part definition. Please refer to fig1-architect.sysml (this is a model code example) to correct and optimize it, regenerate the code, and save the generated code to a brand new file.

[0096] In Example 1, a code correction guidance program was constructed. This program generates code correction prompts, interacts with the user, and submits confirmed code correction prompts to the target model. Specifically, the program first collects code correction instructions described by the user. The program has a built-in complete code correction template that can interact with the target model. The program checks the received code correction instructions, including parsing the instructions, matching the parsed natural language with the corresponding positions in the code correction template, and checking the completeness of the instructions. Based on the completeness check results, for parts required in the code correction template but missing from the instructions, the program prompts the user to supplement them, or the generation program supplements them and the user confirms them. The supplemented instructions are then checked again. This checking and supplementation process continues until the check passes. For parts that cannot be parsed, the program automatically or prompts the user to place the unparsed parts in the corresponding positions in the code correction template, and then checks them again. If any problems are found during the check, the user supplements them according to the above process, or the generation program supplements them and the user confirms them, until the check passes.

[0097] The program can display the approved code correction instructions to the user for confirmation. After confirmation, the program will send the corrected code correction prompts, as part of the code correction guidance information, to each target model for SysML v2 model code correction. If the user believes there are omissions or modifications are needed, the current version will be provided for the user to edit freely. During editing, the program's built-in code correction prompt templates can be shown or hidden for the user's reference. After the user completes the editing, the program will check again. If any problems are found during the check, the user can supplement the information according to the above process, or the generation program can supplement it and then the user can confirm it, until the check passes and the corrected code correction prompts are sent to each target model for SysML v2 model code correction.

[0098] 2. For each target model, for each type of error in the generated model code, a corresponding model code example is generated. This model code example includes a correct code example (i.e., a correct code snippet) corresponding to that error type. For example: For incorrect references, generate a model code example with correct references (i.e., a correct code example).

[0099] If the keyword definition is incorrect, generate a model code example with the correct keyword definition (i.e., a correct code example).

[0100] If the unit definition is incorrect, generate a model code example with the correct unit definition (i.e., a correct code example).

[0101] For incorrect nesting, generate a model code example with correct nesting (i.e., the correct code example).

[0102] If a symbol is used incorrectly, generate a model code example that uses the correct symbol (i.e., the correct code example).

[0103] Example 1 proposes that the following principles should be followed when generating model code examples: (1) Semantic and syntactic correctness. The primary criterion is that the semantics and syntax are correct and conform to the SysMLv2 specification version to which the generated model code is adapted. When generating model code examples, a script tool can be used to connect to the model code library and select the corresponding code from the accumulated model code library as model code examples. Since the code in the model code library has been verified, the semantics and syntax are correct.

[0104] (2) Strong Error Correlation. The script tool can compare the code types in the model code library and select model code that is consistent with or similar to the error types identified by the semantic and syntactic verification tool as model code examples. The type of the model code example should be consistent with or related to the error type of the model code generated by the target model. The number of candidate code fragments selected by the script can be set and configured by the user according to the remaining space in the model code library. For example, if the keyword definition is incorrect, the script provides the code with the correct keyword definition for the target model to refer to and correct the code. If there are multiple errors, multiple case code examples can be provided to clearly indicate which model code example corresponds to which error, providing a complete context for the target model to learn and understand.

[0105] (3) Streamline code size. For the same error type, there may be multiple code snippets that can be used as model code examples. The script tool will prioritize selecting code snippets with fewer labels and shorter code lengths from the model code library as model code examples, so as to use as few clear codes as possible and focus on the error of the target model, making it easier for the target model to quickly understand and correct the error by referring to the model code examples.

[0106] The error types and code correction guidance information above are only examples. The actual error content and code correction guidance information are not limited to Example 1.

[0107] For each target model, code correction guidance information (including code correction prompts and model code examples) corresponding to the errors existing in that target model can be generated. After generating the code correction guidance information, the guidance information is provided to the corresponding target model (including by the code correction guidance program described above), instructing the target model to generate new SysML v2 model code based on the guidance information. Specifically, for each target model, the code correction prompts corresponding to that target model can be compiled into a single file and provided to that target model; and / or the model code examples corresponding to that target model can be compiled into a single file and provided to that target model.

[0108] S109: If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.

[0109] As described above, after obtaining the model code output by each target model, if none of the output model code conforms to the specifications, code correction guidance information is generated as above to guide each target model in generating new SysML v2 model code, and the newly generated model code is then verified to ensure it conforms to the specifications. Therefore, if one or more of the output model codes from a given set of target models conform to the specifications, the target code corresponding to the SysML v2 model modeling task can be determined from these conforming model codes. For example, the conforming model code output by one or more target models can be used as the target code. The following explains the different scenarios: Scenario 1: Only one target model outputs model code that conforms to the specification. In this case, the model code output by the target model is used as the target code corresponding to the SysML v2 model modeling task mentioned above.

[0110] Scenario 2: The model code output by multiple target models conforms to the specifications. In this case, the target code corresponding to the SysML v2 model modeling task mentioned above is determined from the model codes output by these multiple target models. The available rules for determining the target code are explained below: (1) Accuracy. Due to the different capabilities of various AI large language models, in addition to ensuring no semantic or syntactic errors, it is necessary to select which target model(s) output model code that does not generate model code beyond the aforementioned natural language description information. That is, if the natural language information requires the completion of three tasks A, B, and C, and the generated model code also happens to complete these three tasks without generating unnecessary model content, or generating only a small amount within a tolerable range, such model code should be given priority as the target code.

[0111] (2) Conciseness. Due to the different pre-training datasets, the coding styles of different AI large language models also differ. When the semantics and syntax are correct and the tasks in natural language information are completed (i.e., satisfying the above accurate rules), model code with fewer lines of code and more direct definition methods should be selected to improve readability and reduce the complexity of users reading and maintaining model code. Especially for complex systems with a large amount of code, the conciseness of each piece of code can save a considerable number of lines of code and volume, thereby indirectly improving the efficiency of the system and computing devices in executing the code.

[0112] (3) Decoupling. For model code generation tasks in complex scenarios, multiple model code files may be generated and reference each other. Therefore, when creating model code files and defining and declaring functions, variables, etc., decoupling is required. The complex model code is divided into multiple different model code fragments or files according to different functions (functionalities) to achieve decoupling at the model code level, thereby improving readability and reducing the difficulty of subsequent modification and maintenance of model code.

[0113] The selection of target code can adopt one or more of the above rules, or other suitable rules, as is the case in Example 1.

[0114] In Example 1, the target code can be saved as a target code file of a SysML v2 model that conforms to the aforementioned modeling task. For example, the model code that conforms to the specifications required by engineering practice can be saved as model data.

[0115] Preferably, various correct model codes can be stored in the aforementioned model code library. Furthermore, all compliant model codes output by the target model can be added to the model code library so that when generating similar models later, model code examples can be selected or extracted from the library.

[0116] Multiple practical verifications have proven that Example 1 can control the generation of SysML v2 model code that conforms to the specification. The following describes some of the practical verification results: Verification 1: Unmanned Aerial Vehicle Architecture Model (i.e., Modeling Task) Using TraeCN, a development tool that integrates large AI models, select "Alibaba Cloud Large Model Qwen-3-Coder" as the target model, create a new dialogue, and input natural language information to describe the SysML v2 model modeling task.

[0117] The natural language information used to describe the SysML v2 modeling task is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements.

[0118] #Architecture Define the overall architecture of a hydrogen-powered multi-rotor UAV: ​​including the "hydrogen power plant" that embodies the characteristics of hydrogen-powered UAVs, as well as the "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system", and "UAV payload"; #property Define the overall key attributes of the hydrogen-powered multi-rotor drone, including "endurance," "range," "flight altitude," "flight speed," "airframe dimensions," "payload mass," "rate of climb," "reliability," and "economic cost." Note: Specific numerical values ​​and units are not required for the aforementioned attributes; only the attributes themselves are displayed. #relation Each part of the established system, including "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system" and "UAV payload", is decomposed into different parts.

[0119] After the target model generates model code for the first time, it is verified that the semantic syntax of the initially generated model code does not conform to SysML semantic syntax, and there is an error in the use of keywords in the part definition.

[0120] Based on the error types and content of the initially generated model code, corresponding code correction prompts and model code examples are generated to help the target model correct and optimize itself. The model code example correctly defines the architecture model, correctly demonstrates the usage of the `part` keyword and the definition of attributes, is strongly related to the errors in the initially generated model code, and does not involve other unrelated model code. The specific code correction guidance information, based on the definition method, composition content, and usage method, is: "The code you provided contains errors in the keywords used in the `part` definition. Please refer to fig1-architect.sysml for correction and optimization, regenerate the code, and save the generated code to a new file." The model code example corresponding to fig1-architect.sysml is then provided to the target model.

[0121] The newly generated model code for the target model is verified to conform to the SysMLv2 specification and can be converted into a SysML graphical model. The compliant model code is saved as project data, or it can be added to the model code library as a model code example for subsequent correction of large model errors.

[0122] Verification 2: UAV State Model (i.e., Modeling Task) Using TraeCN, a development tool that integrates large AI models, select "Alibaba Cloud Large Model Qwen-3-Coder" as the target model, create a new dialogue, and input natural language information to describe the SysML v2 model modeling task.

[0123] The natural language information used to describe the SysML v2 modeling task is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements.

[0124] #Architecture Define the overall architecture of a hydrogen-powered multi-rotor UAV: ​​including the "hydrogen power plant" that embodies the characteristics of hydrogen-powered UAVs, as well as the "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system", and "UAV payload"; #property Define the overall key attributes of the hydrogen-powered multi-rotor drone, including "endurance," "range," "flight altitude," "flight speed," "airframe dimensions," "payload mass," "rate of climb," "reliability," and "economic cost." Note: Specific numerical values ​​and units are not required for the aforementioned attributes; only the attributes themselves are displayed. #relation Each part of the established system, including "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system" and "UAV payload", is decomposed into different parts.

[0125] After the target model generates model code for the first time, it is verified that the semantics and syntax of the initially generated model code do not conform to SysML semantics and syntax, and there are errors in the use of keywords in the overall model definition, state definition, state nesting, and state transition.

[0126] Based on the error types and content of the initially generated model code, corresponding code correction prompts and model code examples are generated to help the target model correct and optimize itself. The model code example correctly defines the architecture model, correctly demonstrates the definition methods of the overall model definition, state definition, state nesting, and state transition, is strongly related to the errors in the initially generated model code, and does not involve other unrelated model code. The specific code correction guidance information, based on the definition method, composition, and usage method, is: "The code you provided contains errors in model definition, state definition, state nesting, and state transition. Please refer to fig3-uav_state_machine.sysml for correction and optimization, regenerate the code, and save the generated code to a new file." The model code example corresponding to fig3-uav_state_machine.sysml is then provided to the target model.

[0127] The newly generated model code for the target model is verified to conform to the SysMLv2 specification and can be converted into a SysML graphical model. The compliant model code is saved as project data, or it can be added to the model code library as a model code example for subsequent correction of large model errors.

[0128] Verification 3: New Energy Vehicle State Model (i.e., Modeling Task) Verification 3 is conducted based on Verification 2, and is an additional verification of Verification 2.

[0129] Using the same development tool TraeCN that integrates large AI models, we selected "Alibaba Cloud Qwen-3-Coder" as the target model, created a new dialogue, and entered natural language information to describe the SysML v2 model modeling task.

[0130] The natural language information used to describe the SysML v2 modeling task is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements, and save it as a new file.

[0131] #States and Nesting Define a state named "New Energy Vehicle State" (state def); The state definition of "new energy vehicle status" is referenced (state def), and the states of "vehicle parked and stopped" and "vehicle running" are instantiated (usage). Under the "vehicle running" state (state), sub-states named "self-check start", "acceleration running", "turning" and "deceleration running" are nested.

[0132] #property Define attributes named "Acceleration Command", "Brake Deceleration Command", "Steering Command", and "Steering Return to Center".

[0133] #State Transition When the vehicle is in the "vehicle parked and stopped" state, it first enters the "self-check start" sub-state. If the attribute "acceleration command" is met as the state transition condition, it transitions from the "self-check start" sub-state to the "acceleration operation" sub-state. If the attribute "braking deceleration command" is met as the state transition condition, it transitions from the "acceleration operation" sub-state to the "deceleration operation" sub-state. If the attribute "steering command" is met as the state transition condition, it transitions from the "deceleration operation" sub-state to the "turning" sub-state. If the attribute "steering return to center" is met as the state transition condition, it transitions from the "turning" sub-state to the "acceleration operation" sub-state.

[0134] After the target model generates its initial code, its semantics and syntax are verified to conform to the specifications, and it can be converted into a graphical model. The compliant model code can be saved as engineering data or added to a model code repository as an example to correct errors in larger models later.

[0135] Verification 3 demonstrates that, after implementing model code generation control, including the aforementioned modifications and optimizations, on the target model through Verification 2, and generating compliant SysML v2 model code for a specific modeling task, when the target model is further instructed to generate model code for the same modeling task (the UAV state model in Verification 2 and the new energy vehicle state model in Verification 3 have similar modeling requirements and belong to the same modeling task), the target model can generate compliant SysML v2 model code in one go. This illustrates that after implementing model code generation control on the target model using the method described in Example 1, the target model can continuously produce correct SysML v2 model code for the same modeling task.

[0136] Verification 4: Unmanned Aerial Vehicle Architecture Model (i.e., Modeling Task) Select the DeepSeek v3.1 web-based large model as the target model, create a new dialogue, and enter natural language information to describe the SysML v2 model modeling task.

[0137] The natural language information used to describe the SysML v2 modeling task is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the SysML v2 specification according to the following requirements.

[0138] #Architecture Define the overall architecture of a hydrogen-powered multi-rotor UAV: ​​including the "hydrogen power plant" that embodies the characteristics of hydrogen-powered UAVs, as well as the "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system", and "UAV payload"; #property Define the overall key attributes of the hydrogen-powered multi-rotor drone, including "endurance," "range," "flight altitude," "flight speed," "airframe dimensions," "payload mass," "rate of climb," "reliability," and "economic cost." Note: Specific numerical values ​​and units are not required for the aforementioned attributes; only the attributes themselves are displayed. #relation Each part of the established system, including "navigation system", "flight control system", "sensors", "remote controller", "electrical system", "communication link system", "UAV ground station and mission planning system" and "UAV payload", is decomposed into different parts.

[0139] Without providing guidance on code correction, the target model generated multiple times in a row did not conform to the specifications and contained errors in the part definition method and the attribute definition method.

[0140] Based on the error types and content in the newly generated model code, corresponding code correction prompts and model code examples are generated to help the target model correct and optimize itself. The model code examples correctly demonstrate the model part definition methods and attribute definition methods, are strongly related to the errors in the newly generated model code, and do not involve other unrelated model code. The specific code correction guidance information, based on definition methods, component content, and usage methods, is: "The code you provided contains errors in part definition and usage, and attribute definition and usage. Please refer to the attached file to modify the code and regenerate." The model code example (as an attachment) is also provided to the target model.

[0141] The newly generated model code for the target model is verified to conform to the SysMLv2 specification and can be converted into a SysML graphical model. The compliant model code is saved as project data, or it can be added to the model code library as a model code example for subsequent correction of large model errors.

[0142] Verification 5: UAV State Model (i.e., Modeling Task) Select the DeepSeek v3.1 web-based large model as the target model, create a new dialogue, and enter natural language information to describe the SysML v2 model modeling task.

[0143] The natural language information used to describe the SysML v2 modeling task is as follows: You are a SysML language modeling engineer proficient in the MBSE methodology. Please follow the language specification of April 2025 and write code that conforms to the Sysml v2 specification according to the following requirements.

[0144] #States and Nesting Define a state named "drone state" (state def); The state definition (state def) of "drone state" is referenced, and the states (state) of "drone stationary" and "drone mission flight" are instantiated (usage). Under the state of "drone mission flight", sub-states named "self-check", "climb", "hover" and "descent" are nested.

[0145] #property Define attributes named "Takeoff and Climb", "Hovering Command", "Descent Command", and "Return Command".

[0146] #State Transition When in the "UAV mission flight" state, it first enters the "self-check" sub-state. If the attribute "take-off and climb" is met as the state transition condition, it transitions from the "self-check" sub-state to the "climb" sub-state; if the attribute "hover command" is met as the state transition condition, it transitions from the "climb" sub-state to the "hover" sub-state; if the attribute "descent command" is met as the state transition condition, it transitions from the "hover" sub-state to the "descent" sub-state; if the attribute "return command" is met as the state transition condition, it transitions from the "descent" sub-state to the "self-check" sub-state.

[0147] Without providing guidance on code correction, the target model generated multiple times in a row did not conform to the specifications and contained errors in the use of state definition models, state transition models, and state transition conditions.

[0148] Based on the error types and content found in the latest generated model code, corresponding code correction prompts and model code examples are generated to help the target model correct and optimize itself. The model code examples correctly demonstrate the use of state definition models, state transition models, and state transition conditions, are strongly related to the errors in the latest generated model code, and do not involve other unrelated model code. According to the definition method, composition, and usage method, the specific code correction guidance information is: "The code you provided contains errors in the use of state transitions and transition conditions. Please refer to the attached file I uploaded to modify the code and regenerate." The model code example (as an attachment) is also provided to the target model.

[0149] The newly generated model code for the target model is verified to conform to the SysMLv2 specification and can be converted into a SysML graphical model. The compliant model code is saved as project data, or it can be added to the model code library as a model code example for subsequent correction of large model errors.

[0150] Example 1 can achieve the following beneficial effects: In Example 1, structured code correction guidance information helps the large language model understand errors and problems in its generated code, thus achieving control over SysML v2 model code generation for the AI ​​large language model. This enables the AI ​​large language model to generate correct SysML v2 model code, or to correct and optimize erroneous SysML v2 model code generated by the AI ​​large language model into correct SysML v2 model code through code correction guidance information. Furthermore, after SysML v2 model code generation control, the AI ​​large language model can continuously produce correct SysML v2 model code, further improving SysML v2 model code generation efficiency.

[0151] Specifically, Implementation 1 combines code correction prompts with model code examples. The code correction prompts point out the problems in the model code, and the correct model code examples are provided, enabling the large language model to quickly locate the problems and correct the erroneous code to the correct code. This avoids the illusion problem that the large language model may produce when generating code as much as possible. With low interaction cost, it enables the large language model to generate correct SysML v2 model code, effectively improving the correctness, effectiveness, and usability of SysML v2 model code generated by the AI ​​large language model, with higher efficiency and stronger targeting.

[0152] In Example 1, the SysML v2 modeling task is characterized by natural language description information, which enables the AI ​​large language model to better understand the modeling requirements and the specifications to be followed. This helps to reduce errors in the initially generated model code and improve the accuracy of the initially generated model code.

[0153] By comprehensively utilizing natural language description information and code correction guidance information, the AI ​​large language model can improve its understanding of the context, such as code generation requirements, compliance with standards, and the existence of errors in the code. This enables the AI ​​large language model to refer to standards as reference documents during modeling, minimize errors during generation, and correct and optimize when errors occur, thereby improving the accuracy and efficiency of generating SysML v2 model code using the AI ​​large language model.

[0154] Example 1 implements AI-assisted modeling, which can improve the efficiency of using the MBSE method to carry out the design and development of complex systems. It can be applied to technical fields such as model-based engineering practice, complex system design, and model-based systems engineering in complex systems, as well as engineering design practice based on the MBSE method and MBSE system modeling of complex systems such as aircraft design.

[0155] The second embodiment of this specification provides a SysML v2 model code AI generation control device corresponding to the method described in Embodiment 1, the device comprising: The task representation module is used to determine the target model for generating SysML v2 model code from among the candidate AI large language models, and to establish natural language information to describe the SysML v2 model modeling task. The code control module is used to enable each target model to generate SysML v2 model code based on the natural language information, and to obtain the model code output by each target model. After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications. If none of the model codes obtained this time conform to the specifications, code correction guidance information will be generated based on the error situation of the model codes obtained this time, and each target model will be instructed to generate new SysML v2 model code according to the code correction guidance information. If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.

[0156] Preferably, the natural language information includes role positioning information, modeling specification information, and modeling requirement information.

[0157] Preferably, the role positioning information is used to define the role of the target model; And / or, The modeling specification information is used to define the modeling specifications that the target model needs to follow; And / or, The modeling requirements information is used to specify the modeling requirements that the target model must follow.

[0158] As a preferred option, the target models selected from the candidate AI large language models for generating SysML v2 model code include: Based on the optimization and / or functional integration and / or usage limitations of each candidate AI large language model, the target model for generating SysML v2 model code is determined from among the candidate AI large language models.

[0159] As a preferred approach, the code correction guidance information generated based on the error characteristics of the model code obtained this time includes: For each error type in the model code obtained this time, corresponding code correction guidance information will be generated.

[0160] Preferably, the code correction guidance information includes code correction prompts and model code examples.

[0161] Preferably, the code correction prompts include errors present in the model code obtained this time.

[0162] Preferably, for each error type in the model code obtained this time, the model code example includes a correct code example corresponding to that error type.

[0163] Preferably, the model code examples are selected from a model code library; The device also includes a storage module for adding compliant model code to the model code library.

[0164] The contents not described in detail in Embodiment 1 and Embodiment 2 can be referred to each other. Embodiment 2 can achieve the same beneficial effects as Embodiment 1. The above embodiments can be used in combination.

[0165] The above description is merely an embodiment of this specification and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.

Claims

1. A SysML v2 model code AI generation control method, characterized in that, The method includes: From the candidate AI large language models, the target model for generating SysML v2 model code is determined, and natural language information is established to describe the SysML v2 model modeling task. Each target model generates SysML v2 model code based on the natural language information, and the model code output by each target model is obtained. After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications. If none of the model codes obtained this time conform to the specifications, code correction guidance information will be generated based on the error situation of the model codes obtained this time, and each target model will be instructed to generate new SysML v2 model code according to the code correction guidance information. If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.

2. The method as described in claim 1, characterized in that, The natural language information includes role positioning information, modeling specification information, and modeling requirement information.

3. The method as described in claim 2, characterized in that, The role positioning information is used to define the role of the target model; And / or, The modeling specification information is used to define the modeling specifications that the target model needs to follow; And / or, The modeling requirements information is used to specify the modeling requirements that the target model must follow.

4. The method as described in claim 1, characterized in that, The target models for generating SysML v2 model code were determined from among the candidate AI large language models, including: Based on the optimization and / or functional integration and / or usage limitations of each candidate AI large language model, the target model for generating SysML v2 model code is determined from among the candidate AI large language models.

5. The method as described in claim 1, characterized in that, Based on the errors identified in the acquired model code, the following code correction guidance information was generated: For each error type in the model code obtained this time, corresponding code correction guidance information will be generated.

6. The method as described in claim 1, characterized in that, The code correction guidance information includes code correction prompts and model code examples.

7. The method as described in claim 6, characterized in that, The code correction prompts include the errors found in the model code obtained this time.

8. The method as described in claim 6 or 7, characterized in that, For each error type in the model code obtained this time, the model code example contains a correct code example corresponding to that error type.

9. The method as described in claim 6 or 7, characterized in that, The model code examples are selected from the model code library; The method further includes: Add the model code that conforms to the specifications to the model code library.

10. A SysML v2 model code AI generation control device, characterized in that, The device includes: The task representation module is used to determine the target model for generating SysML v2 model code from among the candidate AI large language models, and to establish natural language information to describe the SysML v2 model modeling task. The code control module is used to enable each target model to generate SysML v2 model code based on the natural language information, and to obtain the model code output by each target model. After obtaining the model code output by each target model each time, verify whether the obtained model code conforms to the specifications. If none of the model codes obtained this time conform to the specifications, code correction guidance information will be generated based on the error situation of the model codes obtained this time, and each target model will be instructed to generate new SysML v2 model code according to the code correction guidance information. If one or more target model outputs model codes that conform to the specification in a certain acquisition of model code, then the target code corresponding to the SysML v2 model modeling task is determined from the model codes that conform to the specification.