Data acquisition method and device of gateway equipment, gateway equipment and storage medium

By dynamically adjusting the acquisition frequency of electrical equipment and constructing a frequency mapping queue, the problem of prolonged data acquisition cycle in existing technologies is solved, achieving efficient data acquisition and adapting to the needs of multi-device and high-frequency scenarios.

CN121908163APending Publication Date: 2026-04-21LIANGYUN SMART ENERGY (GUANGDONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LIANGYUN SMART ENERGY (GUANGDONG) CO LTD
Filing Date
2026-01-08
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, the active polling mechanism based on the Modbus protocol leads to a longer data acquisition cycle in scenarios with multiple devices, high frequency, and traffic limitations, which cannot meet the requirements of data timeliness and system performance.

Method used

By acquiring application scenario information and energy consumption attributes of electrical equipment, the data acquisition frequency is dynamically adjusted, and a data acquisition queue is constructed based on the frequency mapping relationship to achieve targeted and flexible data acquisition.

Benefits of technology

It improves data collection efficiency, reduces waiting time, and ensures that more valuable data is obtained in a shorter time, adapting to the needs of multi-device, high-frequency, and traffic-limited scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121908163A_ABST
    Figure CN121908163A_ABST
Patent Text Reader

Abstract

The invention provides a data collection method and device of gateway equipment, the gateway equipment and a storage medium, and belongs to the field of data collection, and the method comprises the steps: obtaining the collection frequency of each electric equipment in a current time period; the acquisition frequency of each electric device in the current time period is determined according to the application scene information of each electric device and the energy consumption attribute corresponding to the current time period; each acquisition frequency corresponds to at least one electric device; for the acquisition frequency of each electric device, calling a data acquisition queue corresponding to the acquisition frequency at an acquisition time point corresponding to the acquisition frequency; the data acquisition queue corresponding to the acquisition frequency comprises identification information of all electric equipment corresponding to the acquisition frequency; the acquisition frequency and the data acquisition queue have a mapping relationship; and performing data acquisition of each electric device based on the identification information in the data acquisition queue corresponding to each acquisition frequency. According to the invention, the pertinence and flexibility of data acquisition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data acquisition technology, and more specifically, relates to a data acquisition method and apparatus for a gateway device, a gateway device, and a storage medium. Background Technology

[0002] In fields such as smart energy management and the Industrial Internet of Things, data acquisition from electrical equipment is the core foundation for achieving equipment monitoring, energy consumption analysis, and fault early warning.

[0003] However, in existing technologies, the industry typically uses the Modbus protocol and a polling mechanism to periodically collect device data. This means sending query commands to all devices one by one at preset fixed intervals. However, since it is impossible to read data from a large number of devices at once, the overall data collection cycle is significantly lengthened in scenarios with multiple devices, high frequency, and traffic limitations. The time required to complete a full data collection cycle may exceed business requirements, further restricting the timeliness of data and the overall performance of the system, resulting in the inability to collect data effectively. Summary of the Invention

[0004] Based on the above problems, this application provides a data acquisition method and apparatus for a gateway device, a gateway device, and a storage medium, aiming to at least solve or alleviate one of the technical problems existing in the prior art.

[0005] A first aspect of this application provides a data acquisition method for a gateway device, applied to a data acquisition system. The data acquisition system includes a gateway device and multiple electrical devices. The gateway device is communicatively connected to each electrical device. The method is executed by the gateway device and includes: Obtain the sampling frequency of each electrical device within the current time period; the sampling frequency of each electrical device within the current time period is determined by the application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period; each sampling frequency corresponds to at least one electrical device; For each electrical device, at the corresponding sampling time point, the data acquisition queue corresponding to that sampling frequency is invoked; the data acquisition queue corresponding to that sampling frequency contains the identification information of all electrical devices corresponding to that sampling frequency; there is a mapping relationship between the sampling frequency and the data acquisition queue; Data is collected from each electrical device based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

[0006] A second aspect of this application provides a data acquisition device for a gateway device, applied to a gateway device in a data acquisition system. The system further includes multiple electrical devices, and the gateway device is communicatively connected to each electrical device. The data acquisition device includes: The sampling frequency acquisition module is used to acquire the sampling frequency of each electrical device within the current time period. The sampling frequency of each electrical device within the current time period is determined by the application scenario information of each electrical device and the energy consumption attribute corresponding to the current time period. Each sampling frequency corresponds to at least one electrical device. The queue invocation module is used to invoke the data acquisition queue corresponding to each acquisition frequency at the corresponding acquisition time point for each electrical device. The data acquisition queue corresponding to the acquisition frequency contains the identification information of all electrical devices corresponding to that acquisition frequency. There is a mapping relationship between the acquisition frequency and the data acquisition queue. The data acquisition module is used to acquire data from each electrical device based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

[0007] A third aspect of this application provides a gateway device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the data acquisition method of the gateway device described above.

[0008] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data acquisition method for the gateway device described above.

[0009] A fifth aspect of this application provides a computer program product, including a computer program or computer-executable instructions, wherein when the computer program or computer-executable instructions are executed by a processor, the steps of the data acquisition method of the gateway device described above are implemented.

[0010] The beneficial effects of the embodiments of this application are as follows: In this embodiment, the data collection frequency for each electrical device within the current time period is obtained by considering the application scenario information of each device and the energy consumption attributes corresponding to the current time period. Since the application scenario information and energy consumption attributes of each device provide a deeper understanding of the operating characteristics and data requirements of different devices in different scenarios and times, determining the collection frequency for each device within the current time period based on this information allows data collection to move beyond a fixed, unchanging pattern and dynamically adjust according to actual conditions, improving the targeting and flexibility of data collection. This embodiment collects data according to the determined collection frequency for each device within the current time period, avoiding the indiscriminate sequential access to all devices in traditional active polling mechanisms. In multi-device scenarios, data from key devices or devices requiring high-frequency collection can be prioritized, reducing data collection waiting time, improving overall data collection efficiency, and ensuring that more valuable data is obtained in a shorter time. In this embodiment, each collection frequency corresponds to a data collection queue, and the queue contains the device identification information corresponding to the collection frequency. Gateway devices collect data based on queues, enabling more targeted batch collection from devices with different frequency requirements. This avoids invalid and duplicate queries, improves data collection efficiency, and allows for a full data collection cycle to be completed in a shorter time, better adapting to scenarios with multiple devices, high frequency, and traffic constraints. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 A schematic diagram of a data acquisition system provided in an embodiment of this application; Figure 2 A schematic flowchart illustrating a data acquisition method for a gateway device provided in an embodiment of this application; Figure 3 A schematic diagram illustrating a data acquisition process based on the Modbus protocol, provided as an embodiment of this application; Figure 4 A schematic diagram of a second data acquisition process based on the Modbus protocol provided in an embodiment of this application; Figure 5 This is a structural block diagram of a data acquisition device for a gateway device provided in an embodiment of this application; Figure 6 This is a schematic block diagram of a gateway device provided in an embodiment of this application. Detailed Implementation

[0013] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments in the specific implementation of this application should fall within the protection scope of the embodiments of this application.

[0014] To keep the drawings concise, each drawing only schematically shows the parts relevant to the disclosure, and these do not represent the actual structure of the product. Furthermore, for ease of understanding, in some drawings, only one of components with the same structure or function is schematically shown, or only one is labeled. In this document, "a" not only means "only one," but can also mean "more than one," and "several" includes "two" and "more than two." Additionally, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0015] It should be understood that, unless the context clearly indicates otherwise, the terms “comprising,” “including,” or “having” as used herein refer to the presence of an element, but do not exclude the presence or addition of one or more other elements. Furthermore, as used herein, “comprising” and / or “including” indicate the presence of shapes, numbers, steps, operations, members, elements, and / or combinations thereof, and do not exclude the presence or addition of one or more other shapes, numbers, operations, elements, and / or combinations thereof.

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.

[0017] This application provides a data acquisition method for a gateway device, applicable to a data acquisition system, such as... Figure 1 As shown, the data acquisition system may include a target device, a gateway device, and multiple electrical devices. The target device is communicatively connected to the gateway device; the gateway device is communicatively connected to each electrical device; and a smart energy platform system may be deployed in the target device to process the acquired data.

[0018] Based on the above embodiments, this application provides a data acquisition method for a gateway device. Please refer to [the relevant documentation]. Figure 2 This method can be applied to a data acquisition system. The method is executed by a gateway device and may include: S101-S102.

[0019] S101: Obtain the sampling frequency of each electrical device within the current time period.

[0020] In this embodiment, the sampling frequency of each electrical device within the current time period is determined by the application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period. Each sampling frequency corresponds to at least one electrical device.

[0021] In this embodiment, "electrical equipment" refers to all power-consuming devices that require data collection, encompassing various carriers from small appliances to industrial equipment. Examples include cash registers, freezers, or lighting systems in retail settings; refrigerators, induction cookers, or air conditioners in restaurants; washing machines or water heaters in rental properties; and small production line motors or air compressors in small-scale industries. Application scenario information refers to the industry / scenario type of the electrical equipment, reflecting the electricity consumption patterns and data demand characteristics within that scenario. Energy consumption attributes can refer to the energy intensity of each electrical device during the current time period. For example, if the scenario type is retail, its electricity consumption pattern could be peak hours from 10:00 to 22:00 and off-peak hours from 22:00 to 10:00 the next day. Energy intensity can be as shown in Table 1. Table 1 Energy consumption intensity of various electrical devices during the same period (taking peak hours in a retail setting as an example)

[0022] In one embodiment of this application, the data acquisition system further includes a target device, which is communicatively connected to a gateway device. The application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period are determined by the target device in the following manner: The application scenario information of each electrical device is determined based on the location information of each electrical device; The energy consumption attributes of each electrical device in the current time period are determined based on the historical electricity consumption data of each electrical device in the target time period; the target time period is a historical time period that periodically corresponds to the current time period.

[0023] In this embodiment, the data collection frequency of each electrical device during the current time period can be calculated by the smart energy platform system and distributed to the gateway device, which can also be deployed in a distributed manner. The location information of the electrical device refers to its geographical location. For each electrical device, its corresponding application scenario can be determined based on its geographical location. For example, if the location information of an electrical device is labeled "XX Shopping Mall," then the application scenario corresponding to that device can be a retail scenario. If the location information of an electrical device is "XX Food Street A12," then the application scenario corresponding to that device can be a restaurant scenario. In this embodiment, by pre-constructing a mapping feature library between location information and scenario types, once the location information of an electrical device is obtained, the application scenario information of that device can be directly determined by matching it to the mapping library. Alternatively, after obtaining the location information of an electrical device, the location information can be matched to a scenario using an application scenario matching model to obtain the application scenario information of that device.

[0024] In this embodiment, the power consumption behavior of devices in different scenarios exhibits inherent patterns. For example, in retail scenarios, peak power consumption is concentrated between 10:00 and 22:00, with moderate power fluctuations; in restaurant scenarios, peak power consumption is concentrated during mealtimes, with significant power fluctuations; and in rental housing scenarios, peak power consumption is concentrated between 18:00 and 23:00, with stable power. Therefore, in this embodiment, in addition to the aforementioned location information of the device, the application scenario information for each device can also be confirmed by analyzing its historical operating data.

[0025] Specifically, the target device can collect historical electricity consumption data from various electrical devices, and compare the electricity consumption behavior patterns with typical patterns of preset scenarios using a clustering algorithm to match the closest scenario. More specifically, in this embodiment, the K-Means clustering algorithm can be used, with K set to 4 (retail, restaurant, rental housing, and small industrial) as in the aforementioned embodiment. During the clustering process of historical electricity consumption data from various electrical devices, the clustering algorithm automatically clusters four centroids and repeatedly adjusts the centroid positions, ultimately forming multiple clusters. This ensures that the data features within each cluster are most similar, while the data features between clusters have the greatest difference. Each data point in a cluster corresponds to the historical electricity consumption data of one electrical device. In this embodiment, multiple typical feature templates can be preset, each corresponding to an application scenario. The average features of each cluster or the features of the cluster centroids in the clustering results are matched with the preset typical feature templates, and the application scenario corresponding to the typical feature template with the highest matching degree is taken as the application scenario corresponding to each data point in that cluster.

[0026] In this embodiment, the energy consumption behavior of electrical equipment is periodic, such as consistent energy intensity at the same time each day, week, or month. Therefore, energy consumption data from the same time period in the past can be used as a reference for the energy consumption attributes of the current time period. For example, if the current time period is 9:00-10:00 on October 15, 2023, the target time period could be 9:00-10:00 on October 8, 2023, 9:00-10:00 on October 1, 2023, etc. Historical electricity consumption data refers to the specific power consumption data of the electrical equipment within the target time period, such as average power, maximum load, or fluctuation range, used to quantify the energy intensity of the same historical period.

[0027] In this embodiment, the energy consumption attribute of the current time period can be determined by analyzing historical electricity consumption data for the target time period. For example, if the average power consumption of the electrical device during the target time period exceeds a preset power threshold, the energy consumption attribute of the electrical device during the current time period can be determined as high energy intensity. The preset power threshold can be based on empirical presets. The energy consumption attribute can be characterized as high energy intensity, medium energy intensity, and low energy intensity, or it can be characterized in numerical form.

[0028] In this embodiment, the energy consumption attribute can also be whether the electrical device is in working condition during the current time period. For example, if the electrical device is in working condition throughout the target time period, then the energy consumption attribute of the electrical device is determined to be in working condition.

[0029] In this embodiment, the sampling frequency of each electrical device within the current time period can be determined based on application scenario information and energy consumption attributes of the current time period. Specifically, different application scenario information can correspond to different basic frequency ranges. For example, the basic frequency range for the service industry can be 15 seconds / time - 90 seconds / time, and the basic frequency range for the retail scenario can be 30 seconds / time - 15 minutes / time. Energy consumption attributes can be used to determine which specific value to select within the determined basic frequency range. One implementation method is to set a frequency adjustment coefficient for the energy consumption attribute. For example, dividing by power range, 0-500W is low energy consumption intensity, 501-2000W is medium energy consumption intensity, and above 2001W is high energy consumption intensity. The adjustment coefficient corresponding to high energy consumption intensity can be 1, taking the upper limit of the basic frequency range; the adjustment coefficient corresponding to low energy consumption intensity can be 0.1, taking the lower limit of the basic frequency range; and the adjustment coefficient corresponding to medium energy consumption intensity can be a value between 0.2 and 0.8, representing the selection of the middle value of the basic range.

[0030] In this embodiment, the sampling frequency of each electrical device can also be determined based on a preset mapping table, as shown in Table 2.

[0031] Table 2 Application Scenario Information, Energy Consumption Attribute - Acquisition Frequency Mapping Table

[0032] S102: For each electrical device, at the sampling time point corresponding to the sampling frequency, call the data acquisition queue corresponding to that sampling frequency.

[0033] In this embodiment, the data acquisition queue corresponding to the acquisition frequency contains the identification information of all electrical devices corresponding to the acquisition frequency; there is a mapping relationship between the acquisition frequency and the data acquisition queue.

[0034] In this embodiment, after determining the acquisition frequency of each electrical device, data can be acquired from each electrical device according to its acquisition frequency.

[0035] Please refer to Figure 3 In existing data acquisition processes, most data collection is based on the Modbus protocol. Taking a fixed 15-minute interval as an example, whenever the collection time is reached, the smart energy platform system will collect data from the devices in the queue through the gateway device and adopt an active polling mechanism. Specifically, it will extract the device commands to be collected from the queue in sequence. The command may contain the device identifier to determine whether the queue has been traversed: if not all devices have been traversed, the command will continue to be retrieved and executed; if the traversal is complete, it will wait for the next data source collection cycle to traverse again, forming a loop.

[0036] Figure 3 Device A (point table) defines the point structure of device A, which contains multiple data acquisition points and is the specific object read by the ModBus protocol. Similarly, Device B (point table) defines the point structure of device B, which also contains multiple data acquisition points and is the specific object read by the ModBus protocol. However, since a single data acquisition typically corresponds to only 60 data points, this leads to relatively low data update efficiency.

[0037] In one embodiment of this application, the acquisition frequency refers to the specific acquisition frequency of each electrical device determined by the preceding steps within the current time period. For example, device C is acquired every 30 seconds, device D every 30 seconds, and device E every 15 minutes. The data acquisition queue refers to a task list categorized by acquisition frequency, containing unique identifiers of all electrical devices requiring acquisition at that frequency, such as device IDs or numbers. For example, the queue corresponding to the 30-second frequency might contain the IDs of industrial motors A01 and A02; the queue for the 15-minute frequency might contain the IDs of rental water heaters B01 and B02. The identification information of the electrical devices is a code used to uniquely identify the devices, ensuring that the data acquisition system can accurately locate specific devices.

[0038] In this embodiment, the sampling frequency is bound one-to-one with the corresponding data acquisition queue; that is, one frequency corresponds to one queue. When a preset time point of a certain sampling frequency is reached, the data acquisition queue corresponding to that sampling frequency can be invoked.

[0039] In this embodiment, it should be noted that the queue can be pre-built or generated in real time. If the queue is pre-built, the queues corresponding to each acquisition frequency should be maintained and updated in a timely manner. If it is generated in real time, all electrical devices using that acquisition frequency can be placed into a queue in a certain order to obtain the data acquisition queue corresponding to that acquisition frequency. After the queue is invoked (or generated and invoked), the system sends acquisition instructions to each device in the order of device identifiers in the queue to obtain data (such as voltage, current, energy consumption, etc.) until all devices in the queue have completed acquisition.

[0040] S103: Data acquisition of each electrical device is performed based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

[0041] For example, the sampling frequency corresponding to the induction cooker is triggered once every 30 seconds. Every 30 seconds, the real-time power, temperature and other data of the induction cooker can be accessed through the ModBus protocol.

[0042] As can be seen from the above, the data collection frequency of each electrical device in the current time period in this embodiment is obtained through the application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period. Since the application scenario information and energy consumption attributes of each electrical device can provide a deeper understanding of the operating characteristics and data requirements of different devices in different scenarios and times, determining the data collection frequency of each electrical device in the current time period based on this information makes data collection no longer a fixed, unchanging pattern, but rather dynamically adjustable according to the actual situation, improving the targeting and flexibility of data collection. This embodiment collects data according to the determined collection frequency of each electrical device in the current time period, avoiding the indiscriminate sequential access to all devices in the traditional active polling mechanism. In multi-device scenarios, data from key devices or devices requiring high-frequency collection can be collected first, reducing data collection waiting time, improving overall data collection efficiency, and ensuring that more valuable data is obtained in a shorter time. In this embodiment, each collection frequency corresponds to a data collection queue, and the queue contains the identification information of the electrical device corresponding to the collection frequency. Gateway devices collect data based on queues, enabling more targeted batch collection from devices with different frequency requirements. This avoids invalid and duplicate queries, improves data collection efficiency, and allows for a full data collection cycle to be completed in a shorter time, better adapting to scenarios with multiple devices, high frequency, and traffic constraints.

[0043] Secondly, this embodiment determines the specific data collection frequency based on the actual situation of each electrical device within the current time period. The system can collect data from the corresponding devices at different frequencies, avoiding the problem of excessively long waiting times for some devices due to unified polling, greatly improving the efficiency of data updates and ensuring timely acquisition of the latest data from the devices. This embodiment makes data collection more targeted by determining different collection frequencies for different electrical devices. For devices with frequent changes in operating status and high real-time requirements, a higher collection frequency is set to promptly grasp changes in their operating parameters and identify potential faults. Conversely, for devices with relatively stable operation and lower real-time requirements, a lower collection frequency can be set to reduce unnecessary data collection, lower system resource consumption, better meet the actual needs of different devices, and improve the quality and value of data collection.

[0044] In one embodiment of this application, the data acquisition system further includes: a target device, which is connected to a gateway device for communication. Each power device includes multiple data points, and the acquisition frequency of each power device in the current time period includes: the acquisition frequency of each data point in each power device. The data collection frequency for each data point in each electrical device is determined by the target device based on application scenario information and energy consumption attributes for the current time period using the following method: The sampling frequency range of each electrical device within the current time period is determined based on application scenario information and energy consumption attributes of the current time period. The sampling frequency of each data point in each electrical device is determined by using the sampling frequency range corresponding to each electrical device and the data attributes of each data point in each electrical device.

[0045] In this embodiment, each data point of an electrical device refers to a specific monitoring point where data can be collected from each device. It is the smallest unit of data collection, and each point corresponds to a specific parameter of the device. For example, a data point can be current, voltage, or power. The collection frequency range refers to the upper and lower limits of the collection frequency set for a single electrical device. It can be determined by the application scenario to which the device belongs and the energy consumption attributes of the current time period. Similar to Table 1 above, Table 1 shows specific frequency values. In this embodiment, the specific frequency values ​​in the correspondence between application scenario information, energy consumption attributes of the current time period, and frequency can be replaced with frequency ranges, as shown in Table 3.

[0046] Table 3 Application Scenario Information, Energy Consumption Attribute - Acquisition Frequency Range Mapping Table

[0047] In this embodiment, after determining the above-mentioned sampling frequency range, the specific sampling frequency of an electrical device can be determined based on the data attributes of each data point. The data attributes of the data points can characterize the data collection needs or necessity of the corresponding electrical device.

[0048] Specifically, the data attributes of a data point may include at least one of the following: data timeliness requirements, data update frequency, and data anomaly frequency. In this embodiment, for each data point, the collection frequency of the data point is positively correlated with the data timeliness requirements of the data point, the collection frequency of the data point is positively correlated with the data update frequency of the data point, and the collection frequency of the data point is positively correlated with the data anomaly frequency of the data point.

[0049] In this embodiment, taking a data point with the above three data attributes as an example, after determining the sampling frequency of the electrical equipment corresponding to the data point, the sampling frequency of the data point can be determined based on the following method: ,in This indicates the frequency of data point collection. This indicates the maximum data collection frequency of the electrical equipment associated with this data point. This indicates the minimum data collection frequency of the electrical equipment associated with this data point. This represents the data timeliness requirement coefficient. Indicates the data update frequency coefficient. Indicates the frequency coefficient of data anomalies. , , This represents the weighting coefficient. , and All values ​​are quantized values, and their range is between 0 and 1. For example, The larger the value, the higher the demand for timeliness. , and The quantization process is essentially a normalization process. The specific method will not be elaborated in this embodiment. The corresponding weight coefficients can be fixed values ​​or set or adjusted based on the application scenario information of the electrical equipment corresponding to the data point. For example, the default weight coefficients are equal and sum to 1. If the application scenario information of the electrical equipment corresponding to the data point is an industrial scenario, data anomalies may cause equipment shutdown, which has a significant impact. Therefore, the weight coefficients can be increased according to a preset step size. Correspondingly reduced and The sum of the weights must be 1.

[0050] In one embodiment of this application, the data acquisition frequency of each data point in each electrical device includes multiple data point acquisition frequencies. For each electrical device's acquisition frequency, at the acquisition time point corresponding to that acquisition frequency, the data acquisition queue corresponding to that acquisition frequency is invoked, including: For each data point sampling frequency, at the sampling time point corresponding to that sampling frequency, the data acquisition queue corresponding to that sampling frequency is called. The sampling frequency of a data point is the sampling frequency of each data point within the current time period. The data acquisition queue corresponding to that sampling frequency contains the identification information of all electrical devices corresponding to that sampling frequency. There is a mapping relationship between the sampling frequency of a data point and the data acquisition queue. Data is collected from each electrical device based on the identification information in the data acquisition queue corresponding to the acquisition frequency of each point.

[0051] In this embodiment, the point acquisition frequency refers to the specific acquisition frequency of a single data point in the electrical equipment within the current time period, which is distinct from the device-level frequency of the acquisition frequency. The point acquisition frequency corresponds one-to-one with the corresponding data acquisition queue, as shown in the reference. Figure 4 This describes a multi-frequency queue data acquisition process based on the ModBus protocol, namely an improved multi-queue parallel and differentiated frequency acquisition mechanism. The core is to achieve differentiated data acquisition at the device / location level through multiple queues with different periods. Specifically, multiple queues with different periods are set up, each queue corresponding to a unique acquisition frequency, achieving a one-to-one binding between frequency and queue. 30-second circular queue: This includes devices that require data collection every 30 seconds (such as device A ②), which fall under high-frequency data collection scenarios, such as key industrial locations or devices used during peak hours in restaurants.

[0052] 15-minute cyclic queue: This includes devices that require data collection every 15 minutes (such as device A① and device B②), which are low-frequency data collection scenarios, such as off-peak devices in rental properties and non-critical retail locations.

[0053] After the data acquisition process starts, multiple time intervals are monitored simultaneously. If the trigger time of a certain queue is reached, the device acquisition commands are extracted from the corresponding queue in sequence. After the acquisition of all devices in the queue is completed, the process waits for another iteration to achieve cyclical execution.

[0054] In this embodiment, Device A (point table) and Device B (point table): Each device contains multiple data points (1, 2, 3...n), but different points / devices can belong to different queues, realizing differentiated frequency control at the device / point level. Different points within the same device, or different devices, can enter different frequency queues according to their own needs.

[0055] In this embodiment, when the collection time for a certain data point is reached, data can be collected only from that data point or data from all data points of the electrical equipment corresponding to that data point can be collected.

[0056] In one embodiment of this application, the application scenario information includes data timeliness requirements and device resource limitations; in this embodiment, determining the collection frequency range of each electrical device within the current time period based on the application scenario information and the energy consumption attributes of the current time period includes: The minimum data collection frequency for each electrical device is determined based on the data timeliness requirements and the energy consumption attributes of the current time period. Determine the maximum sampling frequency for each electrical device based on equipment resource constraints; The range of sampling frequencies for each electrical device within the current time period is determined by using the highest and lowest sampling frequencies of each electrical device.

[0057] In this embodiment, data timeliness requirement refers to the scenario's requirement for timely data collection, which can be quantified as an acceptable upper limit for data latency. Device resource limitation refers to the resource bottleneck of the electrical equipment or its associated data collection system, such as hardware resources, network resources, or processing resources. Both data timeliness requirement and device resource limitation can be preset information. Data timeliness requirement can be stored with an acceptable latency, and device resource limitation can be stored as gateway computing power limitation.

[0058] In this embodiment, the higher the data timeliness requirement and the higher the intensity of the current energy consumption attribute, the higher the minimum collection frequency needs to be to avoid missing key data. For example, the data timeliness requirement can be quantified first, and the acceptable delay can be converted into a frequency threshold. For example, if the delay is ≤1 second, the corresponding minimum frequency is ≥1 time / second; if the delay is ≤5 minutes, the corresponding minimum frequency is ≥1 time / 5 minutes. Secondly, adjustments can be made based on the current energy consumption attribute. When the energy consumption intensity is high, such as when the power of the electrical equipment is ≥80% of the rated value, the minimum frequency is increased based on the timeliness threshold; when the energy consumption intensity is low, such as when the power is ≤20% of the rated value, the threshold can be maintained or appropriately reduced.

[0059] In this embodiment, the gateway computing power limit can be related to the corresponding highest acquisition frequency, which can be set by those skilled in the art.

[0060] For an electrical device, after determining its minimum and maximum sampling frequencies, the minimum sampling frequency can be set as the lower limit and the maximum sampling frequency as the upper limit to obtain the sampling frequency range corresponding to the electrical device.

[0061] As can be seen from the above, this embodiment of the application uses each data point of electrical equipment as the smallest unit of data collection, and independently considers the specific parameters of each point. This allows for more accurate capture of detailed information about equipment operation, providing a richer and more accurate data foundation for subsequent energy consumption analysis and fault diagnosis. This embodiment also tailors the collection frequency for each data point by comprehensively considering data attributes such as data timeliness requirements, data update frequency, and data anomaly frequency. For example, for key points with high data timeliness requirements, frequent updates, and high anomaly frequency, a higher collection frequency is set to ensure timely acquisition of the latest data for rapid response to potential problems. Conversely, for points with lower timeliness requirements, slow updates, and low anomaly frequency, the collection frequency can be appropriately reduced to decrease unnecessary data collection and improve the targeting and effectiveness of data collection.

[0062] This embodiment employs an improved multi-queue parallel and differentiated frequency acquisition mechanism, setting up multiple queues with different periods, each queue corresponding to a unique acquisition frequency, achieving a one-to-one binding between frequency and queue. The multi-queue parallel approach allows data points with different acquisition frequency requirements to be acquired independently according to their respective frequencies, avoiding the inefficiency caused by uniformly processing different frequency requirements in the traditional single-queue polling method, thus improving data acquisition efficiency.

[0063] In one embodiment of this application, the data acquisition method further includes: sending the acquired data of each electrical device to a target device, so that the target device writes the data of each electrical device into a data processing queue in the order of data reception, and performs target processing on the data in the data processing queue.

[0064] In this embodiment, since the gateway devices can be distributed, the smart energy platform system may receive a large amount of data in a short period of time, which can easily lead to data corruption, processing resource overload, or the omission of critical data. Therefore, a first-in-first-out (FIFO) mechanism of the data processing queue can be used to buffer and sort the massive amounts of concurrently received data. On the one hand, this avoids processing conflicts caused by overlapping reception times of data sent by different gateways, ensuring that the data from each device can be completely recorded in the order of collection. On the other hand, it transforms sudden high-concurrency data into ordered serial processing tasks, matching the computing power capacity of the smart energy platform system and preventing system lag or crashes due to excessive instantaneous data volume.

[0065] In this embodiment, the target processing can be data analysis. The smart energy platform system can analyze and process the received data to determine whether any abnormalities have occurred. For example, for the data of each electrical device received, the data of the previous N times of the electrical device can be compared with the data of the currently received electrical device. If the deviation is greater than a preset deviation threshold, it is determined to be abnormal, which can assist relevant personnel in further investigation and processing.

[0066] The data acquisition method for the gateway device corresponding to the above embodiment, Figure 5 This is a structural block diagram of a data acquisition device for a gateway device according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 5 The data acquisition device 20 of the gateway device is used in the gateway device of the data acquisition system. The system also includes multiple electrical devices. The gateway device communicates with each electrical device. The data acquisition device 20 includes: acquisition frequency acquisition module 21, queue call module 22 and data acquisition module 23.

[0067] The sampling frequency acquisition module 21 is used to acquire the sampling frequency of each electrical device in the current time period. The sampling frequency of each electrical device in the current time period is determined by the application scenario information of each electrical device and the energy consumption attribute corresponding to the current time period. Each sampling frequency corresponds to at least one electrical device. The queue invocation module 22 is used to invoke the data acquisition queue corresponding to each acquisition frequency at the acquisition time point corresponding to that acquisition frequency for each electrical device; the data acquisition queue corresponding to that acquisition frequency contains the identification information of all electrical devices corresponding to that acquisition frequency; there is a mapping relationship between the acquisition frequency and the data acquisition queue; The data acquisition module 23 is used to acquire data from each electrical device based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

[0068] In one embodiment of this application, the data acquisition system further includes: a target device, which is connected to a gateway device for communication. Each power device includes multiple data points, and the acquisition frequency of each power device in the current time period includes: the acquisition frequency of each data point in each power device. The data collection frequency for each data point in each electrical device is determined by the target device based on application scenario information and energy consumption attributes for the current time period using the following method: The sampling frequency range of each electrical device within the current time period is determined based on application scenario information and energy consumption attributes of the current time period. The sampling frequency of each data point in each electrical device is determined by using the sampling frequency range corresponding to each electrical device and the data attributes of each data point in each electrical device.

[0069] In one embodiment of this application, the acquisition frequency of each data point in each electrical device includes multiple acquisition frequencies. The queue calling module 22 is further used to call the data acquisition queue corresponding to the acquisition frequency of each data point at the acquisition time point corresponding to the acquisition frequency of that data point. The data acquisition queue corresponding to the acquisition frequency of that data point contains the identification information of all electrical devices corresponding to the acquisition frequency of that data point, and there is a mapping relationship between the acquisition frequency of the data point and the data acquisition queue.

[0070] In one embodiment of this application, the application scenario information includes data timeliness requirements and device resource limitations; Among them, the sampling frequency range of each electrical device within the current time period is determined based on application scenario information and energy consumption attributes of the current time period, including: The minimum data collection frequency for each electrical device is determined based on the data timeliness requirements and the energy consumption attributes of the current time period. Determine the maximum sampling frequency for each electrical device based on equipment resource constraints; The range of sampling frequencies for each electrical device within the current time period is determined by using the highest and lowest sampling frequencies of each electrical device.

[0071] In one embodiment of this application, the data acquisition system further includes a target device, which is communicatively connected to a gateway device. The application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period are determined by the target device in the following manner: The application scenario information of each electrical device is determined based on the location information of each electrical device; The energy consumption attributes of each electrical device in the current time period are determined based on the historical electricity consumption data of each electrical device in the target time period; the target time period is a historical time period that periodically corresponds to the current time period.

[0072] In one embodiment of this application, it further includes: a data sending module, used to send the collected data of each electrical device to the target device, so that the target device writes the data of each electrical device into the data processing queue in the order of data reception, and performs target processing on the data in the data processing queue.

[0073] In one embodiment of this application, the data attributes of the data points include: data timeliness requirements, data update frequency, and data anomaly frequency; For each data point, the collection frequency of that data point is positively correlated with the data timeliness requirement of that data point, the collection frequency of that data point is positively correlated with the data update frequency of that data point, and the collection frequency of that data point is positively correlated with the data anomaly frequency of that data point.

[0074] See Figure 6 , Figure 6 This is a schematic block diagram of a gateway device provided in one embodiment of this application. Figure 6 The gateway device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of the modules in the above-described device embodiments, for example... Figure 5 The functions of the sampling frequency acquisition module 21, the queue call module 22, and the data acquisition module 23 are shown.

[0075] It should be understood that, in the embodiments of this application, the processor 301 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0076] Input device 302 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 303 may include a display (LCD, etc.), a speaker, etc.

[0077] The memory 304 may include read-only memory and random access memory, and provides instructions and data to the processor 301. A portion of the memory 304 may also include non-volatile random access memory. For example, the memory 304 may also store device type information.

[0078] In specific implementations, the processor 301, input device 302, and output device 303 described in the embodiments of this application can execute the implementation method described in the data acquisition method of the gateway device provided in the embodiments of this application, or they can execute the implementation method of the gateway device described in the embodiments of this application, which will not be repeated here.

[0079] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to complete the process. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0080] The computer-readable storage medium can be an internal storage unit of the gateway device in any of the foregoing embodiments, such as the hard drive or memory of the gateway device. The computer-readable storage medium can also be an external storage device of the gateway device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., provided on the gateway device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the gateway device. The computer-readable storage medium is used to store computer programs and other programs and data required by the gateway device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0081] This application provides a computer program product, which includes computer-executable instructions or a computer program. The computer-executable instructions or computer program are stored in a computer-readable storage medium. The processor of the gateway device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the gateway device to perform the data acquisition method of the gateway device described in this application.

[0082] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0083] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the gateway device and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed gateway devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces or units, or it may be an electrical, mechanical, or other form of connection.

[0085] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.

[0086] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0087] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data acquisition method for a gateway device, characterized in that, The method is applied to a data acquisition system, which includes a gateway device and multiple electrical devices. The gateway device is communicatively connected to each electrical device, and the method is executed by the gateway device, including: The sampling frequency of each electrical device within the current time period is obtained; the sampling frequency of each electrical device within the current time period is determined by the application scenario information of each electrical device and the energy consumption attribute corresponding to the current time period; each sampling frequency corresponds to at least one electrical device; For each electrical device, at the corresponding sampling time point, the data acquisition queue corresponding to that sampling frequency is invoked; the data acquisition queue corresponding to that sampling frequency contains the identification information of all electrical devices corresponding to that sampling frequency; there is a mapping relationship between the sampling frequency and the data acquisition queue; Data is collected from each electrical device based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

2. The data acquisition method for a gateway device as described in claim 1, characterized in that, The data acquisition system further includes: a target device, which is connected to the gateway device. Each power device includes multiple data points. The acquisition frequency of each power device in the current time period includes: the acquisition frequency of each data point in each power device. The data collection frequency of each data point in each electrical device is determined by the target device based on the application scenario information and the energy consumption attributes of the current time period in the following way: Based on the application scenario information and the energy consumption attributes of the current time period, determine the sampling frequency range of each electrical device within the current time period. The sampling frequency of each data point in each electrical device is determined by using the sampling frequency range corresponding to each electrical device and the data attributes of each data point in each electrical device.

3. The data acquisition method for a gateway device as described in claim 2, characterized in that, The data acquisition frequency for each data point in each electrical device includes multiple data point acquisition frequencies. For each electrical device's acquisition frequency, at the acquisition time point corresponding to that frequency, the data acquisition queue corresponding to that acquisition frequency is invoked, including: For each sampling frequency, at the sampling time point corresponding to that sampling frequency, the data acquisition queue corresponding to that sampling frequency is invoked; the data acquisition queue corresponding to that sampling frequency contains the identification information of all electrical devices corresponding to that sampling frequency, and there is a mapping relationship between the sampling frequency and the data acquisition queue.

4. The data acquisition method for a gateway device as described in claim 2, characterized in that, The application scenario information includes data timeliness requirements and device resource limitations; The step of determining the sampling frequency range of each electrical device within the current time period based on the application scenario information and the energy consumption attributes of the current time period includes: The minimum data collection frequency for each electrical device is determined based on the data timeliness requirements and the energy consumption attributes of the current time period. The maximum sampling frequency for each electrical device is determined based on the aforementioned equipment resource limitations. The range of sampling frequencies for each electrical device within the current time period is determined by using the highest and lowest sampling frequencies of each electrical device.

5. The data acquisition method for a gateway device as described in claim 1, characterized in that, The data acquisition system further includes a target device, which is communicatively connected to the gateway device. The application scenario information of each electrical device and the energy consumption attributes corresponding to the current time period are determined by the target device in the following way: The application scenario information of each electrical device is determined based on the location information of each electrical device; The energy consumption attributes of each electrical device in the current time period are determined based on the historical electricity consumption data of each electrical device in the target time period; the target time period is a historical time period that periodically corresponds to the current time period.

6. The data acquisition method for a gateway device as described in claim 1, characterized in that, Also includes: The system sends the collected data from each electrical device to the target device, so that the target device writes the data from each electrical device into a data processing queue in the order of data reception, and performs target processing on the data in the data processing queue.

7. The data acquisition method for a gateway device as described in claim 2, characterized in that, The data attributes of the data points include: data timeliness requirements, data update frequency, and data anomaly frequency; For each data point, the collection frequency of that data point is positively correlated with the data timeliness requirement of that data point, the collection frequency of that data point is positively correlated with the data update frequency of that data point, and the collection frequency of that data point is positively correlated with the data anomaly frequency of that data point.

8. A data acquisition device for a gateway device, characterized in that, A gateway device is used in a data acquisition system, the system also includes multiple electrical devices, the gateway device is communicatively connected to each electrical device, and the data acquisition device includes: The sampling frequency acquisition module is used to acquire the sampling frequency of each electrical device within the current time period; the sampling frequency of each electrical device within the current time period is determined by the application scenario information of each electrical device and the energy consumption attribute corresponding to the current time period; each sampling frequency corresponds to at least one electrical device. The queue invocation module is used to invoke the data acquisition queue corresponding to each acquisition frequency at the corresponding acquisition time point for each electrical device. The data acquisition queue corresponding to the acquisition frequency contains the identification information of all electrical devices corresponding to that acquisition frequency. There is a mapping relationship between the acquisition frequency and the data acquisition queue. The data acquisition module is used to acquire data from each electrical device based on the identification information in the data acquisition queue corresponding to each acquisition frequency.

9. A gateway device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.