A large model multi-agent assisted industrial measurement and control software honing migration method

By employing a large-scale model multi-agent collaboration framework and a recursive decomposition strategy, the efficiency and consistency issues in migrating industrial measurement and control software to the HarmonyOS system were resolved. This enabled high-precision software and hardware interface mapping and system integration, improving the automation and reliability of the migration process.

CN122363752APending Publication Date: 2026-07-10NANJING UNIV OF AERONAUTICS & ASTRONAUTICS +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
Filing Date
2026-04-08
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In the existing technology, the migration of industrial measurement and control software to the HarmonyOS system is characterized by low efficiency, complex underlying hardware communication protocol mapping, and difficulty in ensuring the consistency of software and hardware control logic. Traditional Qt measurement and control software faces development challenges when migrating to the HarmonyOS system, as it cannot effectively understand the complex timing synchronization requirements of test instruments and hardware instruction context.

Method used

A large-scale multi-agent collaborative framework is adopted, and the measurement and control tasks are divided into independently transferable functional sub-units through a recursive decomposition strategy. Combined with a reflective iterative optimization mechanism driven by semantic reasoning and consistency detection, a software and hardware interface mapping relationship is constructed to achieve high-precision consistency migration from Qt source code to the HarmonyOS platform.

Benefits of technology

It improves the structuring and processing efficiency of the migration process, ensures the accuracy and consistency of equipment control command conversion, reduces manual migration and debugging costs, and enhances the reliability and engineering efficiency of Qt industrial measurement and control applications on the HarmonyOS platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122363752A_ABST
    Figure CN122363752A_ABST
Patent Text Reader

Abstract

This invention discloses a HarmonyOS migration method for industrial measurement and control software assisted by a large-scale model and multiple agents. The method includes: constructing a software dependency graph containing business logic, interface layout, and hardware dependencies for the original Qt measurement and control application; dividing the system into independent functional sub-units based on the software dependency graph and generating natural language functional descriptions; constructing a knowledge context of software and hardware interface mapping relationships using the natural language functional descriptions as input, combined with retrieval ranking and semantic reasoning; generating ArkUI interface code and underlying device access encapsulation classes based on the knowledge context of software and hardware interface mapping relationships, and performing consistency checks and iterative optimization; integrating the optimized system to construct the HarmonyOS engineering architecture; and completing the HarmonyOS system migration of the measurement and control software after system-level consistency verification. This invention achieves high-precision seamless migration from Qt to HarmonyOS, significantly improving the automation and accuracy of the migration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent software code generation and software / hardware adaptation and optimization technology, and in particular to a method for migrating industrial measurement and control software to HarmonyOS with large-scale model and multi-agent assistance. Background Technology

[0002] With the advancement of industrial digitalization and the strategy of independent control, the demand for domestically produced operating systems for industrial software and high-end testing instruments (such as digital oscilloscopes, spectrum analyzers, and industrial integrated measurement and control consoles) is constantly increasing. Such industrial measurement and control software is typically developed based on the Qt framework and is tightly coupled with the underlying hardware, controlling and processing hardware devices through instrument control instruction sets, dedicated communication protocols, and data acquisition interfaces. However, HarmonyOS, as a new generation of domestically produced operating systems, adopts a completely new distributed soft bus architecture and HDF driver model, which is fundamentally different from the hardware interaction methods of traditional industrial software that rely on C++ pointers to directly manipulate memory or call dynamic libraries (DLLs / SOs).

[0003] While migrating Qt applications to the HarmonyOS platform is essential for achieving technological self-reliance and control, the software and hardware adaptation and optimization in the testing instrument field faces extremely high barriers. Traditional Qt measurement and control software employs a tightly coupled architecture, where UI controls directly trigger underlying hardware register operations or send specific bus commands. When migrating to HarmonyOS's ArkTS declarative development paradigm, the original instrument driver layer and hardware abstraction layer are completely disconnected. Developers not only need to rewrite the upper-layer UI but also face the enormous challenge of mapping tens of thousands of proprietary measurement and control commands, waveform data callback mechanisms, and bus communication logic to the HarmonyOS HDF driver framework.

[0004] Existing automated code translation tools often only handle general business logic and cannot understand the complex timing synchronization requirements and hardware instruction context of testing instruments. Simply performing syntax translation can lead to uncontrollable instrument control latency, lost interrupt responses, and even hardware instruction corruption. Therefore, there is an urgent need for an intelligent migration method that can deeply understand the hardware-software interaction mechanism of industrial testing instruments and automatically realize the full-stack reconstruction from low-level protocol adaptation to high-level measurement and control interface, in order to solve the efficiency and reliability challenges of industrial software in cross-operating system adaptation. Summary of the Invention

[0005] To address the challenges of low efficiency, complex underlying hardware communication protocol mapping, and difficulty in ensuring software-hardware control logic consistency during the migration of industrial measurement and control software to the HarmonyOS system, this invention proposes a large-scale model-assisted multi-agent migration method for industrial measurement and control software to HarmonyOS. This method parses the software-hardware interaction logic based on a multi-agent collaborative framework, employs a recursive decomposition strategy to divide complex measurement and control tasks into independently transferable functional sub-units, and constructs a domain knowledge context for industrial protocol adaptation by combining retrieval matching and semantic reasoning. Furthermore, a consistency-detection-driven reflective iterative optimization mechanism is introduced to perform closed-loop optimization of the generated ArkUI interface code and underlying device access logic. Finally, system integration is completed based on the measurement and control business logic and software-hardware collaborative constraints, thereby achieving high-precision consistency migration from Qt source code to the HarmonyOS platform.

[0006] To achieve the above-mentioned technical objectives, the present invention provides the following technical solution: A method for migrating large-scale, multi-agent-assisted industrial measurement and control software to HarmonyOS, specifically including the following steps: S1. Perform static code analysis on the source Qt measurement and control application, and perform semantic completion analysis in conjunction with the large language model to extract instrument measurement and control panel information, underlying hardware communication protocols and device driver call relationships. Identify complex hardware interaction logic missed during rule parsing and construct a software dependency graph that includes measurement and control business logic, underlying driver parameter configuration, interface layout code and hardware driver dependencies. S2. Based on the software dependency graph, the measurement and control function interface and the hardware and software collaborative task are divided into multiple independently transferable measurement and control function sub-units using a recursive decomposition method. Then, a multi-agent collaborative mechanism is used to perform semantic understanding on each measurement and control function sub-unit to generate a natural language function description. S3. For each measurement and control function subunit, using natural language function description as input, and combining retrieval ranking and semantic reasoning mechanisms, relevant migration rules are retrieved from the industrial measurement and control migration knowledge base, and a knowledge context of software and hardware interface mapping relationships, including interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules, is constructed. S4. Based on the knowledge context of the software and hardware interface mapping relationship, generate the corresponding ArkUI interface code and the underlying device access encapsulation class, and perform sub-unit-level consistency detection on the generated results and natural language function description through multiple agents. Optimize and correct the ArkUI interface code and the underlying device access encapsulation class by adopting a reflective iterative optimization mechanism based on rule constraints and model reasoning. After meeting the preset consistency constraints, dynamically update the newly formed software and hardware interface mapping rules to the industrial measurement and control migration knowledge base. S5. Based on the measurement and control business logic relationships and hardware driver dependencies in the software dependency graph, the ArkUI interface code and underlying device access encapsulation class, after sub-unit level consistency testing and iterative optimization, are integrated into the system to build a complete engineering architecture that conforms to the HarmonyOS system specifications. After integration, system-level consistency verification is performed on the complete engineering architecture. If the verification result does not meet the preset verification conditions, iterative correction is performed based on the verification feedback until the preset verification conditions are met, thus completing the migration of the measurement and control software to the HarmonyOS system.

[0007] Furthermore, step S1 specifically includes: Extract the instrument control panel, data visualization window, and hardware communication context information from the build script and configuration list of the source Qt control application, and identify each interface window entity in the source Qt control application that carries independent control functions as an independent control function interface. Based on the window identification information of each measurement and control function interface, locate and associate the corresponding interface layout file and interface description file, and obtain the component structure information of each measurement and control function interface based on the interface layout file and interface description file. The component reference relationships and syntax structure in the source code of the Qt measurement and control application are analyzed to identify the calling relationships between interface control components, between interface control components and business logic modules, and between business logic modules and underlying hardware drivers. The underlying hardware I / O interface calls, device control instruction logic, hardware I / O threads, and related resource files are extracted. The related resource files include interface resource files, application configuration files, device driver configuration files, and industrial communication protocol description files. Complex hardware interaction logic that involves cross-thread asynchronous calls, callback chain call structures, dynamic loading mechanisms, or static parsing that cannot construct a complete call path is identified as difficult-to-identify complex hardware interaction logic. A large language model is used to perform semantic analysis and supplementary parsing on the relevant code fragments to complete the device control flow, cross-thread interaction relationships, and corresponding underlying driver call paths. Based on the above analysis results, a software dependency graph is constructed and stored in a structured manner. The nodes of the software dependency graph include interface control component nodes, business logic nodes, and device driver nodes. The edges of the software dependency graph represent component call relationships, data dependencies, and hardware driver dependencies.

[0008] Furthermore, step S2 specifically includes: Based on the software dependency graph analysis, the calling relationships between interface control components, business logic modules and device driver nodes are determined, the interaction relationships between interface control logic, data acquisition tasks and hardware interrupt handling modules are determined, and the associated paths between interface control logic and device driver calls are extracted. The interaction relationships and associated paths are used to guide the recursive decomposition of subsequent measurement and control function subunits, and as the basis for determining the device control closed loop and interface interaction closed loop. Using a multi-agent collaborative analysis mechanism driven by a large language model, a bottom-up recursive decomposition strategy is adopted to hierarchically decompose the measurement and control function interface. Starting from the device driver node in the software dependency graph, the control logic module and interface control component that have a calling relationship with the device driver node are traced up layer by layer. The device driver identification, interface component parsing and control logic analysis are completed by multi-agent collaboration, and the measurement and control function sub-units are divided. During the recursive decomposition strategy, when a single device control loop, a single interface interaction loop, or no cross-thread dependency relationship is met, the current decomposition result is determined as an independently transferable measurement and control function subunit, and the recursive decomposition process is completed; each measurement and control function subunit obtained includes at least an interface control component, a control logic module, and the corresponding device driver call relationship; For each measurement and control function subunit, the characteristics of interface control components, event response mechanism, data update method and device driver calling method are identified, and the structured feature information of each measurement and control function subunit is extracted from four dimensions: interface rendering method, interaction processing mechanism, data update mode and device driver calling method. Based on structured feature information, a unified semantic description template is constructed through a large language model to integrate and express interface functional features and device control logic, thereby generating a natural language functional description that describes the functional behavior of the measurement and control sub-unit and the device interaction process.

[0009] Furthermore, step S3 specifically includes: Based on the natural language function description of the measurement and control function subunit generated in step S2, the mapping items related to the natural language function description are retrieved from the pre-built industrial measurement and control migration knowledge base. The mapping items include interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules. For each measurement and control function subunit, if there is a matching mapping item in the industrial measurement and control migration knowledge base, a retrieval and re-ranking method based on keyword matching and semantic relevance analysis is adopted to screen and rank the candidate mapping items, and select the mapping items that meet the preset relevance conditions as candidate adaptation schemes. If no matching mapping item is found, the large language model is used to perform semantic reasoning on the natural language function description to generate potential HarmonyOS adaptation schemes. The generation process is constrained and supplemented by the existing search results. Relevant industrial communication protocol adaptation rules, data access methods and underlying driver call examples are obtained from the industrial measurement and control migration knowledge base to construct alternative adaptation schemes. The candidate adaptation schemes and alternative adaptation schemes are integrated and screened for consistency to construct a knowledge context of software and hardware interface mapping relationships, which includes interface component conversion rules, device driver interface adaptation rules and industrial communication protocol adaptation rules.

[0010] Furthermore, step S4 specifically includes: Based on the knowledge context of the software and hardware interface mapping relationship constructed in step S3 and the source Qt measurement and control application, the large language model is guided to generate the adapted ArkUI interface code and the underlying device access encapsulation class under the drive of the multi-agent collaborative mechanism, and a preliminary mapping relationship is established between the interface interaction logic and the underlying device control logic. A verification agent is introduced to perform consistency checks on the generated ArkUI interface code and the underlying device access encapsulation class with the natural language function description obtained in step S2. The consistency check includes evaluating the timing consistency and functional logic consistency of the software and hardware interaction process. Based on the consistency detection, the difference information between the generated result and the natural language function description is identified, and the difference information is fed back as a constraint to the joint generation process of ArkUI interface code and underlying device access encapsulation class; When the consistency detection result does not meet the preset consistency constraints, the optimization agent is used to perform iterative optimization on the ArkUI interface code and the underlying device access encapsulation class. This includes adaptive adjustments to the device interface calling method, event response mechanism, and data update strategy, and continuously corrects the generated result based on constraint feedback until the consistency constraints are met or the preset maximum number of iterations is reached. The consistency constraints are: requiring the generated result to maintain temporal consistency and functional logic consistency with the natural language function description during the software and hardware interaction process. When the consistency constraints are met, the generated results are comprehensively judged, including: overall consistency verification of the integrity of interface functional behavior, stability of control timing and correctness of device driver call relationships; The software and hardware interface mapping rules formed through consistency testing and iterative optimization are structured and stored, and then updated to the industrial measurement and control migration knowledge base.

[0011] Furthermore, step S5 specifically includes: Based on the software dependency graph constructed in step S1, the ArkUI interface code and underlying device access encapsulation class, after consistency testing and iterative optimization, are modularly organized and integrated into the system. Based on the measurement and control business logic relationship and component dependency relationship, the calling relationship and data transmission relationship between the interface interaction logic and the device control logic are reconstructed, and the ArkUI interface code and underlying device access encapsulation class are modularly reorganized according to the module function division to construct an engineering structure that conforms to the HarmonyOS layered architecture specification. After the complete engineering architecture integration is completed, system-level consistency verification is performed, including: Perform consistency verification on the device connection authentication process; perform timing consistency verification on the execution of control commands, status feedback, and data acquisition processes during software and hardware interaction; perform consistency verification on the interface refresh logic; and perform consistency verification on system resource loading and module dependencies. When any system-level consistency verification fails, iterative corrections are performed on the ArkUI interface code or the underlying device access encapsulation class based on the system-level consistency verification results. This includes adjusting the interface calling method, refactoring the control logic, and optimizing the parameter configuration to resolve compatibility issues. Ultimately, a complete industrial measurement and control software project that meets the operational requirements of the HarmonyOS system is output.

[0012] In addition, this application also discloses a HarmonyOS migration system for industrial measurement and control software with large-scale model multi-agent assistance, which specifically includes: The parsing and extraction module is used to parse the source Qt measurement and control application, extract the instrument measurement and control interface information and the underlying hardware communication protocol mapping relationship, and construct a dependency relationship graph; The recursive decomposition module is used to decompose the instrument measurement and control interface and hardware and software synchronization tasks into measurement and control function sub-units based on the dependency graph, and generate corresponding natural language function descriptions. The knowledge construction module is used to query the industrial protocol knowledge base based on the description of the measurement and control function subunit and construct an adaptive domain knowledge context. The reflection generation module is used to generate ArkUI interface code and HarmonyOS underlying device access class based on the adaptive domain knowledge context. It compares the generated code with the natural language function description of the measurement and control function subunit through subordinate intelligent agents, performs iterative optimization, and records the optimized and verified software and hardware interface mapping scheme into the industrial protocol knowledge base. The assembly and verification module is used to reorganize the optimized ArkUI code units into the HarmonyOS engineering architecture based on the dependency graph and verify it, thus completing the migration of the measurement and control software to the HarmonyOS system.

[0013] An electronic device is also disclosed, comprising a memory and a processor, wherein: Memory is used to store computer programs that can run on a processor; The processor is used to execute, as described above, a large-scale multi-agent assisted industrial measurement and control software HarmonyOS migration method when running the computer program.

[0014] A computer-readable storage medium is also disclosed, which stores computer instructions for causing a processor to execute and implement the HarmonyOS migration method for industrial measurement and control software with a large model and multiple agents as described above.

[0015] Based on the above technical solution, the present invention has at least the following beneficial effects: (1) The present invention is based on a multi-agent collaborative processing framework driven by a large language model. Through a recursive decomposition strategy, the communication tasks between the measurement and control interface and the underlying hardware in the Qt measurement and control application are divided into multiple independently transferable measurement and control functional sub-units, thereby realizing the structured decomposition of complex software and hardware interaction logic, and completing the mapping construction from the software and hardware interaction abstract logic to the ArkUI interface code and the underlying device access encapsulation class, thereby improving the structured degree and processing efficiency of the migration process. (2) By integrating retrieval ranking and semantic reasoning knowledge enhancement mechanism, this invention can generate adaptation code that conforms to HarmonyOS declarative development specifications and underlying driver access requirements when calling instrument control protocol and HarmonyOS driver interface mapping rules and domain knowledge base. It also solves the semantic inconsistency problem in the mapping process from native hardware interface to HarmonyOS driver interface through context constraint completion mechanism, thereby improving the accuracy and consistency of device control command conversion. (3) This invention introduces a reflective iterative optimization mechanism driven by consistency detection, constructs a sub-unit level closed-loop processing flow of generation-detection-feedback-optimization, performs multiple rounds of consistency detection and difference correction on the generated ArkUI interface code and the underlying device access encapsulation class, effectively eliminates timing deviations and functional logic inconsistencies in the software and hardware control process, thereby improving the logical consistency and operational stability of the generated code in complex measurement and control scenarios. (4) In the system integration stage, the present invention constructs a system-level verification and feedback correction mechanism based on multi-dimensional consistency constraints. By performing overall consistency verification on device authentication, interaction timing, interface refresh and module dependency, and performing iterative correction when verification fails, a system-level closed-loop optimization process is formed. At the same time, combined with the dynamic update mechanism of the knowledge base, the continuous accumulation and evolution of industrial measurement and control migration rules are realized, thereby reducing the cost of manual migration and debugging, and improving the reliability and engineering efficiency of the migration of Qt industrial measurement and control applications to the HarmonyOS platform. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating the steps of a HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance, as described in this invention. Figure 2 This invention presents a HarmonyOS migration system architecture and data flow diagram for a large-scale, multi-agent-assisted industrial measurement and control software. Figure 3 This is a flowchart illustrating the construction of the software and hardware interface mapping relationship in an embodiment of the present invention; Figure 4 This is a flowchart of the consistency detection and reflective iterative optimization based on multi-agent systems in an embodiment of the present invention. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0018] Although the steps in this invention are arranged by reference numerals, this is not intended to limit the order of the steps. Unless the order of the steps is explicitly stated or the execution of a step requires other steps as a basis, the relative order of the steps can be adjusted. It is understood that the term "and / or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items.

[0019] Please refer to Figures 1 to 4 This illustrates a specific implementation of an embodiment of the present invention. Figure 1 This illustrates the overall step flow of the method of the present invention. Figure 2 This illustrates the system architecture and data flow relationships. Figure 3 This illustrates the process of constructing the software and hardware interface mapping relationship. Figure 4 This embodiment demonstrates a consistency detection and reflective iterative optimization process based on multi-agent systems. It utilizes a large language model-driven multi-agent system dual-loop collaborative framework to deeply analyze the hardware-software interaction business and underlying instrument control protocol logic structure of Qt measurement and control applications, and recursively decomposes the instrument measurement and control interface and hardware control command translation tasks. It constructs an adaptive domain knowledge context using a knowledge base that enhances retrieval generation and maps underlying driver interfaces. It introduces verification and optimization agents to perform timing consistency checks, functional logic consistency checks, and reflective iterative corrections on the generated HarmonyOS system code, and automatically assembles the complete HarmonyOS system project architecture based on the measurement and control business logic and hardware driver dependency logic.

[0020] This method significantly solves the problems of large differences in development paradigms between native hardware driver APIs and HarmonyOS underlying driver abstraction layers, inconsistent rendering mechanisms of measurement and control dedicated components, and difficulties in migrating hardware driver calling logic. Through an internal and external double-loop closed-loop feedback mechanism, it automatically detects and repairs instruction timing errors and functional deviations, achieving high-precision, automated, and seamless cross-platform migration of industrial measurement and control software with complex underlying hardware dependencies.

[0021] Combination Figure 1 and Figure 2 The present invention proposes a method for migrating industrial measurement and control software to HarmonyOS with a large-scale model and multi-agent assistance, as shown in the method flow and system architecture. The method specifically includes the following steps: S1. Perform static code analysis on the source Qt measurement and control application, and perform semantic completion analysis in conjunction with the large language model to extract instrument measurement and control panel information, underlying hardware communication protocols and device driver call relationships. Identify complex hardware interaction logic missed during rule parsing and construct a software dependency graph that includes measurement and control business logic, underlying driver parameter configuration, interface layout code and hardware driver dependencies. In a preferred embodiment, step S1 specifically includes: Extract the instrument control panel, data visualization window, and hardware communication context information from the build script and configuration list of the source Qt control application, and identify each interface window entity (including the main control interface window, parameter configuration window, and data visualization window) used to carry independent control functions in the source Qt control application as an independent control function interface. Based on the window identification information of each measurement and control function interface (including window class name, object identifier name, interface file path, signal slot binding relationship and window hierarchy relationship; obtained from the construction script, UI description file and source code static parsing), the corresponding interface layout file and interface description file are located and associated. Based on the interface layout file and interface description file, the component structure information of each measurement and control function interface is obtained. The component structure information is used to construct the interface component hierarchy relationship model and serves as the structural basis for the subsequent division of measurement and control function sub-units. The component reference relationships and syntax structure in the source code of the Qt measurement and control application are analyzed to identify the calling relationships between interface control components, between interface control components and business logic modules, and between business logic modules and underlying hardware drivers. The underlying hardware I / O interface calls, device control instruction logic, hardware I / O threads, and related resource files are extracted. The related resource files include interface resource files, application configuration files, device driver configuration files, and industrial communication protocol description files. Complex hardware interaction logic that involves cross-thread asynchronous calls, callback chain call structures, dynamic loading mechanisms, or static parsing that cannot construct a complete call path is identified as difficult-to-identify complex hardware interaction logic. A large language model is used to perform semantic analysis and supplementary parsing on the relevant code fragments to complete the device control flow, cross-thread interaction relationships, and corresponding underlying driver call paths. Based on the above analysis results, a software dependency graph is constructed and stored in a structured manner. The nodes of the software dependency graph include interface control component nodes, business logic nodes, and device driver nodes. The edges of the software dependency graph represent component call relationships, data dependencies, and hardware driver dependencies.

[0022] In this embodiment, by using static analysis tools in conjunction with a large language model, the underlying hardware driver parameters, instrument control panel layout resources, and underlying instrument control protocol code in the Qt measurement and control application project are taken as input. The measurement and control panel structure tree is constructed, the underlying driver interface dependency is resolved, and the software and hardware interaction logic is extracted. A dependency graph containing the complete control architecture of the measurement and control equipment and the characteristics of the underlying driver resources is automatically constructed, thereby realizing the accurate reconstruction of the source program's measurement and control business logic and hardware control logic, providing data support for subsequent conversion.

[0023] S2. Based on the software dependency graph, the measurement and control function interface and the hardware and software collaborative task are divided into multiple independently transferable measurement and control function sub-units using a recursive decomposition method. Then, a multi-agent collaborative mechanism is used to perform semantic understanding on each measurement and control function sub-unit to generate a natural language function description. In a preferred embodiment, step S2 specifically includes: Based on the software dependency graph analysis, the calling relationships between interface control components, business logic modules and device driver nodes are determined, the interaction relationships between interface control logic, data acquisition tasks and hardware interrupt handling modules are determined, and the associated paths between interface control logic and device driver calls are extracted. The interaction relationships and associated paths are used to guide the recursive decomposition of subsequent measurement and control function subunits, and as the basis for determining the device control closed loop and interface interaction closed loop. Using a multi-agent collaborative analysis mechanism driven by a large language model, a bottom-up recursive decomposition strategy is adopted to hierarchically decompose the measurement and control function interface. Starting from the device driver node in the software dependency graph, the control logic module and interface control component that have a calling relationship with the device driver node are traced up layer by layer. The device driver identification, interface component parsing and control logic analysis are completed by multi-agent collaboration, and the measurement and control function sub-units are divided. During the recursive decomposition strategy, when a single device control loop, a single interface interaction loop, or no cross-thread dependency relationship is met, the current decomposition result is determined as an independently transferable measurement and control function subunit, and the recursive decomposition process is completed; each measurement and control function subunit obtained includes at least an interface control component, a control logic module, and the corresponding device driver call relationship; For each measurement and control function subunit, the characteristics of interface control components, event response mechanism, data update method and device driver calling method are identified, and the structured feature information of each measurement and control function subunit is extracted from four dimensions: interface rendering method, interaction processing mechanism, data update mode and device driver calling method. Based on structured feature information, a unified semantic description template is constructed through a large language model to integrate and express interface functional features and device control logic, thereby generating a natural language functional description that describes the functional behavior of the measurement and control sub-unit and the device interaction process.

[0024] In this embodiment, a recursive decomposition strategy is used to coordinate multiple agents. Based on the dependence of measurement and control business logic and real-time data flow, bottom-up semantic parsing and complex instrument measurement and control panel decomposition are performed to automatically generate natural language function descriptions of independent measurement and control functional units. This leads to the construction of a clear conversion roadmap, ensuring that the target code accurately restores the underlying hardware access logic and upper-layer interaction functions.

[0025] S3. For each measurement and control function subunit, using natural language function description as input, and combining retrieval ranking and semantic reasoning mechanisms, relevant migration rules are retrieved from the industrial measurement and control migration knowledge base, and a knowledge context of software and hardware interface mapping relationships, including interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules, is constructed. As a preferred embodiment, such as Figure 3 As shown, step S3 specifically includes: Based on the natural language function description of the measurement and control function subunit generated in step S2, the mapping items related to the natural language function description are retrieved from the pre-built industrial measurement and control migration knowledge base. The mapping items include interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules. For each measurement and control function subunit, if there is a matching mapping item in the industrial measurement and control migration knowledge base, a retrieval and re-ranking method based on keyword matching and semantic relevance analysis is adopted to screen and rank the candidate mapping items, and select the mapping items that meet the preset relevance conditions as candidate adaptation schemes. If no matching mapping item is found, the large language model is used to perform semantic reasoning on the natural language function description to generate potential HarmonyOS adaptation schemes. The generation process is constrained and supplemented by the existing search results. Relevant industrial communication protocol adaptation rules, data access methods and underlying driver call examples are obtained from the industrial measurement and control migration knowledge base to construct alternative adaptation schemes. The candidate adaptation schemes and alternative adaptation schemes are integrated and screened for consistency to construct a knowledge context of software and hardware interface mapping relationships, which includes interface component conversion rules, device driver interface adaptation rules and industrial communication protocol adaptation rules.

[0026] In this embodiment, by integrating retrieval ranking and semantic reasoning mechanisms, hardware driver scheme optimization matching or RAG completion is performed based on the instrument control protocol-HarmonyOS underlying driver mapping table and the instrument control protocol adaptation knowledge base. An adaptive domain knowledge context containing instrument control instruction adaptation specifications is automatically constructed, thereby providing accurate basis for the generation of underlying driver and instrument measurement and control interface code.

[0027] S4. Based on the knowledge context of the software and hardware interface mapping relationship, generate the corresponding ArkUI interface code and the underlying device access encapsulation class, and perform sub-unit-level consistency detection on the generated results and natural language function description through multiple agents. Optimize and correct the ArkUI interface code and the underlying device access encapsulation class by adopting a reflective iterative optimization mechanism based on rule constraints and model reasoning. After meeting the preset consistency constraints, dynamically update the newly formed software and hardware interface mapping rules to the industrial measurement and control migration knowledge base. As a preferred embodiment, such as Figure 4 As shown, step S4 specifically includes: Based on the knowledge context of the software and hardware interface mapping relationship constructed in step S3 and the source Qt measurement and control application, the large language model is guided to generate the adapted ArkUI interface code and the underlying device access encapsulation class under the drive of the multi-agent collaborative mechanism, and the preliminary mapping relationship between the interface interaction logic and the underlying device control logic is established (representing the calling relationship between the ArkUI interface code and the underlying device access encapsulation class). A verification agent is introduced to perform consistency checks on the generated ArkUI interface code and the underlying device access encapsulation class with the natural language function description obtained in step S2. The consistency check includes evaluating the timing consistency and functional logic consistency of the software and hardware interaction process. Based on the consistency detection, the difference information between the generated result and the natural language function description is identified, and the difference information is fed back as a constraint to the joint generation process of ArkUI interface code and underlying device access encapsulation class; When the consistency detection result does not meet the preset consistency constraints, the optimization agent is used to perform iterative optimization on the ArkUI interface code and the underlying device access encapsulation class. This includes adaptive adjustments to the device interface calling method, event response mechanism, and data update strategy, and continuously corrects the generated result based on constraint feedback until the consistency constraints are met or the preset maximum number of iterations is reached. The consistency constraints are: requiring the generated result to maintain temporal consistency and functional logic consistency with the natural language function description during the software and hardware interaction process. When the consistency constraints are met, the generated results are comprehensively judged to evaluate whether they meet the quality requirements for being used as the final migration result, including: overall consistency verification of the integrity of interface functional behavior, stability of control timing and correctness of device driver call relationships; The software and hardware interface mapping rules formed through consistency testing and iterative optimization are structured and stored, and then updated to the industrial measurement and control migration knowledge base.

[0028] In this embodiment, the instrument control instruction adaptation specification guides the generation of underlying driver and instrument measurement and control interface code. The intelligent agent performs difference comparison and reflection iteration optimization of the underlying driver control timing, and automatically maps and updates the newly established instrument control protocol to the knowledge base, thereby realizing a closed-loop flow of industrial measurement and control software quality optimization and industry adaptation knowledge evolution.

[0029] S5. Based on the measurement and control business logic relationships and hardware driver dependencies in the software dependency graph, the ArkUI interface code and underlying device access encapsulation class, after sub-unit level consistency detection and iterative optimization, are integrated into the system to build a complete engineering architecture that conforms to the HarmonyOS system specifications. After integration, system-level consistency verification is performed on the complete engineering architecture. If the verification result does not meet the preset verification conditions, iterative correction is performed based on the verification feedback until the preset verification conditions are met, thus completing the migration of the measurement and control software to the HarmonyOS system. In a preferred embodiment, step S5 specifically includes: Based on the software dependency graph constructed in step S1, the ArkUI interface code and underlying device access encapsulation class, after consistency testing and iterative optimization, are modularly organized and integrated into the system. Based on the measurement and control business logic relationship and component dependency relationship, the calling relationship and data transmission relationship between the interface interaction logic and the device control logic are reconstructed, and the ArkUI interface code and underlying device access encapsulation class are modularly reorganized according to the module function division to construct an engineering structure that conforms to the HarmonyOS layered architecture specification. After the complete engineering architecture integration is completed, system-level consistency verification is performed, including: Perform consistency verification on the device connection authentication process to confirm that the device access request can trigger the preset identity authentication process, and that the permission verification result is consistent with the preset access control policy, and ensure that unauthorized device access requests do not trigger the execution of device control commands. The timing consistency of the control command execution, status feedback and data acquisition process during the software and hardware interaction is verified to confirm that the order of control command issuance, status feedback and data acquisition triggering are consistent with the corresponding business processes in the natural language function description and software dependency graph. Perform consistency verification on the interface refresh logic to confirm that the corresponding interface state can be updated according to the preset refresh rules after the underlying device data changes, and that the interface display result is consistent with the underlying device state. Perform consistency checks on system resource loading and module dependencies to confirm that all resource files required for project operation are loaded correctly, and that the module call relationships are consistent with the dependencies in the software dependency graph, and that there are no abnormal calls caused by missing dependencies, incorrect dependencies, or circular dependencies. When any system-level consistency verification fails, iterative corrections are performed on the ArkUI interface code or the underlying device access encapsulation class based on the system-level consistency verification results. This includes adjusting the interface calling method, refactoring the control logic, and optimizing the parameter configuration to resolve compatibility issues. Ultimately, a complete industrial measurement and control software project that meets the operational requirements of the HarmonyOS system is output.

[0030] In this embodiment, based on the dependence of measurement and control business logic and the underlying driver control logic, the scattered ArkUI interface and underlying driver code units are reorganized into a complete project architecture. Through the integrity verification of underlying instrument control interaction and resources, a seamless HarmonyOS application that enables plug-and-play operation of measurement and control equipment is constructed.

[0031] In addition, this application also discloses a HarmonyOS migration system for industrial measurement and control software with large-scale model multi-agent assistance, which specifically includes: The parsing and extraction module is used to parse the source Qt measurement and control application, extract the instrument measurement and control interface information and the underlying hardware communication protocol mapping relationship, and construct a dependency relationship graph; The recursive decomposition module is used to decompose the instrument measurement and control interface and hardware and software synchronization tasks into measurement and control function sub-units based on the dependency graph, and generate corresponding natural language function descriptions. The knowledge construction module is used to query the industrial protocol knowledge base based on the description of the measurement and control function subunit and construct an adaptive domain knowledge context. The reflection generation module is used to generate ArkUI interface code and HarmonyOS underlying device access class based on the adaptive domain knowledge context. It compares the generated code with the natural language function description of the measurement and control function subunit through subordinate intelligent agents, performs iterative optimization, and records the optimized and verified software and hardware interface mapping scheme into the industrial protocol knowledge base. The assembly and verification module is used to reorganize the optimized ArkUI code units into the HarmonyOS engineering architecture based on the dependency graph and verify it, thus completing the migration of the measurement and control software to the HarmonyOS system.

[0032] An electronic device is also disclosed, comprising a memory and a processor, wherein: Memory is used to store computer programs that can run on a processor; The processor is used to execute, as described above, a large-scale multi-agent assisted industrial measurement and control software HarmonyOS migration method when running the computer program.

[0033] A computer-readable storage medium is also disclosed, which stores computer instructions for causing a processor to execute and implement the HarmonyOS migration method for industrial measurement and control software with a large model and multiple agents as described above.

[0034] In summary, this invention proposes a large-scale, multi-agent-assisted method for migrating industrial measurement and control software to the HarmonyOS platform. This method utilizes a multi-agent collaborative framework to deeply analyze the native layer logic of hardware and software interaction, employs a recursive strategy to decompose tasks into the smallest units, and integrates retrieval matching and semantic reasoning to construct an adaptive domain knowledge context. It optimizes the code through a reflective generation mechanism and assembles the project according to the measurement and control business logic and hardware / software synchronization requirements. This clearly realizes a closed-loop process of measurement and control interaction parsing, task decomposition, knowledge enhancement, and reflective optimization, significantly improving the automation and accuracy of migrating Qt measurement and control applications to the HarmonyOS platform.

[0035] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0036] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0037] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for migrating industrial measurement and control software to HarmonyOS with a large-scale multi-agent assisted model, characterized in that, Specifically, the following steps are included: S1. Perform static code analysis on the source Qt measurement and control application, and perform semantic completion analysis in conjunction with the large language model to extract instrument measurement and control panel information, underlying hardware communication protocols and device driver call relationships. Identify complex hardware interaction logic missed during rule parsing and construct a software dependency graph that includes measurement and control business logic, underlying driver parameter configuration, interface layout code and hardware driver dependencies. S2. Based on the software dependency graph, the measurement and control function interface and the hardware and software collaborative task are divided into multiple independently transferable measurement and control function sub-units using a recursive decomposition method. Then, a multi-agent collaborative mechanism is used to perform semantic understanding on each measurement and control function sub-unit to generate a natural language function description. S3. For each measurement and control function subunit, using natural language function description as input, and combining retrieval ranking and semantic reasoning mechanisms, relevant migration rules are retrieved from the industrial measurement and control migration knowledge base, and a knowledge context of software and hardware interface mapping relationships, including interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules, is constructed. S4. Based on the knowledge context of the software and hardware interface mapping relationship, generate the corresponding ArkUI interface code and the underlying device access encapsulation class, and perform sub-unit-level consistency detection on the generated results and natural language function description through multiple agents. Optimize and correct the ArkUI interface code and the underlying device access encapsulation class by adopting a reflective iterative optimization mechanism based on rule constraints and model reasoning. After meeting the preset consistency constraints, dynamically update the newly formed software and hardware interface mapping rules to the industrial measurement and control migration knowledge base. S5. Based on the measurement and control business logic relationship and hardware driver dependency relationship in the software dependency relationship graph, the ArkUI interface code and the underlying device access encapsulation class after sub-unit level consistency detection and iterative optimization are integrated into the system to build a complete engineering architecture that conforms to the HarmonyOS system specification. After integration, system-level consistency verification is performed on the complete engineering architecture. If the verification result does not meet the preset verification conditions, iterative correction is carried out based on the verification feedback until the preset verification conditions are met, and the migration of the measurement and control software to the HarmonyOS system is completed.

2. The HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in claim 1, characterized in that, Step S1 specifically includes: Extract the instrument control panel, data visualization window, and hardware communication context information from the build script and configuration list of the source Qt control application, and identify each interface window entity in the source Qt control application that carries independent control functions as an independent control function interface. Based on the window identification information of each measurement and control function interface, locate and associate the corresponding interface layout file and interface description file, and obtain the component structure information of each measurement and control function interface based on the interface layout file and interface description file. The component reference relationships and syntax structure in the source code of the Qt measurement and control application are analyzed to identify the calling relationships between interface control components, between interface control components and business logic modules, and between business logic modules and underlying hardware drivers. The underlying hardware I / O interface calls, device control instruction logic, hardware I / O threads, and related resource files are extracted. The related resource files include interface resource files, application configuration files, device driver configuration files, and industrial communication protocol description files. Complex hardware interaction logic that involves cross-thread asynchronous calls, callback chain call structures, dynamic loading mechanisms, or static parsing that cannot construct a complete call path is identified as difficult-to-identify complex hardware interaction logic. A large language model is used to perform semantic analysis and supplementary parsing on the relevant code fragments to complete the device control flow, cross-thread interaction relationships, and corresponding underlying driver call paths. Based on the above analysis results, a software dependency graph is constructed and stored in a structured manner. The nodes of the software dependency graph include interface control component nodes, business logic nodes, and device driver nodes. The edges of the software dependency graph represent component call relationships, data dependencies, and hardware driver dependencies.

3. The HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in claim 1, characterized in that, Step S2 specifically includes: Based on the software dependency graph analysis, the calling relationships between interface control components, business logic modules and device driver nodes are determined, the interaction relationships between interface control logic, data acquisition tasks and hardware interrupt handling modules are determined, and the associated paths between interface control logic and device driver calls are extracted. The interaction relationships and associated paths are used to guide the recursive decomposition of subsequent measurement and control function subunits, and as the basis for determining the device control closed loop and interface interaction closed loop. Using a multi-agent collaborative analysis mechanism driven by a large language model, a bottom-up recursive decomposition strategy is adopted to hierarchically decompose the measurement and control function interface. Starting from the device driver node in the software dependency graph, the control logic module and interface control component that have a calling relationship with the device driver node are traced up layer by layer. The device driver identification, interface component parsing and control logic analysis are completed by multi-agent collaboration, and the measurement and control function sub-units are divided. During the recursive decomposition strategy, when a single device control loop, a single interface interaction loop, or no cross-thread dependency relationship is met, the current decomposition result is determined as an independently transferable measurement and control function subunit, and the recursive decomposition process is completed; each measurement and control function subunit obtained includes at least an interface control component, a control logic module, and the corresponding device driver call relationship; For each measurement and control function subunit, the characteristics of interface control components, event response mechanism, data update method and device driver calling method are identified, and the structured feature information of each measurement and control function subunit is extracted from four dimensions: interface rendering method, interaction processing mechanism, data update mode and device driver calling method. Based on structured feature information, a unified semantic description template is constructed through a large language model to integrate and express interface functional features and device control logic, thereby generating a natural language functional description that describes the functional behavior of the measurement and control sub-unit and the device interaction process.

4. The HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in claim 1, characterized in that, Step S3 specifically includes: Based on the natural language function description of the measurement and control function subunit generated in step S2, the mapping items related to the natural language function description are retrieved from the pre-built industrial measurement and control migration knowledge base. The mapping items include interface component conversion rules, device driver interface adaptation rules, and industrial communication protocol adaptation rules. For each measurement and control function subunit, if there is a matching mapping item in the industrial measurement and control migration knowledge base, a retrieval and re-ranking method based on keyword matching and semantic relevance analysis is adopted to screen and rank the candidate mapping items, and select the mapping items that meet the preset relevance conditions as candidate adaptation schemes. If no matching mapping item is found, the large language model is used to perform semantic reasoning on the natural language function description to generate potential HarmonyOS adaptation schemes. The generation process is constrained and supplemented by the existing search results. Relevant industrial communication protocol adaptation rules, data access methods and underlying driver call examples are obtained from the industrial measurement and control migration knowledge base to construct alternative adaptation schemes. The candidate adaptation schemes and alternative adaptation schemes are integrated and screened for consistency to construct a knowledge context of software and hardware interface mapping relationships, which includes interface component conversion rules, device driver interface adaptation rules and industrial communication protocol adaptation rules.

5. The HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in claim 1, characterized in that, Step S4 specifically includes: Based on the knowledge context of the software and hardware interface mapping relationship constructed in step S3 and the source Qt measurement and control application, the large language model is guided to generate the adapted ArkUI interface code and the underlying device access encapsulation class under the drive of the multi-agent collaborative mechanism, and a preliminary mapping relationship is established between the interface interaction logic and the underlying device control logic. A verification agent is introduced to perform consistency checks on the generated ArkUI interface code and the underlying device access encapsulation class with the natural language function description obtained in step S2. The consistency check includes evaluating the timing consistency and functional logic consistency of the software and hardware interaction process. Based on the consistency detection, the difference information between the generated result and the natural language function description is identified, and the difference information is fed back as a constraint to the joint generation process of ArkUI interface code and underlying device access encapsulation class; When the consistency detection result does not meet the preset consistency constraints, the optimization agent is used to perform iterative optimization on the ArkUI interface code and the underlying device access encapsulation class. This includes adaptive adjustments to the device interface calling method, event response mechanism, and data update strategy, and continuously corrects the generated result based on constraint feedback until the consistency constraints are met or the preset maximum number of iterations is reached. The consistency constraints are: requiring the generated result to maintain temporal consistency and functional logic consistency with the natural language function description during the software and hardware interaction process. When the consistency constraints are met, the generated results are comprehensively judged, including: overall consistency verification of the integrity of interface functional behavior, stability of control timing and correctness of device driver call relationships; The software and hardware interface mapping rules formed through consistency testing and iterative optimization are structured and stored, and then updated to the industrial measurement and control migration knowledge base.

6. The HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in claim 1, characterized in that, Step S5 specifically includes: Based on the software dependency graph constructed in step S1, the ArkUI interface code and underlying device access encapsulation class, after consistency testing and iterative optimization, are modularly organized and integrated into the system. Based on the measurement and control business logic relationship and component dependency relationship, the calling relationship and data transmission relationship between the interface interaction logic and the device control logic are reconstructed, and the ArkUI interface code and underlying device access encapsulation class are modularly reorganized according to the module function division to construct an engineering structure that conforms to the HarmonyOS layered architecture specification. After the complete engineering architecture integration is completed, system-level consistency verification is performed, including: Perform consistency verification on the device connection authentication process; perform timing consistency verification on the execution of control commands, status feedback, and data acquisition processes during software and hardware interaction; perform consistency verification on the interface refresh logic; and perform consistency verification on system resource loading and module dependencies. When any system-level consistency verification fails, iterative corrections are performed on the ArkUI interface code or the underlying device access encapsulation class based on the system-level consistency verification results. This includes adjusting the interface calling method, refactoring the control logic, and optimizing the parameter configuration to resolve compatibility issues. Ultimately, a complete industrial measurement and control software project that meets the operational requirements of the HarmonyOS system is output.

7. A HarmonyOS migration system for industrial measurement and control software with large-scale model and multi-agent assistance, characterized in that, Specifically, it includes: The parsing and extraction module is used to parse the source Qt measurement and control application, extract the instrument measurement and control interface information and the underlying hardware communication protocol mapping relationship, and construct a dependency relationship graph; The recursive decomposition module is used to decompose the instrument measurement and control interface and hardware and software synchronization tasks into measurement and control function sub-units based on the dependency graph, and generate corresponding natural language function descriptions. The knowledge construction module is used to query the industrial protocol knowledge base based on the description of the measurement and control function subunit and construct an adaptive domain knowledge context. The reflection generation module is used to generate ArkUI interface code and HarmonyOS underlying device access class based on the adaptive domain knowledge context. It compares the generated code with the natural language function description of the measurement and control function subunit through subordinate intelligent agents, performs iterative optimization, and records the optimized and verified software and hardware interface mapping scheme into the industrial protocol knowledge base. The assembly and verification module is used to reorganize the optimized ArkUI code units into the HarmonyOS engineering architecture based on the dependency graph and verify it, thus completing the migration of the measurement and control software to the HarmonyOS system.

8. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein: Memory is used to store computer programs that can run on a processor; A processor is configured to execute, while running the computer program, a HarmonyOS migration method for industrial measurement and control software with large-scale multi-agent assistance as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause the processor to execute and implement the HarmonyOS migration method for industrial measurement and control software with large model multi-agent assistance as described in any one of claims 1-6.