CN113076268A - Method for collecting slave equipment data in batches - Google Patents

Method for collecting slave equipment data in batches Download PDF

Info

Publication number
CN113076268A
CN113076268A CN202110351100.9A CN202110351100A CN113076268A CN 113076268 A CN113076268 A CN 113076268A CN 202110351100 A CN202110351100 A CN 202110351100A CN 113076268 A CN113076268 A CN 113076268A
Authority
CN
China
Prior art keywords
data
slave
register
slave device
register address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110351100.9A
Other languages
Chinese (zh)
Inventor
刘三明
刘佳
雷治策
云佩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Anguan Tech Co ltd
Original Assignee
Shenzhen Anguan Tech Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Anguan Tech Co ltd filed Critical Shenzhen Anguan Tech Co ltd
Priority to CN202110351100.9A priority Critical patent/CN113076268A/en
Publication of CN113076268A publication Critical patent/CN113076268A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/36Handling requests for interconnection or transfer for access to common bus or bus system
    • G06F13/362Handling requests for interconnection or transfer for access to common bus or bus system with centralised access control

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method for collecting slave equipment data in batches, which is characterized in that slave equipment sets are obtained by acquiring basic parameters of slave equipment to be collected and classifying the slave equipment to be collected according to the basic parameters. And then, register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data. And finally, acquiring the data stored in the slave equipment to be acquired in batch according to the hash bucket. The invention can lead the host equipment to collect the data of the slave equipment in batch, and solves the problem that the host equipment in the prior art has to collect the data in a polling collection mode of the slave equipment, which causes lower data collection efficiency.

Description

Method for collecting slave equipment data in batches
Technical Field
The invention relates to the field of Internet of things, in particular to a method for collecting slave equipment data in batches.
Background
The Modbus protocol adopts a master-slave working mode, allows one host device to communicate with a plurality of slave devices, the address of each slave device is set by a user, and the address range is 1-255. The Modbus protocol has the advantages of simple and clear structure, reliable communication and large communication data volume. However, at present, when the master device collects data of the slave devices through the Modbus protocol, data collection must be performed in a polling collection manner of the slave devices, which results in low data collection efficiency.
Thus, there is still a need for improvement and development of the prior art.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method for batch collecting data of slave devices, aiming at solving the problem that in the prior art, a master device must collect data in a polling collection manner of the slave devices, resulting in low data collection efficiency.
The technical scheme adopted by the invention for solving the problems is as follows:
in a first aspect, an embodiment of the present invention provides a method for collecting slave device data in batches, where the method includes:
obtaining basic parameters of slave equipment to be collected, and classifying the slave equipment to be collected according to the basic parameters to obtain a slave equipment set;
register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data;
and acquiring the data stored in the slave equipment to be acquired in batches according to the hash bucket.
In one implementation manner, the obtaining basic parameters of the to-be-collected slave devices, and classifying the to-be-collected slave devices according to the basic parameters to obtain a slave device set includes:
acquiring basic parameters of the slave equipment to be acquired, and determining station address data and functional code data corresponding to the slave equipment to be acquired according to the basic parameters;
and taking all the slave devices to be collected with the same station address data and function code data as a slave device set.
In one implementation, the obtaining register address range data corresponding to each slave device in the slave device set, and determining hash buckets corresponding to the slave devices according to the register address range data includes:
taking any one slave device in the slave device set as a slave device to be processed;
register address data and register length data of the to-be-processed slave equipment are obtained, and register address range data corresponding to the to-be-processed slave equipment are determined according to the register address data and the register length data;
determining hash bucket index values corresponding to the slave devices to be processed according to the register address range data, and obtaining hash bucket index values corresponding to each slave device in the slave device set;
and determining the hash bucket corresponding to each slave device according to the hash bucket index value corresponding to each slave device.
In one implementation, the determining, according to the register address data and the register length data, register address range data corresponding to the slave device to be processed includes:
adding the register address data and the register length data and subtracting 1 to obtain cut-off address data corresponding to the slave equipment to be processed;
and determining register address range data corresponding to the slave equipment to be processed according to the starting address data and the ending address data by taking the register address data as the starting address data.
In one implementation, the determining, according to the register address range data, a hash bucket index value corresponding to the slave device to be processed includes:
acquiring preset maximum batch acquisition register length data, and performing integer division and downward integer rounding on the register address range data according to the maximum batch acquisition register length data to obtain an integer value;
and determining a hash bucket index value corresponding to the slave equipment to be processed according to the integer value.
In one implementation manner, the batch collection of the data stored in the slave device to be collected according to the hash bucket includes:
storing the basic parameters of each slave device into a corresponding hash bucket according to the basic parameters of the slave device to be collected;
taking any one of hash buckets corresponding to the slave devices as a batch acquisition unit;
register address data corresponding to the batch acquisition units are obtained, and target register address data are obtained;
acquiring register length data corresponding to the batch acquisition units to obtain target register length data;
acquiring station address data corresponding to the batch acquisition units and functional code data corresponding to the batch acquisition units to obtain target station address data and target functional code data;
and acquiring data stored in the slave equipment to be acquired in batch according to the target register address data, the target register length data, the target station address data and the target function code data.
In an implementation manner, the obtaining of the register address data corresponding to the batch acquisition unit to obtain the target register address data includes:
acquiring hash bucket index values corresponding to the batch acquisition units;
multiplying the hash bucket index value corresponding to the batch acquisition unit with the maximum batch acquisition register length data to obtain register address data corresponding to the batch acquisition unit;
and taking the register address data corresponding to the batch acquisition unit as target register address data.
In an implementation manner, the obtaining of the register length data corresponding to the batch acquisition unit to obtain the target register length data includes:
adding the address data of the target register and the length data of the maximum batch acquisition register to obtain a numerical value to be verified;
acquiring maximum register address data of a slave equipment set corresponding to the batch acquisition unit, and comparing the value to be verified with the maximum register address data;
when the value to be verified is smaller than or equal to the maximum register address data, taking the maximum batch acquisition register length data as register length data corresponding to the batch acquisition unit;
and when the value to be verified is larger than the maximum register address data, subtracting the maximum register address data from the target register address data and adding 1 to obtain the register length data corresponding to the batch acquisition unit.
In one implementation, the obtaining the maximum register address data of the set of slave devices corresponding to the batch collection unit includes:
register address range data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit are obtained;
according to register address range data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit, determining cut-off address data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit, and obtaining cut-off address data to be screened;
and taking the cutoff address data with the largest value in the cutoff address data to be screened as the maximum register address data of the slave equipment set corresponding to the batch acquisition unit.
In one implementation manner, the batch collecting data stored in the slave device to be collected according to the target register address data, the target register length data, the target station address data, and the target function code data includes:
generating a batch acquisition instruction according to the target register address data, the target register length data, the target station address data and the target function code data;
and carrying out batch acquisition on the data stored in the slave equipment to be acquired through the batch acquisition instruction.
The invention has the beneficial effects that: according to the embodiment of the invention, the basic parameters of the slave equipment to be collected are obtained, and the slave equipment to be collected is classified according to the basic parameters to obtain the slave equipment set. And then, register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data. And finally, acquiring the data stored in the slave equipment to be acquired in batch according to the hash bucket. The invention can lead the host equipment to collect the data of the slave equipment in batch, and solves the problem that the host equipment in the prior art has to collect the data in a polling collection mode of the slave equipment, which causes lower data collection efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for batch collection of slave device data according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of data flow provided in the embodiment of the present invention.
Fig. 3 is a schematic diagram of internal modules of an apparatus for batch collection of slave device data according to an embodiment of the present invention.
Fig. 4 is a schematic block diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, if directional indications (such as up, down, left, right, front, and back … …) are involved in the embodiment of the present invention, the directional indications are only used to explain the relative positional relationship between the components, the movement situation, and the like in a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indications are changed accordingly.
The intelligent data acquisition system mainly comprises an upper computer and a front end. Front-end refers to independently developed field data collection devices. The operation parameters of the front end and the acquired signals need to interact with an upper computer. Therefore, a set of reliable, mature and easy-to-implement communication protocols is the key for stable operation of the intelligent data acquisition system, wherein the Modbus protocol is a better choice.
The Modbus protocol adopts a master-slave working mode, allows one host device to communicate with a plurality of slave devices, the address of each slave device is set by a user, and the address range is 1-255. The Modbus protocol has the advantages of simple and clear structure, reliable communication and large communication data volume. However, at present, when the master device collects data of the slave devices through the Modbus protocol, data collection must be performed in a polling collection manner of the slave devices, which results in low data collection efficiency.
In view of the above-mentioned defects in the prior art, the present invention provides a method for collecting slave device data in batches, which obtains a set of slave devices by obtaining basic parameters of slave devices to be collected and classifying the slave devices to be collected according to the basic parameters. And then, register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data. And finally, acquiring the data stored in the slave equipment to be acquired in batches according to the hash buckets corresponding to the slave equipment respectively. The invention can lead the host equipment to collect the data of the slave equipment in batch, and solves the problem that the host equipment in the prior art has to collect the data in a polling collection mode of the slave equipment, which causes lower data collection efficiency.
As shown in fig. 1, the method comprises the steps of:
step S100, obtaining basic parameters of the slave equipment to be collected, and classifying the slave equipment to be collected according to the basic parameters to obtain a slave equipment set.
Specifically, in order to enable the master device to successfully collect data on the slave devices in batch, in the present embodiment, firstly, the slave devices need to be classified, as shown in fig. 2, a specific classification result is determined according to a basic parameter of each slave device itself, and since the basic parameter of the slave device may reflect some attribute information of the slave device itself, such as address information of the slave device, function information of the slave device, and the like, the present embodiment classifies the slave devices according to the basic parameter of the slave device, and can classify the slave devices having close attributes, so as to realize better batch collection of device data for different types of slave devices in the following process.
In one implementation, the step S100 specifically includes the following steps:
step S101, obtaining basic parameters of the slave equipment to be collected, and determining station address data and functional code data corresponding to the slave equipment to be collected according to the basic parameters;
step S102, all the slave devices to be collected with the same station address data and the same function code data are used as a slave device set.
Specifically, in this embodiment, it is required to obtain basic parameters of the slave device to be acquired, and obtain station address data and function code data in the basic parameters, where the station address data may indicate a base station to which the slave device belongs, and the function code data may reflect a type of a function executed by the slave device to be acquired. In the embodiment, the slave devices with the same station address data and function code data are classified into one slave device set so as to realize the subsequent batch collection of the slave device data which is regularly and sequentially executed.
As shown in fig. 1, the method further comprises the steps of:
step S200, register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to each slave device are determined according to the register address range data.
Specifically, after the slave devices to be collected are classified into a plurality of slave device sets, if the batch collection process of the slave device data is directly executed according to the slave device sets, the situation that data collection fails due to the fact that the address range of the slave device register is discontinuous is likely to occur. Therefore, in order to smoothly perform batch collection of data of the slave devices, in this embodiment, register address range data corresponding to each slave device in the slave device set needs to be acquired, hash buckets corresponding to each slave device are determined according to the register address range data, each hash bucket is used as a new batch collection unit, and the data of the slave devices are collected in batches according to the batch collection unit during collection.
In one implementation, the step S200 specifically includes the following steps:
step S201, taking any slave device in the slave device set as a slave device to be processed;
step S202, register address data and register length data of the to-be-processed slave device are obtained, and register address range data corresponding to the to-be-processed slave device are determined according to the register address data and the register length data;
step S203, determining a hash bucket index value corresponding to the slave device to be processed according to the register address range data, and obtaining hash bucket index values corresponding to each slave device in the slave device set;
and step S204, determining the hash bucket corresponding to each slave device according to the hash bucket index value corresponding to each slave device.
It should be noted that, in this embodiment, it is necessary to determine the hash bucket corresponding to each slave device in each slave device set, and since the same determination method is adopted, the embodiment takes one of the slave devices as an example to describe how to determine the hash bucket corresponding to the slave device. Specifically, any one of the slave devices in the slave device set is used as a slave device to be processed, then register address data and register length data of the slave device to be processed are obtained, and register address range data corresponding to the slave device to be processed is determined according to the register address data and the register length data. In an implementation manner, in order to accurately determine register address range data corresponding to the to-be-processed slave device, in this embodiment, the register address data and the register length data are added and then subtracted by 1 to obtain ending address data corresponding to the to-be-processed slave device, and then the register address data is used as start address data, and the register address range data corresponding to the to-be-processed slave device is determined according to the start address data and the ending address data. For example, if the register address data of the to-be-processed slave device a is 24 and the register length data is 8, the corresponding cutoff address data of the to-be-processed slave device a is 24+8-1, which is 31, and the corresponding register address range data is 24-31.
After determining the register address range data corresponding to the to-be-processed slave device, the embodiment needs to further determine the hash bucket index value corresponding to the register address range data corresponding to the to-be-processed slave device according to the register address range data corresponding to the to-be-processed slave device. The hash table is a data structure that is directly accessed based on the key value, and it accesses the record by mapping the key value to a location in the table to speed up the lookup. The hash bucket index value is an index of the hash array, and converts the searched key code value into an index in the hash table through a certain hash algorithm. In an implementation manner, in order to determine the hash bucket index value, in this embodiment, it is necessary to obtain preset maximum batch acquisition register length data, perform integer division on the register address range data of each slave device according to the maximum batch acquisition register length data and perform downward rounding to obtain an integer value, and then determine the hash bucket index value corresponding to each slave device according to the integer value. For example, if the register address range data of the slave device a to be collected is 9 to 12, and the maximum batch collection register length data is 8, the value obtained by dividing 9 by 8 is equal to 1.125, the value obtained by rounding down is 1, the value obtained by dividing 10 by 8 is equal to 1.25, and the value obtained by rounding down is 1, the hash bucket index value corresponding to the slave device a to be collected is 1, and the hash bucket index value corresponds to the hash bucket 1.
As shown in fig. 1, the method further comprises the steps of:
and step S300, acquiring the data stored in the slave equipment to be acquired in batch according to the Hash barrel.
In brief, in this embodiment, it is required to determine hash bucket index values corresponding to all slave devices in each slave device set, and further determine hash buckets corresponding to all slave devices in each slave device set, and perform batch collection of the slave devices by using one hash bucket as a batch collection unit.
In one implementation, the step S300 specifically includes the following steps:
step S301, storing the basic parameters of each slave device into a corresponding hash bucket according to the basic parameters of the slave device to be collected;
step S302, any one of the hash buckets corresponding to the slave devices is used as a batch acquisition unit;
step S303, register address data corresponding to the batch acquisition units are obtained, and target register address data are obtained;
s304, acquiring register length data corresponding to the batch acquisition units to obtain target register length data;
step S305, acquiring station address data corresponding to the batch acquisition unit and functional code data corresponding to the batch acquisition unit to obtain target station address data and target functional code data;
step S306, collecting data stored in the slave device to be collected in batch according to the target register address data, the target register length data, the target station address data and the target function code data.
First, for each slave device set, basic parameters of each slave device in each slave device set need to be stored in its corresponding hash bucket. In the present embodiment, any one of the hash buckets corresponding to each slave device is used as a batch acquisition unit, and it can be understood that each hash bucket is a batch acquisition unit, and the principles of batch acquisition of slave device data are the same.
Firstly, register address data corresponding to one batch acquisition unit is obtained, and target register address data is obtained. Specifically, in this embodiment, the register address data corresponding to the batch acquisition unit is obtained by obtaining the hash bucket index value corresponding to the batch acquisition unit, multiplying the hash bucket index value corresponding to the batch acquisition unit by the maximum batch acquisition register length data, and then taking the register address data corresponding to the batch acquisition unit as the target register address data. For example, assuming that the hash bucket index value corresponding to the batch acquisition unit a is 3 and the maximum batch acquisition register length is 8, the target register address corresponding to the batch acquisition unit a is 3 × 8 — 24.
And then, register length data corresponding to the batch acquisition units are required to be acquired to obtain target register length data. In an implementation manner, the obtained address data of the target register is added to the length data of the maximum batch collection register to obtain a value to be verified. And then, acquiring the maximum register address data of the slave equipment set corresponding to the batch acquisition unit, and comparing the value to be verified with the maximum register address data. Specifically, the maximum register address data of the slave device set corresponding to the batch acquisition unit may be obtained by: register address range data respectively corresponding to each slave device in a slave device set corresponding to the batch acquisition unit is obtained, and according to the register address range data respectively corresponding to each slave device in the slave device set corresponding to the batch acquisition unit, cutoff address data respectively corresponding to each slave device in the slave device set corresponding to the batch acquisition unit is determined, so that cutoff address data to be screened are obtained. And then, the cutoff address data with the largest value in the cutoff address data to be screened is used as the maximum register address data of the slave equipment set corresponding to the batch acquisition unit. For example, if the slave device set B corresponding to the batch collection unit B includes slave devices B1, B2, and B3, where register address ranges of B1, B2, and B3 are 8 to 12, 9 to 15, and 10 to 19, respectively, the respective cut-off address data of B1, B2, and B3 are 12, 15, and 19, respectively, where 19 is the maximum value, and then 19 is used as the maximum register address of the slave device set B.
The value to be verified is then compared to the maximum register address data. And when the value to be verified is less than or equal to the maximum register address data, taking the maximum batch acquisition register length data as the register length data corresponding to the batch acquisition unit. And when the value to be verified is larger than the maximum register address data, subtracting the maximum register address data from the obtained target register address data and adding 1 to obtain the register length data corresponding to the batch acquisition unit. For example, assuming that the target register address data corresponding to the batch acquisition unit a is 24 and the maximum batch acquisition register length is 8, the value to be verified is 24+8 equals 32, and the maximum register address of the slave device set corresponding to the batch acquisition unit a is 30, the register length corresponding to the batch acquisition unit a is 7 according to 30-24+1 equals 7.
And finally, acquiring station address data corresponding to the batch acquisition unit and functional code data corresponding to the batch acquisition unit to obtain target station address data and target functional code data. And then, acquiring data stored in the slave equipment to be acquired in batch according to the target register address data, the target register length data, the target station address data and the target function code data. Specifically, in order to realize batch acquisition of data of the slave devices, in this embodiment, a batch acquisition instruction needs to be generated according to the obtained target register address data, target register length data, target station address data, and target function code data, and then the batch acquisition instruction is used to perform batch acquisition on data stored in the slave devices to be acquired. It can be understood that, in order to perform batch collection on data on all slave devices to be collected, in this embodiment, a batch collection instruction for each hash bucket corresponding to each slave device set needs to be generated, and the batch collection instruction polls data in each hash bucket corresponding to each slave device set in sequence.
Based on the above embodiment, the present invention further provides a device for collecting slave device data in batches, as shown in fig. 3, the device includes:
the acquisition module 01 is used for acquiring basic parameters of the slave equipment to be acquired, classifying the slave equipment to be acquired according to the basic parameters, and acquiring a slave equipment set;
a determining module 02, configured to obtain register address range data corresponding to each slave device in the slave device set, and determine hash buckets corresponding to each slave device according to the register address range data;
and the acquisition module 03 is configured to acquire the data stored in the slave device to be acquired in batch according to the hash bucket.
Based on the above embodiments, the present invention further provides a terminal, and a schematic block diagram thereof may be as shown in fig. 4. The terminal comprises a processor, a memory, a network interface and a display screen which are connected through a system bus. Wherein the processor of the terminal is configured to provide computing and control capabilities. The memory of the terminal comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the terminal is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a method of batch gathering slave device data. The display screen of the terminal can be a liquid crystal display screen or an electronic ink display screen.
It will be understood by those skilled in the art that the block diagram of fig. 4 is a block diagram of only a portion of the structure associated with the inventive arrangements and is not intended to limit the terminals to which the inventive arrangements may be applied, and that a particular terminal may include more or less components than those shown, or may have some components combined, or may have a different arrangement of components.
In one implementation, one or more programs are stored in a memory of the terminal and configured to be executed by one or more processors include instructions for performing a method of batch gathering slave device data.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
In summary, the present invention discloses a method for collecting slave device data in batch, which obtains a set of slave devices by obtaining basic parameters of slave devices to be collected and classifying the slave devices to be collected according to the basic parameters. And then, register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data. And finally, acquiring the data stored in the slave equipment to be acquired in batch according to the hash bucket. The invention can lead the host equipment to collect the data of the slave equipment in batch, and solves the problem that the host equipment in the prior art has to collect the data in a polling collection mode of the slave equipment, which causes lower data collection efficiency.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.

Claims (10)

1. A method of collecting slave device data in batches, the method comprising:
obtaining basic parameters of slave equipment to be collected, and classifying the slave equipment to be collected according to the basic parameters to obtain a slave equipment set;
register address range data corresponding to each slave device in the slave device set is obtained, and hash buckets corresponding to the slave devices are determined according to the register address range data;
and acquiring the data stored in the slave equipment to be acquired in batches according to the hash bucket.
2. The method according to claim 1, wherein the obtaining of the basic parameters of the slave devices to be collected and the classifying of the slave devices to be collected according to the basic parameters to obtain the set of slave devices comprises:
acquiring basic parameters of the slave equipment to be acquired, and determining station address data and functional code data corresponding to the slave equipment to be acquired according to the basic parameters;
and taking all the slave devices to be collected with the same station address data and function code data as a slave device set.
3. The method according to claim 1, wherein the obtaining register address range data corresponding to each slave device in the slave device set, and determining the hash bucket corresponding to each slave device according to the register address range data comprises:
taking any one slave device in the slave device set as a slave device to be processed;
register address data and register length data of the to-be-processed slave equipment are obtained, and register address range data corresponding to the to-be-processed slave equipment are determined according to the register address data and the register length data;
determining hash bucket index values corresponding to the slave devices to be processed according to the register address range data, and obtaining hash bucket index values corresponding to each slave device in the slave device set;
and determining the hash bucket corresponding to each slave device according to the hash bucket index value corresponding to each slave device.
4. The method of claim 3, wherein the determining register address range data corresponding to the slave device to be processed according to the register address data and the register length data comprises:
adding the register address data and the register length data and subtracting 1 to obtain cut-off address data corresponding to the slave equipment to be processed;
and determining register address range data corresponding to the slave equipment to be processed according to the starting address data and the ending address data by taking the register address data as the starting address data.
5. The method as claimed in claim 3, wherein said determining the hash bucket index value corresponding to the slave device to be processed according to the register address range data includes:
acquiring preset maximum batch acquisition register length data, and performing integer division and downward integer rounding on the register address range data according to the maximum batch acquisition register length data to obtain an integer value;
and determining a hash bucket index value corresponding to the slave equipment to be processed according to the integer value.
6. The method for batch collection of slave device data according to claim 5, wherein the batch collection of the data stored in the slave device to be collected according to the hash bucket comprises:
storing the basic parameters of each slave device into a corresponding hash bucket according to the basic parameters of the slave device to be collected;
taking any one of hash buckets corresponding to the slave devices as a batch acquisition unit;
register address data corresponding to the batch acquisition units are obtained, and target register address data are obtained;
acquiring register length data corresponding to the batch acquisition units to obtain target register length data;
acquiring station address data corresponding to the batch acquisition units and functional code data corresponding to the batch acquisition units to obtain target station address data and target functional code data;
and acquiring data stored in the slave equipment to be acquired in batch according to the target register address data, the target register length data, the target station address data and the target function code data.
7. The method of claim 6, wherein the obtaining register address data corresponding to the batch collection unit to obtain target register address data comprises:
acquiring hash bucket index values corresponding to the batch acquisition units;
multiplying the hash bucket index value corresponding to the batch acquisition unit with the maximum batch acquisition register length data to obtain register address data corresponding to the batch acquisition unit;
and taking the register address data corresponding to the batch acquisition unit as target register address data.
8. The method of claim 7, wherein the obtaining of the register length data corresponding to the batch collection unit to obtain the target register length data comprises:
adding the address data of the target register and the length data of the maximum batch acquisition register to obtain a numerical value to be verified;
acquiring maximum register address data of a slave equipment set corresponding to the batch acquisition unit, and comparing the value to be verified with the maximum register address data;
when the value to be verified is smaller than or equal to the maximum register address data, taking the maximum batch acquisition register length data as register length data corresponding to the batch acquisition unit;
and when the value to be verified is larger than the maximum register address data, subtracting the maximum register address data from the target register address data and adding 1 to obtain the register length data corresponding to the batch acquisition unit.
9. The method of claim 8, wherein the obtaining of the maximum register address data of the slave device set corresponding to the batch collection unit comprises:
register address range data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit are obtained;
according to register address range data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit, determining cut-off address data corresponding to each slave device in the slave device set corresponding to the batch acquisition unit, and obtaining cut-off address data to be screened;
and taking the cutoff address data with the largest value in the cutoff address data to be screened as the maximum register address data of the slave equipment set corresponding to the batch acquisition unit.
10. The method for batch collecting data of slave devices according to claim 6, wherein the batch collecting data stored in the slave devices to be collected according to the target register address data, the target register length data, the target station address data and the target function code data comprises:
generating a batch acquisition instruction according to the target register address data, the target register length data, the target station address data and the target function code data;
and carrying out batch acquisition on the data stored in the slave equipment to be acquired through the batch acquisition instruction.
CN202110351100.9A 2021-03-31 2021-03-31 Method for collecting slave equipment data in batches Pending CN113076268A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110351100.9A CN113076268A (en) 2021-03-31 2021-03-31 Method for collecting slave equipment data in batches

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110351100.9A CN113076268A (en) 2021-03-31 2021-03-31 Method for collecting slave equipment data in batches

Publications (1)

Publication Number Publication Date
CN113076268A true CN113076268A (en) 2021-07-06

Family

ID=76614296

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110351100.9A Pending CN113076268A (en) 2021-03-31 2021-03-31 Method for collecting slave equipment data in batches

Country Status (1)

Country Link
CN (1) CN113076268A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070732A (en) * 2021-11-17 2022-02-18 远景智能国际私人投资有限公司 Data processing method, device, equipment and medium based on Internet of things

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070732A (en) * 2021-11-17 2022-02-18 远景智能国际私人投资有限公司 Data processing method, device, equipment and medium based on Internet of things
CN114070732B (en) * 2021-11-17 2024-01-05 远景智能国际私人投资有限公司 Data processing method, device, equipment and medium based on Internet of things

Similar Documents

Publication Publication Date Title
CN111371638B (en) Intelligent equipment testing method and device, server and storage medium
CN109408355B (en) Test case obtaining method and device
CN111737564A (en) Information query method, device, equipment and medium
CN113076268A (en) Method for collecting slave equipment data in batches
CN113328927B (en) Industrial Internet of things gateway with calculation, storage and network exchange functions
CN111061802A (en) Power data management processing method and device and storage medium
CN113177015B (en) Frame header-based serial port communication method and serial port chip
CN109218131B (en) Network monitoring method and device, computer equipment and storage medium
CN111625600B (en) Data storage processing method, system, computer equipment and storage medium
CN111414395B (en) Data processing method, system and computer equipment
CN115639578B (en) Beidou navigation positioning monitoring processing method and system
CN116467372A (en) Automatic database conversion method and device, electronic equipment and storage medium
CN112291212B (en) Static rule management method and device, electronic equipment and storage medium
CN113704177A (en) Storage method, system and related components of server firmware upgrade file
CN109284260B (en) Big data file reading method and device, computer equipment and storage medium
CN113468275A (en) Data importing method and device of graph database, storage medium and electronic equipment
CN107679093B (en) Data query method and device
CN111488226A (en) Data processing method of mobile terminal and computer
CN113111012B (en) Application data locator generation method and application data locating method
CN117311257B (en) PLC centralized control method and system applied to cell formation composition
CN112650682B (en) Page test processing method and device, electronic equipment and readable storage medium
CN113095689A (en) Performance calculation method and device, mobile terminal and readable storage medium
CN117851397A (en) Data quality detection method, device, equipment and storage medium
CN111796876A (en) Method, device, equipment and medium for defining requirements on storage equipment based on user
CN118093197A (en) Memory page migration method and device, memory device and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination