Macro script conversion system, method, electronic device, medium, and program product
Patent Information
- Application Number
- CN202480090262.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]尽管在模型构建和模型分析的方式在不同的行业软件平台上是相似的,但是不同软件都有各自独特的脚本规则集,目前,若要将自动化流程从A软件迁移到B软件需要仿真专家深入了解A软件与B软件的自动化流程,并在B软件中手动重构自动化脚本,因此相应迁移的成本非常高昂,导致大多数最终用户望而却步
Smart Images

Figure CN123023027A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application mainly relate to the field of industrial digitalization, and in particular to a macro script conversion system, method, electronic device, medium and program product. Background Technology
[0002] With the increasing demand for automation in simulation modeling and analysis, most industry software platforms, such as CAD, CAE, CAM, and PLC software, have script-based integrated automation functions. These functions enable users to use scripts to automatically perform tasks such as model building, adjustment, and simulation settings.
[0003] Although the methods of model building and model analysis are similar across different industry software platforms, each software has its own unique set of script rules. Currently, migrating an automated process from software A to software B requires simulation experts to have an in-depth understanding of the automated processes in both software A and software B, and to manually reconstruct the automated scripts in software B. Therefore, the cost of the migration is very high, causing most end users to give up. Summary of the Invention
[0004] This application provides a macro script conversion system, method, electronic device, medium, and program product, which can accurately and quickly convert macro scripts of source software into macro scripts of target software.
[0005] In a first aspect, a macro script conversion system is provided, comprising: a receiving module configured to receive a first macro script input by a user, as well as the name of a source software and the name of a target software; wherein the first macro script includes the macro script of the source software; a code translation agent module configured to convert the first macro script into corresponding natural language and pseudocode; and a code generation agent module configured to create a macro script corresponding to the name of the target software based on the natural language and pseudocode.
[0006] Secondly, a method for converting macro scripts is provided, comprising: receiving a first macro script input by a user, as well as the name of a source software and the name of a target software; wherein the first macro script includes the macro script of the source software; converting the first macro script into corresponding natural language and pseudocode through a code translation agent; and creating a macro script corresponding to the name of the target software through a code generation agent based on the natural language and pseudocode.
[0007] Thirdly, an electronic device is provided, comprising: at least one memory configured to store computer-readable code; and at least one processor configured to invoke the computer-readable code to perform the steps of the method provided in the second aspect.
[0008] Fourthly, a computer-readable medium is provided, on which computer-readable instructions are stored, which, when executed by a processor, cause the processor to perform the steps of the method provided in the second aspect.
[0009] Fifthly, a computer program product is provided, the computer program product being tangibly stored on a computer-readable medium and including computer-executable instructions that, when executed, cause at least one processor to perform the steps of the method provided in the second aspect. Attached Figure Description
[0011] The following figures are intended only to illustrate and explain the embodiments of this application, and do not limit the scope of the embodiments of this application. Wherein: Figure 1 This is a schematic diagram of a macro script conversion system according to an embodiment of this application; Figure 2 This is a flowchart of a macro script conversion method according to an embodiment of this application; Figure 3 This is a schematic diagram of an electronic device according to an embodiment of this application.
[0012] Explanation of reference numerals in the attached figures 10: Macro script conversion system 11: Receiving module 12: Code translation agent module 13: Code Generation Proxy Module; 200: Macro Script Conversion Method; 201~203: Method Steps 300: Electronic device; 301: Processor; 302: Communication interface 303: Memory; 304: Communication bus; 305: Program Detailed Implementation
[0013] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed merely to enable those skilled in the art to better understand and implement the subject matter described herein, and are not intended to limit the scope, applicability, or examples set forth in the claims. The function and arrangement of the elements discussed may be changed without departing from the scope of the embodiments of this application. Various processes or components may be omitted, substituted, or added as needed in the various examples. For example, the described methods may be performed in a different order than described, and steps may be added, omitted, or combined. Furthermore, features described in some examples may be combined in other examples.
[0014] As used herein, the term "comprising" and its variations are open terms meaning "including but not limited to". The term "based on" means "at least partially based on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other definitions, whether explicit or implicit, may be included below. Unless explicitly indicated by the context, the definition of a term shall remain consistent throughout the specification.
[0015] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0016] Figure 1 This is a schematic diagram of a macro script conversion system according to an embodiment of this application, such as... Figure 1 As shown, the macro script conversion system 10 includes: The receiving module 11 is configured to receive the first macro script input by the user, as well as the name of the source software and the name of the target software.
[0017] The first macro script refers to the macro script of the source software. In addition, the source software and the target software can be different software or different versions of the same software, because the way macro scripts are written will be updated after the version is updated, and the new version of the software may not be able to read the macro files of the old version.
[0018] The code translation agent module 12 is configured to convert the first macro script into the corresponding natural language and pseudocode.
[0019] The code generation agent module 13 is configured to create a macro script corresponding to the name of the target software based on the obtained natural language and pseudocode.
[0020] This application embodiment first receives the macro script of the source software, the name of the source software, and the name of the target software input by the user. Next, a code translation agent module converts the macro script of the source software into corresponding natural language and pseudocode. Then, based on the converted data, a macro script corresponding to the target software is created. This application embodiment can accurately and quickly convert the macro script of the source software into the macro script of the target software. Furthermore, by converting the software script into natural language and pseudocode, this application embodiment also facilitates user understanding of the operational logic of the automation process, thereby improving user efficiency.
[0021] In one embodiment, the system 10 further includes a code logic checking agent module, configured to: retrieve errors or omissions in the natural language and pseudocode; and when any error or omission exists, input the corresponding error or omission into the code translation agent module 12 to update the obtained natural language and pseudocode.
[0022] In one embodiment, the code generation agent module 13 is further configured to: create a second macro script for the name of the source software. The code syntax checking agent module is configured to: check for syntax errors or API errors in the second macro script; when any syntax error or API error exists, input the corresponding error and the second macro script to the code generation agent module 13 to update the second macro script. The code functionality checking agent module is configured to: detect the functional consistency between the second macro script and the first macro script. Specifically, optionally, in a test environment, the code functionality checking agent module can run the first macro script and the second macro script in an initial simulation software environment and check for consistency by comparing the results. Optionally, the code functionality checking agent module can independently evaluate functional consistency, such as whether the order of operation steps is the same, whether the set states are consistent, etc.
[0023] When any error occurs, such as the reduction of operation steps, the addition of steps with additional effects, parameter errors, etc., the corresponding error and the first macro script are input into the code translation agent module 12 to update the natural language and pseudocode. This application embodiment supports automated testing and comparison of script execution effects, thereby greatly reducing the time and resources required for manual testing.
[0024] In one embodiment, the code syntax checking agent module is configured to: verify whether there are syntax errors or API errors in the macro script corresponding to the name of the target software; when any syntax error or API error exists, input the corresponding error and the macro script corresponding to the name of the target software to the code generation agent module 13 to update the macro script corresponding to the name of the target software, thereby obtaining a third macro script. Optionally, the code functionality checking agent module is further configured to: detect the functional consistency between the third macro script and the first macro script. Specifically, optionally, in a test environment, the code functionality checking agent calls simulation software to run the first macro script and the third macro script on the source software and the target software respectively, and checks the consistency by comparing the corresponding results. Optionally, the code functionality checking agent module can independently evaluate functional consistency.
[0025] If any error is found, the corresponding error and the first macro script are input into the code generation agent to update the natural language and pseudocode.
[0026] In one embodiment, natural language and pseudocode can be displayed to the user through a user interface. The user can annotate or point out possible errors or content that needs to be adjusted, and then the user's feedback can be provided to the code translation agent module 12 to update the natural language and pseudocode.
[0027] Optionally, both the code translation agent module 12 and the code generation agent module 13 are based on a large language model and are trained using a dataset of a general simulation scenario, a relevant dataset of the source software, and a relevant dataset of the target software as training datasets.
[0028] Optionally, the training dataset of the code translation agent module 12 may also include task requirements and corresponding pseudocode datasets, as well as optional AI-amplified task requirements and corresponding code datasets. The above datasets are used as follows: the code is used as the input and the task requirements are used as the output.
[0029] Optionally, the training dataset of the code generation agent module 13 may also include task requirements and corresponding pseudocode datasets, as well as optional AI-amplified task requirements and corresponding code datasets. The above datasets are used as follows: the code is used as the input and the task requirements are used as the output.
[0030] Optionally, the training dataset for the code logic inspection agent module may include: a dataset of general simulation scenarios, operation documents of the corresponding software, application programming interface (API) documentation of the corresponding software, and / or relevant software code example documents.
[0031] Optionally, the training dataset for the code syntax checking agent module may include: corresponding software API documentation, relevant software code example documentation, task requirements and corresponding software code datasets, and optional AI-amplified task requirements and corresponding software code datasets.
[0032] Optionally, the training data for the code functionality inspection agent module may include: datasets of relevant software, such as operation documents, API documentation, code example documents, task requirements and corresponding software code datasets, and optional AI-enhanced task requirements and corresponding software code datasets.
[0033] The embodiments of this application can learn the scripts of new software platforms based on relevant documents and script examples, thereby achieving the ability to automatically expand.
[0034] In one embodiment, the system 10 further includes an output module configured to return a macro script corresponding to the name of the target software to the user via a user interface.
[0035] Figure 2 This is a flowchart of a macro script conversion method according to an embodiment of this application, such as... Figure 2 As shown, the macro script conversion method 200 includes: Step 201: Receive the first macro script input by the user, as well as the name of the source software and the name of the target software.
[0036] Step 202: Convert the first macro script into corresponding natural language and pseudocode using a code translation agent.
[0037] Step 203: Based on natural language and pseudocode, create a macro script corresponding to the name of the target software through a code generation agent.
[0038] Optionally, both the code translation agent and the code generation agent are based on a large language model and are trained using a dataset of a general simulation scenario, a relevant dataset of the source software, and a relevant dataset of the target software as training datasets.
[0039] The embodiments of this application can accurately and quickly convert macro scripts of source software into macro scripts of target software.
[0040] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device. See also... Figure 3 The electronic device 300 provided in this application embodiment includes: a processor 302, a communications interface 304, a memory 306, and a communication bus 308. Wherein: The processor 302, communication interface 304, and memory 306 communicate with each other via communication bus 308.
[0041] Communication interface 304 is used to communicate with other electronic devices or servers.
[0042] The processor 302 is used to execute program 310, specifically to execute the relevant steps in the aforementioned macro script conversion method 200 embodiment.
[0043] Specifically, program 310 may include program code that includes computer operation instructions.
[0044] Processor 302 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The smart device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0045] Memory 302 is used to store program 310. Memory 306 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0046] This application also provides a computer-readable storage medium storing instructions for causing a machine to execute the macro script conversion method 200 as described herein. Specifically, a system or apparatus equipped with a storage medium storing software program code that implements the functions of any of the embodiments described above, and enabling the computer (or CPU or MPU) of the system or apparatus to read and execute the program code stored in the storage medium.
[0047] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of this application.
[0048] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0049] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0050] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion module connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion module execute some and all of the actual operations, thereby realizing the function of any of the above embodiments.
[0051] This application also provides a computer program product, which is tangibly stored on a computer-readable medium and includes computer-executable instructions. When executed, these computer-executable instructions cause at least one processor to perform the macro script conversion method 200 provided in the above embodiments. It should be understood that the solutions in this embodiment have the corresponding technical effects in the above method embodiments, which will not be repeated here.
[0052] It should be noted that not all steps and modules in the above processes and system structure diagrams are mandatory; some steps or modules can be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.
[0053] In this patent application, nouns and pronouns relating to people are not limited to specific genders.
[0054] In the above embodiments, the hardware modules can be implemented mechanically or electrically. For example, a hardware module may include permanent, dedicated circuitry or logic (such as a dedicated processor, FPGA, or ASIC) to perform the corresponding operations. The hardware module may also include programmable logic or circuitry (such as a general-purpose processor or other programmable processor), which can be temporarily configured by software to perform the corresponding operations. The specific implementation method (mechanical, dedicated, permanent circuitry, or temporarily configured circuitry) can be determined based on cost and time considerations.
[0055] The present application has been shown and described in detail above with reference to the accompanying drawings and preferred embodiments. However, the present application is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art will know that more embodiments of the present application can be obtained by combining the code review methods in the different embodiments above. These embodiments are also within the protection scope of the present application.
[0056] In this patent application, nouns and pronouns relating to people are not limited to specific genders.
Claims
1. A macro script conversion system, comprising: - The receiving module (11) is configured to: receive a first macro script input by the user, as well as the name of the source software and the name of the target software; wherein the first macro script includes the macro script of the source software; - The code translation agent module (12) is configured to: convert the first macro script into the corresponding natural language and pseudocode; - The code generation agent module (13) is configured to: create a macro script corresponding to the name of the target software based on the natural language and pseudocode.
2. The system according to claim 1, wherein, Also includes: - A code logic inspection agent module is configured to: retrieve errors or omissions in the natural language and pseudocode; - When any error or omission exists, the corresponding error or omission is input into the code translation agent module (12) to update the natural language and pseudocode.
3. The system according to claim 1 or 2, wherein, - The code generation agent module (13) is also configured to: create a second macro script for the name of the source software; - The code syntax checking agent module is configured to check for syntax errors or API errors in the second macro script; - When any syntax error or API error exists, the corresponding error and the second macro script are input to the code generation agent module (13) to update the second macro script; - The code functionality inspection proxy module is configured to: detect the functional consistency between the second macro script and the first macro script; - If any error exists, the corresponding error and the first macro script are input into the code translation agent module (12) to update the natural language and pseudocode.
4. The system according to claim 1, wherein, - A code syntax checking proxy module is configured to: verify whether there are syntax errors or API errors in the macro script corresponding to the name of the target software; - When any syntax error or API error exists, the corresponding error and the macro script corresponding to the name of the target software are input into the code generation agent module (13) to update the macro script corresponding to the name of the target software and obtain the third macro script.
5. The system according to claim 4, wherein, - The code functionality inspection proxy module is also configured to: detect the functional consistency between the third macro script and the first macro script; - If any error exists, the corresponding error and the first macro script are input into the code generation agent module (13) to update the natural language and pseudocode.
6. The system according to any one of claims 1 to 4, wherein, Both the code translation agent module and the code generation agent module are based on a large language model and are trained using datasets from general simulation scenarios, relevant datasets from the source software, and relevant datasets from the target software as training datasets.
7. The system according to any one of claims 1, wherein, Also includes: - The output module is configured to return the macro script corresponding to the name of the target software to the user through the user interface.
8. A method for converting macro scripts, comprising: - Receive (201) user input of a first macro script, the name of the source software, and the name of the target software; wherein the first macro script includes the macro script of the source software; - The first macro script is converted (202) into the corresponding natural language and pseudocode via a code translation agent; - Based on the natural language and pseudocode, a macro script corresponding to the name of the target software is created (203) by a code generation agent.
9. The method according to claim 8, wherein, Both the code translation agent and the code generation agent are based on a large language model and are trained using datasets from general simulation scenarios, relevant datasets from the source software, and relevant datasets from the target software as training datasets.
10. An electronic device (300), comprising: The processor (301), communication interface (302), memory (303), and communication bus (304) communicate with each other through the communication bus (304). The memory (303) is used to store at least one executable instruction that causes the processor to perform the operation corresponding to the macro script conversion method as described in any one of claims 8-9.
11. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the macro script conversion method as described in any one of claims 8-9.
12. A computer program product tangibly stored on a computer-readable medium and comprising computer-executable instructions that, when executed, cause at least one processor to perform the macro script conversion method according to any one of claims 8-9.
