Data acquisition method, electronic device and photovoltaic power generation system
By storing the communication hop count of slave devices in the master device and sending downlink data acquisition messages in batches, the problem of low data acquisition efficiency in IoT systems is solved, achieving more efficient communication and reduced energy consumption.
Patent Information
- Application Number
- CN202510268513.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-03-07
AI Technical Summary
Existing IoT systems suffer from low data acquisition efficiency, long processing times, and high energy consumption. In particular, in photovoltaic power generation systems, the method of sending data acquisition requests from master devices to slave devices one by one results in low communication efficiency.
The master device stores the communication hop count of the slave device. By traversing all communication hop counts, it broadcasts downlink data acquisition messages based on the current communication hop count. This enables the slave device to determine whether to send uplink data acquisition messages and the timing of the response based on the information carried in the messages, thus achieving batch data acquisition.
While ensuring communication reliability, the communication efficiency of data acquisition has been improved and energy consumption has been reduced.
Smart Images

Figure CN120050220B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data collection, in particular to a data collection method, an electronic device and a photovoltaic power generation system. BACKGROUND
[0002] Many current Internet of Things systems involve data collection, and the collection method commonly used is that the master device uses the maximum communication hop count to actively send data collection downlink messages to all slave devices one by one, and each slave device sends a data collection uplink message after receiving the corresponding data request, but the overall efficiency of such collection is low and the time consumption is long. SUMMARY
[0003] The purpose of the present application is to provide a data collection method, an electronic device and a photovoltaic power generation system to improve the communication efficiency of data collection, reduce the overall time of data collection, and reduce the energy consumption of slave devices.
[0004] Embodiments of the present application can be implemented as follows:
[0005] In a first aspect, the present application provides a data collection method applied to a master device, wherein the master device is in communication connection with at least one slave device; the master device stores the communication hop count of each slave device, wherein the communication hop count of the slave device represents the number of forwarding times required for the data collection uplink message of the slave device to reach the master device; and the method comprises:
[0006] Iterating through all communication hop counts, performing a group of data collection on the slave device corresponding to each communication hop count;
[0007] In each group of data collection, at least once broadcast sends a data collection downlink message based on the current communication hop count, so that each slave device receiving the data collection downlink message determines whether to send a data collection uplink message and the time of sending a response according to the MAC address carried in the data collection downlink message and the reporting interval time.
[0008] Optionally, the communication hop count of each slave device is determined by the following method:
[0009] Obtain a to-be-updated list, wherein the to-be-updated list includes the MAC address of each slave device whose communication hop count is not determined;
[0010] At least once broadcast sends the data collection downlink message based on the to-be-updated list, so as to determine the communication hop count of each slave device according to the data collection uplink message responded by each slave device.
[0011] Optionally, the step of broadcasting the data collection downlink message at least once based on the to-be-updated list to determine the communication hop count of each slave device according to the data collection uplink message replied by each slave device comprises:
[0012] initializing the current communication hop count of the master device as a first preset value;
[0013] broadcasting the data collection downlink message at least once based on the to-be-updated list, the current communication hop count of the master device, the corresponding reporting interval time and the preset collection period, and determining the communication hop count of each slave device when receiving the data collection uplink message replied by any slave device after each broadcasting, and updating the to-be-updated list;
[0014] updating the current communication hop count of the master device if the number of slave devices whose communication hop count is not determined is not 0 and the current communication hop count of the master device does not satisfy the preset stop condition;
[0015] continuing to execute the step of broadcasting the data collection downlink message at least once based on the to-be-updated list, the current communication hop count of the master device and the preset collection period until the number of slave devices whose communication hop count is not determined is 0 or the current communication hop count of the master device satisfies the preset stop condition, and obtaining the communication hop count of each slave device.
[0016] Optionally, the step of broadcasting the data collection downlink message at least once based on the to-be-updated list, the current communication hop count of the master device and the preset collection period, and determining the communication hop count of each slave device when receiving the data collection uplink message replied by any slave device after each broadcasting, and updating the to-be-updated list comprises:
[0017] grouping all MAC addresses in the to-be-updated list to obtain at least one to-be-updated sub-list according to the current communication hop count of the master device, the corresponding reporting interval time and the collection period; the to-be-updated sub-list comprises the MAC address of at least one target to-be-updated slave device;
[0018] taking the first to-be-updated sub-list as a target to-be-updated sub-list;
[0019] generating the data collection downlink message based on the target to-be-updated sub-list, the current communication hop count of the master device and the corresponding reporting interval time, and broadcasting the data collection downlink message, so that each slave device receiving the data collection downlink message determines whether to send the data collection uplink message and the reply sending time based on the data collection downlink message, wherein each target to-be-updated slave device replies the data collection uplink message to the master device at the reply sending time determined by itself;
[0020] when receiving any of the data collection uplink messages from the target slave device to be updated, determining the communication hop count of the target slave device to be updated based on the data collection uplink message, and deleting the MAC address of the target slave device to be updated from the update list;
[0021] If the target update sub-list is not the last update sub-list, after waiting for the collection period from the time of broadcasting the data collection downlink message, taking the next update sub-list as a new target update sub-list, and continuing to execute the steps of generating the data collection downlink message based on the target update sub-list, the current communication hop count of the master device and the corresponding reporting interval time, and broadcasting the data collection downlink message, until the target update sub-list is the last update sub-list.
[0022] Optionally, the step of grouping all MAC addresses in the update list according to the current communication hop count of the master device, the corresponding reporting interval time and the collection period to obtain at least one update sub-list comprises:
[0023] finding the reporting interval time corresponding to the current communication hop count of the master device from a preset relationship mapping table; the relationship mapping table comprises a plurality of different hop counts each corresponding to a reporting interval time;
[0024] downwardly rounding the result of dividing the collection period by the reporting interval time corresponding to the current communication hop count of the master device to obtain the number of updateable slave devices this time;
[0025] grouping all MAC addresses in the update list based on the number of updateable slave devices this time to obtain at least one update sub-list.
[0026] Optionally, the method further comprises:
[0027] In each data collection process, judging whether there are unresponsive slave devices in the current broadcast sending after a period of time of broadcast sending; the unresponsive slave devices are slave devices in the target slave device list contained in the data collection downlink message of the current broadcast sending, which fail to send the data collection uplink message to the master device within a period of time after the broadcast sending of the master device; if there are, updating the communication hop count of each unresponsive slave device according to a preset rule.
[0028] Optionally, the method further comprises: in each data collection process, when receiving a data collection uplink message, updating the communication hop count of the corresponding slave device according to the information in the data collection uplink message.
[0029] Optionally, the step of updating the communication hop count of the corresponding slave device according to the information in the data collection uplink message comprises:
[0030] determining the number of forwarding times of the data collection uplink message according to the information carried in the data collection uplink message; judging whether the communication hop count of the corresponding slave device is consistent with the number of forwarding times; if not, modifying the communication hop count of the corresponding slave device to the number of forwarding times.
[0031] Optionally, the step of traversing all the communication hop counts and performing a set of data collection on the slave device corresponding to each communication hop count comprises:
[0032] initializing the current communication hop count of the master device to a second preset value;
[0033] filtering out each to-be-collected slave device whose communication hop count is equal to the current communication hop count of the master device, and performing a set of data collection on all the to-be-collected slave devices by broadcasting the data collection downlink message at least once;
[0034] if the current communication hop count of the master device is not equal to the preset stop threshold, then after adding 1 to the current communication hop count of the master device, the step of filtering out each to-be-collected slave device whose communication hop count is equal to the current communication hop count of the master device and performing a set of data collection on all the to-be-collected slave devices by broadcasting the data collection downlink message at least once is continued to be executed until the current communication hop count of the master device is equal to the preset stop threshold.
[0035] Optionally, the step of filtering out each to-be-collected slave device whose communication hop count is equal to the current communication hop count of the master device and performing a set of data collection on all the to-be-collected slave devices by broadcasting the data collection downlink message at least once comprises:
[0036] filtering out the MAC address of each to-be-collected slave device whose communication hop count is equal to the current communication hop count of the master device from the MAC addresses of all the slave devices to obtain a to-be-collected list;
[0037] according to the to-be-collected list, the current communication hop count of the master device, the corresponding reporting interval time and the collection period, broadcasting the data collection downlink message at least once to obtain the data collection uplink message replied by each to-be-collected slave device.
[0038] Optionally, the step of according to the to-be-collected list, the current communication hop count of the master device and the collection period, broadcasting the data collection downlink message at least once to obtain the data collection uplink message replied by each to-be-collected slave device comprises:
[0039] grouping all the MAC addresses in the to-be-collected list according to the current communication hop number of the master device, the corresponding reporting interval time of the current communication hop number and the collection period, to obtain at least one to-be-collected sub-list; the to-be-collected sub-list comprises the MAC address of at least one target to-be-collected slave device;
[0040] taking the first to-be-collected sub-list as a target to-be-collected sub-list;
[0041] generating the data collection downlink message based on the target to-be-collected sub-list, the current communication hop number of the master device and the corresponding reporting interval time of the current communication hop number, and broadcasting the data collection downlink message, so that each slave device receiving the data collection downlink message determines whether to send the data collection uplink message and a response sending time point based on the data collection downlink message, wherein each target to-be-collected slave device sends the data collection uplink message to the master device at the response sending time point determined by itself;
[0042] when receiving the data collection uplink message in response to any target to-be-collected slave device, deleting the MAC address of the target to-be-collected slave device from the to-be-collected list;
[0043] if the target to-be-collected sub-list is not the last to-be-collected sub-list, then after waiting for the collection period from the time point of broadcasting the data collection downlink message, taking the next to-be-collected sub-list as a new target to-be-collected sub-list, and continuing to execute the step of generating the data collection downlink message based on the target to-be-collected sub-list, the current communication hop number of the master device and the corresponding reporting interval time of the current communication hop number, and broadcasting the data collection downlink message, until the target to-be-collected sub-list is the last to-be-collected sub-list.
[0044] Optionally, the step of grouping all the MAC addresses in the to-be-collected list according to the current communication hop number of the master device, the corresponding reporting interval time of the current communication hop number and the collection period, to obtain at least one to-be-collected sub-list comprises:
[0045] finding the reporting interval time corresponding to the current communication hop number of the master device from a preset relationship mapping table; the relationship mapping table comprises a plurality of different hop numbers each corresponding to a reporting interval time;
[0046] taking the result of dividing the collection period by the reporting interval time corresponding to the current communication hop number of the master device as an integer, to obtain the number of collectable slave devices this time;
[0047] grouping all the MAC addresses in the to-be-collected list according to the number of collectable slave devices this time, to obtain at least one to-be-collected sub-list.
[0048] In a second aspect, the application further provides a data collection method applied to a slave device, wherein the slave device is in communication connection with a master device; the method comprises:
[0049] when receiving the data collection downlink message broadcasted by the master device, determining whether to send the data collection uplink message and the responding sending time according to the MAC address and the reporting interval time carried in the data collection downlink message.
[0050] Optionally, the step of determining whether to send the data collection uplink message and the responding sending time according to the MAC address and the reporting interval time carried in the data collection downlink message comprises:
[0051] when receiving the data collection downlink message, parsing the data collection downlink message to obtain the reporting interval time and the MAC address list;
[0052] if the MAC address list includes the MAC address of the slave device, determining that the data collection uplink message of the slave device needs to be sent;
[0053] multiplying the arrangement serial number of the MAC address of the slave device in the MAC address list by the reporting interval time to obtain a waiting duration; wherein the responding sending time is the time after the waiting duration from the time when the data collection downlink message is received;
[0054] generating the data collection uplink message based on the MAC address and the reporting data of the slave device, and sending the data collection uplink message to the master device at the responding sending time.
[0055] In a third aspect, the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a software program, and the processor executes the software program to realize the data collection method according to the first aspect or the second aspect when the electronic device is running.
[0056] In a fourth aspect, the present application further provides a photovoltaic power generation system, comprising a master device and a plurality of slave devices connected with the master device in communication, wherein the master device executes the data collection method according to the first aspect, and the slave devices execute the data collection method according to the second aspect to realize the data collection of the master device to each slave device; the master device is a data concentrator in the photovoltaic power generation system, and the slave devices are any one of an intelligent shutdown device, an intelligent optimizer and a photovoltaic module with communication function in the photovoltaic power generation system.
[0057] Compared with the prior art, the embodiment of the application provides a data collection method, an electronic device and a photovoltaic power generation system. The master device stores the communication hop count of each slave device. The communication hop count represents the number of forwarding times required for the data collection uplink message of the slave device to reach the master device. The method is that the master device iterates all the communication hop counts, and performs a group of data collection on the slave device corresponding to each communication hop count. In each group of data collection, the master device broadcasts the data collection downlink message at least once based on the current communication hop count, so that each slave device receiving the data collection downlink message determines whether to send the data collection uplink message and the response sending time according to the information carried in the downlink message. In this way, the data is collected in batches based on different communication hop counts. Compared with the traditional method of collecting the slave devices one by one using the maximum communication hop count, the communication efficiency is improved and the energy consumption is reduced under the premise of ensuring the communication reliability. BRIEF DESCRIPTION OF DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0059] Figure 1 One of the flowcharts of the data collection method provided by the embodiment of the application.
[0060] Figure 2 The second flowchart of the data collection method provided by the embodiment of the application.
[0061] Figure 3 The third flowchart of the data collection method provided by the embodiment of the application.
[0062] Figure 4 The fourth flowchart of the data collection method provided by the embodiment of the application.
[0063] Figure 5 The fifth flowchart of the data collection method provided by the embodiment of the application.
[0064] Figure 6 The structural schematic diagram of the electronic device provided by the embodiment of the application. DETAILED DESCRIPTION
[0065] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.
[0066] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative labor are within the scope of protection of the present application.
[0067] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0068] In addition, if the terms "first", "second" and the like are used, they are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0069] It should be noted that: the features in the embodiments of the present application can be combined with each other without conflict.
[0070] Here, first, the key words or key terms related to the present application are introduced:
[0071] 1. Flooding: a simple routing algorithm, the core idea of which is to copy and send the received data packet to all possible connection paths until the data packet reaches the destination. The main problem is that a large number of duplicate data packets will be generated, occupying channel resources and being low in efficiency. In order to solve this problem, a parameter "remaining hops" is generally added to the data packet, the "remaining hops" is reduced by 1 when the data packet is flooded and forwarded 1 time, and the data packet is not forwarded when the "remaining hops" is reduced to 0.
[0072] 2. A common Internet of Things system is composed of the following parts:
[0073] (1) Cloud platform: a platform for managing all devices in the system and the data collected by them.
[0074] (2) Master device: after collecting data from the slave device, the master device reports the collected data to the cloud platform.
[0075] (3) Slave device: in the field of photovoltaic power generation technology, it is an intelligent contactor, an intelligent optimizer or a photovoltaic module with communication function.
[0076] (4) Communication module: The communication module for sending and receiving messages between the concentrator and the slave device, which can be a wireless module or a power line carrier module;
[0077] In a photovoltaic power generation system, slave devices collect parameters such as voltage, current, and temperature of photovoltaic modules in real time. The master device (usually a data concentrator) periodically and proactively collects data from the slave devices, aggregates the data, and uploads it to the cloud platform, thereby achieving refined management of the photovoltaic power station.
[0078] The present invention relates to an Internet of Things (IoT) system comprising a master device and multiple slave devices communicatively connected to the master device. Each slave device can be directly connected to the master device or indirectly connected via at least one routing device and / or switching device. The master device stores a communication hop count for each slave device, which represents the number of forwarding steps required for an uplink data acquisition message from the slave device to reach the master device.
[0079] Please refer to Figure 1 , Figure 1 A flow chart of a data collection method provided in an embodiment of the present invention is provided. The method is applied to a master device in an Internet of Things system. The method includes the following steps:
[0080] S300, traverse all communication hops and collect a set of data from the slave device corresponding to each communication hop;
[0081] S400. During each data collection process, a data collection downlink message is broadcast at least once based on the current number of communication hops, so that each slave device that receives the data collection downlink message can determine whether to send its own data collection uplink message and the time to send the response based on the MAC address carried in the downlink message and the reporting interval.
[0082] In this embodiment, the complete process of collecting data from all slave devices corresponding to one communication hop count is a set of data collection processes, during which the data collection downlink message may be broadcast more than once.
[0083] The communication hop count for each set of data collection is used as the hop count field in each broadcast data collection downlink message. The data collection uplink message responded by the slave device may include the data collected by the slave device, which may include but is not limited to: voltage, current, temperature and other data.
[0084] The data collection method provided by the embodiment of the application, wherein the master device stores the communication hop count of each slave device, the communication hop count representing the number of forwarding times required for the data collection uplink message of the slave device to reach the master device, the method comprising: the master device traverses all the communication hop counts, and performs a group of data collection on the slave device corresponding to each communication hop count, and in each group of data collection, the master device broadcasts the data collection downlink message at least once based on the current communication hop count of the master device, so that each slave device receiving the data collection downlink message determines whether to send the data collection uplink message and the response sending time according to the information carried in the downlink message. In this way, the data collection is performed in batches based on different communication hop counts, compared with the traditional method of performing the data collection on the slave devices one by one using the maximum communication hop count, the communication efficiency is improved and the energy consumption is reduced under the premise of ensuring the communication reliability.
[0085] The determination process of the communication hop count of each slave device will be introduced below.
[0086] Before the first operation of the Internet of Things system, the master device has not stored the communication hop count of each slave device, and the communication hop count of each slave device needs to be determined in the first operation process. For example, after the photovoltaic power generation system is installed and debugged, when the system is started for the first time, the communication hop count of each slave device needs to be determined in the first round of data collection process. The first round of data collection process is the process of performing the first data collection on all the slave devices.
[0087] Optionally, before the step S300, the data collection method can further comprise:
[0088] S100, obtaining a to-be-updated list.
[0089] In the embodiment, the to-be-updated list is used to store the MAC address of each slave device whose communication hop count is not determined. At the beginning, the communication hop count of each slave device is unknown, and therefore the MAC address of each slave device in the Internet of Things system is included in the to-be-updated list.
[0090] S200, broadcasting the data collection downlink message at least once based on the to-be-updated list, so as to determine the communication hop count of each slave device according to the data collection uplink message responded by each slave device.
[0091] Optionally, referring to Figure 2 , the sub-step of the step S200 can comprise:
[0092] S210, initializing the current communication hop count of the master device as a first preset value.
[0093] In the embodiment, the communication hop count of the master device is the hop count field required when the master device encapsulates the message.
[0094] S220, according to the list to be updated, the current communication hop count of the master device, the corresponding reporting interval time and the preset collection period, at least broadcast the data collection downlink message once, and after each broadcast, receive the data collection uplink message of any slave device to determine the communication hop count of the slave device and update the list to be updated.
[0095] In the embodiment, according to the list to be updated, the current communication hop count of the master device, the corresponding reporting interval time and the preset collection period, at least broadcast the data collection downlink message once. Within a period of time after each broadcast (i.e. the collection period), if the data collection uplink message of any slave device is received, the communication hop count of the slave device can be determined and the MAC address of the slave device is deleted from the list to be updated.
[0096] S230, determine whether the number of slave devices whose communication hop count is not determined is 0.
[0097] In combination Figure 2 It can be seen that if the number of slave devices whose communication hop count is not determined is not 0, the following S240 is executed, and if the number of slave devices whose communication hop count is not determined is 0, the following S260 is executed.
[0098] S240, determine whether the current communication hop count of the master device meets the preset stop condition.
[0099] In combination Figure 2 It can be seen that if the current communication hop count of the master device does not meet the preset stop condition, the following step S250 is executed and then step S220 is continued, and if the current communication hop count of the master device meets the preset stop condition, the following step S260 is executed.
[0100] S250, update the current communication hop count of the master device.
[0101] In an optional implementation, the first preset value can be 0, 1, 2 or the like small number, so that the updating mode of the current communication hop count of the master device can be: adding 1 (or 2) each time, which belongs to the incremental mode, and the preset stop condition at this time is that the current communication hop count of the master device is equal to the preset value (for example, 10 or 12).
[0102] S260, obtain the communication hop count of each slave device.
[0103] If there are 100 slave devices (ID0~ID99) in the whole Internet of Things system, but the slave devices ID98 and ID99 are both offline, then through the above steps, the communication hop count of the slave device ID97 can be determined as 2, the communication hop count of the slave device ID96 can be determined as 3, and so on. Figure 2The last stage of the flow shown determines the communication hop number of each slave device. In the case that the number of slave devices whose communication hop number is not determined is always not 0, but the current communication hop number of the master device meets the preset stop condition, the communication hop numbers of only 98 slave devices can be actually obtained, but the communication hop numbers of slave devices ID98 and ID99 are temporarily set as the above preset value. The example is only an example, and the number of slave devices is not limited herein.
[0104] In the optional implementation, on the basis of Figure 2 Figure 3 For the process of "broadcasting the data collection downlink message at least once according to the to-be-updated list, the current communication hop number of the master device, the corresponding reporting interval time and the preset collection period, and determining the communication hop number of any slave device that replies to the data collection uplink message after each broadcasting and updating the to-be-updated list" in step S220, the following sub-steps are included.
[0105] S221, grouping all MAC addresses in the to-be-updated list according to the current communication hop number of the master device, the corresponding reporting interval time and the collection period, to obtain at least one to-be-updated sub-list.
[0106] In this embodiment, the to-be-updated sub-list can include the MAC address of at least one target to-be-updated slave device. Optionally, the master device also stores a preset relationship mapping table, which includes a plurality of different hop numbers each corresponding to a reporting interval time. Therefore, the sub-step of step S221 includes:
[0107] S221-1, finding the reporting interval time corresponding to the current communication hop number of the master device from the relationship mapping table;
[0108] S221-2, taking the result of dividing the collection period by the reporting interval time corresponding to the current communication hop number of the master device as an integer to obtain the number of updateable slave devices this time;
[0109] S221-3, grouping all MAC addresses in the to-be-updated list based on the number of updateable slave devices this time to obtain at least one to-be-updated sub-list.
[0110] In this embodiment, if the number of MAC addresses in the to-be-updated list is M and the number of updateable slave devices this time is Y, then the number of to-be-updated sub-lists is M ÷ Y rounded up, that is, the number of MAC addresses in the to-be-updated sub-list is either Y or an integer between 1 and Y-1.
[0111] S222, taking the first to-be-updated sub-list as the target to-be-updated sub-list.
[0112] S223, generating a data collection downlink message based on the target sub-list to be updated, the current communication hop count of the master device and the corresponding reporting interval time, and broadcasting the data collection downlink message, so that each slave device receiving the data collection downlink message determines whether to send a data collection uplink message and the response sending time based on the data collection downlink message.
[0113] In the embodiment, the hop count field in the data collection downlink message is the latest current communication hop count of the master device, and the data collection downlink message further includes the target sub-list to be updated and the reporting interval time corresponding to the current communication hop count of the master device. After the data collection downlink message is broadcasted, a flood is performed in the local communication network until the hop count field in the data collection downlink message is reduced to 0.
[0114] Among them, for each target slave device in the target sub-list to be updated, it will respond to the data collection uplink message to the master device at the response sending time determined by itself.
[0115] And for each target slave device receiving the data collection downlink message, the processing process when receiving the data collection downlink message is as follows:
[0116] (1) Analyzing the data collection downlink message to obtain the reporting interval time and the target sub-list to be updated;
[0117] (2) If the target sub-list to be updated includes the MAC address of the slave device itself, multiplying the arrangement serial number of the MAC address of the slave device in the target sub-list to be updated by the reporting interval time to obtain the response message sending waiting time length;
[0118] (3) At the response sending time when the waiting time length ends, generating a data collection uplink message based on the MAC address of the slave device and the collected data, and sending the data collection uplink message to the master device.
[0119] It can be understood that assuming the reporting interval time length is 1s, and the target slave device receives the data collection downlink message at 10:00:00. If the MAC address of the target slave device is arranged in the first position in the target sub-list to be updated, then the response message sending time of the slave device is 10:00:01, and if the MAC address of the target slave device is arranged in the second position in the target sub-list to be updated, then the response message sending time of the slave device is 10:00:02. As can be seen, setting the reporting interval time length can make each slave device send the data collection uplink message in time, so that the master device does not face the situation of high concurrency of data collection uplink messages from multiple slave devices at the same time. The example is only an example and is not limited herein.
[0120] S224, when receiving the data collection uplink message of any target slave device to be updated, determining the communication hop count of the target slave device to be updated based on the data collection uplink message, and deleting the MAC address of the target slave device to be updated from the update list.
[0121] In the embodiment, when the master device receives the data collection uplink message of any target slave device to be updated, the master device can obtain the collection data of the target slave device to be updated and determine the communication hop count of the target slave device to be updated by analyzing the data collection uplink message, and delete the MAC address of the target slave device to be updated from the update list. Therefore, in the embodiment, the way of determining whether the number of slave devices whose communication hop count is not determined is 0 in step S230 can be determining whether the update list is empty. Figure 3
[0122] Optionally, an associated collection flag value can be configured for each slave device, and the collection flag value is 0 by default. When the master device receives the data collection uplink message of any target slave device to be updated, the master device sets the collection flag value of the target slave device to be updated to 1. Therefore, the way of determining whether the number of slave devices whose communication hop count is not determined is 0 in step S230 can be determining whether there is a slave device with a collection flag value of 0.
[0123] S225, determining whether the target update sub-list is the last update sub-list.
[0124] In the embodiment, if the target update sub-list is not the last update sub-list, the following step S226 is performed until the target update sub-list is the last update sub-list. If the target update sub-list is the last update sub-list, step S230 is performed.
[0125] S226, starting from the time of broadcasting the data collection downlink message, waiting for a collection period, and then taking the next update sub-list as a new target update sub-list.
[0126] In the embodiment, the interval time between the adjacent two times of broadcasting is one collection period T.
[0127] In an optional example, assuming that the MAC addresses of 120 slave devices are included in the to-be-updated list, the collection period T = 20 s, the current communication hop count of the master device is 2, and the corresponding reporting interval time is 0.6 s, then the number of the slave devices that can be updated this time is 33, and the 120 MAC addresses obtained by copying the to-be-updated list are grouped into 4 to-be-updated sublists, wherein the first three to-be-updated sublists each include 33 MAC addresses, and the last to-be-updated sublist includes only 21 MAC addresses. Based on the 4 to-be-updated sublists, the data collection downlink message needs to be broadcasted and sent 4 times. The example is only an example, and is not limited herein.
[0128] In an optional example, the relationship mapping table is as shown in the following table:
[0129] Table (1)
[0130]
[0131] If the to-be-updated list includes 100 MAC addresses of slave devices, the collection period T = 20 s, the current communication hop count of the master device is represented by Xi, and i represents the i th round of data collection (i = 1, 2, 3…N, one round of data collection represents that each slave device of the Internet of Things system is collected once), then starting from the current communication hop count Xi initialized as 0, the process of determining the communication hop count of each slave device is as follows:
[0132] (1) When the current communication hop count of the master device Xi = 0, the number of the slave devices that can be updated this time Y = 100 is calculated, and after copying the 100 MAC addresses in the to-be-updated list, the 100 MAC addresses are grouped into one to-be-collected slave device sublist according to each group of 100, and one broadcast sending needs to be performed;
[0133] Suppose that within 20 s after the broadcast sending, 10 data collection uplink messages of the slave devices are received, and the communication hop count of each of the 10 slave devices is determined, and the MAC addresses of the 10 slave devices are deleted from the to-be-updated list;
[0134] (2) When the current communication hop count of the master device Xi = 1, the number of the slave devices that can be updated this time Y = 50 is calculated, and after copying the 90 MAC addresses in the to-be-updated list, the 90 MAC addresses are grouped into two to-be-collected slave device sublists according to each group of 50, and two broadcast sendings need to be performed in turn;
[0135] Suppose that within 20 s after the first broadcast, 15 data collection uplink messages of the slave devices are received, and within 20 s after the second broadcast, 20 data collection uplink messages of the slave devices are received, then the two broadcasts can determine the communication hop count of 35 slave devices and the MAC addresses of the 35 slave devices are deleted from the to-be-updated list;
[0136] (3) When the current communication hop number of the master device is Xi=2, the number of the slave devices that can be updated this time is calculated as Y=33. After copying 55 MAC addresses in the list to be updated, the 55 MAC addresses are grouped into 2 sublists of 33 MAC addresses each, and then two broadcasts are performed in turn:
[0137] Suppose that 33 data collection uplink messages from the slave devices are received within 20s after the first broadcast, and 22 data collection uplink messages from the slave devices are received within 20s after the second broadcast, then the communication hop numbers of 35 slave devices can be determined through the two broadcasts, and the MAC addresses of the 55 slave devices are deleted from the list to be updated. At this time, the list to be updated is empty, and the communication hop numbers of 100 slave devices have been obtained.
[0138] The example is only an exemplary illustration of the sub-steps of step S200, and is not limited herein.
[0139] As can be seen from the above, in the relationship mapping table, the greater the hop number, the longer the reporting interval time. Because the greater the communication hop number of a slave device, the longer the transmission time required for the slave device to send a data collection uplink message to the master device, the reporting interval time corresponding to the current communication hop number of the master device in the relationship mapping table needs to be greater than or equal to the transmission time corresponding to the current communication hop number of the master device. Thus, one broadcast is actually only sent to Y slave devices in a sublist to be updated, so that the Y slave devices can perform data reporting in turn within one collection period T, that is, after the completion of the current broadcast, data collection uplink messages from all Y slave devices can be received before the next broadcast, so as to avoid signal interference caused by simultaneous reporting of the slave devices, and also avoid the situation that the communication hop numbers of the slave devices cannot be correctly updated.
[0140] At the same time that the communication hop numbers of the slave devices are determined based on the sub-steps of step S200, a round of data collection of all slave devices is actually performed, that is, the communication hop numbers of the slave devices are determined by the master device in the process of the first round of data collection. In order to perform collection according to the communication hop numbers in the process of the non-first round of data collection.
[0141] It should be noted that in the photovoltaic power generation system, data collection is performed every certain period of time, and each round of data collection needs to cover all slave devices. The first round of data collection (i.e., the first round of data collection) of the system can apply steps S100, S200 and sub-steps thereof in the foregoing embodiments; the second and subsequent rounds of data collection all use step S300 and sub-steps thereof. Each round of data collection process includes multiple groups of data collection, and each group of data collection only covers all slave devices corresponding to one communication hop. One data collection is only for all slave devices in the MAC address list in the data collection downlink message of one broadcast. Therefore, one group of data collection process needs at least one data collection (i.e., one broadcast), so as to complete data collection for all slave devices corresponding to one communication hop.
[0142] The following describes in detail the process of one group of data collection based on each communication hop in the non-first round of data collection.
[0143] Optionally, the sub-step of "iterating all communication hops and performing one group of data collection for slave devices corresponding to each communication hop" in step S300 can be: performing one group of data collection for all slave devices corresponding to each communication hop in the order of increasing communication hop.
[0144] Further, after step S400, the following can also be included:
[0145] S500, in each group of data collection process, determining whether there is an unresponsive slave device after a period of time of each broadcast transmission, and if so, updating the communication hop of each unresponsive slave device according to a preset rule.
[0146] Wherein, one broadcast transmission is for multiple target slave devices to be collected. In the target slave device to be collected sub-list contained in the data collection downlink message of one broadcast transmission, the slave device that fails to successfully send the data collection uplink message to the master device within a period of time after the master device broadcasts the data collection downlink message is an unresponsive slave device. The reason why the data collection uplink message fails to be successfully sent to the master device can be that the slave device does not receive the data collection downlink message at all, so it does not report; or the slave device sends the data collection uplink message, but packet loss occurs in the transmission process.
[0147] If there is an unresponsive slave device in one broadcast transmission, the first case is that the unresponsive slave device fails and goes offline, and the second case is that the position of the unresponsive slave device in the network topology changes, and the communication hop of the unresponsive slave device stored by the master device cannot transmit the message to the slave device. For the second case, in order to ensure the comprehensiveness of the collection, the preset rule can be to increase the communication hop of the unresponsive slave device by at least 1, so that the unresponsive slave device enters the next or next group of data collection.
[0148] Optionally, a collection period can be waited after each broadcast transmission, and it is judged whether there is a non-responding slave device in the current broadcast transmission, and if so, the communication hop count of each non-responding slave device is increased by at least 1, so that the non-responding slave device enters the next group or the next group of data collection.
[0149] S600, in each group of data collection process, when receiving the data collection uplink message, updating the communication hop count of the corresponding slave device according to the information in the data collection uplink message.
[0150] In this embodiment, when the master device receives the data collection uplink message, the communication hop count of the corresponding slave device can be updated when the forwarding times of the data collection uplink message meet the hop count update condition. That is, in S600, the sub-step of updating the communication hop count of the corresponding slave device according to the information in the data collection uplink message can include:
[0151] S610, determining the forwarding times of the data collection uplink message according to the information received in the data collection uplink message;
[0152] S620, if the communication hop count of the corresponding slave device is not consistent with the forwarding times, modifying the communication hop count of the corresponding slave device to the forwarding times.
[0153] It can be understood that if a slave device (assuming slave device A) suddenly fails to communicate and cannot send and receive messages, the communication hop count of slave device A will increase to the maximum value (i.e. the preset value) in the collection process of a certain round through step S500.
[0154] After a period of time, slave device A recovers from the fault, and in the collection process of the round after the fault recovery, slave device A can normally send the data collection uplink message to the master device, and then the master device can reset its communication hop count to the actual forwarding times, which can improve the collection efficiency.
[0155] Please refer to Figure 4 , in detail, for the above step S300, if the data collection is performed in the order of the communication hop count from small to large, it can include the following sub-steps:
[0156] S310, initializing the current communication hop count of the master device to the second preset value.
[0157] In this embodiment, the second preset value can be 0, or the minimum value of the communication hop count of each slave device.
[0158] S320, screen out each to-be-sampled slave device whose communication hop number is equal to the current communication hop number of the master device, and perform a group of data collection on all to-be-sampled slave devices by at least broadcasting the data collection downlink message once.
[0159] In the embodiment, the MAC addresses of the to-be-sampled slave devices can be added in the data collection downlink message each time of broadcasting transmission, so as to realize the collection of the to-be-sampled slave devices. Specifically, the sub-step of step S320 can include:
[0160] S321, screen out the MAC address of each to-be-sampled slave device whose communication hop number is equal to the current communication hop number of the master device from the MAC addresses of all slave devices, to obtain a to-be-sampled list;
[0161] S322, according to the to-be-sampled list, the current communication hop number of the master device, and the corresponding reporting interval time and collection period, broadcast the data collection downlink message at least once, to obtain the data collection uplink message replied by each to-be-sampled slave device.
[0162] In the embodiment, the data collection downlink message can be broadcast more than once for the MAC addresses of all to-be-sampled slave devices in the to-be-sampled list to complete the collection.
[0163] S330, judge whether the current communication hop number of the master device is equal to a preset stop threshold.
[0164] The preset stop threshold can be the maximum value in the communication hop numbers of all slave devices. If the current communication hop number of the master device is not equal to the preset stop threshold, step S340 is executed; if the current communication hop number of the master device is equal to the preset stop threshold, step S350 is executed.
[0165] S340, add 1 to the current communication hop number of the master device.
[0166] In the embodiment, after adding 1 to the current communication hop number of the master device, the next group of data collection is started by continuing to execute step S320. Alternatively, after adding 2 to the current communication hop number of the master device, step S320 is continued to be executed.
[0167] In the embodiment, one round of data collection needs to complete the comprehensive collection of all slave devices. After one round of data collection is completed, the master device can obtain the reported data of each slave device, and the master device can locally store the reported data and / or upload the reported data to a cloud platform.
[0168] Suppose the communication hop numbers of all slave devices are only 2, 3, 4, and 5, then four groups of data collection are needed to complete one round of data collection. The example is only for illustration, and is not limited herein.
[0169] In an optional implementation, Figure 4 Based on Figure 5 In step S322, the process of "broadcasting and sending a data collection downlink message at least once based on the list to be collected, the current number of communication hops of the master device and its corresponding reporting interval and collection period to obtain a data collection uplink message responded by each slave device to be collected" may include the following sub-steps:
[0170] S322-1. Group all MAC addresses in the to-be-collected list according to the current communication hop count of the master device and its corresponding reporting interval and collection period to obtain at least one to-be-collected sub-list.
[0171] In this embodiment, the list of slave devices to be sampled includes the MAC address of at least one target slave device to be sampled. In combination with the relationship mapping table described above, the sub-steps of step S322-1 may include:
[0172] S322-11. Searching for the reporting interval corresponding to the current number of communication hops of the master device from a preset relationship mapping table;
[0173] S322-12. Divide the collection period by the reporting interval corresponding to the current number of communication hops of the master device and round down the result to obtain the number of slave devices that can be collected this time;
[0174] S322-13. Based on the number of slave devices that can be collected this time, group all MAC addresses in the list to be collected to obtain at least one sub-list to be collected.
[0175] In this embodiment, if the number of MAC addresses in the list to be collected is N and the number of slave devices that can be collected this time is Y, then the number of sub-lists to be collected is the result of N ÷ Y rounded up, that is, the number of MAC addresses in the sub-list to be collected is either Y or an integer between 1 and Y-1.
[0176] S322-2. The first list of items to be collected is used as the target list of items to be collected.
[0177] S322-3. Generate a data acquisition downlink message based on the target sub-list to be acquired, the current communication hop count of the master device and its corresponding reporting interval, and broadcast the data acquisition downlink message so that each slave device that receives the data acquisition downlink message determines whether to send and the response sending time based on the data acquisition downlink message.
[0178] In the embodiment, the hop count field in the data collection downlink message is the current communication hop count of the current master device. The data collection downlink message also includes a target to-be-collected sub-list and a reporting interval corresponding to the current communication hop count of the master device. After the data collection downlink message is broadcast, it is flooded in the local communication network until the hop count field in the data collection downlink message is reduced to 0.
[0179] For each target to-be-collected slave device in the target to-be-collected sub-list, it sends a data collection uplink message to the master device at a response sending time point determined by itself.
[0180] For each target to-be-collected slave device that receives the data collection downlink message, the processing procedure when it receives the data collection downlink message is as follows:
[0181] (1) Analyzing the data collection downlink message to obtain the reporting interval and the target to-be-collected sub-list;
[0182] (2) If the target to-be-collected sub-list includes the MAC address of the target to-be-collected slave device, multiplying the arrangement serial number of the MAC address of the target to-be-collected slave device in the target to-be-collected sub-list by the reporting interval to obtain a waiting time length;
[0183] (3) Generating a data collection uplink message based on the MAC address of the target to-be-collected slave device and the reported data at a response sending time point when the waiting time length ends, and sending the data collection uplink message to the master device.
[0184] S322-4, when receiving the data collection uplink message in response to any target to-be-collected slave device, deleting the MAC address of the target to-be-collected slave device from the to-be-collected list.
[0185] In the embodiment, when the master device receives the data collection uplink message in response to any target to-be-collected slave device, it can obtain the reported data of the target to-be-collected slave device by analyzing the data collection uplink message, and then delete the MAC address of the target to-be-collected slave device from the to-be-collected list.
[0186] Optionally, the above step S500 is to determine whether there is an unresponsive slave device after each broadcast, or to determine whether the to-be-collected list is empty after the determination result of step S322-5 in the above embodiment is “yes”, if the to-be-collected list is empty, directly continue to execute step S330, if the to-be-collected list is not empty, increase the communication hop count of each to-be-collected slave device corresponding to the MAC address in the to-be-collected list by at least 1, so that it enters the next group or the next group of data collection. Figure 5
[0187] Optionally, each slave device can also be configured with an associated collection flag value, which is 0 by default. S322-4 is replaced by: when the master device receives a data collection uplink message from a target slave device to be collected, the master device sets the collection flag value of the target slave device to 1. Thus, after the result of step S322-5 in the above embodiment is "Yes", it is determined whether there is an unresponsive slave device with a collection flag value of 0 among all the slave devices corresponding to the list to be collected. If not, step S330 is directly executed. If so, the communication hop count of each unresponsive slave device is increased by at least 1. Figure 5
[0188] S322-5, determining whether the target sub-list to be collected is the last sub-list to be collected.
[0189] In the embodiment, if the target sub-list to be collected is not the last sub-list to be collected, the following step S322-6 is executed, and then step S322-3 is executed until the target sub-list to be collected is the last sub-list to be collected. If the target sub-list to be collected is the last sub-list to be collected, step S330 is executed.
[0190] S322-6, after waiting for a collection period from the moment of broadcasting the data collection downlink message, the next sub-list to be collected is taken as a new target sub-list to be collected.
[0191] Therefore, in combination with Figure 5 It can be seen that for each communication hop count, a group of data collection processes need to collect data from each target slave device corresponding to the communication hop count, and the list to be collected corresponding to the communication hop count is divided into how many sub-lists to be collected, that is, how many data collection downlink messages need to be broadcast.
[0192] In the above-described relationship mapping table, the number of collectable slave devices Y is calculated based on the collection period T and the reporting interval time corresponding to the current communication hop count of the master device, and the number of collectable slave devices Y in the collection period T gradually decreases as the current communication hop count of the master device increases.
[0193] Optionally, the number of collectable slave devices Y can also be set as a fixed value, and the relationship mapping table remains unchanged. The collection period T is flexibly regulated based on the change of the current communication hop count of the master device, that is, the list to be updated or the list to be collected is directly grouped based on the number of collectable slave devices Y, and for the current communication hop count Xi of the master device, the product of the number of collectable slave devices Y and the reporting interval time corresponding to the current communication hop count Xi of the master device in the relationship mapping table is calculated to obtain the collection period corresponding to the current communication hop count Xi of the master device, that is, the interval time between two broadcasts. For example, the number of collectable slave devices Y = 80, and the above table (1) is combined:
[0194] When the current communication hop number Xi of the master device is 0, then the collection period T=0.2s×80=16s, after each broadcast, 16s is waited before the next broadcast is performed;
[0195] When the current communication hop number Xi of the master device is 1, then the collection period T=0.4s×80=32s, after each broadcast, 32s is waited before the next broadcast is performed;
[0196] When the current communication hop number Xi of the master device is 2, then the collection period T=0.6s×80=48s, after each broadcast, 48s is waited before the next broadcast is performed;
[0197] It can be found by analogy that, as the current communication hop number Xi of the master device is larger, as the number of collectable slave devices Y is fixed, the collection period T needs to be larger, so that, in the process of collecting data of all slave devices corresponding to each communication hop number in the order from small to large, after each broadcast is sent, each target slave device can send the data collection uplink message in time, without signal interference.
[0198] The example is only an example, and is not limited herein.
[0199] The embodiment of the application further provides a data collection method applied to any slave device in an Internet of Things system, and the method comprises the following steps:
[0200] S600, when a data collection downlink message broadcasted by the master device is received, whether the data collection uplink message of the slave device needs to be sent and a response sending time are determined according to the MAC address carried in the data collection downlink message and a reporting interval time.
[0201] Optionally, the sub-step of step S600 can comprise the following steps:
[0202] S610, when the data collection downlink message is received, the data collection downlink message is parsed to obtain the reporting interval time and a MAC address list;
[0203] S620, if the MAC address list comprises the MAC address of the slave device, it is determined that the data collection uplink message of the slave device needs to be sent;
[0204] S630, the arrangement serial number of the MAC address of the slave device in the MAC address list is multiplied by the reporting interval time to obtain a waiting time length, wherein the response sending time is the time after the waiting time length from the time when the data collection downlink message is received;
[0205] S640, generating a data collection uplink message based on the MAC address of the slave device and the collected data, and sending the data collection uplink message to the master device at the response sending time.
[0206] It should be noted that the execution sequence of each step in the above method embodiment is not limited to the drawing shown, and the execution sequence of each step is subject to the actual application situation.
[0207] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0208] In the present application, the master device determines the communication hop count of each slave device during the first round of data collection, and then can collect data based on the communication hop count during the non-first round of data collection.
[0209] In the present application, during the non-first round of data collection, all slave devices corresponding to each communication hop count are collected in order from small to large, and during each group of data collection, all MAC addresses in the to-be-collected list are divided into at least one to-be-collected sub-list according to the number of collectable slave devices this time, and each to-be-collected sub-list is broadcasted once, achieving batch collection.
[0210] In the present application, the data collection downlink message broadcasted by the master device each time includes a MAC address list (to-be-updated sub-list or to-be-collected sub-list), a hop count field equal to the current communication hop count of the master device, and a reporting interval time corresponding to the current communication hop count of the master device, so that when the slave device receives the data collection downlink message, it can obtain the reporting interval time and the MAC address list in the message, and then when it confirms that the MAC address list includes its own MAC address, it multiplies the arrangement position of its own MAC address in the MAC address list by the reporting interval time to obtain a waiting time, and then at the response sending time when the waiting time ends, it generates a data collection uplink message based on its own MAC address and collected data, and sends the data collection uplink message to the master device. In this way, it is ensured that each target to-be-collected slave device can send the data collection uplink message in time within one collection period, without signal interference.
[0211] The embodiments of the present application also provide a photovoltaic power generation system, which includes a master device and a plurality of slave devices in communication connection with the master device, and the master device and the slave devices each perform the above data collection method to realize data collection of the master device on each slave device. The master device can be a data concentrator in the photovoltaic power generation system, and the slave device can be any one of an intelligent shutdown device, an intelligent optimizer, and a photovoltaic module with communication function in the photovoltaic power generation system.
[0212] Please refer to Figure 6 , Figure 6A structural schematic diagram of an electronic device is provided in the embodiments of the present application. The electronic device 300 comprises a processor 310, a memory 320 and a bus 330, and the processor 310 is connected with the memory 320 through the bus 330.
[0213] The memory 320 can be used to store software programs, and the processor 310 can execute various functional applications and data processing to realize the data acquisition method provided in the embodiments of the present application by running the software programs stored in the memory 320.
[0214] The memory 320 can be, but is not limited to, a RAM (Random Access Memory), a ROM (Read Only Memory), a FLASH (FLASH memory), a PROM (Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), an EEPROM (Electric Erasable Programmable Read-Only Memory) and the like.
[0215] The processor 310 can be an integrated circuit chip with signal processing capability. The processor 310 can be a general-purpose processor, including a CPU (Central Processing Unit), a NP (Network Processor), a SoC (System on Chip) and the like; and can also be a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0216] It can be understood that the electronic device 300 can be a concentrator in a photovoltaic power generation system based on an Internet of Things architecture, or can be a collection server in other Internet of Things systems. Figure 6 The structure shown is only schematic, and the electronic device 300 can further comprise more or less components than those shown in the drawings, or have a different configuration from that shown in the drawings. Figure 6 The structure shown is only schematic, and the electronic device 300 can further comprise more or less components than those shown in the drawings, or have a different configuration from that shown in the drawings. Figure 6 The structure shown is only schematic, and the electronic device 300 can further comprise more or less components than those shown in the drawings, or have a different configuration from that shown in the drawings. Figure 6The components shown in the figures can be implemented in hardware, software, or a combination thereof.
[0217] To sum up, the embodiment of the present application provides a data acquisition method, an electronic device and a photovoltaic power generation system. The master device stores the communication hop counts of each slave device. The communication hop count represents the number of forwarding times that the data acquisition uplink message of the slave device needs to pass through to reach the master device. The method is as follows: the master device iterates all the communication hop counts, and performs a group of data acquisition on the slave device corresponding to each communication hop count. In each group of data acquisition, the master device broadcasts the data acquisition downlink message at least once based on the current communication hop count, so that each slave device that receives the data acquisition downlink message determines whether to send the data acquisition uplink message and the response sending time according to the information carried in the downlink message. In this way, the data is collected in batches based on different communication hop counts. Compared with the traditional method of collecting the slave devices one by one using the maximum communication hop count, the communication efficiency is improved and the energy consumption is reduced under the premise of ensuring the reliability of the communication.
[0218] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical range disclosed by the present application can be easily thought of by those skilled in the art, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data collection method, characterized in that: Applied to a master device, the master device is communicatively connected to at least one slave device; the master device stores a communication hop count of each slave device, where the communication hop count of the slave device represents the number of forwarding times required for an uplink data acquisition message of the slave device to reach the master device; The method comprises: Traverse all communication hops and collect a set of data from the slave device corresponding to each communication hop; During each data collection process, a data collection downlink message is broadcast at least once based on the current communication hop count, so that each slave device that receives the data collection downlink message can determine whether to send its own data collection uplink message and the time to send the response based on the MAC address and reporting interval carried in the data collection downlink message; Among them, a group of data collection processes requires at least one round of data collection, and the data collection downlink message required in each round of data collection process includes a target sub-list to be collected, a current communication hop count and its corresponding reporting interval; the target sub-list to be collected includes a MAC address of at least one target slave device to be collected, and the target slave device to be collected is a slave device whose communication hop count is equal to the current communication hop count; the response sending time of the target slave device to be collected is determined based on the arrangement sequence number of its own MAC address in the target sub-list to be collected and the reporting interval.
2. The method according to claim 1, characterized in that The number of communication hops of each slave device is determined in the following manner: Obtain a to-be-updated list, the to-be-updated list including a MAC address of each slave device for which the number of communication hops has not been determined; The data acquisition downlink message is broadcasted at least once based on the to-be-updated list, so as to determine the communication hop count of each slave device according to the data acquisition uplink message responded by each slave device.
3. The method according to claim 2, characterized in that The step of broadcasting and sending the data acquisition downlink message at least once based on the to-be-updated list, and determining the number of communication hops of each slave device according to the data acquisition uplink message responded by each slave device, includes: Initialize the current communication hop count of the master device to a first preset value; According to the to-be-updated list, the current communication hop count of the master device and the corresponding reporting interval and the preset collection period, the data collection downlink message is broadcasted at least once, and after each broadcast, upon receiving a data collection uplink message in response from any slave device, the communication hop count is determined, and the to-be-updated list is updated; If it is not determined that the number of slave devices with the communication hop count is not 0 and the current communication hop count of the master device does not meet the preset stop condition, updating the current communication hop count of the master device; Continue to execute the step of broadcasting and sending the data acquisition downlink message at least once according to the list to be updated, the current communication hop number of the master device and the corresponding reporting interval time and the preset acquisition period, until the number of slave devices whose communication hop number is not determined is 0 or the current communication hop number of the master device meets the preset stop condition, and obtain the communication hop number of each slave device.
4. The method according to claim 3, characterized in that The step of broadcasting and sending the data acquisition downlink message at least once according to the to-be-updated list, the current communication hop count of the master device, the corresponding reporting interval, and the preset acquisition period, and determining the communication hop count of any slave device when receiving a data acquisition uplink message in response after each broadcast, and updating the to-be-updated list includes: According to the current communication hop count of the master device and its corresponding reporting interval and the collection period, all MAC addresses in the to-be-updated list are grouped to obtain at least one to-be-updated sub-list; the to-be-updated sub-list includes the MAC address of at least one target to-be-updated slave device; The first sublist to be updated is used as the target sublist to be updated; Generate the data acquisition downlink message based on the target sublist to be updated, the current communication hop count of the master device and its corresponding reporting interval, and broadcast the data acquisition downlink message, so that each slave device that receives the data acquisition downlink message determines whether to send its own data acquisition uplink message and the response sending time based on the data acquisition downlink message, wherein each target slave device to be updated responds to the master device with the data acquisition uplink message at the response sending time determined by itself; When receiving a data acquisition uplink message responded by any of the target to-be-updated slave devices, determining the communication hop count of the target to-be-updated slave device based on the data acquisition uplink message, and deleting the MAC address of the target to-be-updated slave device from the to-be-updated list; If the target sublist to be updated is not the last sublist to be updated, then after waiting for the acquisition period from the moment the data acquisition downlink message is broadcast, the next sublist to be updated is used as the new target sublist to be updated, and the steps of generating the data acquisition downlink message based on the target sublist to be updated, the current number of communication hops of the master device and its corresponding reporting interval time, and broadcasting the data acquisition downlink message are continued until the target sublist to be updated is the last sublist to be updated.
5. The method according to claim 4, characterized in that The step of grouping all MAC addresses in the to-be-updated list according to the current communication hop count of the master device and its corresponding reporting interval and the collection period to obtain at least one to-be-updated sub-list includes: Searching for a reporting interval corresponding to the current communication hop count of the master device from a preset relationship mapping table; the relationship mapping table includes reporting intervals corresponding to a plurality of different hop counts; The result obtained by dividing the collection period by the reporting interval corresponding to the current number of communication hops of the master device is rounded down to obtain the number of slave devices that can be updated this time; Based on the number of slave devices that can be updated this time, all MAC addresses in the list to be updated are grouped to obtain at least one sub-list to be updated.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: During each data collection process, after a period of time after the broadcast transmission, it is determined whether there are any unresponsive slave devices in the broadcast transmission; the unresponsive slave devices are slave devices in the target slave device list included in the data collection downlink message sent by the broadcast transmission, which have failed to send the data collection uplink message to the master device within a period of time after the master device broadcast transmission; If so, the communication hop count of each of the unresponsive slave devices is updated according to a preset rule.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: During each data collection process, when a data collection uplink message is received, the communication hop count of the corresponding slave device is updated according to the information in the data collection uplink message.
8. The method according to claim 7, characterized in that The step of updating the communication hop count of the corresponding slave device according to the information in the data acquisition uplink message includes: Determine the number of forwarding times the data collection uplink message has undergone based on the information carried in the data collection uplink message; Determine whether the communication hop count of the corresponding slave device is consistent with the forwarding count; If they are inconsistent, change the communication hop count of the corresponding slave device to the forwarding count.
9. The method according to any one of claims 1 to 5, characterized in that The step of traversing all communication hops and collecting a set of data from the slave device corresponding to each communication hop includes: Initializing the current communication hop count of the master device to a second preset value; Screening out each slave device to be collected whose communication hop number is equal to the current communication hop number of the master device, and performing a group of data collection on all the slave devices to be collected by broadcasting and sending the data collection downlink message at least once; If the current communication hop number of the master device is not equal to the preset stop threshold, the current communication hop number of the master device is increased by 1, and the steps of screening out each slave device to be collected whose communication hop number is equal to the current communication hop number of the master device, and performing a group of data collection on all the slave devices to be collected by broadcasting the data collection downlink message at least once, are continued until the current communication hop number of the master device is equal to the preset stop threshold.
10. The method according to claim 9, characterized in that The step of screening out each slave device to be collected whose communication hop number is equal to the current communication hop number of the master device, and performing a group of data collection on all the slave devices to be collected by broadcasting and sending the data collection downlink message at least once, includes: Filter out the MAC address of each slave device to be acquired whose communication hop number is equal to the current communication hop number of the master device from the MAC addresses of all slave devices, and obtain a list to be acquired; According to the list to be collected, the current communication hop count of the master device and its corresponding reporting interval and the preset collection period, the data collection downlink message is broadcasted at least once to obtain the data collection uplink message responded by each slave device to be collected.
11. The method according to claim 10, characterized in that The step of broadcasting and sending the data acquisition downlink message at least once according to the to-be-acquired list, the current communication hop count of the master device and its corresponding reporting interval and the preset acquisition period to obtain the data acquisition uplink message responded by each to-be-acquired slave device includes: According to the current communication hop count of the master device and its corresponding reporting interval and the collection period, all MAC addresses in the to-be-collected list are grouped to obtain at least one to-be-collected sub-list; the to-be-collected sub-list includes the MAC address of at least one target to-be-collected slave device; The first waiting list is used as the target waiting list; Generate the data acquisition downlink message based on the target slave list to be acquired, the current communication hop count of the master device and its corresponding reporting interval, and broadcast the data acquisition downlink message, so that each slave device that receives the data acquisition downlink message determines whether to send and the response sending time based on the data acquisition downlink message, wherein each target slave device to be acquired sends the data acquisition uplink message to the master device at the response sending time determined by itself; When receiving a data acquisition uplink message in response to any of the target slave devices to be acquired, deleting the MAC address of the target slave device to be acquired from the list to be acquired; If the target sub-list to be collected is not the last sub-list to be collected, then after waiting for the collection period from the moment the data collection downlink message is broadcasted, the next sub-list to be collected is used as the new target sub-list to be collected, and the steps of generating the data collection downlink message based on the target sub-list to be collected, the current number of communication hops of the master device and its corresponding reporting interval, and broadcasting the data collection downlink message are continued until the target sub-list to be collected is the last sub-list to be collected.
12. The method according to claim 11, characterized in that The step of grouping all MAC addresses in the to-be-collected list according to the current communication hop count of the master device and its corresponding reporting interval and the collection period to obtain at least one to-be-collected sub-list comprises: Searching for a reporting interval corresponding to the current communication hop count of the master device from a preset relationship mapping table; the relationship mapping table includes reporting intervals corresponding to a plurality of different hop counts; The result obtained by dividing the collection period by the reporting interval corresponding to the current communication hop count of the master device is rounded down to obtain the number of slave devices that can be collected this time; Based on the number of slave devices that can be collected this time, all MAC addresses in the list to be collected are grouped to obtain at least one sub-list to be collected.
13. A data collection method, characterized in that: Applied to a slave device, the slave device being communicatively connected to a master device; the method comprises: Upon receiving the data acquisition downlink message broadcasted by the master device, the data acquisition downlink message is parsed to obtain the reporting interval and MAC address list carried in the data acquisition downlink message; If the MAC address list includes its own MAC address, it is determined that its own data collection uplink message needs to be sent; Multiply the sequence number of its own MAC address in the MAC address list by the reporting interval to obtain the waiting time; wherein, the time after the waiting time from the moment of receiving the data collection downlink message is the time of sending the response; The data acquisition uplink message is generated based on its own MAC address and reported data, and the data acquisition uplink message is sent to the master device at the response sending time.
14. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement: the data collection method according to any one of claims 1 to 12, or the data collection method according to any one of claim 13.
15. A photovoltaic power generation system, characterized in that: The method comprises a master device and a plurality of slave devices communicatively connected to the master device, wherein the master device executes the data acquisition method according to any one of claims 1 to 12, and the slave devices execute the data acquisition method according to any one of claim 13, so as to realize data acquisition of each slave device by the master device; The master device is a data concentrator in a photovoltaic power generation system, and the slave device is any one of an intelligent switch, an intelligent optimizer, and a photovoltaic component with communication function in the photovoltaic power generation system.
Citation Information
Patent Citations
Fault detection method and device of IP unvarnished transmission ad hoc network and computer equipment
CN115134271A
Master device and communication method
US20230066623A1