A PLC library management method and system based on cloud function-driven architecture

By encapsulating PLC library function modules into cloud functions and combining them with an event-driven mechanism, unified cloud registration and dynamic invocation of PLC library management are achieved. This solves the problems of insufficient resource decoupling and on-demand invocation in existing technologies, and improves the system's resource utilization and response performance.

CN121028661BActive Publication Date: 2026-06-30CHINA RAILWAY CONSTR HEAVY IND +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA RAILWAY CONSTR HEAVY IND
Filing Date
2025-08-08
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing PLC library management methods suffer from insufficient resource decoupling and on-demand calling, failing to meet cloudification requirements, resulting in difficulties in system integration, low performance utilization, and the inability to achieve function-level dynamic scheduling and cross-project sharing.

Method used

By encapsulating the PLC control logic function module into cloud functions, it supports unified registration, automatic deployment, and on-demand instantiation in the cloud. Combined with the event-driven mechanism, it enables flexible deployment and efficient execution of functions, and optimizes resource utilization by utilizing resource analysis and timing analysis sub-modules.

Benefits of technology

It improves resource utilization and system response performance, supports resource sharing across devices and projects, and meets the flexibility and intelligence requirements of modern industrial automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121028661B_ABST
    Figure CN121028661B_ABST
Patent Text Reader

Abstract

This invention relates to the field of industrial automation control and communication systems, and provides a PLC library management method based on cloud function-driven architecture. The method includes defining PLC control logic as library module source files, parsing and function-converting them into cloud functions and uploading them to a cloud function library; dragging the target cloud function into the business process or logic diagram, automatically identifying the corresponding function ID and generating a queue of function execution requests to be called; receiving call requests from the queue, determining whether there are existing cloud function instances available for scheduling; if no available instances are found, dynamically instantiating the target cloud function and performing function calculations based on an event queue mechanism; and filtering out a set of functions to be deployed to edge devices based on the calculation results and distributing them to the edge cloud devices. By combining the PLC library management module with cloud function-driven architecture, the basic unit of PLC cloud computing is reduced to a function, providing finer granularity, allowing users to directly deploy function code, and automatically completing tasks such as data redundancy, load balancing, regional redundancy, and log recording.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial automation control and communication systems, and in particular to a PLC library management method and system based on cloud function-driven architecture. Background Technology

[0002] With the continuous development of industrial control systems, PLCs (Programmable Logic Controllers), as core control devices, are experiencing increasingly complex control logic and greater demand for reuse. To improve development efficiency and system maintainability, the industrial sector commonly encapsulates and manages frequently used function modules by pre-setting PLC libraries. However, in existing technologies, most PLC libraries are integrated into local IDEs, deployed in a centralized and static manner along with the project. This results in inconvenient updates, high version coupling, and difficulty in meeting the cloud-based requirements of modern industrial automation, such as remote access and resource reuse.

[0003] In recent years, cloud computing and edge computing technologies have been gradually adopted in industrial scenarios, and some PLC systems have begun to migrate their programs and library resources to the cloud. However, existing solutions are mostly based on overall deployment or coarse-grained service encapsulation, lacking the ability to manage library functions in a refined manner, and failing to achieve function-level dynamic scheduling, elastic resource allocation, and cross-project sharing. At the same time, there are differences between traditional library function design and cloud function platforms, such as architectural incompatibility and different operating mechanisms, resulting in difficulties in system integration and low performance utilization.

[0004] Therefore, existing PLC library management methods still have significant shortcomings in resource decoupling, on-demand invocation, and cloud-based service provisioning, hindering the promotion and intelligent upgrading of cloud-based PLC systems. There is an urgent need for a cloud-based function-driven mechanism that supports function-level decoupling, event-driven mechanisms, and on-demand instantiation. This mechanism would enable unified registration, automatic deployment, dynamic invocation, and edge deployment of PLC library functions, thereby improving resource utilization efficiency and system response performance, and adapting to the flexibility and intelligent development needs of modern industrial control systems. Summary of the Invention

[0005] To address the aforementioned problems, the present invention aims to provide a PLC library management method and system based on cloud function-driven architecture. This method aims to solve the static, centralized deployment issues in existing PLC library management technologies. By encapsulating PLC control logic function modules as cloud functions and supporting unified registration, automatic deployment, on-demand instantiation, and dynamic invocation in the cloud, it improves resource utilization, optimizes computing resource allocation, supports collaborative work between cloud and edge devices, and achieves flexible deployment and efficient execution of functions. This, in turn, enhances the flexibility, intelligence, and responsiveness of industrial automation systems. The above-mentioned objective of the present invention is achieved through the following technical solutions:

[0006] This invention provides a PLC library management method based on cloud function-driven architecture, comprising:

[0007] The PLC control logic can be defined graphically or by code editing through the PLC library management module and saved as a library module source file. The internal library parsing submodule is called to perform syntax parsing and function conversion on the source file, and encapsulate it into a cloud function with standard interface parameters, logic body and version information. The library management submodule then performs resource registration, function ID generation and registration and upload to the cloud function library.

[0008] During the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution.

[0009] After receiving the call request from the request queue, the request processing submodule determines whether there is an existing cloud function instance available for scheduling. If no instance is available, the target cloud function is dynamically instantiated through the function computing module, and function computing is performed based on the event queue mechanism. Meanwhile, the resource analysis submodule and the time series analysis submodule are periodic tasks that regularly analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start preheating operations in advance.

[0010] Based on the computation results executed by the function computing module, the management submodule selects the set of functions that need to be deployed to edge devices, and distributes them to edge cloud devices through the edge deployment submodule to achieve minimal function deployment.

[0011] Furthermore, the internal library parsing submodule is invoked to perform syntax parsing and function conversion on the source file, encapsulating it into a cloud function with standard interface parameters, logical body, and version information. The library management submodule then performs resource registration, function ID generation, and registration and uploading to the cloud function library, including:

[0012] After the PLC control logic is parsed and transformed into a function by the syntax parser in the library parsing submodule, a standard cloud function is generated. The meta-information of the cloud function includes: function name, input and output parameters, version information, and logic body. The logic body is either code or a container image.

[0013] Assign a unique function ID to each generated cloud function, register the metadata as a resource and write it into the function metadata database, and upload the logic body to the function code repository or function platform;

[0014] Cloud functions are categorized according to their functional types and assigned to corresponding sub-libraries within the cloud function library. Additionally, each cloud function has its own access permissions set based on its functional requirements, allowing it to be classified as either a system public library or a user private library.

[0015] Furthermore, during the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution.

[0016] In response to the defined business process configuration, the business process configuration allows users to add target cloud functions to the business process or logic diagram through the PLC library management module in a graphical or code editing manner, and configure their input and output parameters;

[0017] During the compilation of business processes or logic diagrams, the target cloud functions are automatically identified, and the corresponding function execution request queue is generated and sent to the request processing submodule.

[0018] Furthermore, after receiving the call request from the request queue, the request processing submodule determines whether there is an existing cloud function instance available for scheduling. If no instance is available, the target cloud function is dynamically instantiated through the function computation module, and function computation is performed based on the event queue mechanism, including:

[0019] Based on the received call request, determine whether a corresponding cloud function instance exists;

[0020] When a cloud function instance exists, the available instance can be directly scheduled for processing;

[0021] When no metafunction instance exists, the target cloud function is dynamically instantiated through the function computation module. The instantiation process is based on the meta information in the call request. The function computation module performs the computation in the order of the call request through the event queue mechanism and returns the computation result.

[0022] Furthermore, the resource analysis submodule and the time-series analysis submodule, as periodic tasks, regularly analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start warm-up operations in advance, including:

[0023] The resource analysis submodule periodically obtains the current system resource usage status. Based on the current resource usage status and future function call requirements, it predicts the amount of data to be loaded. If the predicted data is not used within a preset time or the system resources are insufficient, it releases the data that is no longer needed in the cache.

[0024] The time series analysis submodule periodically analyzes the time series data of function calls, deletes outdated data and appends the latest data, calculates function call patterns and frequencies, and generates or destroys function instances in advance based on the prediction results to optimize function execution.

[0025] Furthermore, the system periodically obtains the current system resource usage status. Based on the current resource usage status and future function call requirements, it predicts the amount of data to be loaded. If the predicted data is not used within a preset time or system resources are insufficient, it releases the cached data that is no longer needed, including:

[0026] Regularly obtain the current resource usage status, including the real-time availability of CPU, memory and / or storage resources, and monitor the load status, including CPU load, memory pressure and / or storage I / O load;

[0027] Based on the function call trends provided by the time series analysis submodule, the resource analysis submodule predicts the amount of data that needs to be loaded into the cache within a preset time period in the future, and assesses whether the current resource usage meets the data loading requirements.

[0028] If the loading requirements are met, the data will be loaded into the cache.

[0029] Release unnecessary data from the cache when the loading requirements are not met, or when the amount of data will not be used within a preset time in the future.

[0030] Furthermore, the time-series data of function calls is analyzed periodically, outdated data is deleted and the latest data is appended, function call patterns and frequencies are calculated, and function instances are generated or destroyed in advance based on the prediction results to optimize function execution, including:

[0031] Periodically collect time-series data of function calls and update the time-series data according to preset time intervals;

[0032] Calculate the call patterns and trends of the updated time series functions, predict the future function call trends, and generate or destroy corresponding function instances based on the function call trends.

[0033] Based on the same inventive concept, this invention also provides a PLC library management system based on cloud function-based driving, which executes the PLC library management method described above, including:

[0034] The cloud database is used to define PLC control logic through the PLC library management module in a graphical or code editing manner and save it as a library module source file. The internal library parsing submodule is called to perform syntax parsing and function conversion on the source file, and encapsulate it into a cloud function with standard interface parameters, logic body and version information. The library management submodule performs resource registration, function ID generation and registration and upload to the cloud function library.

[0035] The PLC library management module is used during engineering development to drag target cloud functions into business processes or logic diagrams through the PLC management platform. During the compilation phase, it automatically identifies the corresponding function IDs and generates a queue of function execution requests to be called. The request queue is then passed to the request processing submodule for scheduling and execution. Based on the calculation results executed by the function calculation module, the management submodule selects the set of functions that need to be deployed to edge devices and distributes them to edge cloud devices through the edge deployment submodule to achieve minimal function deployment.

[0036] The Function Compute module is used by the request processing submodule to receive call requests from the request queue, determine whether there are existing cloud function instances available for scheduling, and if no available instances are available, dynamically instantiate the target cloud function and execute function computation based on the event queue mechanism.

[0037] Furthermore, the PLC library management module also includes a resource analysis submodule and a timing analysis submodule, which are used as periodic tasks to periodically analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start preheating operations in advance.

[0038] Furthermore, the request processing submodule is used to determine whether a corresponding cloud function instance exists based on the received call request. When a cloud function instance exists, it directly schedules an available instance for processing. When no meta-function instance exists, the target cloud function is dynamically instantiated through the function computing module. The instantiation process is based on the meta-information in the call request. The function computing module executes the calculation in the order of the call request through an event queue mechanism and returns the calculation result.

[0039] Compared with the prior art, the present invention has at least one of the following beneficial effects:

[0040] This invention combines a PLC library management module with cloud functionization, reducing the basic unit of PLC cloud computing to a function. This results in finer granularity, higher single-host instance density, event-driven function operation, and an automatic scaling mechanism to address high concurrency issues: instances are automatically scaled based on the number of requests. Users can directly deploy function code without worrying about the infrastructure. It automatically handles data redundancy, load balancing, regional redundancy, and logging, providing extremely high elasticity and efficient resource utilization. Attached Figure Description

[0041] Figure 1 This is a flowchart illustrating the steps of the PLC library management method based on cloud function-driven architecture of the present invention.

[0042] Figure 2 This is a schematic diagram illustrating the working principle of the PLC library management method based on cloud function-driven architecture of the present invention.

[0043] Figure 3 This is a schematic diagram of the architecture of the PLC library management system based on cloud function-driven architecture of the present invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0045] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0046] First Embodiment

[0047] In traditional industrial automation systems, PLC (Programmable Logic Controller) programming typically relies on a local IDE (Integrated Development Environment) for development and debugging. Most traditional PLC library management systems are deployed on a standalone basis, embedding the PLC library management as a functional module into the local program. While this static integration approach may meet simple needs in the early stages, problems gradually emerge as the control logic becomes more complex. Especially when updating, optimizing, or deleting PLC library modules, the entire program must be recompiled and a new version released, resulting in high costs for both the enterprise and the user.

[0048] Furthermore, traditional PLC library management typically integrates library modules locally, resulting in relatively independent resources that are difficult to share across different devices and projects. This stand-alone deployment model limits the effective utilization of system resources and fails to fully meet the needs of modern industrial automation systems. When faced with cross-regional and cross-device resource access requirements, traditional PLC library management methods struggle to achieve flexible resource sharing and remote access, significantly hindering the cloudification process of industrial control systems.

[0049] With the development of Industrial Internet of Things (IIoT) and cloud computing technologies, the need for cloud-based PLC systems has become increasingly urgent. Cloud-based PLCs can not only significantly improve resource utilization and sharing rates, but also meet the demands of modern industrial automation for flexible, on-demand resource scheduling. Therefore, existing PLC library management methods cannot meet the needs of cloudification, requiring a new technical solution to break through existing limitations and support dynamic scheduling and cross-platform access to cloud resources.

[0050] Therefore, existing technologies have the following problems: ① Traditional PLC library management technology adopts local single-machine deployment and resource isolation, which cannot achieve resource sharing and cross-platform calling, thus limiting the system's flexibility and scalability; ② Whenever a PLC library module needs to be added, optimized, or deleted, the entire program must be recompiled and a new version released, requiring users to reinstall and update, resulting in high maintenance costs and time losses; ③ Traditional PLC library management systems cannot meet the needs of modern cloud-based industrial control systems, especially in terms of cross-device and cross-regional resource calling, where there are significant bottlenecks; ④ Traditional systems have static and fixed library function management, which cannot be scheduled on demand and is difficult to cope with the increasing flexibility and intelligence requirements in industrial automation.

[0051] Addressing the issues of poor resource independence, complex updates, and inability to meet cloud-based requirements in existing technologies, the inventors recognized that traditional PLC library management systems cannot meet the demands of modern industrial automation for flexibility and resource sharing. Therefore, they proposed a cloud-function-based PLC library management method. This method utilizes cloud function technology to modularize the PLC library, supporting dynamic deployment, on-demand instantiation, and elastic resource allocation. By migrating PLC library functions to the cloud, this solution achieves refined function management and cross-device, cross-project resource sharing, overcoming the limitations of traditional management methods, improving resource utilization and system response performance, and perfectly meeting the needs of modern intelligent manufacturing. The specific implementation method is as follows:

[0052] like Figure 1 The present invention provides a PLC library management method based on cloud function-driven architecture, comprising:

[0053] Step S1: Define the PLC control logic through the PLC library management module in a graphical or code editing manner, and save it as a library module source file. Call the internal library parsing submodule to perform syntax parsing and function conversion on the source file, and encapsulate it into a cloud function with standard interface parameters, logic body and version information. The library management submodule performs resource registration, function ID generation and registration and upload to the cloud function library.

[0054] Step S2: During the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution.

[0055] Step S3: After receiving the call request from the request queue, the request processing submodule determines whether there is an existing cloud function instance available for scheduling. If there is no available instance, the target cloud function is dynamically instantiated through the function computing module, and function computing is performed based on the event queue mechanism. At the same time, the resource analysis submodule and the time sequence analysis submodule, as periodic tasks, regularly analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start preheating operations in advance.

[0056] Step S4: Based on the calculation results executed by the function computing module, the management submodule selects the set of functions that need to be deployed to the edge devices, and distributes them to the edge cloud devices through the edge deployment submodule to achieve minimal function deployment.

[0057] Specifically, such as Figure 2 , 3 As shown, the PLC library management platform based on cloud function-based management includes a management module, a cloud function library, and a function computing module. The management module includes functions such as library management, library parsing, resource analysis, timing analysis, interface requests, and edge cloud deployment. Library parsing includes library function-based deployment and library module interface calls. Library management includes adding, deleting, modifying, and querying library functions. Library function-based deployment runs the system's library modules as cloud functions, deployed independently. The edge cloud deployment can be based on specific application scenarios and can achieve minimal deployment of edge cloud PLCs. The cloud function library includes, but is not limited to, development libraries, communication libraries, type conversion libraries, timing libraries, algorithm verification libraries, mathematical function libraries, and custom libraries, enabling functions such as AI inference and image processing. The function platform and library management platform instantiate functions based on user requests and execute functions in the form of event queues, automatically completing tasks such as data redundancy, load balancing, regional redundancy, and log recording. The management module uses timing analysis technology to predict peak call requests and accelerate the function platform's cold start. The management module uses caching loading technology to reduce the library functions' requests to external resources.

[0058] Furthermore, the internal library parsing submodule is invoked to perform syntax parsing and function conversion on the source file, encapsulating it into a cloud function with standard interface parameters, logical body, and version information. The library management submodule then performs resource registration, function ID generation, and registration and uploading to the cloud function library, including:

[0059] After the PLC control logic is parsed and transformed into a function by the syntax parser in the library parsing submodule, a standard cloud function is generated. The meta-information of the cloud function includes: function name, input and output parameters, version information, and logic body. The logic body is either code or a container image.

[0060] Assign a unique function ID to each generated cloud function, register the metadata as a resource and write it into the function metadata database, and upload the logic body to the function code repository or function platform;

[0061] Cloud functions are categorized according to their functional types and assigned to corresponding sub-libraries within the cloud function library. Additionally, each cloud function has its own access permissions set based on its functional requirements, allowing it to be classified as either a system public library or a user private library.

[0062] It should be noted that this cloud function library is used to store PLC library module functions that have been processed into functions. Users can complete the function development, structure standardization conversion, and registration and uploading process through the PLC library management platform, i.e., the PLC library management module. Each function includes interface parameters, logic body, version information and dependency description, supports cloud calls and edge deployment, and the sub-library classes in the cloud function library include, but are not limited to, development libraries, communication libraries, type conversion libraries, time libraries, algorithm verification libraries, mathematical function libraries, custom libraries, etc., and can be extended to more complex functions, such as AI inference and image processing.

[0063] Furthermore, during the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution.

[0064] In response to the defined business process configuration, the business process configuration allows users to add target cloud functions to the business process or logic diagram through the PLC library management module in a graphical or code editing manner, and configure their input and output parameters;

[0065] During the compilation of business processes or logic diagrams, the target cloud functions are automatically identified, and the corresponding function execution request queue is generated and sent to the request processing submodule.

[0066] Furthermore, after receiving the call request from the request queue, the request processing submodule determines whether there is an existing cloud function instance available for scheduling. If no instance is available, the target cloud function is dynamically instantiated through the function computation module, and function computation is performed based on the event queue mechanism, including:

[0067] Based on the received call request, determine whether a corresponding cloud function instance exists;

[0068] When a cloud function instance exists, the available instance can be directly scheduled for processing;

[0069] When no metafunction instance exists, the target cloud function is dynamically instantiated through the function computation module. The instantiation process is based on the meta information in the call request. The function computation module performs the computation in the order of the call request through the event queue mechanism and returns the computation result.

[0070] Furthermore, the resource analysis submodule and the time-series analysis submodule, as periodic tasks, regularly analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start warm-up operations in advance, including:

[0071] The resource analysis submodule periodically obtains the current system resource usage status. Based on the current resource usage status and future function call requirements, it predicts the amount of data to be loaded. If the predicted data is not used within a preset time or the system resources are insufficient, it releases the data that is no longer needed in the cache.

[0072] The time series analysis submodule periodically analyzes the time series data of function calls, deletes outdated data and appends the latest data, calculates function call patterns and frequencies, and generates or destroys function instances in advance based on the prediction results to optimize function execution.

[0073] Furthermore, the system periodically obtains the current system resource usage status. Based on the current resource usage status and future function call requirements, it predicts the amount of data to be loaded. If the predicted data is not used within a preset time or system resources are insufficient, it releases the cached data that is no longer needed, including:

[0074] Regularly obtain the current resource usage status, including the real-time availability of CPU, memory and / or storage resources, and monitor the load status, including CPU load, memory pressure and / or storage I / O load;

[0075] Based on the function call trends provided by the time series analysis submodule, the resource analysis submodule predicts the amount of data that needs to be loaded into the cache within a preset time period in the future, and assesses whether the current resource usage meets the data loading requirements.

[0076] If the loading requirements are met, the data will be loaded into the cache.

[0077] Release unnecessary data from the cache when the loading requirements are not met, or when the amount of data will not be used within a preset time in the future.

[0078] Furthermore, the time-series data of function calls is analyzed periodically, outdated data is deleted and the latest data is appended, function call patterns and frequencies are calculated, and function instances are generated or destroyed in advance based on the prediction results to optimize function execution, including:

[0079] Periodically collect time-series data of function calls and update the time-series data according to preset time intervals;

[0080] Calculate the call patterns and trends of the updated time series functions, predict the future function call trends, and generate or destroy corresponding function instances based on the function call trends.

[0081] It should be specifically noted that in the time-series analysis submodule, based on time-series analysis technology, peak call requests are predicted to accelerate the cold start of the function platform. Through periodic tasks, the time series of function requests are analyzed, the oldest time-series data is deleted, and the latest time-series data is appended. The time-series data is maintained and statistically analyzed to calculate the time-series characteristics of library functions, such as call patterns (suddenness, regularity), call frequency (periodicity, trend), etc., and the probability of function calls in a certain period of time is calculated, thereby realizing the pre-generation and destruction of function instances.

[0082] To put it another way, in order to improve the response speed and computing efficiency of the cloud-based PLC library management system, especially in high-concurrency environments, the management of function instances becomes crucial. Traditional function calling methods cannot effectively predict and schedule function instances, leading to function cold start latency and resource waste. Therefore, this embodiment combines timing analysis technology to predict function call trends based on historical call patterns, thereby achieving function instance pre-generation, cold start acceleration, and resource optimization.

[0083] The specific implementation method can be as follows:

[0084] (1) In the time series analysis submodule, time series data of function call requests are collected periodically. The data includes the timestamp of each function call, the function ID called, the function execution time, the resources required, etc. This submodule updates the time series data according to a predetermined time interval.

[0085] (2) The time series analysis submodule maintains the time series data based on the latest function call requests and historical data. Specific operations include: deleting the oldest data record and appending the latest data to ensure the real-time performance and accuracy of the time series data.

[0086] (3) The timing analysis submodule performs statistical analysis on the collected timing data and calculates the calling characteristics of library functions, including:

[0087] Call patterns: such as sudden calls (a surge in call volume within a certain period of time) and regular calls (a stable or periodic call volume within a certain period of time).

[0088] Call frequency: such as periodic calls (e.g., calls at fixed intervals such as daily or weekly) and trend calls (e.g., call frequency gradually increasing or decreasing).

[0089] Based on these characteristics, the submodule predicts the possible function call demand within a certain period of time in the future and calculates the demand for function instances within that period.

[0090] Based on the prediction results of time-series analysis, the system generates the necessary function instances in advance. If a high demand for a function is predicted during a specific future period, the system will instantiate the function on the cloud function platform in advance to reduce cold start latency. When a function instance is predicted to be no longer needed, the system will destroy the unnecessary instance, thereby optimizing resource utilization. During function instantiation, the time-series analysis submodule dynamically adjusts the function instance warm-up strategy by predicting high-concurrency periods and peak function requests, loading cold start functions in advance to reduce cold start latency and improve system response speed.

[0091] Meanwhile, during function computation, frequently used data is pre-loaded into the cache using caching techniques. This reduces the frequency of requests to external resources (such as databases or external APIs), thereby improving function execution efficiency and reducing latency.

[0092] In step S4, based on the calculation results executed by the function computation module, the management submodule selects the set of functions that need to be deployed to edge devices, and distributes them to edge cloud devices through the edge deployment submodule, thereby achieving minimal function deployment.

[0093] In specific application scenarios, such as workshop assembly line control systems, the PLC library management platform stores a large number of function modules, for example, 500 functions. However, in actual applications, only specific functions need to be deployed at the edge. Based on the calculation results executed by the function calculation module, the management submodule filters out the set of functions that need to be deployed to edge devices, and then the edge deployment submodule sends these selected functions to the edge cloud devices for execution, thereby achieving minimal function deployment. Therefore, the PLC library management platform analyzes the current project requirements, control logic, and deployed hardware environment to identify only 30 necessary functions, and deploys these functions along with their dependencies to the edge cloud devices. In this way, only functions closely related to the current project requirements are deployed and executed, avoiding unnecessary resource consumption and improving system response efficiency. Through this on-demand deployment mechanism, the system can achieve efficient resource management and optimize the control process of the workshop assembly line.

[0094] In addition to filtering functions to be deployed to edge devices, the management submodule also handles the creation, deletion, modification, and querying of library functions. Specifically, the management submodule supports the following functions: users can add newly developed functions to the library for registration and storage for later use; users can delete unnecessary functions to optimize library resources and avoid redundant functions occupying storage space; if a function needs updating or optimization, the management submodule supports modifying the function's content, including function logic and interface parameters. Users can query all registered functions in the library through the management submodule to view detailed information such as version number, interface description, and call status. Through these functions, the management submodule ensures that the functions in the cloud function library are always up-to-date and can flexibly respond to ever-changing industrial automation needs.

[0095] Second Embodiment

[0096] Based on the same inventive concept, this invention also provides a PLC library management system based on cloud function-based driving, which executes the PLC library management method described above, including:

[0097] The cloud database is used to define PLC control logic through the PLC library management module in a graphical or code editing manner and save it as a library module source file. The internal library parsing submodule is called to perform syntax parsing and function conversion on the source file, and encapsulate it into a cloud function with standard interface parameters, logic body and version information. The library management submodule performs resource registration, function ID generation and registration and upload to the cloud function library.

[0098] The PLC library management module is used during engineering development to drag target cloud functions into business processes or logic diagrams through the PLC management platform. During the compilation phase, it automatically identifies the corresponding function IDs and generates a queue of function execution requests to be called. The request queue is then passed to the request processing submodule for scheduling and execution. Based on the calculation results executed by the function calculation module, the management submodule selects the set of functions that need to be deployed to edge devices and distributes them to edge cloud devices through the edge deployment submodule to achieve minimal function deployment.

[0099] The Function Compute module is used by the request processing submodule to receive call requests from the request queue, determine whether there are existing cloud function instances available for scheduling, and if no available instances are available, dynamically instantiate the target cloud function and execute function computation based on the event queue mechanism.

[0100] Furthermore, the PLC library management module also includes a resource analysis submodule and a timing analysis submodule, which are used as periodic tasks to periodically analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start preheating operations in advance.

[0101] Furthermore, the request processing submodule is used to determine whether a corresponding cloud function instance exists based on the received call request. When a cloud function instance exists, it directly schedules an available instance for processing. When no meta-function instance exists, the target cloud function is dynamically instantiated through the function computing module. The instantiation process is based on the meta-information in the call request. The function computing module executes the calculation in the order of the call request through an event queue mechanism and returns the calculation result.

[0102] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

[0103] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A cloud function-based driving PLC library management method, characterized by, include: The PLC control logic is defined graphically or through code editing via the PLC library management module and saved as a library module source file. The internal library parsing submodule then performs syntax parsing and function conversion on the source file, encapsulating it into a cloud function with standard interface parameters, logic body, and version information. The library management submodule then registers the resource, generates and uploads the function ID to the cloud function library. After the PLC control logic is parsed by the syntax parser in the library parsing submodule and the function conversion is performed, a standard cloud function is generated. The cloud information of the cloud function includes: function name, input and output parameters, version information and logic body. The logic body is code or container image. Assign a unique function ID to each generated cloud function, register the cloud information as a resource and write it into the function metadata database, and upload the logic body to the function code repository or function platform; The cloud functions are classified according to their functional types and assigned to the corresponding sub-libraries in the cloud function library. At the same time, each cloud function is assigned a corresponding access permission according to its functional requirements and is assigned to either the system public library or the user private library. During the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution. After receiving a call request from the request queue, the request processing submodule determines whether there is an existing cloud function instance available for scheduling. If no instance is available, the target cloud function is dynamically instantiated through the function computation module, and function computation is performed based on the event queue mechanism, including... Based on the received call request, determine whether a corresponding cloud function instance exists; When the cloud function instance exists, the available instance is directly scheduled for processing; When the cloud function instance does not exist, the target cloud function is dynamically instantiated by the function calculation module. The instantiation process is based on the cloud information in the call request. The function calculation module performs calculations in the order of the call request through the event queue mechanism and returns the calculation results. The resource analysis and time-series analysis submodules, as periodic tasks, regularly analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start warm-up operations in advance, including... The resource analysis submodule periodically obtains the current system resource usage status. Based on the current system resource usage status and future function call requirements, it predicts the amount of data to be loaded. If the predicted data is not used within a preset time or system resources are insufficient, it releases the cached data that is no longer needed, including... The system periodically acquires the current system resource usage status, which includes the real-time availability of CPU, memory, and / or storage resources, and monitors the load status, which includes CPU load, memory pressure, and / or storage I / O load. Based on the function call trend provided by the time-series analysis submodule, the resource analysis submodule predicts the amount of data that needs to be loaded into the cache within a preset time period in the future, and evaluates whether the current system resource usage meets the loading requirements of the data amount; If the loading requirements are met, the data volume is loaded into the cache. When the loading requirements are not met, or when the amount of data will not be used within the preset future time, release the data that is not needed in the cache. The time-series analysis submodule periodically analyzes the time-series data of function calls, deletes outdated data and appends the latest data, calculates the function call patterns and frequencies, and generates or destroys function instances in advance based on the prediction results to optimize function execution. Specifically, it periodically collects time-series data of function calls and updates the time-series data according to preset time intervals; calculates the call patterns and trends of the updated time-series functions; predicts the future function call trends; and generates or destroys corresponding function instances based on the function call trends. Based on the calculation results performed by the function computation module, the management submodule selects the set of functions that need to be deployed to edge devices, and distributes them to edge cloud devices through the edge deployment submodule to achieve minimal function deployment.

2. The PLC library management method according to claim 1, characterized by, During the engineering development process, the target cloud function is dragged into the business process or logic diagram through the PLC management platform. During the compilation stage, the corresponding function ID is automatically identified and a function execution request queue to be called is generated. The request queue is then passed to the request processing submodule for scheduling and execution. In response to the defined business process configuration, the business process configuration allows the user to add the target cloud function to the business process or logic diagram through the PLC library management module in the graphical or code editing manner, and configure its input and output parameters. During the compilation of the business process or logic diagram, the target cloud function is automatically identified, and the corresponding function execution request queue is generated and sent to the request processing submodule.

3. A cloud function-based driving PLC library management system that executes the PLC library management method according to any one of claims 1 to 2, characterized by include: The cloud database is used to define PLC control logic through the PLC library management module in a graphical or code editing manner and save it as a library module source file. The internal library parsing submodule is called to perform syntax parsing and function conversion on the source file, and encapsulate it into a cloud function with standard interface parameters, logic body and version information. The library management submodule performs resource registration, function ID generation and registration and upload to the cloud function library. The PLC library management module is used to drag target cloud functions into business processes or logic diagrams through the PLC management platform during the engineering development process. During the compilation stage, it automatically identifies the corresponding function ID and generates a function execution request queue to be called, and passes the request queue to the request processing submodule for scheduling and execution. Based on the calculation results performed by the function computation module, the management submodule selects the set of functions that need to be deployed to edge devices, and distributes them to edge cloud devices through the edge deployment submodule to achieve minimal function deployment; The function computation module is used to determine whether there is an existing cloud function instance available for scheduling after the request processing submodule receives the call request in the request queue. If there is no available instance, the target cloud function is dynamically instantiated and the function computation is performed based on the event queue mechanism.

4. The PLC library management system according to claim 3, characterized in that, The PLC library management module also includes a resource analysis submodule and a timing analysis submodule, which are used as periodic tasks to periodically analyze the current system resource status and load, predict function call trends, and perform resource optimization and cold start preheating operations in advance.

5. The PLC library management system according to claim 4, characterized in that, The request processing submodule is used to determine whether a corresponding cloud function instance exists based on the received call request; when the cloud function instance exists, the available instance is directly scheduled for processing; when the cloud function instance does not exist, the target cloud function is dynamically instantiated through the function calculation module, wherein the instantiation process is based on the cloud information in the call request; the function calculation module performs calculations in the order of the call request through the event queue mechanism and returns the calculation results.

Citation Information

Patent Citations

  • Request processing method and device based on cloud function and computer readable medium

    CN111970338A

  • Cloud function plug-in configuration method and system, cloud function plug-in scheduling method and system and electronic equipment

    CN117251223A