Collection method and device for data of multiple measuring points and storage medium
By setting data priority and adjusting the acquisition sequence in industrial communication, the problem of data acquisition time due to the excessive device signals is solved, and the rapid refresh of key data and real-time data acquisition is achieved.
Patent Information
- Application Number
- CN202311323398.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-11
- Publication Date
- 2025-04-11
AI Technical Summary
In the field of industrial communications, excessive device signals lead to too long data acquisition time, affecting the real-time nature of data. In particular, the Modbus protocol limits the maximum number of registers collected each time, and multiple acquisitions are required to complete data refresh.
By setting the priority of key data, grouping and sorting them, adjusting the acquisition order, and setting the threshold for waiting for acquisition to increase the refresh frequency of key data.
It realizes rapid refresh of key data, reduces the refresh delay of non-critical data, and improves the real-timeness of data collection.
Smart Images

Figure CN119814678A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a method, a device and a storage medium for collecting data of multiple measuring points. Background Art
[0002] In the field of industrial communication, as the equipment becomes more and more intelligent, the equipment communication protocol measurement points are increasing. A smart meter may have more than 1000 signal measurement points. With the continuous development of information technology, many applications have higher and higher requirements for data real-time performance. If there are too many device signals, the polling time will be very long, which will affect the real-time performance of data in the system. Modbus protocol is a general communication protocol that has been widely used in today's industrial control field. According to its format, it can be divided into Modbus-RTU protocol, Modbus-TCP protocol, etc. Among them, Modbus-RTU is suitable for serial communication control networks, and Modbus-TCP is mainly used in control networks based on Ethernet TCP / IP communication. Because the number of bytes of the register value is 8 bits wide and the maximum value of the Modbus protocol message is 256 bytes, only 125 registers of Modbus-RTU and 123 registers of Modbus-TCP can be read at a time. For a meter with more than 1000 signals, at least 8 acquisitions are required to complete a data refresh. However, in fact, the register address definitions of many devices are not continuous, and they do not support continuous acquisition of 125 addresses. Acquisition 8 times is often not enough.
[0003] The traditional approach to collecting equipment data under existing technologies is to collect all data by polling. The time it takes to refresh equipment data is determined by the number of collected measurement points. When the amount of data is large, it takes a long time to refresh the data of key measurement points of the equipment. Summary of the invention
[0004] To solve the above problem, the present invention proposes a method for collecting data at multiple measuring points, which can increase the refresh frequency of key data by setting the priority of key data.
[0005] According to a first aspect, the present invention provides a method for collecting data from multiple measuring points, comprising: grouping the multiple measuring points for which data collection is required, and dividing the measuring points with the same priority into the same collection group; sorting the multiple measuring points in descending order of priority of the collection groups to form a first collection sequence; setting a waiting collection frame number threshold for each collection group, the waiting collection frame number threshold being used to adjust the collection order of the first collection sequence; collecting data from the multiple measuring points according to the first collection sequence and the set waiting collection frame number threshold, and outputting the collected measuring point data in the collection order.
[0006] Optionally, the data are collected for the multiple measuring points according to the first collection sequence and the set waiting collection frame number threshold, and the collected measuring point data is output in the order of collection, including: collecting the measuring points in the first collection sequence, and during the collection process: after completing the collection of all measuring points in the first collection group, starting to collect the measuring points of the second collection group; when the waiting frame number of the first collection group exceeds its corresponding waiting collection frame number threshold, pausing the collection of the second collection group, and collecting the first collection group again until the collection of all measuring points in the first collection group is completed; outputting the collected measuring point data in the order of collection; wherein the priority of the first collection group is higher than that of the second collection group; the waiting frame number refers to the number of collection frames required for collecting the collection group again after completing the collection of the collection group once.
[0007] Optionally, after completing the acquisition of all measuring points in the first acquisition group and starting to acquire the measuring points of the second acquisition group, the method further includes: when the waiting frame numbers of the first acquisition group and the waiting frame numbers of the third acquisition group both exceed their respective waiting acquisition frame number thresholds, pausing the acquisition of the second acquisition group, and first re-acquiring the third acquisition group, and then re-acquiring the first acquisition group; wherein, when re-acquiring the third acquisition group, suspending the statistics of the waiting frame numbers of the first acquisition group until completing the acquisition of all measuring points in the third acquisition group; wherein, the priority of the third acquisition group is higher than the priority of the first acquisition group.
[0008] Optionally, after completing the acquisition of all measuring points in the first acquisition group and starting to acquire the measuring points of the second acquisition group, the method further includes: when the number of waiting frames of the third acquisition group exceeds its corresponding waiting acquisition frame number threshold, pausing the acquisition of the second acquisition group and acquiring the third acquisition group again; and at the same time pausing the statistics of the number of waiting frames of the first acquisition group until the acquisition of all measuring points in the third acquisition group is completed; wherein the priority of the third acquisition group is higher than the priority of the first acquisition group.
[0009] Optionally, data is collected for the multiple measuring points according to the first collection sequence and the waiting collection frame number threshold, and the collected measuring point data is output in the collection order, and also includes: determining the number of the collection groups after grouping and the number of collection frames of the measuring point data in each of the collection groups according to the priorities of the multiple measuring points; and calculating the total number of frames of the output collected measuring point data according to the number of the collection groups, the number of collection frames of the measuring point data in each of the collection groups and the set waiting collection frame number threshold.
[0010] Optionally, calculating the total number of frames of the measured point data for the output acquisition based on the number of the acquisition groups, the number of acquisition frames of the measured point data in each acquisition group, and the waiting acquisition frame number threshold thereof includes: the total number of frames S of the measured point data for the output acquisition m is
[0011] S m = ts m , where
[0012] wherein, ts1, ts2, ts m-1 , ts m , ts (m-1)-1 represent intermediate variables; N1 represents the number of acquisition frames of the measured point data in the acquisition group with priority level 1, N2 represents the number of acquisition frames of the measured point data in the acquisition group with priority level 2, N m-1 represents the number of acquisition frames of the measured point data in the acquisition group with priority level m - 1, N m represents the number of acquisition frames of the measured point data in the acquisition group with priority level m, m represents the number of the acquisition groups, the larger the number of the priority level, the lower the priority; L represents the set waiting acquisition frame number threshold, and the set waiting acquisition thresholds of each acquisition group are the same.
[0013] Optionally, calculating the total number of frames of the measured point data for the output acquisition based on the number of the acquisition groups, the number of acquisition frames of the measured point data in each acquisition group, and the set waiting acquisition frame number threshold further includes: calculating the refresh frame number F of the measured point data in the acquisition group with priority level x according to the number of the acquisition groups, the number of acquisition frames of the measured point data in each of the acquisition groups, the set waiting acquisition frame number threshold, and the total number of frames of the measured point data for the output acquisition x :
[0014] When x = 1, F x = N1 + L;
[0015] When 1 < x < m, F x ∈[tf x , tf x + N x-1 ,
[0016] wherein,
[0017] When x = m, F x = S m ;
[0018] wherein, tf x , tf x-1 , tf (x-1)-1 represent intermediate variables; N xIndicates the number of acquisition frames of the measurement point data in the acquisition group with priority level x.
[0019] Optionally, the waiting acquisition frame number threshold is greater than 1 and less than the sum of the acquisition frame numbers of all acquisition groups that are not of the highest priority.
[0020] According to a second aspect, the present invention provides a device for collecting data from multiple measuring points, including: a grouping module for grouping multiple measuring points that need to collect data, and dividing measuring points with the same priority into the same collection group; a sorting module for sorting the multiple measuring points in order of the priority of the collection group from high to low to form a first collection sequence; a threshold setting module for setting a waiting collection frame number threshold for each collection group, and the waiting collection frame number threshold is used to adjust the collection order of the first collection sequence; the collection module is used to collect data from the multiple measuring points according to the first collection sequence and the set waiting collection frame number threshold, and output the collected measuring point data in the collection order.
[0021] According to a third aspect, the present invention provides a storage medium, wherein the storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by a processor, the steps of any method described in the first aspect are implemented.
[0022] The present invention increases the acquisition frequency of key data (data with higher priority) by defining acquisition priority and waiting acquisition frame number threshold, thereby achieving the effect of accelerating the refresh of key data and delaying the refresh of non-key data. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the acquisition sequence of multiple measuring points in the prior art;
[0024] Figure 2 A schematic diagram of a method for collecting data at multiple measuring points in one embodiment of the present invention;
[0025] Figure 3 A schematic diagram of the output sequence of a collection method in one embodiment of the present invention;
[0026] Figure 4 A schematic diagram of the output sequence of a collection method in another embodiment of the present invention;
[0027] Figure 5 Schematic diagram of the execution flow of the collection method according to an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of an output sequence of waiting for a collection frame number threshold of 4 in a collection method according to an embodiment of the present invention;
[0029] Figure 7This is a schematic diagram of the output sequence of waiting for the acquisition frame number threshold to be 2 in an acquisition method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The specific embodiments of the present invention will be described in detail below. It should be noted that the embodiments herein are only used for illustration and are not intended to limit the present invention. In the following description, a large number of specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to those of ordinary skill in the art that these specific details are not necessarily used to implement the present invention. In other examples, in order to avoid confusing the present invention, known procedures, materials or methods are not specifically described.
[0031] In the prior art method of collecting data at multiple measuring points, the Modbus protocol limits the maximum number of registers collected each time. If there are too many protocol register addresses, many collections are required to complete a data refresh. Figure 1 The figure shows the acquisition sequence of multiple measuring points in the prior art. There are 1300 signal measuring points of the smart meter, and the register addresses where the data is stored are not continuous. The maximum register address is 2500. Each time 125 registers are collected, at least 20 data (20 frames of data) are collected to complete the acquisition of all measuring points, and only one acquisition is completed for each measuring point. According to the calculation of 500ms for each acquisition, it takes 10s to poll once. If an alarm occurs in the device, it may take 10s to collect the fault data of a certain measuring point of the device. Such an acquisition method obviously cannot meet the requirements for real-time data. Although the Simple Network Management Protocol (SNMP) does not limit the number of measuring points collected at one time, when the amount of data is large, the full amount of data is obtained each time, and the time consumption of obtaining data will also increase, and it will cause too much pressure on the network management equipment and terminal equipment, affecting the normal business of the equipment.
[0032] To solve the above problems, an embodiment of the present invention provides a method for collecting data from multiple measuring points. Figure 2As shown, it includes: step S201, grouping multiple measuring points of the equipment that needs to collect data, and dividing the measuring points with the same priority into the same collection group. For example, the measuring point with a priority of 1 is regarded as the highest priority, and the measuring point with a priority of 2 is regarded as the second highest priority, and the priorities decrease in sequence. Step S202, sorting the multiple measuring points in order from high to low according to the priority of the collection group to form a first collection sequence, where the priority of the collection group is determined according to the priority of the measuring points included in the collection group, that is, the priority of the collection group is the same as the priority of the test points included in the group. Step S203, setting a waiting collection frame number threshold for each collection group, and the waiting collection frame number threshold is used to adjust the first collection sequence, that is, used to adjust the collection frequency of collection groups with different priorities in the first collection sequence. Specifically, a waiting frame number is defined for each acquisition group of each priority level, and the waiting integer refers to the number of acquisition frames required for the interval between completing the acquisition of all measurement points of the acquisition group once and then acquiring the acquisition group again; by comparing the waiting frame number with the waiting acquisition frame number threshold, the time to acquire the acquisition group again can be determined, that is, the acquisition frequency of the acquisition group can be adjusted by adjusting the waiting acquisition frame number threshold. It should be understood that the waiting acquisition frame number thresholds set for each acquisition group can be the same or different, depending on specific needs. In some embodiments, the waiting acquisition frame number threshold is greater than 1 and less than the sum of the acquisition frame numbers of all acquisition groups that are not of the highest priority. Step S204: data acquisition is performed on the multiple measurement points according to the first acquisition sequence and the waiting acquisition frame number threshold, and the collected measurement point data is output in the order of acquisition. Specifically, after completing the acquisition of all measuring points in the first acquisition group, start acquiring the measuring points of the second acquisition group; when the waiting frame number of the first acquisition group exceeds the waiting acquisition frame number threshold, suspend the acquisition of the second acquisition group, and acquire the first acquisition group again until completing the acquisition of all measuring points in the first acquisition group; output the acquired measuring point data in the order of acquisition.
[0033] Combine the following Figure 3 The above process is illustrated by an example. Figure 3As shown in the figure, multiple measuring points are divided into two levels of priority to obtain acquisition group A and acquisition group B, where the priority of acquisition group A is higher than that of acquisition group B. Assume that IdleCnt[1] represents the waiting frame number of acquisition group A, and IdleCnt[2] represents the waiting frame number of acquisition group B; 4 frames of data are required to complete the acquisition of each measuring point of acquisition group A, that is, the number of acquisition frames of the measuring point data of acquisition group A is 4, and these 4 frames of data can be represented by acquisition sequence numbers A1, A2, A3, and A4; 10 frames of data are required to complete the acquisition of acquisition group B, and the acquisition sequence numbers of each frame are recorded as B1, B2, B3, B4, B5, B6, B7, B8, B9, and B10, respectively, and the number of acquisition frames of the measuring point data of acquisition group B is 10; the waiting acquisition frame number threshold of each acquisition group is the same, and the waiting acquisition frame number threshold L of each acquisition group is set to 4. Start acquisition: Start acquisition of acquisition group A, and collect four frames of data in sequence according to the acquisition sequence numbers A1, A2, A3, and A4; after the acquisition of acquisition group A with level 1 priority is completed, start to collect acquisition group B with level 2 priority. This acquisition group B has a total of ten frames of data, which are also collected in sequence according to the acquisition sequence numbers. When acquiring frame B1, acquisition group A waited for 1 frame, so its waiting frame number IdleCnt[1] = 1. When acquiring frame B2, acquisition group A waited for another frame, so IdleCnt[1] plus 1 is 2. And so on. When acquiring frame B3, IdleCnt[1] = 3. When acquiring frame B4, IdleCnt[1] = 4. When acquiring frame B5, IdleCnt[1] = 5 at this time, which has exceeded the set waiting acquisition frame number threshold L = 4. At this time, the acquisition of frame B5 is interrupted (or paused). Do not acquire the data of frame B5 first, and start acquiring again. Data collection is performed on collection group A, that is, the data of the four frames A1, A2, A3, and A4 in collection group A are collected again in sequence; after the data of collection group A is collected again and IdleCnt[1] is cleared, the collection of frame B5 is restarted and the data of frames B6, B7, and B8 are collected in sequence according to the collection sequence of collection group B. When the data of collection group B9 is to be collected, IdleCnt[1] is 5 again, and the collection of collection group A is continued. After the data of collection group A is collected again, the collection of frames B9 and B10 is restarted. At this point, the collection of all data in collection group A and collection group B is completed. During the entire collection process, collection group A is collected 3 times and collection group B is collected once.
[0034] It can be seen that the present invention increases the acquisition frequency of key data (data with higher priority) by defining the acquisition priority and the waiting acquisition frame number threshold, so as to achieve the effect of accelerating the refresh of key data and delaying the refresh of non-key data. The existing modbus protocol limits the maximum number of registers collected each time, and too many protocol register addresses require many acquisitions to complete a data refresh. The above method using the embodiment of the present application can increase the refresh frequency of key data by setting the priority of key data settings. Although the existing Snmp protocol does not limit the number of measurement points collected at one time, when there is a lot of data, the full amount of data is obtained each time, and the time consumption for obtaining data will also increase, and it will cause too much pressure on network management equipment and terminal equipment, affecting the normal business of the equipment. The above method using the embodiment of the present application only accelerates the acquisition of key data, which can not only meet the real-time nature of the data, but also make the network management equipment and the terminal have no pressure.
[0035] In some other embodiments, after completing the acquisition of all measuring points in the first acquisition group and starting to acquire the measuring points of the second acquisition group, it also includes: when the number of waiting frames of the third acquisition group exceeds the waiting acquisition frame number threshold, pausing the acquisition of the second acquisition group and acquiring the third acquisition group again; at the same time, pausing the statistics of the number of waiting frames of the first acquisition group until the acquisition of all measuring points in the third acquisition group is completed; wherein the priority of the third acquisition group is higher than the priority of the first acquisition group.
[0036] like Figure 4 As shown, there is also a collection group C, which has a higher priority than collection group A. Assume that IdleCnt[3] represents the waiting frame number of collection group C; 3 frames of data are required to complete the collection of collection group C (that is, the number of collection frames of measurement point data of collection group C is 3), and their collection numbers are recorded as C1, C2, and C3 respectively. In this example, the waiting frame number threshold L of each acquisition group is the same and is still set to 4. Start the acquisition: after completing the acquisition of acquisition group C, start the acquisition of acquisition group A. After completing the acquisition of 4 frames of data of acquisition group A, start the acquisition of acquisition group B. When acquiring frame B1, IdleCnt[3]=5 exceeds L. Since the priority of acquisition group C is higher than that of acquisition group A and acquisition group B, the acquisition of frame B1 is suspended, and C1, C2, and C3 are acquired again. During the acquisition of acquisition group C again, the counting of the waiting frames of acquisition group A is suspended (that is, these 3 frames are not counted in IdleCnt[1]). After completing the acquisition of acquisition group C again, continue to acquire frames B1, B2, B3, and B4, and resume counting IdleCnt[1].
[0037] In some other embodiments, after the acquisition of all the measurement points in the first acquisition group is completed, the acquisition of the measurement points in the second acquisition group is started, and the method further includes: when the waiting frame number of the first acquisition group and the waiting frame number of the third acquisition group both exceed the waiting acquisition frame number threshold, suspending the acquisition of the second acquisition group and re-acquiring the third acquisition group first; and suspending the statistics of the waiting frame number of the first acquisition group until the acquisition of all the measurement points in the third acquisition group is completed; wherein the priority of the third acquisition group is higher than the priority of the first acquisition group. Continuing with the above example, when the B5 frame is to be acquired, IdleCnt[3]=5 and IdleCnt[1]=5 both exceed L, the acquisition of the B5 frame is suspended. Since the priority of acquisition group C is higher than that of acquisition group A, acquisition group C is collected again and the statistics of IdleCnt[1] are suspended. After the re-acquisition of acquisition group C is completed, acquisition group A is collected again. Since the priority of acquisition group C is higher, the statistics of IdleCnt[3] will not be suspended when acquiring acquisition group A.
[0038] Figure 5The following is a schematic diagram of the execution flow of the acquisition method of an embodiment of the present invention. Obtain the priority level and corresponding acquisition sequence number of each acquisition group, define a waiting acquisition frame number IdleCnt in each priority level, which is equivalent to setting a waiting acquisition frame number threshold for each acquisition group; obtain the acquisition priority level, that is, inquire whether the acquisition group of the current priority level needs to be acquired in order from high to low priority. For example, first inquire the acquisition group with the highest priority level (that is, priority level 1) to determine whether this level needs to be acquired. If the current acquisition sequence number of the acquisition group of this priority level is less than the total acquisition frame number of this priority level, it means that this priority level has not completed one acquisition. Then, return "true" that this level of priority needs to be acquired and return the acquisition sequence number of this priority level. According to the priority level and acquisition The sequence number collects the measurement point data of this level; if the measurement point data in this priority level has been collected once, then each time a frame of measurement point data in the next level priority collection group is collected, the IdleCnt of the collection group is increased by 1; wherein, the next level priority refers to all priorities lower than this priority (it can refer to all collection groups lower than the first level priority, such as the 2nd level priority or the 3rd level priority); when the IdleCnt of the collection group is greater than the set waiting collection frame number threshold L of the collection group, the collection group needs to collect again, and when the IdleCnt of the collection group is less than or equal to the set waiting collection frame number threshold L of the collection group, it returns "false" that this level of priority does not need to collect. If the collection group corresponding to the priority currently being queried does not need to collect, then continue to query the next level of priority. When the collection group of the last level of priority returns that it does not need to collect, it means that all data collection has been completed once, reset the IdleCnt and collection sequence number of all collection groups, and start a new round of collection.
[0039] In some embodiments, the number of the acquisition groups after grouping and the number of acquisition frames of the measurement point data in each acquisition group are determined according to the priorities of the multiple measurement points; the total number of frames of the outputted measurement point data is calculated according to the number of the acquisition groups, the number of acquisition frames of the measurement point data in each acquisition group, and the set waiting acquisition frame number threshold. m for:
[0040] S m =ts m ,in,
[0041] Among them, ts1, ts2, ts m-1 ,ts m ,ts (m-1)-1 represents an intermediate variable; N1 represents the number of acquisition frames of the measurement point data in the acquisition group with a priority level of 1, N2 represents the number of acquisition frames of the measurement point data in the acquisition group with a priority level of 2, N m-1The number of frames of measurement point data collected in the collection group with priority level m - 1, N m The number of frames of measurement point data collected in the collection group with priority level m. m represents the number of collection groups. The larger the number of the priority level, the lower the priority; L represents the set waiting collection frame number threshold. In this embodiment, the waiting collection thresholds set for each collection group are the same, and the setting range of the waiting collection frame number threshold is 1 < L < (N2 + N3 + …… + N m-1 +N m ), The operator represents rounding up.
[0042] For example Figure 6 , it is still necessary to collect 1300 signal measurement points of the smart meter, with at least 20 packets (20 frames) of data. Among these 20 packets of data (20 frames of data), there are 2 frames of data for the meter alarm event, 5 frames of data for the main analog quantity, and the remaining 13 frames of data are secondary data. That is, according to the method of the embodiment of the present invention, the priority is first divided and grouped: the number of frames of priority level 1, N1, is 2, the number of frames of priority level 2, N2, is 5, and the number of frames of priority level 3, N3, is 13; then L is set to 4. Calculate according to the above formula:
[0043] ts1 = N3 = 13,
[0044]
[0045]
[0046] S3 = ts3 = 51,
[0047] It represents the total number of frames S of the 1300 measurement point data collected and output according to the method for collecting multiple measurement point data described in the embodiment of the present invention under this priority division and this waiting collection frame number threshold m is 51, that is, collecting 51 frames of data can refresh the data of all measurement points once.
[0048] In some embodiments, according to the number of collection groups, the number of frames of measurement point data in each collection group, the waiting collection frame number threshold, and the set total number of frames of measurement point data collected and output, the refresh frame number of the measurement point data in each collection group can be calculated, including: the refresh frame number F of the measurement point data in the collection group with priority level x x is:
[0049] When x = 1, F x = N1 + L;
[0050] When 1 < x < m, F x is a range, that is, F x ∈[tf x ,tfx +N x-1 ],
[0051] in,
[0052] When x = m, F x =S m ;
[0053] Among them, tf x 、tf x-1 、tf (x-1)-1 Indicates the intermediate variable; N x Indicates the number of acquisition frames of the measurement point data in the acquisition group with priority level x; The operator represents rounding down.
[0054] Continuing with the above example, the number of priority level 1 frames, i.e. N1, is 2, the number of priority level 2 frames, i.e. N2, is 5, and the number of priority level 3 frames, i.e. N3, is 13. Then set L to 4. Calculate the refresh frame number of the measurement point data in the acquisition group at each priority level as follows:
[0055] F1=N1+L=2+4=6,
[0056] F2 is a range, that is, F2∈[tf2,tf2+N1],
[0057] Where tf1 = N x +L=N2+L=5+4=9, substituting tf1=9 into the above formula, we get:
[0058]
[0059] Get F2∈[13,15];
[0060] F3=S3=51.
[0061] If a frame of data is collected every 500ms, then using the method described in the embodiment of the present invention, according to the above example, the alarm of priority 1 can be refreshed every 3s, the important data can be refreshed every 6.5 to 7.5s, and the secondary data can be refreshed every 25.5s. It can be found that the refresh frequency of the data of priority 1 and priority 2 is faster than the original polling every 10s.
[0062] If the priority and other conditions are Figure 6 Same as in the example, but set L = 2. Then according to the formula, S3 = 96, F1 = 4, F2 = [13, 15], F3 = 96. Then the data of priority 1 can be refreshed in 2 seconds, the data of priority 2 can be refreshed in 6.5s to 7.5s, and the data of priority 3 can be refreshed in 48s. Collection order Figure 7As shown, the smaller the waiting acquisition frame number threshold is, the higher the acquisition frequency of the data with high priority will be. The waiting acquisition frame number threshold is usually set in the range of 1 to the total number of frames in the first acquisition sequence. Preferably, the waiting acquisition frame number is less than the difference between the total number of frames in the first acquisition sequence and the acquisition frame number of the measurement point data in the highest priority acquisition group.
[0063] Another example can be given to illustrate that 20 packets of data are collected, the number of priority 1 frames, i.e. N1, is 2, the number of priority 2 frames, i.e. N2, is 7, the number of priority 3 frames, i.e. N3, is 6, and the number of priority 4 frames, i.e. N4, is 5; set L to 4. The total number of frames S4 of the collected measurement point data is calculated and output as follows:
[0064]
[0065] Among them, ts1=N4=5, then substitute it into the above formula to get,
[0066]
[0067] Then S4=ts4=78.
[0068] Calculate the refresh frame number of the measurement point data in the acquisition group at each priority level as follows:
[0069] F1=N1+L=2+4=6,
[0070] F2 is a range, that is, F2∈[tf2,tf2+N1],
[0071] Where tf1 = N x +L=N2+L=7+4=11, substituting tf1=11 into the above formula, we get:
[0072]
[0073] Get F2∈[13,17];
[0074] F3 is a range, that is, F3∈[tf3,tf3+N2],
[0075] Where tf1 = N x +L=N3+L=6+4=10, substituting tf1=11 into the above formula, we get:
[0076]
[0077] Get F3∈[36,43];
[0078] F4=S4=78.
[0079] From the above, we can know that the number of frames of priority level 1, i.e. N1, is 2, the number of frames of priority level 2, i.e. N2, is 7, the number of frames of priority level 3, i.e. N3, is 6, the number of frames of priority level 4, i.e. N4, is 5. By setting the maximum number of idle frames of priority, i.e. L, to 4, we can calculate that 78 frames of data need to be collected for a full collection. The refresh frequency of priority level 1 is 6 frames, the refresh frequency of priority level 2 is 15-17 frames, the refresh frequency of priority level 3 is 36-43 frames, and the refresh frequency of priority level 4 is 78 frames. The refresh frame number of priority level 1, i.e. 6, is much smaller than the number of frames collected by polling and then refreshed after 20 frames, and the refresh frequency of priority level 2, i.e. 15-17, is also smaller than the refresh frame number of polling collection.
[0080] It should be understood that the above example is to illustrate that the waiting acquisition frame number thresholds set by each acquisition group are the same value, and no limitation is imposed on this. In some embodiments, different waiting acquisition frame number thresholds can be set for each acquisition group, so as to more flexibly adjust the refresh frequency of the data in each acquisition group.
[0081] An embodiment of the present invention further provides a device for collecting data from multiple measuring points, comprising: a grouping module for grouping multiple measuring points for which data collection is required, and dividing measuring points with the same priority into the same collection group; a sorting module for sorting the multiple measuring points in descending order of priority of the collection groups to form a first collection sequence; a threshold setting module for setting a waiting collection frame number threshold for each collection group, and the waiting collection frame number threshold is used to adjust the collection order of the first collection sequence; and a collection module for collecting data from the multiple measuring points according to the first collection sequence and the waiting collection frame number threshold, and outputting the collected measuring point data in the collection order.
[0082] The various embodiments of this specification are described in a progressive manner, and each embodiment describes the differences from other embodiments or implementations. The same or similar parts between the various embodiments of the present invention can be referred to each other, and the implementation principles and technical effects produced around the inventive concept can be referred to each other, which will not be repeated here. In the absence of conflict, the various embodiments or implementations of the present invention can be combined with each other.
[0083] It should be noted that although the above describes the various steps in a specific order, it does not mean that the various steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order as long as the required functions can be achieved.
[0084] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0085] Computer readable storage medium can be a tangible device that holds and stores instructions used by an instruction execution device. Computer readable storage medium can include, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a protruding structure in a groove on which instructions are stored, and any suitable combination thereof.
[0086] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for collecting data from multiple measuring points, characterized in that: include: Grouping the multiple measuring points for which data need to be collected, and assigning measuring points with the same priority to the same collection group; Sorting the plurality of measuring points in descending order of priority of the acquisition groups to form a first acquisition sequence; Setting a waiting acquisition frame number threshold for each acquisition group, wherein the waiting acquisition frame number threshold is used to adjust the acquisition order of the first acquisition sequence; According to the first acquisition sequence and the set waiting acquisition frame number threshold, data acquisition is performed on the multiple measuring points, and the collected measuring point data is output in the acquisition order.
2. The method according to claim 1, characterized in that The step of collecting data from the plurality of measuring points according to the first collection sequence and the set waiting collection frame number threshold, and outputting the collected measuring point data in the collection order, comprises: The measurement points in the first acquisition sequence are acquired, and during the acquisition process: After completing the acquisition of all the measuring points in the first acquisition group, start to acquire the measuring points of the second acquisition group; When the number of waiting frames of the first acquisition group exceeds its corresponding waiting acquisition frame number threshold, suspending the acquisition of the second acquisition group, and performing acquisition on the first acquisition group again, until the acquisition of all measurement points in the first acquisition group is completed; Output the collected measuring point data in the order of collection; The priority of the first acquisition group is higher than that of the second acquisition group; the waiting number of frames refers to the number of acquisition frames required for performing acquisition on the acquisition group again after completing acquisition of the acquisition group once.
3. The method according to claim 2, characterized in that After completing the collection of all the measuring points in the first collection group and starting to collect the measuring points of the second collection group, the method further includes: When the waiting frame number of the first acquisition group and the waiting frame number of the third acquisition group both exceed their respective waiting acquisition frame number thresholds, suspending the acquisition of the second acquisition group, and Firstly, the third acquisition group is re-acquired, and then the first acquisition group is re-acquired; Wherein, when the third acquisition group is acquired again, the counting of the number of waiting frames of the first acquisition group is suspended until the acquisition of all measurement points in the third acquisition group is completed; The priority of the third collection group is higher than the priority of the first collection group.
4. The method according to claim 2, characterized in that: After completing the collection of all the measuring points in the first collection group and starting to collect the measuring points of the second collection group, the method further includes: When the number of waiting frames of the third acquisition group exceeds its corresponding waiting acquisition frame number threshold, suspending the acquisition of the second acquisition group, and performing acquisition of the third acquisition group again; At the same time, the counting of the number of waiting frames of the first acquisition group is suspended until the acquisition of all measuring points in the third acquisition group is completed; The priority of the third collection group is higher than the priority of the first collection group.
5. The method according to claim 1, characterized in that According to the first acquisition sequence and the waiting acquisition frame number threshold, data is collected for the multiple measuring points, and the collected measuring point data is output in the order of acquisition, and further includes: Determining the number of the acquisition groups after grouping and the number of acquisition frames of the measurement point data in each acquisition group according to the priorities of the multiple measurement points; The total number of frames of the output collected measuring point data is calculated according to the number of the collection groups, the number of collection frames of the measuring point data in each of the collection groups, and the set waiting collection frame number threshold.
6. The method according to claim 5, characterized in that According to the number of acquisition groups, the number of acquisition frames of the measurement point data in each acquisition group and the waiting acquisition frame number threshold, calculating the total number of frames of the output acquisition measurement point data includes: The total number of frames S of the output collected measurement point data m for S m =ts m ,in, Among them, ts1, ts2, ts m-1 ,ts m ,ts (m-1)-1 represents an intermediate variable; N1 represents the number of acquisition frames of the measurement point data in the acquisition group with a priority level of 1, N2 represents the number of acquisition frames of the measurement point data in the acquisition group with a priority level of 2, N m-1 Indicates the number of acquisition frames of the measurement point data in the acquisition group with priority level m-1, N m It represents the number of acquisition frames of the measurement point data in the acquisition group with priority level m, where m represents the number of acquisition groups. The larger the priority level number is, the lower the priority is. L represents the set waiting acquisition frame number threshold, and the waiting acquisition threshold set for each acquisition group is the same.
7. The method according to claim 6, characterized in that Calculating the total number of frames of the output collected measuring point data according to the number of the collection groups, the number of collection frames of the measuring point data in each collection group, and the set waiting collection frame number threshold, further comprising: According to the number of acquisition groups, the number of acquisition frames of the measurement point data in each acquisition group, the set waiting acquisition frame number threshold and the total number of frames of the output acquisition measurement point data, the refresh frame number of the measurement point data in each acquisition group is calculated: The refresh frame number F of the measurement point data in the acquisition group with priority level x x for: When x=1, F x =N1+L; When 1 < x < m, F x ∈ [tf x , tf x + N x-1 , in, When x = m, F x =S m ; Among them, tf x 、tf x-1 、tf (x-1)-1 Indicates the intermediate variable; N x Indicates the number of acquisition frames of the measurement point data in the acquisition group with priority level x.
8. The method according to claim 1, characterized in that The waiting acquisition frame number threshold is greater than 1 and less than the sum of the acquisition frame numbers of all acquisition groups that are not of the highest priority.
9. A device for collecting data from multiple measuring points, characterized in that: include: The grouping module is used to group multiple measuring points that need to collect data, and divide the measuring points with the same priority into the same collection group; The sorting module is used to sort the multiple measuring points into a first acquisition sequence according to the priority of the acquisition group from high to low; The threshold setting module is used to set a waiting acquisition frame number threshold for each acquisition group, and the waiting acquisition frame number threshold is used to adjust the acquisition order of the first acquisition sequence; The acquisition module is used to acquire data from the multiple measuring points according to the first acquisition sequence and the set waiting acquisition frame number threshold, and output the acquired measuring point data in the acquisition order.
10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Software and hardware combined data interaction method and system based on Modbus communication component
CN120723695A