SCADA screen cache update method based on OpenCL

By adopting the OPENCL method in the SCADA system, the three -layer cache structure is designed and using the heterogeneous parallel computing capacity of OpenCL to solve the problem that the hardware platform cannot meet the problem of cache high performance processing of the SCADA system screen. Update and maximize performance.

CN118426900BActive Publication Date: 2025-01-24GUODIAN NANJING AUTOMATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410888559.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2025-01-24
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

The current hardware platform cannot meet the high-performance processing requirements of SCADA system's server-side picture cache data in actual applications.

Method used

Adopt an OPENCL -based SCADA screen cache update method, through the design of the cache layer of the three -layer structure and the distributed heterogeneous computing power of the OpenCl, to achieve rapid update of dynamic attributes in the screen cache.

Benefits of technology

The dynamic attribute update efficiency and screen call speed of the SCADA system server -side screen cache have made full use of the CPU and GPUs of the hardware platform to maximize performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426900B_ABST
    Figure CN118426900B_ABST
Patent Text Reader

Abstract

The present invention provides a SCADA screen cache update method based on OpenCL, which relates to the field of SCADA systems and includes the following steps: acquiring and parsing screen objects based on a SCADA system database to obtain parsing results; and establishing a cache layer according to the parsing results; acquiring hardware devices in an OpenCL platform, and creating a command queue for each OpenCL hardware device; according to the command queue, using each command queue of a computing component to configure a computing task; according to the computing task configuration, executing the computing task through the command queue and entering a data monitoring state after the task is completed. The present invention can efficiently realize the rapid update of dynamic attributes in the screen cache of a SCADA system server by utilizing the distributed heterogeneous computing capability of OpenCL.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of SCADA systems, and in particular to a SCADA picture cache updating method based on OpenCL. Background Art

[0002] Supervisory control and data acquisition (SCADA) systems are widely used in many professional fields such as electricity, metallurgy, chemical industry, railways, etc. As a key component of the SCADA system, the real-time screen function is mainly used to monitor and control the operating status of the business system in real time.

[0003] Real-time screens are usually composed of screen primitives, associated data, dynamic calculation scripts, etc. Among them, screen primitives include a variety of basic primitives (such as path, rect, circle, text, etc.) and custom composite primitives (composed of multiple basic primitives of different types). Each basic primitive and composite primitive can be associated with data in one or more SCADA systems, and according to the associated data value and dynamic calculation script, the text, color, position, size, visibility and other dynamic attributes of the primitive are calculated in real time, thereby intuitively reflecting the changes in the actual operating status.

[0004] In order to ensure the speed of screen call and the real-time update of screen data, the SCADA system usually sets a large-capacity cache on the server side. This cache is used to preload the content of the monitoring screen, screen-related data, dynamic attribute scripts, etc., and calculate the dynamic attributes in advance. When the client calls, it can directly use the processed data in the cache to achieve fast screen call and real-time data update.

[0005] In actual applications, as business systems become increasingly complex, the number of monitoring screens and the graphics and data information contained in each screen are increasing, which increases the computing and processing pressure on the server side for the screen cache data. On the other hand, the current process has promoted the widespread application of autonomous and controllable hardware development platforms. However, due to limitations in process technology, instruction sets, etc., these hardware platforms usually have a large number of cores and weak single-core performance, which cannot meet the requirements of high-performance processing of cache data in actual applications.

[0006] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0007] In view of this, the present invention provides a SCADA screen cache update method based on OpenCL to solve the above-mentioned problem that the current hardware platform cannot well meet the high-performance processing requirements of cache data in practical applications.

[0008] In order to solve the above problems, the specific technical solutions adopted by the present invention are as follows:

[0009] The SCADA screen cache and data update method based on OpenCL (full name: Open Computing Language) includes the following steps:

[0010] S1. Obtain and parse the screen object based on the SCADA system database to obtain the parsing result; and establish a cache layer based on the parsing result;

[0011] S2, obtain the hardware devices in the OpenCL platform and create a command queue for each OpenCL hardware device;

[0012] S3. According to the command queue, use each command queue of the computing component to configure the computing task;

[0013] S4. According to the computing task configuration, the computing task is executed through the command queue and enters the data monitoring state after the task is completed.

[0014] Preferably, acquiring and parsing the screen object based on the SCADA system database to obtain the parsing result; and establishing the cache layer according to the parsing result comprises the following steps:

[0015] S11, using the cache component to traverse the SCADA system database and obtain all screen objects;

[0016] S12, respectively parse each screen object to obtain a parsing result for each screen object;

[0017] S13. The cache component creates a first-level cache, a second-level cache, and a third-level cache respectively according to the parsing result of each screen object.

[0018] Preferably, obtaining hardware devices in the OpenCL platform and creating a command queue for each OpenCL hardware device includes the following steps:

[0019] S21, obtaining an OpenCL platform through a computing component and searching for a hardware device that supports OpenCL;

[0020] S22, calling the OpenCL interface through the computing component and creating a context;

[0021] S23. For each OpenCL hardware device found, the computing component calls the OpenCL interface to create a corresponding command queue.

[0022] Preferably, according to the command queue, configuring the computing task using each command queue of the computing component includes the following steps:

[0023] S31, configuring resources and preparing kernels for the command queue through computing components;

[0024] S32, using the cache component to access the real-time library, obtain the real-time values ​​of all screen-related data points in the third-layer cache, and update the real-time values ​​to the third-layer cache;

[0025] S33. Traverse all calculation scripts in the second-layer cache through the calculation component, generate calculation tasks in sequence, and configure calculation task parameters.

[0026] Preferably, configuring resources and preparing the kernel for the command queue by the computing component comprises the following steps:

[0027] S311, initializing the maximum number of tasks in the command queue by calculating the component;

[0028] S312, creating a buffer, a first global variable, and a second global variable for each command queue through a computing component;

[0029] S313, creating a kernel function for each command queue through the OpenCL interface, and setting the kernel function parameters to the buffer, the first global variable, and the second global variable corresponding to the command queue.

[0030] Preferably, the calculation task parameters include the screen ID, the graphic element ID, the dynamic attribute type, the calculation script, the data point ID array involved in the calculation, and the number of data points involved in the calculation.

[0031] Preferably, according to the computing task configuration, executing the computing task through the command queue and entering the data monitoring state after the task is completed includes the following steps:

[0032] S41, using a computing component to obtain a command queue and a buffer corresponding to the command queue, a first global variable, and a second global variable;

[0033] S42, updating the computing task parameters of the computing task into the structure object of the buffer, and adding 1 to the value of the first global variable;

[0034] S43, submitting the kernel function to the command queue, registering the callback function and obtaining the execution completion signal of the kernel function;

[0035] S44, the computing component submits all scripts that need to be calculated in the second-layer cache to the command queue and then enters a waiting state until the command queue is executed;

[0036] S45. The calculation component determines whether the first global variables of all command queues have been restored to 0. If so, the calculation process ends and the process of monitoring data changes and updating calculations begins. Otherwise, it returns to step S44 and continues to wait.

[0037] Preferably, the computing component obtains the command queue including the following steps:

[0038] S411, traversing the first global variable values ​​corresponding to all command queues through the calculation component, and obtaining the minimum value of all the first global variable values;

[0039] S412. Compare the minimum value of the first global variable value with the maximum number of tasks. If the minimum value of the first global variable value is less than the maximum number of tasks, return to the command queue corresponding to the minimum value of the first global variable; otherwise, return to step S411 to continue searching for the minimum value of all first global variable values.

[0040] Preferably, submitting the kernel function to the command queue, registering the callback function and obtaining the kernel function execution completion signal comprises the following steps:

[0041] S431, obtaining a corresponding structure object from the buffer according to the sequence number of the second global variable, and extracting the calculation script to be executed and the data point ID array involved in the calculation from the structure object;

[0042] S432, obtaining the real-time value of each data point involved in the calculation in the third-layer cache;

[0043] S433, substituting the obtained real-time value into the calculation script for calculation, and updating the calculation result to the structure object obtained in step S431;

[0044] S434, after the kernel function is executed, the OpenCL host receives the execution completion signal through the callback function. If the kernel function is executed correctly, the corresponding structure object is obtained from the buffer according to the sequence number of the second global variable. If the execution is incorrect, step S435 is executed;

[0045] S435, in the first layer cache, find a matching data object according to the screen ID, primitive ID and dynamic attribute type of the structure object, and update the calculation result in the structure object to the data object;

[0046] S436, subtract 1 from the first global variable value corresponding to the current command queue and add 1 to the second global variable value;

[0047] S437: If the value of the second global variable is greater than or equal to the maximum number of tasks, the value of the second global variable is initialized to 0 again.

[0048] Preferably, ending the calculation process and entering the process of monitoring data changes and updating the calculation includes the following steps:

[0049] S451, using the monitoring component to monitor the real-time data changes of the data points in the third-layer cache, if the data changes, then record the data point ID and the change value of the data change and execute step S452, otherwise, continue to monitor;

[0050] S452, after detecting a change in a data point, the monitoring component updates the real-time value of the corresponding data point in the third-layer cache, and inputs the ID of the changed data point to the calculation component;

[0051] S453, the computing component traverses the second-layer cache, identifies all cached data related to the changed data point, and generates corresponding computing tasks;

[0052] S454: The computing component obtains a command queue and executes computing tasks through the command queue.

[0053] The beneficial effects of the present invention are:

[0054] 1. The core of the present invention is to design a SCADA system server-side screen cache structure including a three-layer structure, and on this basis, a cache data update method based on OpenCL is proposed. By utilizing the distributed heterogeneous computing capability of OpenCL, the method can efficiently realize the rapid update of dynamic attributes in the SCADA system server-side screen cache. The client can directly request the calculated screen objects and content from the server for display, without the need to perform additional calculation processing on the dynamic attributes and data associated with the screen, which greatly improves the screen calling speed and the updating efficiency of the dynamic attributes of the screen.

[0055] 2. The present invention proposes a SCADA screen cache update method based on OpenCL. The method adopts heterogeneous parallel computing technology based on OpenCL, optimizes the parallel computing algorithm of dynamic attributes of graphic elements, makes full use of CPU, GPU and other computing resources in the domestic hardware platform, realizes heterogeneous parallel processing, and thus achieves performance maximization. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0057] Figure 1 is a flow chart of a SCADA screen cache update method based on OpenCL according to an embodiment of the present invention;

[0058] Figure 2The present invention is a schematic diagram of a cache based on OpenCL in a SCADA screen cache update method based on OpenCL according to an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0060] According to an embodiment of the present invention, a SCADA picture cache update method based on OpenCL is provided.

[0061] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to an embodiment of the present invention, a SCADA screen cache update method based on OpenCL includes the following steps:

[0062] S1. Obtain and parse the screen object based on the SCADA system database to obtain the parsing result; and establish a cache layer based on the parsing result;

[0063] Specifically, acquiring and parsing the screen object based on the SCADA system database to obtain the parsing result; and establishing the cache layer according to the parsing result includes the following steps:

[0064] S11, using the cache component to traverse the SCADA system database and obtain all screen objects;

[0065] S12, respectively parse each screen object to obtain a parsing result for each screen object;

[0066] It should be noted that the parsing results include graphic element arrays, graphic element objects, and dynamic properties of graphic element objects.

[0067] S13. The cache component creates a first-level cache, a second-level cache, and a third-level cache respectively according to the parsing result of each screen object.

[0068] Specifically, the cache component creates a first-layer cache and a second-layer cache on the OpenCL host according to the parsing result of each screen object, and creates a third-layer cache on the global memory of OpenCL.

[0069] In this process, the cache status of the cache component is evaluated, and the cache hit rate, cache hit time, and the time to create the first-layer cache, the second-layer cache, and the third-layer cache can be obtained. In combination with the set reference hit rate and reference hit time, an evaluation index is determined to represent the performance of the cache component during the evaluation. The evaluation formula is as follows:

[0070] ;

[0071] In the formula, To evaluate the index, Cache hit ratio for cache components, For reference hit rate, is the cache hit time, For reference hit time, The cache effect weight coefficient of the cache component. The time to create the first layer of cache, The time to create the second-level cache. The time to create the third-level cache. Creates the effect weight coefficients of the first-tier cache, second-tier cache, and third-tier cache for the cache component.

[0072] Each parameter in the above formula is processed as a scalar before calculation. The units of each parameter are removed. By comparing the actual indicators with the set reference values, we can more clearly understand whether the performance of the cache component meets expectations. If the actual performance is higher than the reference value, it means that the performance of the cache component is good; otherwise, further optimization may be required. The evaluation index takes into account multiple indicators such as cache hit rate, cache hit time, and cache creation time, and can comprehensively evaluate the performance of the cache component. Such a comprehensive evaluation can provide a more comprehensive understanding of the performance of the cache component, rather than just looking at one indicator.

[0073] It should be noted that the present invention designs a server-side image cache comprising a three-layer structure, namely a first-layer cache, a second-layer cache and a third-layer cache, and names the first-layer cache, the second-layer cache and the third-layer cache as globalCache1, globalCache2 and globalCache3 respectively.

[0074] The first-level cache is directly provided to the client for calling, and contains the contents of all real-time screens of the current SCADA system. The cache uses an array structure, and each screen object is an element of the array, which is used to describe a specific screen; each screen object includes a screen object ID (the screen ID is unique) and a graphic element array, and the graphic element array contains all graphic element objects in the screen.

[0075] In addition, each primitive object contains the primitive ID (the primitive ID is unique in the primitive array), primitive type, basic primitive information, primitive transformation matrix, and primitive dynamic attribute information.

[0076] The primitive type in the present invention uses SVG (full name: Scalable Vector Graphics) basic graphic types (including text, path, circle, rect, image), the primitive basic information is the tag attribute information corresponding to the SVG type, the primitive transformation matrix is ​​the transform matrix in SVG, and a complete static primitive object can be drawn according to the primitive type, primitive basic information and primitive transformation matrix. The dynamic attribute of the primitive is to further adjust the shape of the static primitive object according to the change result of the real-time data of the system.

[0077] The dynamic attributes of the graphic elements in the present invention include text content, horizontal displacement, vertical displacement, horizontal scaling, vertical scaling, rotation angle, fill color, and border color. Each graphic element object can contain several different types of dynamic attributes. The dynamic attributes of the graphic elements in the first layer cache only save the types and calculation results of the dynamic attributes of the graphic elements object, while other related information of the dynamic attributes of the graphic elements object is saved in the second layer cache.

[0078] The second-level cache is used to store all dynamic attribute arrays contained in all screen objects of the current SCADA system. Each element in the array represents a dynamic attribute information, including: screen object ID, that is, the screen object ID to which the dynamic attribute belongs, which is the same as the screen object ID in the first-level cache; primitive object ID, that is, the primitive object ID to which the dynamic attribute belongs, which is the same as the primitive object ID in the first-level cache; dynamic attribute type; dynamic attribute calculation script; dynamic attribute associated data point ID array.

[0079] Substitute the real-time data of the associated data points of the dynamic attribute into the calculation result of the calculation script, that is, the calculation result of the dynamic attribute saved in the first-level cache.

[0080] The second-level cache uses the combination of the screen object ID, the primitive object ID, and the dynamic attribute type as a unique index.

[0081] The third level cache is used to store the real-time data values ​​of all data points associated with all screens of the current SCADA system. This level of cache is indexed by the data point ID, which is the same as the data point ID in the second level cache, and each index corresponds to the current value of the data point.

[0082] Among them, the second-layer cache and the third-layer cache work together to implement the update operation of the dynamic attributes of the primitive objects.

[0083] S2, obtain the hardware devices in the OpenCL platform and create a command queue for each OpenCL hardware device;

[0084] Specifically, obtaining the hardware devices in the OpenCL platform and creating a command queue for each OpenCL hardware device includes the following steps:

[0085] S21, obtaining an OpenCL platform through a computing component and searching for a hardware device that supports OpenCL;

[0086] In OpenCL, a computing component usually refers to a hardware device that can execute OpenCL kernels, such as CPU, GPU, FPGA, etc. The computing component is responsible for executing the computing tasks defined in the OpenCL kernel, thereby realizing parallel computing and accelerating the operation of computing applications.

[0087] First, initialize the OpenCL environment on the computing component, including loading the OpenCL library, obtaining the number of OpenCL platforms, and other operations. Use OpenCL functions (such as clGetPlatformIDs) to obtain the available OpenCL platforms in the system. A system can have multiple OpenCL platforms, each representing a different OpenCL implementation. For the selected platform, use the clGetDeviceIDs function to obtain a list of devices that support OpenCL on the platform. These devices can be CPUs, GPUs, or other accelerator devices.

[0088] S22, calling the OpenCL interface through the computing component and creating a context;

[0089] S23. For each OpenCL hardware device found, the computing component calls the OpenCL interface to create a corresponding command queue.

[0090] S3. According to the command queue, use each command queue of the computing component to configure the computing task;

[0091] Specifically, according to the command queue, configuring the computing task using each command queue of the computing component includes the following steps:

[0092] S31, configuring resources and preparing kernels for the command queue through computing components;

[0093] Specifically, resource configuration and kernel preparation for the command queue through the computing component includes the following steps:

[0094] S311, initializing the maximum number of tasks in the command queue by calculating the component;

[0095] S312, creating a buffer buffer, a first global variable taskCount and a second global variable taskIndex for each command queue through a computing component;

[0096] S313, creating a kernel function for each command queue through the OpenCL interface, and setting the kernel function parameters to the buffer, the first global variable, and the second global variable corresponding to the command queue.

[0097] It should be noted that the address of the buffer buffer is the first address of the structure array, and the length of the array is maxTaskCount; each structure object in the array contains: screen ID, graphic element ID, dynamic attribute type, dynamic calculation script, data point ID array involved in the calculation, the number of data points involved in the calculation, and the calculation result.

[0098] In addition, the first global variable taskCount is used to record the number of unfinished tasks in the current queue, and the second global variable taskIndex is used to record the sequence number of the task being executed, that is, the task index; the first global variable taskCount and the second global variable taskIndex are both integer variables, and their initial values ​​are both set to 0.

[0099] S32, using the cache component to access the real-time library, obtain the real-time values ​​of all screen-related data points in the third-layer cache, and update the real-time values ​​to the third-layer cache;

[0100] S33. Traverse all calculation scripts in the second-layer cache through the calculation component, generate calculation tasks in sequence, and configure calculation task parameters.

[0101] It should be noted that the calculation task parameters include the screen ID, the graphic element ID, the dynamic attribute type, the calculation script, the ID array of the data points involved in the calculation, and the number of data points involved in the calculation.

[0102] S4. According to the computing task configuration, the computing task is executed through the command queue and enters the data monitoring state after the task is completed.

[0103] Specifically, according to the computing task configuration, executing the computing task through the command queue and entering the data monitoring state after the task is completed includes the following steps:

[0104] S41, using a computing component to obtain a command queue and a buffer corresponding to the command queue, a first global variable, and a second global variable;

[0105] Specifically, the computing component obtains the command queue including the following steps:

[0106] S411, traversing the first global variable values ​​corresponding to all command queues through the calculation component, and obtaining the minimum value of all the first global variable values;

[0107] S412. Compare the minimum value of the first global variable value with the maximum number of tasks. If the minimum value of the first global variable value is less than the maximum number of tasks, return to the command queue corresponding to the minimum value of the first global variable; otherwise, return to step S411 to continue searching for the minimum value of all first global variable values.

[0108] S42, updating the computing task parameters of the computing task into the structure object of the buffer, and adding 1 to the value of the first global variable;

[0109] Specifically, the calculation task parameters of the calculation task are updated to the structure object of the buffer, and the value of the first global variable is increased by 1 as follows:

[0110] By updating the screen ID, primitive ID, dynamic attribute type, calculation script, data point ID array involved in the calculation, and the number of data points involved in the calculation task to the structure object with the sequence number (taskIndex+taskCount)%maxTaskCount in the buffer array, and then adding 1 to the value of the first global variable, where taskIndex represents the first global variable, taskCount represents the second global variable, and maxTaskCount represents the maximum number of tasks.

[0111] S43, submitting the kernel function to the command queue, registering the callback function and obtaining the execution completion signal of the kernel function; wherein the kernel function is written in the OpenCL C programming language, describes the computing task to be performed on each computing unit (work item), registering the callback function. The callback function is associated with the OpenCL command queue. When submitting the kernel function to the command queue, you can choose to register a callback function for asynchronous notification after the kernel function is executed.

[0112] Specifically, submitting the kernel function to the command queue, registering the callback function and obtaining the kernel function execution completion signal includes the following steps:

[0113] S431, obtaining a corresponding structure object from the buffer according to the sequence number of the second global variable, and extracting the calculation script to be executed and the data point ID array involved in the calculation from the structure object;

[0114] S432, obtaining the real-time value of each data point involved in the calculation in the third-layer cache;

[0115] S433, substituting the obtained real-time value into the calculation script for calculation, and updating the calculation result to the structure object obtained in step S431;

[0116] S434, after the kernel function is executed, the OpenCL host receives the execution completion signal through the callback function. If the kernel function is executed correctly, the corresponding structure object is obtained from the buffer according to the sequence number of the second global variable. If the execution is incorrect, step S435 is executed;

[0117] S435, in the first layer cache, find a matching data object according to the screen ID, primitive ID and dynamic attribute type of the structure object, and update the calculation result in the structure object to the data object;

[0118] S436, subtract 1 from the first global variable value corresponding to the current command queue and add 1 to the second global variable value;

[0119] S437: If the value of the second global variable is greater than or equal to the maximum number of tasks, the value of the second global variable is initialized to 0 again.

[0120] S44, the computing component submits all scripts that need to be calculated in the second-layer cache to the command queue and then enters a waiting state until the command queue is executed;

[0121] S45. The calculation component determines whether the first global variables of all command queues have been restored to 0. If so, the calculation process ends and the process of monitoring data changes and updating calculations begins. Otherwise, it returns to step S44 and continues to wait.

[0122] Specifically, ending the calculation process and entering the process of monitoring data changes and updating the calculation includes the following steps:

[0123] S451, using the monitoring component to monitor the real-time data changes of the data points in the third-layer cache, if the data changes, then record the data point ID and the change value of the data change and execute step S452, otherwise, continue to monitor;

[0124] S452, after detecting a change in a data point, the monitoring component updates the real-time value of the corresponding data point in the third-layer cache, and inputs the ID of the changed data point to the calculation component;

[0125] S453, the computing component traverses the second-layer cache, identifies all cached data related to the changed data point, and generates corresponding computing tasks;

[0126] S454: The computing component obtains a command queue and executes computing tasks through the command queue.

[0127] In this process, the effect of the monitoring component in monitoring data changes and updating calculations can be evaluated, which can serve as a basis for optimizing the monitoring component. The evaluation parameters include detection rate, data change response time, generation efficiency, and computing task execution time. The detection rate is used to measure the efficiency of the monitoring component in detecting data changes, that is, the proportion of successfully detected data changes. The data change response time is a measure of the response speed of the monitoring component after detecting data changes, that is, the time from detecting data changes to updating the cache. The generation efficiency is a measure of the efficiency of the computing component in generating computing tasks, that is, the proportion of successfully generated computing tasks. The computing task execution time is a measure of the speed at which the computing component executes computing tasks, that is, the time from obtaining the computing task to completing the calculation. The specific analysis formula is as follows:

[0128] ;

[0129] In the formula, is the monitoring evaluation index of the monitoring component, is the detection rate, is the reference detection rate, To generate efficiency, is the reference generation efficiency, is a natural constant, is the data change response time, To calculate the task execution time.

[0130] The evaluation index comprehensively considers multiple key performance indicators of the monitoring component, including detection rate, data change response time, generation efficiency, and computing task execution time. Detection rate and generation efficiency are two key performance indicators of the monitoring component. The detection rate measures the proportion of data changes that the monitoring component successfully detects, while the generation efficiency measures the proportion of computing tasks that the monitoring component successfully generates. These two parameters directly reflect the effectiveness and reliability of the monitoring component, that is, whether the monitoring component can detect data changes in a timely and accurate manner and generate corresponding computing tasks. The data change response time and computing task execution time reflect the speed at which the monitoring component responds to data changes and executes computing tasks, respectively. The data change response time measures the time from detecting data changes to updating the cache, while the computing task execution time measures the time from obtaining the computing task to completing the calculation. These two parameters directly affect the real-time performance and response speed of the monitoring component, that is, how quickly the monitoring component can respond to data changes and execute computing tasks.

[0131] The evaluation index is compared with the set reference value to make the evaluation results more comparable. If the actual index is higher than the reference value, it means that the performance of the monitoring component is good; otherwise, further optimization may be needed. Such a relative comparison can more clearly understand the advantages and disadvantages of the monitoring component.

[0132] Specifically, in step S454, the computing component obtains the command queue, and the specific implementation of executing the computing task through the command queue is as follows:

[0133] The computing component obtains a command queue and obtains the buffer buffer, the first global variable taskCount, and the second global variable taskIndex corresponding to the queue. The computing task parameters in the computing task, including the screen ID, the primitive ID, the dynamic attribute type, the dynamic computing script, the data point ID array involved in the computing, and the number of data points involved in the computing, are updated to the structure object with the sequence number of (taskIndex+taskCount)%maxTaskCount in the buffer array; then, taskCount is increased by 1, the kernel function is submitted to the command queue, and the callback function is registered to obtain the kernel function execution completion signal.

[0134] like Figure 2 As shown, it should be noted that the SCADA screen cache update method based on OpenCL proposed in the present invention is implemented by using three parts: a screen cache component, a computing component based on OpenCL, and a monitoring component. Specifically:

[0135] The screen cache component, referred to as the cache component, is used to create the three-layer cache structure mentioned above and save cache data;

[0136] The computing component based on OpenCL, referred to as computing component, is used to establish a computing framework based on OpenCL and update the screen cache data according to the data changes of the data points associated with the screen;

[0137] The monitoring component is used to monitor the data changes of the screen-related data, update the screen cache with the changed values, and notify the calculation component to generate new calculation tasks.

[0138] In addition, the expanded OpenCL programming framework is designed, and programmers can use OpenCL to write a parallel application that can be executed in parallel by any type and any number of computing devices in a master-slave heterogeneous system. When OpenCL performs parallel computing, it first queries the available OpenCL platforms and devices, and selects one or more devices to perform tasks; then creates an OpenCL context, which will serve as an interactive interface between the host and the device; after the program is compiled and linked, it is necessary to package the function into a data structure called a kernel, that is, to create a kernel function. The runtime system is mainly responsible for dividing the computing tasks and reasonably distributing them to multiple computing devices, and then executing device-specific kernel functions on each computing device to complete the sub-computing tasks assigned to it; it can be seen from the above that in a master-slave heterogeneous multi-device system, CPUs and multiple accelerators can be used to concurrently and collaboratively execute data-level parallel applications, but the most critical issue is how to design kernel functions, and how to reasonably and efficiently schedule tasks between computing devices. The method of the present invention will effectively solve this problem and apply it to the update of SCADA system screen cache data.

[0139] In addition, it should be noted that in the SCADA system, real-time images have been widely used through the "server + client" architecture; using cache to pre-process image data to achieve rapid image calls is also a commonly used technical means in this professional field.

[0140] The present invention also adopts this design idea, but its uniqueness lies in the specific implementation method. Specifically, the present invention designs a special screen cache structure, which not only meets business needs, but also is highly consistent with the implementation method of OpenCL; in addition, the present invention also applies the heterogeneous distributed computing architecture of OpenCL to the calculation and update of screen cache data. After investigation, no technical solution similar to the specific implementation method of this article has been found.

[0141] In summary, by means of the above technical solution of the present invention, the core of the present invention is to design a SCADA system server-side screen cache structure including a three-layer structure, and on this basis, a cache data update method based on OpenCL is proposed. This method can efficiently realize the rapid update of dynamic attributes in the SCADA system server-side screen cache by utilizing the distributed heterogeneous computing capability of OpenCL, and the client can directly request the calculated screen objects and content from the server for display, without the need to perform additional calculations on the dynamic attributes and data associated with the screen. This greatly improves the calling speed of the screen and the updating efficiency of the dynamic attributes of the screen. The present invention proposes a SCADA screen cache update method based on OpenCL, which adopts heterogeneous parallel computing technology based on OpenCL, optimizes the parallel computing algorithm of the dynamic attributes of the primitive, makes full use of the computing resources such as CPU and GPU in the domestic hardware platform, realizes heterogeneous parallel processing, and thus achieves performance maximization.

[0142] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code.

[0143] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A SCADA screen cache update method based on OpenCL, characterized in that: The following steps are involved: S1. Acquire and parse the screen object based on the SCADA system database to obtain the parsing result; and establish a cache layer according to the parsing result; S2, obtain the hardware devices in the OpenCL platform and create a command queue for each OpenCL hardware device; S3. According to the command queue, use each command queue of the computing component to configure the computing task; S4. According to the computing task configuration, the computing task is executed through the command queue and the data monitoring state is entered after the task is completed; The method of acquiring and parsing the screen object based on the SCADA system database to obtain the parsing result; and establishing the cache layer according to the parsing result comprises the following steps: S11, using the cache component to traverse the SCADA system database and obtain all screen objects; S12, respectively parse each screen object to obtain a parsing result for each screen object; S13, the cache component creates a first-layer cache, a second-layer cache, and a third-layer cache respectively according to the parsing result of each screen object; The step of configuring computing tasks using each command queue of a computing component according to the command queue comprises the following steps: S31, configuring resources and preparing kernels for the command queue through computing components; S32, using the cache component to access the real-time library, obtain the real-time values ​​of all screen-related data points in the third-layer cache, and update the real-time values ​​to the third-layer cache; S33. Traverse all calculation scripts in the second-layer cache through the calculation component, generate calculation tasks in sequence, and configure calculation task parameters.

2. The SCADA screen cache update method based on OpenCL according to claim 1, characterized in that: The method of obtaining hardware devices in the OpenCL platform and creating a command queue for each OpenCL hardware device includes the following steps: S21, obtaining an OpenCL platform through a computing component and searching for a hardware device that supports OpenCL; S22, calling the OpenCL interface through the computing component and creating a context; S23. For each OpenCL hardware device found, the computing component calls the OpenCL interface to create a corresponding command queue.

3. The SCADA screen cache update method based on OpenCL according to claim 2, characterized in that, The resource configuration and kernel preparation of the command queue by the computing component includes the following steps: S311, initializing the maximum number of tasks in the command queue by calculating the component; S312, creating a buffer, a first global variable, and a second global variable for each command queue through a computing component; S313, creating a kernel function for each command queue through the OpenCL interface, and setting the kernel function parameters to the buffer, the first global variable, and the second global variable corresponding to the command queue.

4. The SCADA screen cache update method based on OpenCL according to claim 3, characterized in that: The calculation task parameters include the picture ID, the graphic element ID, the dynamic attribute type, the calculation script, the data point ID array involved in the calculation and the number of data points involved in the calculation.

5. The SCADA screen cache update method based on OpenCL according to claim 1, characterized in that: According to the computing task configuration, executing the computing task through the command queue and entering the data monitoring state after the task is completed includes the following steps: S41, using a computing component to obtain a command queue and a buffer corresponding to the command queue, a first global variable, and a second global variable; S42, updating the computing task parameters of the computing task into the structure object of the buffer, and adding 1 to the value of the first global variable; S43, submitting the kernel function to the command queue, registering the callback function and obtaining the execution completion signal of the kernel function; S44, the computing component submits all scripts that need to be calculated in the second-layer cache to the command queue and then enters a waiting state until the command queue is executed; S45. The calculation component determines whether the first global variables of all command queues have been restored to 0. If so, the calculation process ends and the process of monitoring data changes and updating calculations begins. Otherwise, it returns to step S44 and continues to wait.

6. The SCADA screen cache update method based on OpenCL according to claim 5, characterized in that: The computing component obtains the command queue including the following steps: S411, traversing the first global variable values ​​corresponding to all command queues through the calculation component, and obtaining the minimum value of all the first global variable values; S412. Compare the minimum value of the first global variable value with the maximum number of tasks. If the minimum value of the first global variable value is less than the maximum number of tasks, return to the command queue corresponding to the minimum value of the first global variable; otherwise, return to step S411 to continue searching for the minimum value of all first global variable values.

7. The SCADA screen cache update method based on OpenCL according to claim 6, characterized in that: Submitting the kernel function to the command queue, registering the callback function and obtaining the kernel function execution completion signal comprises the following steps: S431, obtaining a corresponding structure object from the buffer according to the sequence number of the second global variable, and extracting the calculation script to be executed and the data point ID array involved in the calculation from the structure object; S432, obtaining the real-time value of each data point involved in the calculation in the third-layer cache; S433, substituting the obtained real-time value into the calculation script for calculation, and updating the calculation result to the structure object obtained in step S431; S434, after the kernel function is executed, the OpenCL host receives the execution completion signal through the callback function. If the kernel function is executed correctly, the corresponding structure object is obtained from the buffer according to the sequence number of the second global variable. If the execution is incorrect, step S435 is executed; S435, in the first layer cache, find a matching data object according to the screen ID, primitive ID and dynamic attribute type of the structure object, and update the calculation result in the structure object to the data object; S436, subtract 1 from the first global variable value corresponding to the current command queue and add 1 to the second global variable value; S437: If the value of the second global variable is greater than or equal to the maximum number of tasks, the value of the second global variable is initialized to 0 again.

8. The SCADA screen cache update method based on OpenCL according to claim 7, characterized in that: The process of ending the calculation process and entering the process of monitoring data changes and updating the calculation includes the following steps: S451, using the monitoring component to monitor the real-time data changes of the data points in the third-layer cache, if the data changes, then record the data point ID and the change value of the data change and execute step S452, otherwise, continue to monitor; S452, after detecting a change in a data point, the monitoring component updates the real-time value of the corresponding data point in the third-layer cache, and inputs the ID of the changed data point to the calculation component; S453, the computing component traverses the second-layer cache, identifies all cached data related to the changed data point, and generates corresponding computing tasks; S454: The computing component obtains a command queue and executes computing tasks through the command queue.

Citation Information

Patent Citations

  • SCADA system picture caching system

    CN107995176A

  • Rendering instruction generation method and device for SVG dynamic primitives in SCADA system

    CN115546343A