Point polling method and device, electronic equipment, storage medium and program product
By optimizing the polling method based on point weights and synchronization flags in industrial control systems, the communication blocking problem caused by equipment polling is solved, and real-time communication and accurate coverage of important data are achieved.
Patent Information
- Application Number
- CN202411571536.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-06
AI Technical Summary
In the field of industrial control technology, the polling method of a large number of devices in the existing technology leads to communication system blockage, resulting in long delays in data acquisition and control command execution, delayed information updates, and insufficient real-time performance.
By determining the target location based on the location weight, synchronization flag, and number of polling rounds, and updating the location weight and synchronization flag after each round of polling, the location polling process is optimized to ensure real-time communication of important data.
It improves the real-time performance of critical data communication, ensures that each round of point polling covers data from important points, and enhances the accuracy of target point determination and communication efficiency.
Smart Images

Figure CN119383119B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a point polling method, device, electronic device, storage medium, and computer program product. Background Art
[0002] In the field of industrial control technology, various protocols can be used to send data collection and control commands to devices. In some protocols, polling is used to collect information from devices and device locations in sequence.
[0003] However, when there are a large number of devices, the above method will cause system communication congestion when polling the devices, resulting in a long execution delay of data acquisition commands and control commands in the communication system, and a delay in information update, resulting in insufficient real-time performance of the polling communication process. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, device, electronic device, computer-readable storage medium and computer program product that can improve the real-time performance of important data communication in response to the above technical problems.
[0005] In a first aspect, the present application provides a point polling method. The method comprises:
[0006] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0007] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain an updated point weight;
[0008] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point is returned to be executed until the point polling is completed.
[0009] In one embodiment, determining the target point to be polled based on the point weight, synchronization flag, and number of point polling of each point includes:
[0010] For each point, obtain the priority of each point; the priority includes high priority, medium priority and low priority;
[0011] In the case where the priority of the point is medium priority, if the synchronization flag of the point is the first flag value, the point is determined to be the initial point;
[0012] The initial points are sorted based on the order of the point weights of the initial points, and the sorted initial points are determined as target points to be polled.
[0013] In one embodiment, after obtaining the priority of each point, the method further includes:
[0014] In a case where the priority of the point is high priority, if the synchronization flag of the point is a first flag value, determining the point as an initial point;
[0015] When the priority of the point is low and the number of polling times of the point reaches the number corresponding to the forced synchronization period, determining the synchronization flag of the point to be the first flag value, and determining the point to be the initial point;
[0016] When the priority of the point is low and the number of polling times of the point does not reach the number corresponding to the forced synchronization period, if the synchronization flag of the point is not the first flag value, the point is determined to be a non-target point.
[0017] In one embodiment, polling the target point to obtain the polled target point, and updating the point weight of the polled target point to obtain the updated point weight includes:
[0018] Polling the target point, and updating the current data value and data change interval of the target point based on the data value obtained by polling;
[0019] The point weight of the target point is updated according to the priority of the target point and the data change interval to obtain an updated point weight.
[0020] In one embodiment, updating the point weight of the target point according to the priority of the target point and the data change interval to obtain the updated point weight includes:
[0021] When the priority of the target point is medium priority, determining a weight adjustment amount; the weight adjustment amount is determined based on a weight coefficient of the target point;
[0022] If it is determined that the data change interval is less than the forced synchronization period, the point weight of the target point is added to the weight adjustment amount to obtain an updated point weight;
[0023] If it is determined that the data change interval is greater than the forced synchronization period, the point weight of the target point is subtracted from the weight adjustment amount to obtain an updated point weight.
[0024] In one embodiment, updating the synchronization flag of the target point based on the updated point weight to obtain the updated synchronization flag includes:
[0025] If the updated point weight is not 0, determining the synchronization flag of the target point to be the first flag value;
[0026] If the updated point weight is 0, the synchronization flag of the target point is determined to be the second flag value.
[0027] In one embodiment, if the priority of the target point is high, the synchronization flag of the target point is determined to be the first flag value;
[0028] If the priority of the target point is low, the synchronization flag of the target point is determined to be the second flag value.
[0029] In a second aspect, the present application further provides a point polling device. The device comprises:
[0030] A point determination module is used to determine the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point;
[0031] A weight updating module is used to poll the target point to obtain the target point after polling, and to update the point weight of the target point after polling to obtain the updated point weight;
[0032] The flag update module is used to update the synchronization flag of the target point based on the updated point weight, obtain the updated synchronization flag, and return to execute the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point until the point polling is completed.
[0033] In a third aspect, the present application further provides an electronic device. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the following steps are implemented:
[0034] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0035] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain an updated point weight;
[0036] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point is returned to be executed until the point polling is completed.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0038] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0039] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain an updated point weight;
[0040] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point is returned to be executed until the point polling is completed.
[0041] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0042] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0043] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain an updated point weight;
[0044] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point is returned to be executed until the point polling is completed.
[0045] The aforementioned point polling method, apparatus, electronic device, storage medium, and computer program product perform multiple rounds of polling on each point of the device. During each round of point polling, the target point to be polled is determined from among the points based on the number of point pollings, the synchronization flag of the point, and the point weight of the point. Based on this, the target point is polled, and after the polling, the point weight of the target point is updated. The synchronization flag of the target point is also updated using the updated point weight. Thus, the target point is updated after each round of polling. The aforementioned point polling process is repeated until the point polling is completed. Each point is screened by point weight, synchronization flag and point polling times. Matching or important target points are determined in each round of point polling. After completing the polling of the target point, the point weight and synchronization flag are updated to provide a basis for determining the target point for the next round of point polling, thereby improving the accuracy of the determined target point. In this way, the target point is polled to ensure that each round of point polling can cover the data of important points and improve the real-time communication of important data. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 A diagram showing an application environment of a point polling method in one embodiment;
[0048] Figure 2 Schematic diagram of a flow chart of a point polling method in one embodiment;
[0049] Figure 3 A schematic flow chart of a point polling method in another embodiment;
[0050] Figure 4 This is a structural block diagram of a point polling device in one embodiment;
[0051] Figure 5 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0053] The point polling method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the point 102 communicates with the server 104 via a communication network. The server 104 can obtain the point attributes of each point 102, such as the point weight and synchronization flag. Based on the point attributes and the number of point polling times corresponding to each round of point polling, the server 104 determines the target point to be polled in each point 102 and sends a polling request to the target point. After the polling, the point attributes corresponding to the target point are updated, as well as the number of point polling times. The data storage system can store the communication data obtained by the server 104 after polling. The data storage system can be integrated with the server 104 or placed on the cloud or other network servers. The point 102 can be a device or a point contained in a device. The point 102 is not limited to various industrial components, industrial equipment, and device points. For example, the point can be a household appliance, a computer, a smartphone, a tablet computer, an IoT device, and a portable wearable device. The IoT device can be a smart speaker, a smart TV, a smart air conditioner, a smart car device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0054] In an exemplary embodiment, Figure 2 As shown, a point polling method is provided, which is applied to Figure 1 The server 104 in the example is used as an example to illustrate the process, including the following steps S202 to S206.
[0055] Step S202: For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point.
[0056] Point polling refers to polling all devices and their points in the system. Point weight and synchronization flag are both point attributes. Point weight indicates the importance of a point, while synchronization flag determines whether a point should be polled.
[0057] Specifically, the server performs multiple rounds of point polling on each device in the system. For each round of point polling, the server can read the point attributes of each point and determine whether the point is a target point based on the point weight and synchronization flag in the point attributes. In one example, if the point weight of a point is greater than a preset weight value, the point can be determined to be a target point; if the synchronization flag of the point is a preset flag value, the point can be determined to be a target point; if the point weight of a point is greater than a preset weight value and the synchronization flag of the point is a preset flag value, the point can be determined to be a target point. Alternatively, the server can determine whether a point is a target point based solely on the number of point polling cycles. For example, when the number of point polling cycles reaches a preset number, the server can determine that a point that meets certain conditions is a target point. Therefore, the server can comprehensively determine whether each point is a target point based on the point weight, synchronization flag, and the number of point polling cycles.
[0058] Step S204: poll the target point to obtain the polled target point, and update the point weight of the polled target point to obtain the updated point weight.
[0059] Specifically, after polling the target point, the polled point is obtained. It is known that the point attributes of the point have been updated. Based on the updated point attributes, the target point's point weight can be updated to obtain an updated point weight. Point attributes can also include priority and data change interval. Priority indicates whether each point can be polled first, and the data change interval indicates the time interval between changes in the point's data value. The server can update the target point's point weight based on the point's priority, data change interval, and the original point weight to obtain an updated point weight.
[0060] Step S206: Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled based on the point weight, synchronization flag and number of point polling for each round of point polling is returned to be executed until the point polling is completed.
[0061] Specifically, the server obtains the updated point weight and, based on a preconfigured update policy, determines the synchronization flag corresponding to the updated point weight and uses it as the latest synchronization flag. After the server updates the point weight and synchronization flag for the target point, it repeats a new round of point polling. The server can continue multiple rounds of point polling until the polling cycle ends. The conditions for ending a unit polling cycle can be configured according to user needs.
[0062] In the above-mentioned point polling method, multiple rounds of polling are performed on each point of the device. During each round of point polling, the target point to be polled is determined from among the points based on the number of point polling, the point synchronization flag, and the point weight. Based on this, the target point is polled, and after the polling, the point weight of the target point is updated. The synchronization flag of the target point is also updated based on the updated point weight. Thus, the target point is updated after each round of polling. The above point polling process is repeated until the point polling is completed. Each point is screened by point weight, synchronization flag and point polling times. Matching or important target points are determined in each round of point polling. After completing the polling of the target point, the point weight and synchronization flag are updated to provide a basis for determining the target point for the next round of point polling, thereby improving the accuracy of the determined target point. In this way, the target point is polled to ensure that each round of point polling can cover the data of important points and improve the real-time communication of important data.
[0063] In an exemplary embodiment, the specific implementation process of the step of "determining the target point to be polled based on the point weight, synchronization flag, and number of point polling of each point" includes:
[0064] For each point, obtain the priority of each point; when the priority of the point is medium priority, if the synchronization flag of the point is the first flag value, determine the point as the initial point; based on the size order corresponding to the point weights of each initial point, sort the initial points, and determine the sorted initial points as the target points to be polled.
[0065] Among them, the priorities include high priority, medium priority and low priority.
[0066] Specifically, the point attributes also include priority. The server obtains the priority of each point based on the point attributes. If the priority of the point is medium priority, the synchronization flag of the point is obtained, and it is determined whether the synchronization flag of the point is the first flag value. If the synchronization flag is the first flag value, the point can be determined to be an initial point. After traversing each point, an initial point consisting of multiple points can be obtained. For each initial point, the server can obtain the point weight of each initial point, and sort the initial points according to the order of the point weight. The sorted initial points are the target points to be polled. For example, the first flag value can be 1. If the value of the synchronization flag is 1, the point can be determined to be an initial point.
[0067] In one example, the server can filter out points whose weights are greater than a preset weight value from the initial points, and sort the filtered points in order of their weights to obtain sorted points, which are then determined as target points to be polled. For example, the preset weight value can be 0.5, and the server sorts the points whose weights are greater than 0.5 in order of their weights to obtain the target point.
[0068] In this embodiment, the synchronization mark of the medium-priority point is used to determine whether the point is the initial point, and the initial points are sorted according to the size of the point weight to obtain the target point. The medium-priority points can be accurately divided according to actual user needs to obtain the target point to be polled, thereby improving the accuracy of obtaining the target point.
[0069] In an exemplary embodiment, after the step of “obtaining the priority of each point”, the method further includes:
[0070] If the priority of a point is high and its synchronization flag is the first flag value, the point is determined to be an initial point. If the priority of a point is low and its polling count reaches the number corresponding to the forced synchronization period, its synchronization flag is determined to be the first flag value and the point is determined to be an initial point. If the priority of a point is low and its polling count does not reach the number corresponding to the forced synchronization period, and its synchronization flag is not the first flag value, the point is determined to be a non-target point.
[0071] The forced synchronization period is the time it takes for the server to perform multiple rounds of point polling for a preset number of times. The forced synchronization period can be configured as time T. During the time period corresponding to time T, the server can perform n rounds of point polling for the point. The number of times corresponding to the forced synchronization period is the ratio of T to the time spent in a single round of point polling, and the ratio is rounded to the integer to obtain the number n. In one example, the number of forced synchronization periods can be the preset number of rounds of point polling. In this example, there is no need to use time T to determine the number n corresponding to the ratio.
[0072] Specifically, the server obtains the priority of each point based on the point attributes. If the point priority is high, the server obtains the synchronization flag of the point and determines whether the synchronization flag of the point is the first flag value. If the synchronization flag is the first flag value, the point can be determined to be the initial point.
[0073] Additionally, if the priority of the point is low, a determination is made as to whether the number of point polling cycles in the current round corresponds to the number corresponding to the forced synchronization period. If the number of point polling cycles in the current round corresponds to the number corresponding to the forced synchronization period, the synchronization flag of the point is set to the first flag value, and the point is determined to be an initial point. In one example, if the number of point polling cycles in the current round corresponds to the number corresponding to the forced synchronization period, all points can be determined to be initial points.
[0074] If the priority of the point is low, determine whether the number of polls for the point in the current round has reached the number corresponding to the forced synchronization period. If the number of polls for the point in the current round has not reached the number corresponding to the forced synchronization period, and the synchronization flag of the point is not the first flag value, the point is determined to be a non-target point. Non-target points are not polled.
[0075] In this embodiment, the initial point is determined by using different judgment logic for high priority and low priority respectively, and the judgment is based on whether the number of point polling reaches the number corresponding to the forced synchronization period. It is possible to flexibly judge points of different priorities to obtain the initial point, which can improve the accuracy of determining the initial point.
[0076] In an exemplary embodiment, the specific implementation process of the step of "polling the target point to obtain the polled target point, and updating the point weight of the polled target point to obtain the updated point weight" includes:
[0077] Poll the target point, and based on the data value obtained from the polling, update the current data value and data change interval of the target point; according to the priority and data change interval of the target point, update the point weight of the target point to obtain the updated point weight.
[0078] Specifically, the point attributes of a point also include the current data value. When the server polls each target point, it may not obtain the latest data value of the target point, but it may obtain the latest data value of the target point. The server can update the latest data value to the current data value in the point attributes. The server determines the data change interval based on the time interval between current data value updates. The server can then update the point weights of target points of different priorities based on the priority of the target point to obtain updated point weights. The server can determine whether to increase or decrease the point weight of the target point based on the data change interval and the forced synchronization period.
[0079] In this embodiment, the current data value and data change interval of the target point are updated through the data value after polling the target point, and the importance of the target point can be determined according to the priority of the target point and the data change interval, so that the point weight is updated according to the importance, thereby improving the accuracy of the updated point weight.
[0080] In an exemplary embodiment, the specific implementation process of the step of "updating the point weight of the target point according to the priority of the target point and the data change interval to obtain the updated point weight" includes:
[0081] When the priority of the target point is medium priority, determine the weight adjustment amount; if it is determined that the data change interval is less than the forced synchronization period, add the point weight of the target point to the weight adjustment amount to obtain the updated point weight; if it is determined that the data change interval is greater than the forced synchronization period, subtract the point weight of the target point from the weight adjustment amount to obtain the updated point weight.
[0082] The weight adjustment amount is determined based on the weight coefficient of the target point. In one example, the server may determine the inverse of the weight coefficient as the weight adjustment amount.
[0083] Specifically, the server determines the priority of the target point. If the priority of the target point is medium, the server determines the weight adjustment amount based on the inverse of the weight coefficient corresponding to the target point. The server determines the data change interval and the size of the forced synchronization period of the target point. If the data change interval is less than the forced synchronization period, the server adds the current point weight of the target point to the weight adjustment amount to obtain the updated point weight. If the data change interval is greater than the forced synchronization period, the server subtracts the current point weight of the target point from the weight adjustment amount to obtain the updated point weight. If the data change interval is equal to the forced synchronization period, the server determines the current point weight of the target point as the updated point weight.
[0084] Optionally, when the priority of the target point is high, the weight coefficient of the target point is determined to be the highest weight coefficient; when the priority of the target point is low, the weight coefficient of the target point is determined to be the lowest weight coefficient.
[0085] In this embodiment, the data change interval of the target point and the size of the forced synchronization period are used to determine whether the point weight of the target point is updated through the weight adjustment amount to obtain the updated point weight. The real-time importance of the target point can be determined based on the data change interval, thereby obtaining the adjusted point weight and improving the accuracy of the point weight.
[0086] In an exemplary embodiment, the specific implementation process of the step of "updating the synchronization flag of the target point based on the updated point weight to obtain the updated synchronization flag" includes:
[0087] If the updated point weight is not 0, the synchronization flag of the target point is determined to be the first flag value; if the updated point weight is 0, the synchronization flag of the target point is determined to be the second flag value.
[0088] Specifically, the value range of the point weight can be 0 to 1. If the updated point weight of the target point is not 0, the server can determine that the synchronization flag of the target point is the first flag value. If the updated point weight of the target point is 0, the server can determine that the synchronization flag of the target point is the second flag value. If the synchronization flag of the target point is the first flag value, a judgment process of whether the point is the target point will be performed in a new round of point polling. If the synchronization flag of the target point is the second flag value, a judgment process of whether the point is the target point does not need to be performed in a new round of point polling, and the point can be directly determined as a non-target point.
[0089] In one example, if the updated point weight is not the preset weight value, the synchronization flag of the target point is determined to be the first flag value; if the updated point weight is the preset weight value, the synchronization flag of the target point is determined to be the second flag value. The preset weight value can be a weight value arbitrarily configured by the user according to actual needs.
[0090] In this embodiment, the synchronization flag of the target point is updated through the updated point weight, which can ensure that important target points can be determined during the next round of point polling, thereby ensuring that important target points participate in each polling as much as possible and improving the real-time nature of important data.
[0091] In an exemplary embodiment, the method further includes: if the priority of the target point is high priority, determining the synchronization flag of the target point to be a first flag value; if the priority of the target point is low priority, determining the synchronization flag of the target point to be a second flag value.
[0092] Specifically, the server can determine the priority of the target point. The priority of the target point may change during the polling process. Based on this, the server can update the synchronization flag of the target point in real time according to the priority of the target point at any time. For example, if the priority of the target point is high, the synchronization flag of the target point is determined to be a first flag value; if the priority of the target point is low, the synchronization flag of the target point is determined to be a second flag value.
[0093] Optionally, the priority of each point may be changed during the polling process. Based on this, the server can update the synchronization flag of each point in real time according to the priority of each point. For example, if the priority of each point is high, the synchronization flag of each point is determined to be the first flag value; if the priority of each point is low, the synchronization flag of each point is determined to be the second flag value.
[0094] Optionally, the priority of each point may be changed during the polling process. Based on this, the server can update the point weight of each point in real time according to the priority of each point. For example, the point weight range is 0 to 1. If the priority of each point is high, the point weight of each point is determined to be 1; if the priority of each point is low, the point weight of each point is determined to be 0.
[0095] In this embodiment, the synchronization flag and point weight of the point can be modified according to the priority of the point, so that the importance of the point can be adjusted at any time according to the priority of the point, so that the data of important points can be processed in time during the next round of polling, thereby improving the real-time communication of important data.
[0096] like Figure 3 As shown, the specific execution process of the above-mentioned point polling method is described in detail below in conjunction with a specific embodiment.
[0097] Unlike conventional polling mechanism communication protocol points, this embodiment adds or supplements the point attribute information in Table 1, specifying attributes such as the point address information addr, data priority P, data change interval Td, point weight V, synchronization flag S, and current data value Data. These point parameters are important for system scheduling and determining point communication needs, and are fundamental parameters for the entire polling system.
[0098] Table 1 Communication point attribute information
[0099]
[0100] The point address information addr includes but is not limited to the device address of the communication point and the monitoring point offset address information. The address information is an important parameter for communicating with the corresponding point of the device.
[0101] The priority level P refers to the priority of the point communication process. The functional characteristics of each priority level are shown in Table 2. The system is divided into three priority levels. Priority level 1 represents the point in the highest priority state. Communication points in this state should communicate and interact with the slave device in each polling cycle. Priority level 2 represents the point in the second priority state. The communication characteristics of this priority point are: whether communication interaction occurs in the polling cycle depends on the point weight V. The system assigns the point to communicate in this round according to the point weight information. Priority level 3 represents the point in the low priority state, indicating that the monitoring point has no strict real-time requirements. Therefore, this priority point will only perform communication scans and data updates for all points during the mandatory update cycle n, that is, during n polling cycles.
[0102] The data change interval time Td refers to the interval time between the data and the previous change. The shorter the Td time is, the faster the data change frequency is, and vice versa, the slower the data change is.
[0103] The point weight V is a measure of the point's importance, ranging from 0-1 (or 0-100, etc.). Priority 1 points are always assigned a weight of 1 (consistently polled in every cycle). Priority 3 points are always assigned a weight of 0 (never polled, polling only after a specific cycle). Priority 2 points require weight analysis based on the number of data scans and data changes before assigning a weight.
[0104] The synchronization flag S is a data synchronization flag. When S=1, the data performs a synchronization operation. When S=0, the data does not perform a synchronization operation. The current data value Data is the point data value.
[0105] Table 2 Communication processing methods for different priority points
[0106]
[0107] Specifically, the specific execution process of the above point polling method includes the following steps:
[0108] S1: Starts periodic polling of points based on the synchronization flag S. At the beginning of the first round of polling, the synchronization flag of all points defaults to 1. During this operation, the communication polls data point by point. This polling process completes the update of the point data value Data and records the data change interval Td.
[0109] S2: Determine whether the number of polling cycles reaches the number of forced synchronization cycles n. The completion of polling for all communication protocol points in the protocol table is recorded as one polling operation. When n polling cycles are completed, the system reaches the number of forced synchronization cycles n.
[0110] S3: By setting the synchronization flag S for all points to 1, polling is completed for all points. This means that polling of all communication protocol points in the protocol table is recorded as one polling operation. As described in S2, this ensures the real-time and effective monitoring of all points. Similar to S1, this polling process updates the point data value Data and records the interval Td between data changes.
[0111] S4: Assign weights V to points of different priorities. The weight of points with priority 1 is assigned to 1, and the weight of points with priority 3 is assigned to 0. Points with priority 2 are assigned a weight of 1 in the first round of scanning, and then the weight V is calculated.
[0112] If T-Td>0, calculation formula 1 is: .
[0113] If T-Td<0, calculation formula 2 is: .
[0114] If T-Td=0, calculation formula 3 is: .
[0115] Where T is the time required for a forced synchronization cycle to complete the entire polling cycle, V is the point weight, which is the point weight in the previous cycle, and m is the weight coefficient. If all points with different weights do not change data for m consecutive judgment cycles, the point weights will be determined to be 0. Similarly, if all points with different weights change data within m consecutive judgment cycles, the point weights will be set to 1.
[0116] It should be understood that for calculation formula 1, In the case of , the process no longer performs the addition operation and assigns the value to 1. For calculation formula 2, In the case of , no subtraction operation is performed and the value is assigned to 0.
[0117] S5: Sort the points according to their weights, and set the synchronization flag (synchronization flag) S according to the point weights. For all communication points with a priority of 1 and a point weight greater than 0, the synchronization flag S is set to 1. For all communication points with a priority of 3 or a weight equal to 0, the synchronization flag S is set to 0.
[0118] In this embodiment, by using a point classification method, polling the corresponding points according to the urgency of the data of points of different importance can avoid the lag of important control data control during the polling communication process in the case of multiple devices, and ensure the real-time upload of key monitoring data. In addition, the embodiment of the present application can simulate slave device communication and monitor the data during the communication process. The number of point polling communications will decrease as the point data changes. When the frequency of point data changes increases, the number of point communications will increase as the point data changes.
[0119] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0120] Based on the same inventive concept, the present application also provides a point polling device for implementing the aforementioned point polling method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more point polling device embodiments provided below can be found in the above-mentioned limitations of the point polling method and will not be repeated here.
[0121] In an exemplary embodiment, Figure 4 As shown, a point polling device 400 is provided, comprising: a point determination module 401, a weight updating module 402 and a flag updating module 403, wherein:
[0122] The point determination module 401 is used to determine the target point to be polled for each round of point polling based on the point weight, synchronization flag and point polling number of each point;
[0123] The weight updating module 402 is used to poll the target point to obtain the target point after polling, and update the point weight of the target point after polling to obtain the updated point weight;
[0124] The flag update module 403 is used to update the synchronization flag of the target point based on the updated point weight, obtain the updated synchronization flag, and return to execute the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point until the point polling is completed.
[0125] Furthermore, the point determination module 401 is specifically used to: obtain the priority of each point for each point; the priority includes high priority, medium priority and low priority; when the priority of the point is medium priority, if the synchronization flag of the point is the first flag value, the point is determined to be an initial point; based on the size order corresponding to the point weights of each initial point, the initial points are sorted, and the sorted initial points are determined to be the target points to be polled.
[0126] Furthermore, the point determination module 401 is specifically used to: when the priority of the point is high priority, if the synchronization flag of the point is the first flag value, determine the point as the initial point; when the priority of the point is low priority and the number of point polling times reaches the number corresponding to the forced synchronization period, determine the synchronization flag of the point as the first flag value, and determine the point as the initial point; when the priority of the point is low priority and the number of point polling times does not reach the number corresponding to the forced synchronization period, if the synchronization flag of the point is not the first flag value, determine the point as a non-target point.
[0127] Furthermore, the weight update module 402 is specifically used to: poll the target point, and update the current data value and data change interval of the target point based on the data value obtained by polling; update the point weight of the target point according to the priority and data change interval of the target point to obtain the updated point weight.
[0128] Furthermore, the weight update module 402 is specifically used to: determine the weight adjustment amount when the priority of the target point is medium priority; the weight adjustment amount is determined based on the weight coefficient of the target point; if it is determined that the data change interval is less than the forced synchronization period, the point weight of the target point is added to the weight adjustment amount to obtain the updated point weight; if it is determined that the data change interval is greater than the forced synchronization period, the point weight of the target point is subtracted from the weight adjustment amount to obtain the updated point weight.
[0129] Furthermore, the flag updating module 403 is specifically configured to: if the updated point weight is not 0, determine the synchronization flag of the target point to be the first flag value; if the updated point weight is 0, determine the synchronization flag of the target point to be the second flag value.
[0130] Furthermore, the flag updating module 403 is further configured to: if the priority of the target point is high, determine the synchronization flag of the target point to be the first flag value; if the priority of the target point is low, determine the synchronization flag of the target point to be the second flag value.
[0131] Each module in the above-mentioned point polling device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor of the electronic device in hardware form, or can be stored in the memory of the electronic device in software form, so that the processor can call and execute the corresponding operations of each module.
[0132] In an exemplary embodiment, an electronic device is provided. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The electronic device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the electronic device is used to store data such as point attributes of points. The input / output interface of the electronic device is used to exchange information between the processor and an external device. The communication interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a point polling method is implemented.
[0133] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0134] In an exemplary embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the following steps are implemented:
[0135] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0136] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain the updated point weight;
[0137] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled based on the point weight, synchronization flag and number of point polling for each round of point polling is returned to be executed until the point polling is completed.
[0138] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0139] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0140] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain the updated point weight;
[0141] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled based on the point weight, synchronization flag and number of point polling for each round of point polling is returned to be executed until the point polling is completed.
[0142] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0143] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0144] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain the updated point weight;
[0145] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled based on the point weight, synchronization flag and number of point polling for each round of point polling is returned to be executed until the point polling is completed.
[0146] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0147] For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and number of point polling of each point;
[0148] Polling the target point to obtain the target point after polling, and updating the point weight of the target point after polling to obtain the updated point weight;
[0149] Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled based on the point weight, synchronization flag and number of point polling for each round of point polling is returned to be executed until the point polling is completed.
[0150] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0151] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0152] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0153] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A point polling method, characterized in that: The method comprises: Read the point attributes of each point; the point attributes include a point weight and a synchronization flag; the point weight is used to indicate the importance of the point, and the synchronization flag is used to determine whether the point is polled; For each round of point polling, the target point to be polled is determined based on the point weight, synchronization flag and point polling number of each point; if the point satisfies at least one of the following conditions: the point weight is greater than a preset weight value, the synchronization flag is a preset flag value and the point polling number reaches the number, then the point is the target point; Polling the target point to obtain the polled target point, and updating the point weight of the polled target point to obtain an updated point weight; the point attribute also includes a priority and a data change interval, the priority being used to indicate whether each point can be polled first, and the data change interval being used to indicate the time interval over which the data value of the point changes; the point weight is updated based on the priority of the point, the data change interval, and the original point weight; Based on the updated point weight, the synchronization flag of the target point is updated to obtain the updated synchronization flag, and the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point is returned to be executed until the point polling is completed.
2. The method according to claim 1, characterized in that The step of determining the target point to be polled based on the point weight, synchronization flag, and number of point polling of each point includes: For each point, obtain the priority of each point; the priority includes high priority, medium priority and low priority; the high-priority point communicates and interacts with the device in each round of point polling, the medium-priority point determines whether to communicate and interact with the device in each round of point polling based on the point weight of the point, and the low-priority point communicates and interacts with the device when the number of point polling times reaches the forced synchronization period; In the case where the priority of the point is medium priority, if the synchronization flag of the point is the first flag value, the point is determined to be the initial point; In a case where the priority of the point is high priority, if the synchronization flag of the point is a first flag value, determining the point as an initial point; When the priority of the point is low and the number of polling times of the point reaches the number corresponding to the forced synchronization period, determining the synchronization flag of the point to be the first flag value, and determining the point to be the initial point; The initial points are sorted based on the order of the point weights of the initial points, and the sorted initial points are determined as target points to be polled.
3. The method according to claim 2, characterized in that After obtaining the priority of each point, the method further includes: When the priority of the point is low and the number of polling times of the point does not reach the number corresponding to the forced synchronization period, if the synchronization flag of the point is not the first flag value, the point is determined to be a non-target point.
4. The method according to claim 2, characterized in that The polling of the target point to obtain the polled target point, and updating the point weight of the polled target point to obtain the updated point weight, includes: Polling the target point, and updating the current data value and data change interval of the target point based on the data value obtained by polling; updating the point weight of the target point according to the priority of the target point and the data change interval to obtain an updated point weight; Wherein, updating the point weight of the target point according to the priority of the target point and the data change interval to obtain the updated point weight includes: When the priority of the target point is medium priority, determining a weight adjustment amount; the weight adjustment amount is determined based on a weight coefficient of the target point; If it is determined that the data change interval is less than the forced synchronization period, the point weight of the target point is added to the weight adjustment amount to obtain an updated point weight; If it is determined that the data change interval is greater than the forced synchronization period, subtracting the point weight of the target point from the weight adjustment amount to obtain an updated point weight; When the priority of the target point is high, determining the weight coefficient of the target point to be the highest weight coefficient; When the priority of the target point is low, the weight coefficient of the target point is determined to be the lowest weight coefficient.
5. The method according to claim 2, characterized in that The updating of the synchronization flag of the target point based on the updated point weight to obtain the updated synchronization flag includes: If the updated point weight is not 0, determining the synchronization flag of the target point to be the first flag value; If the updated point weight is 0, the synchronization flag of the target point is determined to be the second flag value.
6. The method according to claim 5, characterized in that The method further comprises: If the priority of the target point is high, determining the synchronization flag of the target point to be the first flag value; If the priority of the target point is low, the synchronization flag of the target point is determined to be the second flag value.
7. A point polling device, characterized in that: The device comprises: A point determination module is configured to read the point attributes of each point; the point attributes include a point weight and a synchronization flag; the point weight is used to indicate the importance of the point, and the synchronization flag is used to determine whether the point is to be polled; for each round of point polling, a target point to be polled is determined based on the point weight, synchronization flag, and number of point pollings of each point; if the point satisfies at least one of the following conditions: the point weight is greater than a preset weight value, the synchronization flag is a preset flag value, and the number of point pollings reaches a certain number, then the point is the target point; A weight updating module is configured to poll the target points to obtain the polled target points, and to update the point weights of the polled target points to obtain updated point weights; the point attributes further include priority and data change interval, the priority being used to indicate whether each point can be polled first, and the data change interval being used to indicate the time interval over which the data value of the point changes; the point weight is updated based on the priority, data change interval, and original point weight of the point; The flag update module is used to update the synchronization flag of the target point based on the updated point weight, obtain the updated synchronization flag, and return to execute the step of determining the target point to be polled for each round of point polling based on the point weight, synchronization flag and number of point polling of each point until the point polling is completed.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data acquisition method, device and system and electronic equipment
CN114721796A
Multithreaded central operating unit and simultaneous multithreading control method
JP2006343872A