Combinatorial compilation method and system for control model library reuse
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-08-14
AI Technical Summary
但在实际工程应用中,现有复用模式仍以人工选型、手工核对、手动适配为主要方式,工程人员仅能依据说明文档与个人经验判断适配性,难以提前发现输入假设不满足、时序窗口不匹配、资源占用超限、安全等级降级等隐性问题,大量适配缺陷往往延迟至集成测试阶段才暴露,引发高额返工成本与进度风险
其一,本发明可建立全维度机器可读的封装契约体系,将经验化人工判断升级为量化自动校核,通过接口、时序、资源、安全等级多维度兼容性求解,可在编译前置阶段精准识别各类失配风险,从源头降低复用缺陷率,减少集成阶段的返工成本。
Smart Images

Figure CN122569949A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of control model library management technology, and in particular to a combined compilation method and system for control model library reuse. Background Technology
[0002] In the model-based development system of high-safety control systems, common algorithmic logic such as control law calculation, signal filtering, fault detection, and interface adaptation is usually encapsulated into reusable units and stored in the control model library. Cross-project reuse improves development efficiency and ensures algorithm quality. However, in actual engineering applications, the existing reuse mode still mainly relies on manual selection, manual verification, and manual adaptation. Engineers can only judge the adaptability based on the documentation and personal experience, making it difficult to discover hidden problems such as unmet input assumptions, mismatched timing windows, excessive resource consumption, and downgraded security levels in advance. Many adaptation defects are often only exposed in the integration testing stage, leading to high rework costs and schedule risks.
[0003] Meanwhile, due to the lack of automated adaptation tools, when the same library unit is reused in different projects, manual supplementation of interface conversion, boundary protection, and exception handling logic is required. This easily degenerates into copy-based reuse, nominally reusing the original unit but actually making extensive implicit modifications to the unit code. This not only disrupts the version consistency of the library unit but also makes modification traces untraceable and significantly increases the difficulty of code review. In addition, the entire reuse process lacks a systematic recording and control mechanism. Information such as unit source, adaptation changes, and verification supplements are scattered in various documents and communication records, making it impossible to trace the entire reuse chain. When the library unit version iterates, it is impossible to quickly locate the affected projects and scenarios, and the verification results accumulated from historical projects are difficult to inherit effectively, resulting in a large amount of wasted resources from repeated verification. In complex reuse scenarios across hardware platforms and security levels, environmental differences further amplify the above defects, and the efficiency and accuracy of manual adaptation are insufficient to meet the certification review requirements of high-security control systems.
[0004] Therefore, there is an urgent need for a combined compilation method and system for reusing control model libraries to solve the above problems. Summary of the Invention
[0005] The purpose of this invention is to provide a composite compilation method for reusing control model libraries, comprising the following steps: Obtain encapsulation contract data for multiple reusable units in the control model library, wherein the encapsulation contract data includes input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters, and security level identifier for each reusable unit; Based on the reuse requirements of the target project, multiple reusable units to be reused are selected from the control model library, and a composite dependency graph representing the dependency relationship between each reusable unit is constructed based on the port declaration information of each reusable unit. Based on the combined dependency graph and the encapsulation contract data of each reusable unit, a multi-dimensional compatibility solution is performed. Interface dimension verification, timing matching verification, resource conflict verification, and security level backtracking verification are performed on each reusable unit. Based on the verification results, each reusable unit is marked as a fully compatible unit, a conditionally compatible unit, or an incompatible unit. For reusable units marked as conditionally compatible units, based on the type of difference between the encapsulation contract data of the reusable unit and the target project environment, wrapper layer code for eliminating the type of difference is automatically generated and inserted into the call chain of the reusable unit; Each reusable unit marked as fully compatible and conditionally compatible, along with its corresponding wrapper layer code, is combined and compiled according to the aforementioned combination dependency graph to generate executable code for the target platform, and outputs version seal records and reuse evidence files.
[0006] Furthermore, this invention also discloses a combinatorial compilation system for reusing control model libraries, comprising: The acquisition module is used to acquire the encapsulation contract data of multiple reusable units in the control model library, wherein the encapsulation contract data includes the input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters and security level identifier of each reusable unit; The construction module is used to select multiple reusable units to be reused from the control model library according to the reuse requirements of the target project, and construct a composite dependency graph to represent the dependency relationship between the reusable units according to the port declaration information of each reusable unit. The marking module is used to perform multi-dimensional compatibility solving based on the combined dependency graph and the encapsulation contract data of each reusable unit, to perform interface dimension verification, timing matching verification, resource conflict verification and security level backtracking verification on each reusable unit, and to mark each reusable unit as a fully compatible unit, a conditionally compatible unit or an incompatible unit according to the verification results. A generation module is used to automatically generate wrapper layer code to eliminate the difference type between the encapsulation contract data of the reusable unit and the target project environment, based on the difference type between the reusable unit and the encapsulation contract data of the reusable unit, and insert the wrapper layer code into the call chain of the reusable unit for reusable units marked as conditionally compatible units; The output module is used to combine and compile the reusable units marked as fully compatible units and conditionally compatible units and their corresponding wrapper layer code according to the combined dependency graph, generate executable code for the target platform, and output version seal record and reuse evidence file.
[0007] The beneficial effects of this application are as follows: Firstly, this invention can establish a fully machine-readable encapsulation contract system, upgrading empirical manual judgment to quantitative automatic verification. Through multi-dimensional compatibility solutions of interfaces, timing, resources, and security levels, it can accurately identify various mismatch risks in the pre-compilation stage, reduce the reuse defect rate from the source, and reduce rework costs in the integration stage.
[0008] Secondly, this invention can achieve automated and explicit generation of adaptation logic, automatically matching wrapper layer schemes for different types of differences. All adaptation changes exist in the form of independent wrapper layers, without modifying the original code of the unit. This effectively maintains the version consistency of the library unit and completely eliminates the maintenance and review risks caused by implicit modifications, greatly improving the efficiency and standardization of cross-project reuse.
[0009] Third, this invention can construct a full-link traceability mechanism for version sealing and reuse evidence, and fully record the entire process information such as unit version, adaptation scheme, and verification baseline. It can not only support the rapid assessment of the impact range during library unit iteration, but also realize the hierarchical reuse of historical verification evidence based on contract consistency, significantly reducing the resource consumption of repeated verification. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of a method flow proposed in an embodiment of this application.
[0011] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0012] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0013] To make the objectives, technical solutions, and advantages of this invention clearer and more complete, the technical solutions of this invention will be further described in detail and completely below with reference to exemplary drawings and preferred embodiments. It should be understood that the specific embodiments described herein are only for explaining the technical solutions of this invention and are not intended to limit the scope of protection of this invention. Equivalent modifications, optimizations, and adaptations made by those skilled in the art without departing from the core concept of this invention are all within the scope of protection of this invention.
[0014] This invention addresses the industry pain points of existing control model library reuse technologies, such as reliance on manual experience verification, lack of standardized contractual constraints, implicit adaptation processes, lack of quantitative standards for compatibility judgment, untraceable reuse processes, and easy inheritance of errors. It proposes a combinatorial compilation method for control model library reuse. The core innovations of this invention lie in: constructing a fully machine-readable standardized encapsulation contract system to achieve computability, verifiability, adaptability, and traceability of model unit reuse; designing a multi-dimensional quantitative compatibility judgment mechanism and a hierarchical unit adaptation strategy; pioneering an automated packaging layer precision generation technology and compilation link integration mechanism; and achieving intelligent replacement and scheme optimization for incompatible units. This completely solves the technical defects of traditional manual reuse modes, such as low efficiency, large errors, poor security, and lack of compliance evidence chains. It is suitable for engineering reuse and delivery scenarios of high-safety-level control systems such as flight control, avionics bus, rail transit, automotive chassis, and industrial process control.
[0015] This invention provides a combined compilation method for reusing control model libraries. This method is deployed in a high-security intelligent compilation system for control model libraries and can be adapted to various embedded control platforms and real-time operating systems for model code compilation and delivery scenarios. Figure 1 This is an overall method flowchart of an exemplary embodiment of the present invention, as shown below. Figure 1 As shown, this method includes five core steps, S1 to S5, as well as extended steps such as compatible quantification determination and incompatible unit intelligent processing. The specific technical solution is as follows: S1. Obtain the encapsulated contract data of multiple reusable units in the control model library; The encapsulation contract data includes the input assumption parameters, output commitment parameters, timing window parameters, resource usage parameters, and security level identifier for each reusable unit. This step abandons the traditional non-standardized unit description method of manual textual explanation and constructs a fully structured, machine-parsable, and quantifiable encapsulation contract system. This achieves standardized and digital management of model unit reuse from the source, completely avoiding the problem of human interpretation bias.
[0016] S11. Traverse each reusable unit in the control model library and read the structured contract description file corresponding to the reusable unit; In this embodiment, all reusable units (control law modules, filtering modules, fault handling modules, interface adaptation modules, monitoring modules, etc.) in the control model library generate dedicated structured contract description files during the library acceptance phase. These files are archived along with the unit source code, version information, and verification reports, using any standardized structured format such as JSON, XML, or YAML. Unlike traditional Word documents with no fixed format, these files can be directly parsed, calculated, and called by the compilation system without requiring manual secondary translation. When the system executes the combined compilation task, it automatically traverses the model library unit directory and batch loads the contract files of all reusable units, achieving fully automated data acquisition.
[0017] S12. Extract multi-dimensional standardized parameters from the structured contract description file; The system analyzes the contract file precisely to extract five categories of core parameters. All parameters are quantifiable and calculable indicators with no ambiguity. The specific parameter definitions are as follows: The input assumption parameters include the input data type, input value range, input physical unit, and input sampling period, used to define the preconditions for normal operation of the unit. The output commitment parameters include the output data type, output physical unit, and output response time, used to define the deterministic output performance indicators of the unit after satisfying the input constraints. The timing window parameters include the upper limit of single execution time and the period jitter tolerance, used to constrain the timing characteristics of the unit's real-time operation. The resource consumption parameters include memory consumption and CPU utilization, used to quantify the unit's hardware resource consumption. The security level identifier includes the security integrity level or airworthiness level applicable to the reusable unit, used for compliance verification with high-security systems.
[0018] S13. Construct and cache the encapsulated contract data object; Based on the extracted standardized parameters, the system constructs an independent encapsulated contract data object for each reusable unit. The data object encapsulates all attribute parameters and unique identifiers of the unit and caches them uniformly in the system memory. This provides high-speed data support for the entire process of subsequent dependency graph construction, compatibility solving, wrapper layer generation, and compilation assembly, avoiding repeated file reading and improving overall compilation efficiency.
[0019] S2. Construct a composite dependency graph of reusable units; Based on the reuse requirements of the target project, multiple reusable units to be reused are selected from the control model library. Then, based on the input and output port declarations of each reusable unit, a composite dependency graph representing the dependencies between the reusable units is constructed. This step constructs the topology from both data and resource dependencies, accurately reconstructing the coupling logic between units. Simultaneously, it performs fine-grained classification of port matching differences, providing a precise basis for subsequent differentiated adaptation, which differs from the traditional single topology construction method that only focuses on data connections.
[0020] S21. Construct the initial node set; The system reads the target project's preset list of reusable requirements, and accurately loads the corresponding reusable units and their cached encapsulated contract data objects from the control model library based on the unique identifiers of the units in the list. Each reusable unit is treated as an independent topology node, and an initial set of nodes is constructed to form a composite dependency graph, fully covering all the functional units required by the project.
[0021] S22. Construct data dependency edges based on port matching; The system traverses all units within the initial node set, extracts the standardized input port declaration and output port declaration for each unit, and performs precise matching on the four core attributes of port name, data type, physical unit, and data dimension. Based on the matching results, it finely classifies the difference types and establishes corresponding data dependency edges. The specific matching judgment rules are as follows: If the port name, data type, physical unit, and data dimension are completely identical, it is considered a perfect match. A standard data dependency edge is established and marked with a perfect match identifier. If only the data dimension is different, and the other attributes are completely identical, it is considered a dimension-adaptable difference, and an adaptable data dependency edge is established. If only the physical unit is different, and the system's unit conversion knowledge base contains the corresponding conversion relationship, it is considered a unit-adaptable difference; otherwise, it is considered an incompatible difference. If only the data type is different, and the system's type conversion knowledge base supports lossless conversion, it is considered a type-adaptable difference; otherwise, it is considered an incompatible difference. All matching results and difference types are fixed as edge attributes and stored in the corresponding data dependency edges, providing an accurate basis for subsequent compatibility solving.
[0022] S23. Construct shared resource dependency edges based on resource overlap; The system iterates through the resource usage parameters of all units, identifies the hardware and software resources such as memory, hardware registers, and communication buses occupied by each unit, and determines that there is a resource coupling relationship if two units have a shared resource item with the same resource name and resource type. It automatically establishes a shared resource dependency edge between the two units, accurately characterizes the resource competition and coupling risk between units, and makes up for the technical defect of traditional topology models that ignore resource dependencies.
[0023] S24. Generate a complete composite dependency graph; By integrating the initial set of nodes, all data dependency edges, and shared resource dependency edges, a complete directed topological composite dependency graph is generated, fully covering the three core relationships of unit function dependency, data interaction dependency, and hardware resource dependency. At the same time, all port matching results and difference types are solidified into edge attributes, forming a quantifiable and parsable topological data model.
[0024] S3. Perform multidimensional compatibility solving and element hierarchical labeling; Based on the combined dependency graph and the encapsulation contract data of each reusable unit, a multi-dimensional compatibility solution is performed. Interface dimension verification, timing matching verification, resource conflict verification, and security level retrospective verification are conducted for each reusable unit. Combined with a quantitative compatibility score, the unit is classified, and finally, each reusable unit is marked as a fully compatible unit, a conditionally compatible unit, or an incompatible unit. This step, through a multi-dimensional quantitative compatibility judgment model, overcomes the limitations of traditional qualitative verification, achieving accurate quantitative evaluation of reusability. Furthermore, by combining hard rule verification with flexible scoring verification, the accuracy and engineering applicability of compatibility judgment are significantly improved.
[0025] S301. Calculate the five-dimensional matching degree index; For each reusable unit, the system independently calculates five core matching indicators. All indicators have a uniform value range of [0,1]. The closer the value is to 1, the better the adaptability. The specific calculation logic is as follows: Interface matching degree: Calculated based on the ratio of the number of fully matching edges among all data dependency edges of the unit to the total number of edges, intuitively reflecting the basic adaptability of the unit's data interaction. Temporal matching degree: Calculated by combining the unit's own temporal window parameters and the temporal constraint parameters of adjacent connected units to comprehensively calculate the degree of temporal collaborative adaptation. Security level matching degree: Calculated based on the difference between the unit's inherent security level and the minimum security level requirement of the target project. The smaller the level difference, the higher the matching degree. Resource matching degree: Calculated based on the ratio of the unit's total resource consumption to the total available resources of the target platform. The larger the resource consumption margin, the higher the matching degree. Historical verification reusability: Compare the environmental parameters and constraints of the unit's historical reuse scenarios with the similarity of the current project. The higher the similarity, the higher the verification credibility and the higher the matching degree.
[0026] S302, Calculate the reuse compatibility score; To achieve a comprehensive quantitative evaluation of multi-dimensional indicators, this invention designs a proprietary weighted summation calculation model. By pre-setting weights to balance the importance of each dimension, it adapts to the priority requirements of high-security control systems. The calculation formula is as follows: ; in, This indicates the reuse compatibility score. For interface matching degree, For time series matching degree, For security level matching, For resource matching degree, To verify reusability in historical studies, a default weighting coefficient is used. The weights can be flexibly configured according to the project scenario (the security level weight can be increased in high-security scenarios, and the resource weight can be increased in resource-constrained scenarios).
[0027] S303. Perform access downgrade determination based on compatibility. The system has a preset compatibility threshold (default 0.70, customizable). If the unit reuse compatibility score is lower than this threshold, the unit will be forcibly marked as an incompatible unit regardless of whether the single-dimensional verification passes. The system will also automatically generate a detailed list of reasons for mismatch, accurately locate the dimensions of adaptation defects, and avoid the system risks caused by blindly reusing low-adaptability units from a quantitative perspective.
[0028] S31. Interface dimension and data unit verification; The system traverses all data dependency edges in the composite dependency graph, comparing the data types and core attributes of the physical units of upstream and downstream units. If the data types are completely consistent, the interface dimension verification passes; if the physical units are completely consistent, the data unit verification passes. Adaptable differences are simply marked without being considered invalid; incompatible differences are directly deemed to have failed the corresponding dimension verification, ensuring the accuracy of unit communication from the underlying data interaction level.
[0029] S32, Timing Matching Verification; The system performs verification from two core timing dimensions: response latency and jitter tolerance. The upstream unit's output response time is less than or equal to the downstream unit's sampling period, ensuring that the data output timing meets the downstream acquisition requirements. The timing basic matching is passed, and the difference in the jitter tolerance of the upstream and downstream units is within the preset threshold range, ensuring that the timing is stable when multiple units are running in collaboration, without data hazards or timing misalignment issues, thus guaranteeing the real-time performance and stability of the control system.
[0030] S33, Resource Conflict Verification; The system globally calculates the total memory and CPU usage of all units to be reused and compares it with the target platform's hardware resource limit. If the total resource usage does not exceed the platform's limit, the total resource usage verification passes. At the same time, it combines shared resource dependency edges to investigate conflicts where multiple units exclusively occupy the same resource. If there are no resource contention conflicts, the overall resource conflict verification passes, thus avoiding resource overflow and operational lag issues caused by multiple unit reuse.
[0031] S34. Security level retrospective verification; This invention strictly adheres to the industry's core principle of ensuring that the safety level of high-safety control systems does not degrade, and establishes a safety level retrospective verification mechanism. Based on preset industry safety level ranking rules (airworthiness DAL level, functional safety SIL level), it verifies whether the safety level of downstream units is not lower than that of upstream units, preventing low-safety-level units from accessing high-safety control links. This eliminates the risk of safety degradation at the architectural level and meets the functional safety certification requirements for aviation, rail transit, and automotive industries.
[0032] S35, Unit hierarchical marking; The system integrates all verification results and quantitative scores to accurately classify three types of units: those that pass all verification dimensions and meet the compatibility standard are marked as fully compatible units and can be directly reused; those that have adaptable differences, no verification failure dimensions, and meet the compatibility standard are marked as conditionally compatible units and need to be adapted and optimized before reuse; and those that have any verification failure dimension or do not meet the compatibility standard are marked as incompatible units and are prohibited from direct reuse.
[0033] S4. Automatic generation of wrapper layer code for conditionally compatible units; For reusable units marked as conditionally compatible units, based on the type of difference between the encapsulation contract data of the reusable unit and the target project environment, wrapper layer code to eliminate the type of difference is automatically generated and inserted into the call chain of the reusable unit. The core innovation of this step is: differentiated template adaptation, precise link insertion, and quantitative cost assessment, realizing the standardization, automation, and visualization of adaptation logic, completely replacing the traditional implicit adaptation method of manual code modification, and ensuring that the adaptation process is traceable, auditable, and reusable.
[0034] S41. Extract records that can be adapted to differences; The system accurately extracts all adaptable differences of conditionally compatible units, including five standardized difference types: unit adaptable differences, dimension adaptable differences, type adaptable differences, sampling period adaptable differences, and security level adaptable differences, providing a basis for generating targeted adaptation code.
[0035] S42. Generate code based on the difference type matching and packaging template; The system incorporates a standardized wrapper layer template library, precisely matching exclusive templates for different difference types and automatically generating standardized adaptation code without manual intervention: Units can be adapted to the difference matching unit converter template, generating accurate physical unit conversion code; dimensions can be adapted to the difference matching dimension adapter template, generating data dimension transformation code; types can be adapted to the difference matching type converter template, generating lossless data type conversion code; sampling periods can be adapted to the difference matching sampling rate adapter template, generating oversampling interpolation or downsampling extraction code; and security levels can be adapted to the difference matching security enhancement wrapper template, generating security reinforcement code such as redundant voting and health monitoring. All templates have been verified in high-security scenarios, and their code standardization and security meet industry certification requirements.
[0036] S43, Wrapper layer code integration and link insertion; Based on the topological dependencies of the composite dependency graph, the system systematically integrates the generated wrapper layer code into multiple classes. Input adaptation class wrapper code is inserted upstream of reusable units, and output validation class wrapper code is inserted downstream, forming a complete adaptation chain. Simultaneously, standardized comments are embedded in each wrapper layer code segment, clearly recording the reasons for adaptation generation, differences in the original contract, and explanations of the adaptation logic. This makes all adaptation operations explicit and traceable, eliminating implicit code modifications.
[0037] S44. Packaging cost quantitative assessment and solution recommendation; To balance adaptation costs and reuse benefits, this invention proposes a packaging cost scoring model to quantify the workload and engineering costs of unit adaptation. The calculation formula is as follows: ; in, Indicates packaging cost score, To increase the number of adaptation logic, To increase the number of border guards, To increase the number of verification tasks, This adds the number of documents to be reviewed; the default weighting coefficient is used. The system has a preset cost threshold. If the packaging cost score exceeds the threshold, it indicates that the unit adaptation workload is too large and the modification risk is high. The system will automatically generate suggestions for alternative units to help engineers make quick decisions and improve project development efficiency.
[0038] S5, Combined compilation and compliant deliverable output; Each reusable unit marked as fully compatible or conditionally compatible, along with its corresponding wrapper layer code, is combined and compiled according to the aforementioned dependency graph to generate executable code for the target platform. Version sealing records and reuse evidence files are then output. This step addresses the problems of traditional reuse—lack of version control, lack of compliance evidence, and severe interface coupling—by constructing a comprehensive compliant delivery system encompassing code compilation, interface isolation, version sealing, and evidence retention. This system meets the traceability, auditability, and authentication requirements of high-security control systems.
[0039] S51, Orderly build compilation queue; The system determines standardized compilation priorities based on the topological node order of the composite dependency graph, ensuring dependencies are prioritized and compiled step-by-step. Fully compatible units directly add the native source code to the compilation queue, while conditionally compatible units merge and integrate the native source code with the automatically generated wrapper layer code before adding it to the compilation queue, ensuring deep integration and orderly compilation of adaptation logic and native logic.
[0040] S52. Automatically generate interface isolation code; For adjacent reusable units in the topology link, the system automatically generates lightweight interface isolation code, and performs data type verification, physical unit verification, and data range verification in real time during program execution. This avoids data interaction anomalies at the runtime level, decouples implicit coupling between units, and improves the operational stability and fault tolerance of the control system.
[0041] S53, platform-adaptive compilation and linking; The system calls the target platform-specific compiler to uniformly compile and link all native code, wrapper layer code, and interface isolation code in the compilation queue, automatically adapting to the target platform's instruction set, system architecture, and runtime environment to generate executable code that can be directly deployed on the target platform.
[0042] S54. Generate a version seal record with a digital signature; The system integrates the unit version number, encapsulation contract version number, wrapper layer version number, and verification baseline version number of all units, and combines them with the combined configuration version number and timestamp of the current compilation task to generate a unique version seal record. This record is then digitally signed and encrypted to ensure its immutability. This record allows for precise tracking of the unit version, adaptation scheme, and verification baseline for each reused compilation, supporting subsequent version upgrades, issue tracing, and regression testing.
[0043] S55. Generate standardized reusable evidence documents; The system automatically collects data from the entire process, including unit source information, full-dimensional contract verification records, compatibility solution results, packaging layer adaptation instructions, and new verification suggestions, and generates standardized reusable evidence documents to provide complete evidence chain support for the functional safety certification, airworthiness review, and project acceptance of high-safety control systems.
[0044] S501-S504, incompatible unit intelligent processing mechanism; For incompatible units in the composite dependency graph, the system does not directly terminate the task, but instead initiates an intelligent optimization process: automatically extracting unit identifiers and reasons for mismatch, intelligently searching for candidate replacement units in the model library based on functional tags and contract matching degree, and recommending them in order of matching degree; accurately generating optimization suggestions such as packaging enhancement, parameter reshaping, and resource pruning for different defects such as insufficient security level, resource overrun, and parameter mismatch, and estimating the workload; and finally writing all optimization solutions into the reuse evidence file, pausing the compilation task and waiting for user confirmation. Under the premise of ensuring system security, this maximizes the reuse rate of model units and reduces project modification costs.
[0045] This invention enables the standardization and computability of the entire model reuse process, constructs a readable, multi-dimensional encapsulated contract system, replaces traditional manual text descriptions, transforms vague, experience-based reuse into precise quantitative calculation reuse, and completely solves the industry pain points of large errors, missed judgments, and misjudgments in manual verification.
[0046] Furthermore, the compatibility assessment of this invention is more accurate and more in line with engineering practice. It combines a dual mechanism of hard rule verification and flexible quantitative scoring, taking into account both the hard requirements of safety and compliance and the flexible scenarios of engineering adaptation. It processes units with different adaptation states in a hierarchical and classified manner, maximizing the unit reuse rate while ensuring system security.
[0047] This invention also discloses a combinatorial compilation system for reusing control model libraries, comprising: The acquisition module is used to acquire the encapsulation contract data of multiple reusable units in the control model library, wherein the encapsulation contract data includes the input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters and security level identifier of each reusable unit; The construction module is used to select multiple reusable units to be reused from the control model library according to the reuse requirements of the target project, and construct a composite dependency graph to represent the dependency relationship between the reusable units according to the port declaration information of each reusable unit. The marking module is used to perform multi-dimensional compatibility solving based on the combined dependency graph and the encapsulation contract data of each reusable unit, to perform interface dimension verification, timing matching verification, resource conflict verification and security level backtracking verification on each reusable unit, and to mark each reusable unit as a fully compatible unit, a conditionally compatible unit or an incompatible unit according to the verification results. A generation module is used to automatically generate wrapper layer code to eliminate the difference type between the encapsulation contract data of the reusable unit and the target project environment, based on the difference type between the reusable unit and the encapsulation contract data of the reusable unit, and insert the wrapper layer code into the call chain of the reusable unit for reusable units marked as conditionally compatible units; The output module is used to combine and compile the reusable units marked as fully compatible units and conditionally compatible units and their corresponding wrapper layer code according to the combined dependency graph, generate executable code for the target platform, and output version seal record and reuse evidence file.
[0048] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in this application and in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0049] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0050] The above description is merely a preferred embodiment of the present invention and does not limit the scope of this application. Any equivalent results or equivalent process transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.
Claims
1. A combinatorial compilation method for reusing control model libraries, characterized in that, Includes the following steps: Obtain encapsulation contract data for multiple reusable units in the control model library, wherein the encapsulation contract data includes input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters, and security level identifier for each reusable unit; Based on the reuse requirements of the target project, multiple reusable units to be reused are selected from the control model library, and a composite dependency graph representing the dependency relationship between each reusable unit is constructed based on the port declaration information of each reusable unit. Based on the combined dependency graph and the encapsulation contract data of each reusable unit, a multi-dimensional compatibility solution is performed. Interface dimension verification, timing matching verification, resource conflict verification, and security level backtracking verification are performed on each reusable unit. Based on the verification results, each reusable unit is marked as a fully compatible unit, a conditionally compatible unit, or an incompatible unit. For reusable units marked as conditionally compatible units, based on the type of difference between the encapsulation contract data of the reusable unit and the target project environment, wrapper layer code for eliminating the type of difference is automatically generated and inserted into the call chain of the reusable unit; Each reusable unit marked as fully compatible and conditionally compatible, along with its corresponding wrapper layer code, is combined and compiled according to the aforementioned combination dependency graph to generate executable code for the target platform, and outputs version seal records and reuse evidence files.
2. The combined compilation method for control model library reuse according to claim 1, characterized in that, The step of obtaining the encapsulated contract data of multiple reusable units in the control model library includes: Traverse each reusable unit in the control model library and read the structured contract description file corresponding to that reusable unit; Extract the input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters, and security level identifier of the reusable unit from the structured contract description file; The input hypothesis parameters include the input data type, input value range, input physical unit, and input sampling period; the output commitment parameters include the output data type, output physical unit, and output response time; the timing window parameters include the upper limit of single execution time and the period jitter tolerance; the resource consumption parameters include memory consumption and CPU utilization; and the security level identifier includes the security integrity level or airworthiness level applicable to the reusable unit. Construct the encapsulated contract data object of the reusable unit based on the extracted parameters.
3. The combined compilation method for control model library reuse according to claim 1, characterized in that, The step of constructing a composite dependency graph representing the dependencies between reusable units based on the port declaration information of each reusable unit includes: Obtain the reuse requirement list of the target project, load the corresponding reusable units and their encapsulated contract data from the control model library according to the reuse requirement list, and construct the initial node set; Traverse each reusable unit in the initial node set, extract the output port declaration and input port declaration of the reusable unit, match the output port declaration of each reusable unit with the input port declaration of other reusable units for port attributes, and if the match is successful, establish a data dependency edge between the two reusable units. Traverse each reusable unit in the initial node set, extract the resource occupancy parameters of the reusable unit, and if two reusable units have the same resource item in their resource occupancy parameters, then establish a shared resource dependency edge between the two reusable units. Combine all nodes in the initial node set, along with all established data dependency edges and shared resource dependency edges, to generate a composite dependency graph; and record the matching result of each data dependency edge in the edge attribute of that data dependency edge.
4. The combined compilation method for control model library reuse according to claim 1, characterized in that, When matching the port attributes of each output port with the port attributes of each input port, if the port name, data type, physical unit, and data dimension are all the same, it is recorded as a complete match. If there are inconsistencies but they belong to the preset adaptable difference types, they are recorded as adaptable differences. If it does not belong to the adaptable difference type, it is recorded as an inadaptable difference; The matching result of each data dependency edge is recorded in the edge attribute of that data dependency edge.
5. The combined compilation method for control model library reuse according to claim 1, characterized in that, The steps for performing multidimensional compatibility solving include: For each data dependency edge in the combined dependency graph, read the output port declaration of the upstream reusable unit and the input port declaration of the downstream reusable unit connected to the data dependency edge; The output port declaration of the upstream reusable unit is compared with the input port declaration of the downstream reusable unit in terms of data type and physical unit. If they are consistent, the interface dimension verification is passed. The timing window parameters of the upstream reusable unit and the timing window parameters of the downstream reusable unit are compared and matched in a timing match. If the preset timing match conditions are met, the timing match verification is passed. Calculate the total resource occupancy parameters of all reusable units, compare the total resource occupancy parameters with the available resource capacity of the target platform, and if the preset resource capacity conditions are met, the resource conflict check is passed. Obtain the security level identifier of the upstream reusable unit and the security level identifier of the downstream reusable unit connected to each data dependency edge. According to the preset security level sorting rules, determine whether the security level of the downstream reusable unit meets the security level backtracking requirements. If it does, the security level backtracking verification is passed. Based on the verification results of each reusable unit, if all dimensions pass, it is marked as a fully compatible unit; If any dimension is marked as adaptable difference and no dimension is marked as unacceptable, then it is marked as a conditionally compatible unit; If any dimension is marked as failing, then it is marked as an incompatible unit.
6. The combinatorial compilation method for control model library reuse according to claim 5, characterized in that, Before the step of integrating the verification results of each reusable unit, the following steps are also performed: Calculate the interface matching degree, timing matching degree, security level matching degree, resource matching degree, and historical verification reusability of each reusable unit; The reusability compatibility score of the reusable unit is obtained by weighted summation of the interface matching degree, timing matching degree, security level matching degree, resource matching degree and historical verification reusability. If the reuse compatibility score is lower than the preset compatibility threshold, the labeling result of the reusable unit will be downgraded to an incompatible unit.
7. The combined compilation method for control model library reuse according to claim 1, characterized in that, The step of automatically generating wrapper layer code for eliminating the difference types includes: Retrieve all adaptable difference records for each reusable unit marked as a conditionally compatible unit; For each adaptable difference record, the corresponding wrapper layer template is called from the preset wrapper layer template library according to the difference type, and the corresponding wrapper layer code is generated. All generated wrapper layer codes are combined according to the dependencies in the combined dependency graph, and the corresponding wrapper layer codes are inserted upstream and / or downstream of the reusable unit. The packaging cost score of the reusable unit is determined based on the number of new adaptation logic, new boundary guards, new verification tasks, and new review materials added in all the wrapper layer code generated by the reusable unit. If the packaging cost score exceeds a preset cost score threshold, an alternative unit usage suggestion is generated.
8. The combined compilation method for control model library reuse according to claim 1, characterized in that, The steps for performing combined compilation and outputting version seal records and reuse evidence files include: The compilation order of all reusable units is determined according to the node order in the combined dependency graph. For fully compatible units, the source code of the unit is directly added to the compilation queue. For conditionally compatible units, the source code of the unit and the corresponding wrapper layer code are merged and then added to the compilation queue. Based on the connection relationship of each data dependency edge, interface isolation code is generated between adjacent reusable units in the compilation queue; The compiler of the target platform is invoked to compile and link all the code in the compilation queue, generating executable code for the target platform; Obtain the version information of each reusable unit and the configuration information of the current combined compilation task, and combine them to generate a version seal record; Collect source information, verification records, packaging layer descriptions, and new verification suggestions for each reusable unit, and combine them to generate a reuse evidence file.
9. The combined compilation method for control model library reuse according to claim 1, characterized in that, When there are reusable units marked as incompatible units in the composite dependency graph, the following steps are performed before performing composite compilation: Get the cell identifiers of all reusable cells marked as incompatible cells and the corresponding list of mismatch reasons; For each incompatible unit, based on the unit identifier of the incompatible unit, search the control model library for candidate reusable units with the same functional labels and whose encapsulated contract data matches the target project environment, and generate a recommended list of replacement units; For each incompatible unit, generate packaging enhancement suggestions based on the list of reasons for the incompatibility of that incompatible unit; The recommended list of replacement units and the packaging enhancement suggestions are written into the reuse evidence file, and a compilation pause notification is generated. After the user reselects a reusable unit to be reused, the corresponding steps are re-executed.
10. A combinatorial compilation system for reusing control model libraries, characterized in that, include: The acquisition module is used to acquire the encapsulation contract data of multiple reusable units in the control model library, wherein the encapsulation contract data includes the input assumption parameters, output commitment parameters, timing window parameters, resource consumption parameters and security level identifier of each reusable unit; The construction module is used to select multiple reusable units to be reused from the control model library according to the reuse requirements of the target project, and construct a composite dependency graph to represent the dependency relationship between the reusable units according to the port declaration information of each reusable unit. The marking module is used to perform multi-dimensional compatibility solving based on the combined dependency graph and the encapsulation contract data of each reusable unit, to perform interface dimension verification, timing matching verification, resource conflict verification and security level backtracking verification on each reusable unit, and to mark each reusable unit as a fully compatible unit, a conditionally compatible unit or an incompatible unit according to the verification results. A generation module is used to automatically generate wrapper layer code to eliminate the difference type between the encapsulation contract data of the reusable unit and the target project environment, based on the difference type between the reusable unit and the encapsulation contract data of the reusable unit, and insert the wrapper layer code into the call chain of the reusable unit for reusable units marked as conditionally compatible units; The output module is used to combine and compile the reusable units marked as fully compatible units and conditionally compatible units and their corresponding wrapper layer code according to the combined dependency graph, generate executable code for the target platform, and output version seal record and reuse evidence file.