Extra-large-scale index and low-delay data acquisition device in water affair system
By using a programmable data acquisition unit and a low-latency data logic program in the water system, combined with a graphical interface and the Modbus protocol, the problem of high-latency data acquisition in the water system is solved, achieving low-latency and accurate data acquisition, which is suitable for fast-flowing water environments.
Patent Information
- Application Number
- CN202511275818.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-12-05
AI Technical Summary
In water systems, existing technologies suffer from high latency when collecting large amounts of sensor data, leading to data analysis errors and making it impossible to accurately obtain sensor values at the same time.
It adopts a programmable data acquisition device, a low-latency data acquisition logic program and a graphical user interface, supports the Modbus protocol, realizes active polling and data merging, and generates merge query commands by entering indicator parameters through the graphical interface, thereby reducing communication latency.
It enables low-latency data acquisition of a large number of indicators in water systems, and the data is closer to the sensor values at the same time, which is suitable for fast water flow environments and improves the accuracy and efficiency of data acquisition.
Smart Images

Figure CN121078084A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet of Things data collection, in particular to a large number of index, low delay data collection device in water system. BACKGROUND
[0002] Various sensors such as thermometers, pressure gauges, flow meters, etc. are connected to programmable logic controllers (PLC) through cables, which output data to collector units (DTU), and then transmit data to servers or other controllers (upper computers). This is the current common data collection method. ModBus protocol is used for communication between PLC and collector.
[0003] Due to the characteristics of Modbus half-duplex communication, the DTU must wait for the PLC to return the result of the last query before initiating a new query for each active query of an index. Assuming that it takes 5ms to query an index, the delay for querying the 100th index is 500ms. When the number of indexes is large, high latency brings errors to the analysis of data at a certain time. Therefore, the inventor has improved the structure of the data collection device. SUMMARY
[0004] The purpose of the present application is to provide a large number of index, low delay data collection device in water system, which has the advantages of reasonable design, collected data closer to the values of various sensors at the same time, experiments can be performed multiple times, and the faster the water flow, the more obvious the experimental effect, solving the problems raised in the above technical background.
[0005] To achieve the above purpose, the present application provides the following technical scheme: a large number of index, low delay data collection device in water system, the device includes a programmable data collector, a low delay data collection logic program and a graphical operation interface, the programmable data collector supports Modbus protocol, can realize Modbus active polling, support MQTT, HTTP send data, and the programmable data collector has programmable function, can connect with the hardware of PLC and realize Modbus communication, and as the physical carrier of the low delay data collection logic program;
[0006] The low delay data collection logic program runs on the programmable data collector, which can make the data closer to the values of various sensors at the same time when collecting a large number of indexes;
[0007] The graphical operation interface replaces the programming mode, and filling in the register address, data type and index name on the graphical operation interface can complete the data collection. The graphical operation interface is used to input the parameters of each index to be collected, including: register address D1, data type T1 and index name P1 of index 1, register address D2, data type T2 and index name P2 of index 2, …, register address Dn, data type Tn and index name Pn of index n.
[0008] Wherein, the name P is a combination of English letters and numbers, the register address D is a non-negative integer, the data type T includes BYTE, unsigned short integer (16 bit), signed short integer (16 bit), floating point number, unsigned integer (32 bit), signed integer (32 bit) and Boolean type, and the collected information is transmitted to the low-delay data collection logic program for further processing.
[0009] The low-delay data collection logic program receives the transmitted index parameters, calculates and generates an index feature table, formulates a query instruction according to the Modbus protocol, and transmits the query instruction to the hardware layer for execution.
[0010] After the hardware layer, i.e., the low-delay data collection logic program, receives the query instruction formulated according to the Modbus protocol, the query instruction is converted into a digital signal through a port according to the port connected to the programmable data collector, and is transmitted to the PLC through a cable. The PLC is responsible for connecting with the sensor, receiving the sensor signal and converting the sensor signal into a digital signal, returning along the original route, and finally returning to the low-delay data collection logic program.
[0011] Preferably, the following operation steps are included:
[0012] ①Connecting the low-delay data collection logic program with the PLC and setting the communication baud rate;
[0013] ②Adding the data index to be collected on the graphical operation interface, and filling in the register address, data type and index name;
[0014] ③Setting the active collection frequency and time interval, such as collecting once every 30 seconds, and setting the interval of each group of instructions to 5 milliseconds;
[0015] ④Setting the host computer address to which the data collection result is reported;
[0016] ⑤Running the low-delay data collection logic program to execute data collection, and the low-delay data collection logic program is run silently without human intervention throughout the process, and the collection result is reported to the host computer according to the address set in step ④.
[0017] Preferably, in step ①, the low-latency data acquisition logic program is connected to the cable port of the PLC using RS485 or RS232, and the communication baud rate is any one of 9600, 19200, 38400 or 115200.
[0018] Preferably, in step ③, the instruction interval is related to the baud rate, for example, if the baud rate is 9600, the instruction interval time should be no less than 4.0104167 milliseconds.
[0019] Preferably, in step ④, the upper computer address is a server connected to the Internet, and the connection protocol can be TCP / UDP, MQTT, HTTP / HTTPS, COAP, LwM2M.
[0020] Preferably, in step ⑤, the collected data and the status of the entire system can be observed on the upper computer.
[0021] Preferably, the graphical operation interface performs index data preprocessing after collecting each index parameter, and after preprocessing the index parameters, it can combine the tasks that require multiple instruction queries under the existing query method into a single instruction query, and the detailed process is as follows:
[0022] ① According to the definition of each index collected by the graphical operation interface, including index name P, register address D, data type T, such as n indexes, P1, D1, T1, P2, D2, T2……, Pn, Dn, Tn, the lowest address Dmin and the highest address Dmax of the address block are calculated, and the total length L of the address block is calculated. The specific calculation formula is as follows:
[0023]
[0024] Wherein, Dmin refers to the register address when the register address of a certain index is the smallest, Dmax refers to the register address when the register address of a certain index is the largest, T' refers to the data type when the register address of a certain index is the largest, and sizeof is the number of bytes of a certain data type;
[0025] ② Save all index parameters for use in the next step, and save each index according to the register address D from small to large;
[0026] ③ Compile modbus instruction: compile the merged query instruction, that is, the instruction for querying multiple indexes at a time, which needs to use the results calculated in the previous step;
[0027] ④ Output the query instruction to the PLC: since the DTU is connected to the PLC through RS485 / RS232 standard, the instruction needs to be compiled into a digital signal that meets the standard, and then output to the PLC through the cable;
[0028] ⑤PLC outputs sensor data: the PLC is responsible for communication with the sensor and acts as a Modbus slave, which, after receiving a query instruction, performs the action of querying the specified register, and returns the query result along the original route;
[0029] ⑥Modbus protocol decoding: decode the register data from the message returned from the PLC, verify the correctness of the CRC (cyclic redundancy check), and transmit the data to the next step of processing;
[0030] ⑦Data post-processing: the decoded register data V is extracted from the index value one by one, since P1, P2, …, Pn have been sorted in ascending order according to the register address, so the order can be extracted in turn, and the specific formula is as follows:
[0031]
[0032]
[0033] Where i is a number from 1 to n, Bi is the data block containing the Pi index value, Vi is the index value of the index Pi, and V[a, b] is the data taken from the ath to bth byte in the V data block.
[0034] ⑧Data upload to the host computer: send all the index value pairs (P1, V1), (P2, V2), …, (Pn, Vn) obtained in the previous step to the server or other host computer using any of the protocols TCP / UDP, MQTT, HTTP / HTTPS, COAP, LwM2M.
[0035] ⑨Waiting: whether the time interval between the last query is greater than the collection frequency interval, if the collection frequency interval is set to every 30 seconds, continue to wait when the waiting time is less than 30 seconds, and when the waiting time is greater than or equal to 30 seconds, repeat the query process.
[0036] Preferably, in process ③, the instruction format is SD, Fn, D, M, CRC, and the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded, so the actual instruction is: 0x01, 0x03, Dmin, L, CRC.
[0037] Preferably, in process ⑤, the data format is SD, Fn, M, V, CRC, and the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded.
[0038] Compared with the prior art, the beneficial effects of the present application are as follows:
[0039] 1. The application provides a water system with a large number of indicators, low delay data acquisition device, the water system with a large number of indicators, low delay data acquisition device includes programmable data collector, low delay data acquisition logic program and graphical operation interface, the device is reasonable in design, and the data collected by the device is closer to the values of each sensor at the same time, when designing the experiment: install pressure gauge in the water pipe, PLC collects pressure data and stores it in p, q two registers, and p, q two registers are the same pressure value, the water pipe has water flow, generates changing pressure, uses the device to collect 2 water pressure data in PLC, can read the same value, which shows that the read value is the value at the same time.
[0040] 2, use other existing collector to read 2 water pressure data in PLC, the read value has difference, which shows that it is not the value at the same time, and the experiment can be carried out many times, the faster the water flow, the more obvious the experimental effect, so it is suitable for popularization and use. BRIEF DESCRIPTION OF DRAWINGS
[0041] Fig. 1 The structure block diagram of the application;
[0042] Fig. 2 The program flow chart of the computer software of the application.
[0043] The reference signs and names in the drawing are as follows: 1, programmable data collector; 2, low delay data acquisition logic program; 3, graphical operation interface. DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, not all. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0045] In the description of the embodiments of the present application, it should be understood that the terms "length", "width", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the embodiments of the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation of the present application. In addition, the terms "first", "second" are only for the purpose of description and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "a plurality of" is two or more, unless otherwise explicitly specified and limited.
[0046] In the embodiments of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connection", "fixing" and the like should be understood in a broad sense, for example, it can be fixedly connected, or it can be detachably connected, or it can be integrated; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium; it can be the internal communication of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above-mentioned terms in the embodiments of the present application can be understood according to the specific circumstances.
[0047] Please refer to Figs. 1-2 The present application provides an embodiment: a large number of indicators, low-latency data acquisition device in water system, the device includes programmable data collector 1, low-latency data acquisition logic program 2 and graphical operation interface 3, programmable data collector 1 supports Modbus protocol, can realize Modbus active polling, support MQTT, HTTP send data, and programmable data collector 1 has programmable function, can connect with PLC hardware and realize Modbus communication, and as the physical carrier of low-latency data acquisition logic program 2;
[0048] Low-latency data acquisition logic program 2 runs on programmable data collector 1, which can make the data of a large number of indicators closer to the values of each sensor at the same time;
[0049] The graphical operation interface 3 replaces the programming mode, and filling in the register address, data type and index name on the graphical operation interface 3 can complete the data collection. The graphical operation interface 3 is used to input the parameters of each index to be collected, including: the register address D1, the data type T1 and the index name P1 of the index 1, the register address D2, the data type T2 and the index name P2 of the index 2, …, the register address Dn, the data type Tn and the index name Pn of the index n, as shown in Table 1.
[0050]
[0051] Table 1
[0052] Wherein, the name P is a combination of English letters and numbers, the register address D is a non-negative integer, the data type T includes BYTE, unsigned short integer (16 bit), signed short integer (16 bit), floating point number, unsigned integer (32 bit), signed integer (32 bit) and Boolean type, and the collected information will be transmitted to the low-delay data collection logic program 2 and processed next.
[0053] The low-delay data collection logic program 2 receives the transmitted index parameters, calculates and generates an index feature table, formulates a query instruction according to the Modbus protocol, and transmits it to the hardware layer for execution.
[0054] After the hardware layer, i.e., the low-delay data collection logic program 2, receives the query instruction formulated according to the Modbus protocol, it converts the query instruction into a digital signal through port conversion according to the port connected with the programmable data collector 1, and transmits it to the PLC through a cable. The PLC is responsible for connecting with the sensor, receiving the sensor signal and converting it into a digital signal, returning along the original route, and finally returning to the low-delay data collection logic program 2.
[0055] Specifically, the following operation steps are included:
[0056] ① Connect the programmable data collector 1 with the PLC and set the communication baud rate. In this embodiment, the model of the programmable data collector 1 is ZQWL-GD2110YM.
[0057] ② Add the data index to be collected on the graphical operation interface 3, fill in the register address, data type and index name. For example, if there are 30 indexes, fill in Table 2:
[0058]
[0059] Table 2
[0060] ③ Set the active collection frequency and time interval. For example, collect once every 30 seconds, and the interval between each group of instructions is 5 milliseconds.
[0061] ④Set the host computer address after data collection and reporting;
[0062] ⑤Run the low-latency data collection logic program 2 to perform data collection, and the low-latency data collection logic program 2 runs silently, without human intervention throughout the process. The collection results are reported to the host computer according to the address set in step ④.
[0063] Specifically, in step ①, the cable port of the programmable data collector 1 connected to the PLC uses RS485 or RS232, and the communication baud rate value is any one of 9600, 19200, 38400 or 115200.
[0064] Specifically, in step ③, the instruction interval is related to the baud rate. For example, if the baud rate is 9600, the instruction interval time should not be less than 4.0104167 milliseconds.
[0065] Specifically, in step ④, the host computer address is a server connected to the Internet, and the connection protocol can be TCP / UDP, MQTT, HTTP / HTTPS, COAP, LwM2M.
[0066] Specifically, in step ⑤, the collected data and the status of the entire system can be observed on the host computer.
[0067] Specifically, refer to Fig. 2 , the graphical operation interface 3 performs index data preprocessing after collecting each index parameter. After preprocessing the index parameters, the task that requires multiple instructions to query under the existing query method can be combined into a single instruction query. The detailed process is as follows:
[0068] ①According to the definition of each index collected by the graphical operation interface 3, including index name P, register address D, and data type T, such as n indexes P1, D1, T1, P2, D2, T2, …, Pn, Dn, Tn, calculate the lowest address Dmin and the highest address Dmax of the address block, and the total length L of the address block. The specific calculation formula is as follows:
[0069]
[0070] Where Dmin refers to the register address when a certain index is at the minimum register address, Dmax refers to the register address when a certain index is at the maximum register address, T' refers to the data type when a certain index is at the maximum register address, and sizeof is the number of bytes of a certain data type. The number of bytes of each data type is shown in Table 3:
[0071]
[0072] Table 3
[0073] ②Save all index parameters for next step, as shown in Table 4:
[0074]
[0075] Table 4
[0076] Save each index according to register address D from small to large;
[0077] ③Make modbus instruction: make merge query instruction, i.e. single query multiple index instruction, which needs the result calculated in the previous step, as shown in Table 5:
[0078]
[0079] Table 5
[0080] ④Output query instruction to PLC: since DTU and PLC are connected through RS485 / RS232 standard, the instruction needs to be compiled into digital signal conforming to the standard, and then output to PLC through cable;
[0081] ⑤PLC outputs sensor data: PLC is responsible for communication with sensor, acting as Modbus slave, after receiving query instruction, it executes the action of querying specified register, and returns the query result along the original route, as shown in Table 6;
[0082]
[0083] Table 6
[0084] ⑥Modbus protocol decoding: decode register data from PLC returned message, check if CRC is correct, and transmit data to next step;
[0085] ⑦Data post-processing: extract index value from decoded register data V one by one, since P1, P2, …, Pn have been sorted by register address from small to large, it can be extracted in order, and the specific formula is as follows:
[0086]
[0087]
[0088] Where i is a number from 1 to n, Bi is the data block containing Pi index value, Vi is the index value of index Pi, and V[a, b] is the data from a to b bytes in V data block;
[0089] 8. Data uplink to host computer: all index value pairs (P1, V1), (P2, V2), …, (Pn, Vn) obtained in the previous step are sent to the server or other host computer, using any of the protocols TCP / UDP, MQTT, HTTP / HTTPS, COAP, LwM2M;
[0090] 9. Wait: whether the time since the last query is greater than the collection frequency interval time, if the collection frequency interval time is set to every 30 seconds, when the waiting time is less than 30 seconds, continue to wait, when the waiting time is greater than or equal to 30 seconds, repeat the query process.
[0091] Specifically, in process ③, the instruction format is SD, Fn, D, M, CRC, the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded, so the instruction is actually: 0x01, 0x03, Dmin, L, CRC.
[0092] Specifically, in process ⑤, the data format is SD, Fn, M, V, CRC, and the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded.
[0093] It will be obvious to a person skilled in the art that the application is not limited to the details of the foregoing exemplary embodiments, and that the application can be implemented in other concrete forms without departing from the spirit or essential characteristics of the application. Therefore, the embodiments should be considered as exemplary and non-limiting, and the scope of the application is defined by the appended claims rather than the above description, and all changes falling within the meaning and range of the equivalent elements of the claims are intended to be included in the application. Any reference signs in the claims should not be considered as limiting the claims involved.
Claims
1. A device for ultra-massive index, low-latency data acquisition in a water system, characterized by: It comprises a programmable data collector (1), a low-latency data collection logic program (2) and a graphical operation interface (3), wherein the programmable data collector (1) supports Modbus protocol, can realize Modbus active polling, supports MQTT and HTTP data transmission, and has programmable functions, can be connected with the hardware of a PLC and realize Modbus communication, and serves as the physical carrier of the low-latency data collection logic program (2); The low-latency data collection logic program (2) runs on the programmable data collector (1), and can make the data closer to the values of various sensors at the same time when collecting a large number of indexes; The graphical operation interface (3) replaces the programming mode, and the data collection can be completed by filling in the register address, data type and index name on the graphical operation interface (3); the graphical operation interface (3) is used for inputting the parameters of various indexes to be collected, including the register address D1, data type T1 and index name P1 of index 1, the register address D2, data type T2 and index name Pn of index 2, and the register address Dn, data type Tn and index name Pn of index n; Wherein the name P is a combination of English letters and numbers, the register address D is a non-negative integer, the data type T includes BYTE, unsigned short integer (16 bit), signed short integer (16 bit), floating point number, unsigned integer (32 bit), signed integer (32 bit) and Boolean type, and the collected information will be transmitted to the low-latency data collection logic program (2) for further processing; The low-latency data collection logic program (2) receives the transmitted index parameters, calculates and generates an index feature table, formulates a query instruction according to the Modbus protocol, and transmits it to the hardware layer for execution; After receiving the query instruction formulated according to the Modbus protocol, the hardware layer, i.e. the low-latency data collection logic program (2), converts it into a digital signal through port conversion according to the port connected with the programmable data collector (1), and transmits it to the PLC through a cable; the PLC is responsible for connecting with sensors, receiving sensor signals and converting them into digital signals, returning along the original route, and finally returning to the low-latency data collection logic program (2).
2. The device according to claim 1, wherein, It comprises the following operation steps: ① Connect the programmable data collector (1) with the PLC, and set the communication baud rate; ② Add the data indexes to be collected on the graphical operation interface (3), and fill in the register address, data type and index name; ③ Set the active collection frequency and time interval, such as collecting once every 30 seconds, and the interval between each group of instructions is 5 milliseconds; ④ Set the address of the upper computer to which the data collection result will be reported; ⑤ Run the low-latency data collection logic program (2) to execute data collection, and the low-latency data collection logic program (2) runs silently without human intervention throughout the process, and the collection result is reported to the upper computer according to the address set in step ④.
3. The water system super large number of indicators, low latency data acquisition device according to claim 2, characterized in that: In step 1, the cable port of the programmable data collector (1) connected with the PLC adopts RS485 or RS232, and the value of the communication baud rate is any one of 9600, 19200, 38400 or 115200.
4. The water system super large number of indicators, low latency data acquisition device according to claim 2, characterized in that: In step 3, the instruction interval is related to the baud rate, for example, if the baud rate is 9600, the instruction interval time should not be less than 4.0104167 milliseconds.
5. The water system super large number of indicators, low latency data acquisition device according to claim 2, characterized in that: In step 4, the upper computer address is a server connected with the Internet, and the connection protocol can be selected from TCP / UDP, MQTT, HTTP / HTTPS, COAP and LwM2M.
6. The water system super large number of indicators, low latency data acquisition device according to claim 2, characterized in that: In step 5, the collected data and the running state of the whole system can be observed on the upper computer.
7. The water system super large number of indicators, low latency data acquisition device according to claim 1, characterized in that: After collecting various index parameters, the graphical operation interface (3) performs index data preprocessing, and after the index parameter preprocessing, the task that needs multiple instruction queries under the existing query method can be combined into a single instruction query, and the detailed process is as follows: ①According to the definition of each index collected by the graphical operation interface (3), including index name P, register address D, data type T, such as n indexes P1, D1, T1, P2, D2, T2, …, Pn, Dn, Tn, the lowest address Dmin and the highest address Dmax of the address block are calculated, and the specific calculation formula of the total length L of the address block is as follows: Wherein, Dmin refers to the register address when the register address of a certain index is the smallest, Dmax refers to the register address when the register address of a certain index is the largest, T' refers to the data type when the register address of a certain index is the largest, and sizeof is the number of bytes of a certain data type; ②Save all index parameters for use in the next step, save each index according to the register address D from small to large; ③Compile modbus instruction: compile the combined query instruction, that is, the instruction for querying multiple indexes at a time, which needs to use the results calculated in the previous step; ④Output the query instruction to the PLC: since the DTU is connected with the PLC through RS485 / RS232 standard, the instruction needs to be compiled into a digital signal conforming to the standard, and then output to the PLC through the cable; ⑤PLC outputs sensor data: the PLC is responsible for communication with the sensor and acts as a Modbus slave, which executes the action of querying the specified register after receiving the query instruction, and returns the query result along the original route; ⑥Modbus protocol decoding: decode the register data from the PLC return message, verify the correctness of the CRC, and transmit the data to the next step; ⑦Data post-processing: extract the index value from the decoded register data V one by one, since P1, P2, …, Pn have been sorted in order according to the register address from small to large, so the extracted specific formula is as follows: Wherein, i is a number from 1 to n, Bi is the data block containing the index value of Pi, Vi is the index value of the index Pi, and V[a, b] is the data from the a th to b th byte in the V data block.
8. Data uplink to host computer: send all index value pairs (P1, V1), (P2, V2), …, (Pn, Vn) obtained in the previous step to the server or other host computer using any of the protocols TCP / UDP, MQTT, HTTP / HTTPS, COAP, LwM2M; 9. Wait: whether the time since the last query is greater than the collection frequency interval time, if the collection frequency interval time is set to every 30 seconds, continue to wait when the waiting time is less than 30 seconds, when the waiting time is greater than or equal to 30 seconds, repeat the query process.
8. The water system super large number of indicators, low latency data acquisition device according to claim 7, characterized in that: In process 3, the instruction format is SD, Fn, D, M, CRC, and the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded, so the instruction is actually: 0x01, 0x03, Dmin, L, CRC.
9. The water system super large number of indicators, low latency data acquisition device according to claim 7, characterized in that: In process 5, the data format is SD, Fn, M, V, CRC, and the CRC calculation method uses 16-bit arithmetic sum, and the overflow part is discarded.