CN116028674A - Intelligent terminal data communication method and system - Google Patents

Intelligent terminal data communication method and system Download PDF

Info

Publication number
CN116028674A
CN116028674A CN202211198021.XA CN202211198021A CN116028674A CN 116028674 A CN116028674 A CN 116028674A CN 202211198021 A CN202211198021 A CN 202211198021A CN 116028674 A CN116028674 A CN 116028674A
Authority
CN
China
Prior art keywords
data
tree
communication
level
branch
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
CN202211198021.XA
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.)
Hubei University of Science and Technology
Original Assignee
Hubei University of Science and Technology
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 Hubei University of Science and Technology filed Critical Hubei University of Science and Technology
Priority to CN202211198021.XA priority Critical patent/CN116028674A/en
Publication of CN116028674A publication Critical patent/CN116028674A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides an intelligent terminal data communication method and system, wherein the method comprises the following steps: acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches; the data structure of each level of the ordered multi-way tree of the data field is constructed, based on the same data structure, the data is searched for being located at the specific leaf position of the multi-way tree, after the continuously transformed serial communication data are converted into the multi-way tree, the data types and the data values are respectively distributed to different branches according to the respective rules, so that the maintenance is convenient, when one type of data is needed to be added, one branch is needed to be added, any other branch is not needed to be modified, and when one type of data is reduced, one branch is also needed to be reduced, and any other branch is not needed to be modified; all branches use the same data structure, and the structure is simple.

Description

Intelligent terminal data communication method and system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and a system for data communication between intelligent terminals.
Background
Along with the increasing application scenes of the intelligent energy intelligent terminals of the Internet plus, the number of the terminals is increased almost in the order of geometric progression, and the types and the data amounts of energy data generated by each terminal are massive. Although data interaction is generally summarized into control codes and data fields, the types and the combinations of the control codes and the data fields are tens of thousands, which brings great difficulty to data communication. The method commonly used at present is to write a control program for each based on each serial communication consideration processing method, however, the problem caused by this way is that:
firstly, the method is complex, because the communication is carried out serially, each communication can correspond to different control codes and different data fields, and each analysis method can be different, so that the processing methods are various;
secondly, the data structure is complex, the data domain comprises structured, semi-structured and unstructured data, and then the corresponding data structure can be various;
thirdly, maintenance is difficult, a control domain and a data domain are added or reduced, and adjustment of a method and a data structure can be involved;
fourthly, the program quantity is very large, a large storage space is occupied, and the execution efficiency is low;
fifth, the kinds of intelligent terminals are more, and the control and data domains of each terminal are different, however, complicated logic may make the adjustment according to different intelligent terminals rather difficult.
Therefore, a need exists for a method and a system for data communication of an intelligent terminal to solve the above problems.
Disclosure of Invention
In order to solve the above problems, embodiments of the present invention provide a method and a system for data communication of an intelligent terminal, which overcome or at least partially solve the above problems.
In a first aspect, an embodiment of the present invention provides a method for data communication between intelligent terminals, including:
acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches;
and constructing a data structure of each level of the data domain ordered multi-way tree, and searching for a specific leaf position of the data located in the multi-way tree based on the same data structure.
Wherein the frame data structure of the communication data includes:
the frame initiator, the slave station address field, the control code, the data length, the data field, the frame information longitudinal check code and the frame terminator.
The obtaining communication data, constructing a data domain ordered multi-way tree based on the communication data, includes:
establishing an array based on the communication data, wherein the number of elements of the array is the hierarchy of the multi-way tree;
the element concrete value of the array is the branch node number of each level of the multi-way tree;
and sorting the array elements from small to large, wherein the sequence of the array elements after sorting is that of each level of the multi-way tree.
Wherein the method further comprises:
sorting the types of each data field in the branch node number set of each level according to a bubbling sorting method to obtain a branch node number set of each level, wherein the bubbling sorting method is to compare two adjacent elements and exchange the element with a large value to the right.
Wherein the constructing the data structure of each level of the data domain ordered multi-way tree comprises:
building a structural unit of basic data, a data unit of the same level and a data structure of all levels.
Wherein, the constructing the data structure of each level of the data domain ordered multi-way tree further comprises:
the data structure adopts a chained data structure and comprises a data domain of a node, a pointer domain pointing to a father node, a pointer domain pointing to a left child node and a pointer domain pointing to a right child node, and the pointer domain is added for constructing chained storage data; each node in the linked list contains the data for that node and pointers to the addresses of the previous node and the next node.
Wherein, based on the same data structure, the searching data is located at a specific leaf position of the multi-way tree, and the searching comprises:
judging whether all the layers and the current layer are searched, if not, respectively comparing the data identifier with the data identifier in the data table;
if not, comparing with the next data identifier until the next table is found or the next table is entered for analogized searching.
In a second aspect, an embodiment of the present invention further provides an intelligent terminal data communication system, including:
the multi-branch tree construction module is used for acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, and the data types and the data values in the communication data belong to different multi-branch tree branches;
and the data searching module is used for constructing a data structure of each level of the data domain ordered multi-tree, and searching the data to be positioned at the specific leaf position of the multi-tree based on the same data structure.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
a processor, a memory, a communication interface, and a bus; the processor, the memory and the communication interface complete communication with each other through the bus; the memory stores program instructions executable by the processor, and the processor invokes the program instructions to perform a method for data communication of an intelligent terminal as described above.
Fourth aspect embodiments of the present invention provide a non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the above-described method for intelligent terminal data communication.
According to the intelligent terminal data communication method and system provided by the embodiment of the invention, after continuously transformed various serial communication data are converted into the multi-tree, the data types and the data values are respectively distributed into different branches according to respective rules, so that the maintenance is convenient, when one type of data is required to be added, one branch is required to be added, any other branch is not required to be modified, and when one type of data is reduced, one branch is required to be reduced, and any other branch is not required to be modified; all branches use the same data structure, and the structure is simple.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a data communication method of an intelligent terminal provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of a frame data structure according to an embodiment of the present invention;
FIG. 3 is a diagram of a branch query method of a control code;
FIG. 4 is a complete table example of a tree structure provided by an embodiment of the present invention;
FIG. 5 is a diagram of a 5-layer tree structure of a data field according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the same hierarchical structure unit of a data domain according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an overall hierarchical data structure of a data domain provided by an embodiment of the present invention;
FIG. 8 is a schematic diagram of a data structure of all levels of a data domain provided by an embodiment of the present invention;
FIG. 9 is a schematic diagram of a method for traversing and searching an ordered multi-way tree of a data domain according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an intelligent terminal data communication system according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flowchart of a data communication method of an intelligent terminal according to an embodiment of the present invention, as shown in fig. 1, including:
acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches;
and constructing a data structure of each level of the data domain ordered multi-way tree, and searching for a specific leaf position of the data located in the multi-way tree based on the same data structure.
The embodiment of the invention is not limited to single data communication, and the data fields of each communication are analyzed and found, and the core part of the method can be summarized into a reusable multi-tree searching method and a nestable multi-tree data structure. The quick search of the data types and the data values is realized, and the analysis efficiency is improved by at least 50%. More importantly, after the continuously-transformed serial communication data are converted into the multi-way tree, the data types and the data values are divided into different branches according to respective rules, so that the maintenance is convenient, when one type of data is needed to be added, one branch is added, any other branch is not needed to be modified, and when one type of data is reduced, one branch is reduced, and any other branch is not needed to be modified; all branches use the same data structure, and the structure is simple; and because the same data structure is used, the method for searching the final data (leaf) can adopt the same searching method.
On the basis of the above embodiment, the frame data structure of the communication data includes:
the frame initiator, the slave station address field, the control code, the data length, the data field, the frame information longitudinal check code and the frame terminator.
Fig. 2 is a schematic diagram of a frame data structure provided in an embodiment of the present invention, and as shown in fig. 2, each frame of data is composed of 7 fields including a frame initiator, a slave address field, a control code, a data length, a data field, a frame information longitudinal check code, and a frame terminator. Of which the most important is the control code and data field, however, the kinds and combinations of the control code and data field are tens of thousands, greatly affecting the efficiency of communication resolution.
The conventional method is to construct different processing methods and data structures for each type of communication, and then such a large number of data types can make the program and data structures extremely complex.
Therefore, aiming at the situation, the embodiment of the invention abstracts all data fields, constructs the multi-tree, and rapidly searches the corresponding branches by repeatedly using an analysis method through traversing and pruning the multi-tree.
On the basis of the above embodiment, the obtaining communication data, building a data domain ordered multi-way tree based on the communication data includes:
establishing an array based on the communication data, wherein the number of elements of the array is the hierarchy of the multi-way tree;
the element concrete value of the array is the branch node number of each level of the multi-way tree;
and sorting the array elements from small to large, wherein the sequence of the array elements after sorting is that of each level of the multi-way tree.
Firstly, whether the control code is valid needs to be queried, fig. 3 is a schematic diagram of a branch query method of the control code, and as shown in fig. 3, conventional control code types include: a reservation class, a broadcast timing class, a read data class, a read follow-up data class, a read communication address class, a write data class, a write communication address, a freeze command class, a change communication rate class, a modify password class, a maximum demand zeroing class, an ammeter zeroing class, an event zeroing class, and the like.
Preferably, the control code can be defined as 1 byte, and the range of the control code is 0x00 to 0xFF at maximum, namely 256 data identifiers; the value range can be expanded as required, for example, the value range is defined as 2 bytes, and the maximum value range is 0x 00-0 xFFFF, namely 65536 control codes; and so on.
Then, constructing a data field ordered multi-way tree, and fig. 4 is a complete table example of a tree structure provided by the embodiment of the invention, wherein the tree hierarchy is the tree height according to the basic knowledge of the tree. The number of branch nodes per hierarchy is the number of branches of the tree.
The embodiment can adjust the nodes of the tree structure according to the specific situation of the study object during implementation, but the tree structure of the same study problem should be unified.
Hierarchy of ordered multi-way tree: dividing the hierarchy by the kind of data field (data identifier); in general, the data field (data identifier) class can be classified into 4 levels, then the hierarchy is 4;
number of branch nodes per level of the ordered multi-way tree: for example, the condition value of the electric energy is 64, and then the number of branch nodes of the electric energy level is 64;
the hierarchical division method of the ordered multi-way tree comprises the following steps: the number of branch nodes is small at the upper level, the number of branch nodes is large at the lower level, for example, the number (5) of branch nodes of the data type 1 (electric energy) is smaller than the number (65) of branch nodes of the electric energy type 1 ((current) combined active total electric energy), then the level of the data type 1 (electric energy) should be higher than the level of the electric energy type 1 ((current) combined active total electric energy), if the total level is L, the level of the data type 1 (electric energy) is X (X is between 1 and L), then the level of the data type 1 (electric energy) is Y (Y is between 1 and N, and Y > X), for example, if only two levels are provided, then the level of the data type 1 (electric energy) is 1, the level of the electric energy type 1 ((current) combined active total electric energy) is 2, if the number of branch nodes of the two levels is the same, any one can be designated as the upper level, the other as the next level, or historical experience can be selected.
On the basis of the above embodiment, the method further includes:
sorting the types of each data field in the branch node number set of each level according to a bubbling sorting method to obtain a branch node number set of each level, wherein the bubbling sorting method is to compare two adjacent elements and exchange the element with a large value to the right.
The implementation method of the embodiment of the invention is as follows: establishing an array; how many elements of the array are the hierarchy (the type of data field), such as 6; the specific value of the element of the array is the number of branch nodes of each hierarchy, such as Data [17] = {32,5,8,8,64,8), and the corresponding value is the element n=6 of the array; the specific value of an element of the array is the number of branch nodes per level (class of data field), i.e. the number of condition values per level (class of data field), such as the second element is 5, corresponding to the number of condition values for class 1 (electrical energy) of data: the array element value is 64, namely the condition value quantity of the electric energy type 1 (the current combined active total electric energy) of the corresponding level (the type of the data field);
the array elements are ordered from small to large, and then the order of the array elements after adjustment is each level of the ordered multi-way tree. Ordering from small to large, such as bubbling ordering, after ordering is completed, data [ N ] = {5,8,8,8,32,64}; the node number with the same size can be selected to be adjusted or not according to the requirement; the positions in the array where the array elements after adjustment are located are the hierarchy, i.e. the order of the trunk of the tree to the branch nodes (branches) to the leaf nodes (leaves). For example, the internal resistance is located at the first level.
In this embodiment, the sort of each data field in the branch node number set of each level is sorted according to the bubble sorting method, so as to obtain the branch node number set of each level, where the principle of bubble sorting is as follows: comparing two adjacent elements, and exchanging the element with large value to the right; the method comprises the following steps: the two adjacent numbers are compared in sequence, the smaller number is placed in front, and the larger number is placed in back, and the specific steps are as follows: (1) first comparison: first the first and second numbers are compared, the decimal place is in front and the greater number is in back. (2) Comparing the 2 nd and 3 rd numbers, the decimal places are in front and the larger ones are in back. (3) Continuing in this way, knowing that the last two numbers are compared, putting the decimal place in front and the great number in back, repeating the steps until all sequencing is completed; (4) After the comparison of the previous pass is completed, the last number must be the largest one in the array, so the last number does not participate in the comparison when the comparison is performed in the second pass. (5) After the second pass comparison is completed, the second last number must also be the second last big number in the array, so in the third pass comparison, the last two numbers do not participate in the comparison. And (6) analogizing, wherein the comparison times of each pass are reduced in sequence. The Data queue is sorted by bubbling sorting, and the Data queue is sorted according to a small front row, namely bubbling upwards, if N Data are provided, and Data [0] -Data [ L-1] are compared in L-1 time sorting of an algorithm, if Data [ l+1] > Data [ L ], data [ l+1] and Data [ L ] are exchanged in position, array element numbers l+1 and L are exchanged at the same time, wherein L is more than or equal to 1 and less than or equal to L-1, and the bubbling sorting execution is finished after (L-1))/2 times of comparison at most.
Fig. 5 is a schematic diagram of a 5-layer tree structure of a data domain according to an embodiment of the present invention, and as shown in fig. 5, a conventional data hierarchy may be divided into 5 layers. In one example, the data fields may be further divided into different levels according to the type of data to satisfy complex data types.
1) Tree layer L:
and the trunk takes the data type as the trunk.
2) Tree layer L-1:
comprising the following steps:
data type 1 (electric energy),
Data type 2 (maximum demand and time of occurrence),
Data type 3 (variable),
Data type 4 (event record),
Data category 5 (parameter),
Data type 6 (freezing amount),
Data type 7 (load record), etc.
3) Tree layer L-2:
for example, data category 1 (electrical energy) includes:
the electric energy type 1 ((current) combined active total electric energy),
Type 2 ((current) forward active total energy),
The electric energy type 3 ((current) reverse active total electric energy),
The electric energy type 4 ((current) combined reactive power),
The power class 5 (total power), etc.
...
The maximum possible includes 256 different power classes.
For another example, the data category 7 (load record) includes:
load record type 1 (type 1 load record block),
Load record type 2 (type 2 load record block),
Load record type 3 (type 3 load record block),
Load record type 4 (type 4 load record block),
Load record category 5 (category 5 load record block),
Load record category 6 (category 6 load record block),
currently commonly used are 6 types of recording blocks, which comprise a maximum of 256 different recording blocks.
4) Tree layer L-3:
for example, power class 1 ((current) combined active total power):
(currently) combining active total electric energy,
(currently) combining active rate 1 power,
…、
The (current) combined active rate 63 electric energy,
(currently) combining active power data blocks and the like,
the 65 (current) combined active total power, which is commonly used before, comprises 256 different (current) combined active total powers at maximum.
For another example, the class 1 payload record blocks currently have only class 1 payload record blocks without more data classification.
5) Tree layer L-4:
the fifth level of the tree is the fourth level of the data field.
For example, the (current) combined active total power is currently only one of the (current) combined active total power, and no more data classification exists
For another example, the class 1 load record block includes only:
record earliest record block for class 1 load record,
Record block for class 1 load given time,
The most recent record block is loaded by class 1.
On the basis of the foregoing embodiment, the constructing the data structure of each level of the data domain ordered multi-way tree includes:
building a structural unit of basic data, a data unit of the same level and a data structure of all levels.
Specifically, the basic data structure unit is: the present level data identifier, the lower level table flag, the lower level table address/execution function pointer, and one program implementation of the basic data structure is as follows:
data structure for data identification
typedefstruct{
unsigned char dataId; data identifier of the class//
unsigned char nextLevel; 00 = no next level table; 01 The table of the next level is given,
ff=end of table
void entry; per/next level table address/executive function pointer
}DataIdTable;
The present level data identifier: preferably, it can be defined as 1 byte, and the range of the value is 0x00 to 0xFF at maximum, namely 256 data identifiers; the value range can be expanded as required, for example, the value range is defined as 2 bytes, and the maximum value range is 0x 00-0 xFFFF, namely 65536 data identifiers; and so on.
The following table flags: preferably, it can be defined as 1 byte, 0x00 = no next level table; 0 x01=there is a next level table, 0 xff=the present table ends.
Next level table address/execute function pointer: if there is a next table, then the next table address is indicated at this time, and if there is no next table, then the execute function pointer is indicated at this time.
For data units of the same hierarchy, fig. 6 is a schematic diagram of a unit of the same hierarchy structure of a data domain provided by an embodiment of the present invention, as shown in fig. 6, where the data table is named DataIdTable rdi_xx ______; comprising:
a data identifier 1 of 0x00, a lower table flag 1 of 0x1 indicates that there are also lower tables, the lower table address being rdi_00xx ____, which is that the data is electric energy data;
the data identifier 2 is 0x01, the lower table flag 1 is 0x1, and the lower table is also the lower table, and the address of the lower table is RDI_01XX ____, which is the data of the maximum demand and the occurrence time
…: other data by analogy
If the data identifier N is 0xFF, and the lower table flag 1 is 0xFF, the execution function pointer at this time is Read __ invald, which indicates that the data identifier of the table has ended, which is the last element, and the execution function pointer Read __ invald is specially used for corresponding processing.
For all levels of data structure, FIG. 7 is a schematic diagram of all levels of data structures of a data field according to an embodiment of the present invention, and as shown in FIG. 7, a complete data field is formed by combining data identifiers of L-th, L-1-th, L-2-th and … … -th levels. Specifically: the L-th level contains N data identifiers, each of which can point to the L-1-th level (next level) data identifier through a next level table address/execution function pointer; such as the L-1 stage data identifier pointed to by the L-1 stage data identifier 1, there may be M data identifiers; such as the L-1 st data identifier 1, the L-2 nd data identifier to which the L-1 st data identifier 1 points, there may be Q data identifiers.
For example, fig. 8 is a schematic diagram of a data structure of all levels of a data domain provided in the embodiment of the present invention, and it is assumed that the data domain has a total of 4 levels, that is, the levels are respectively the 3 rd level, the 2 nd level, the 1 st level, and the 0 th level, and each level of the data domain may be named as DI3→di2→di1→di0 in sequence.
If DI 3-DI 2-DI 1-DI 0 is 0x 00-0 x00,
the lower table flag 0x01=having the lower table corresponding to the data identifier 0x00 in the 3 rd level data table rdi_xx ______, the lower table address points to the 2 nd level data table rdi_00xx ____;
the lower table flag 0x01=having the lower table corresponding to the data identifier 0x00 in the 2 nd level data table rdi_00XX ___, the lower table address points to the 1 st level data table) read_0000xx __;
the lower table flag 0x01=having the lower table corresponding to the data identifier 0x00 in the 1 st level data table read_0000XX __, the lower table address points to the 1 st level data table) read_000000XX;
the lower table flag 0x00=no lower table corresponding to the data identifier 0X00 in the 0 th level data table read_000000X, and the execution function pointer points to (void) read_00000000, which is used for executing reading (current) combined active total power;
if DI 3-DI 2-DI 1-DI 0 is 0x 00-0 x0C, the data field indicates the combined active total power of the reading (12 settlement days above)
If DI3→di2→di1→di0 is 0x00→0x00→0x32, the current data field is invalid, and although DI3→di2→di1 are valid data fields within the definition range of each level of data identifier, DI0 = 0x32 are not within the definition range of the level of data identifier, so DI3→di2→di1→di0 are illegal data fields, and finally the execution function pointer for processing the data fields of this type is pointed.
On the basis of the foregoing embodiment, the constructing a data structure of each level of the data domain ordered multi-way tree further includes:
the data structure adopts a chained data structure and comprises a data domain of a node, a pointer domain pointing to a father node, a pointer domain pointing to a left child node and a pointer domain pointing to a right child node, and the pointer domain is added for constructing chained storage data; each node in the linked list contains the data for that node and pointers to the addresses of the previous node and the next node.
The chained data structure is adopted, and comprises a data field of a node, a pointer field pointing to a father node, a pointer field pointing to a left child node and a pointer field pointing to a right child node, wherein the chained list is compared with an array, and besides the data field, the pointer field is added for constructing chained storage data. Each node in the linked list contains the data for that node and pointers to the addresses of the previous node and the next node. The pointer is used for searching and accessing the next data element, so that the freedom degree of the linked list is higher. This is represented by the fact that when nodes are added and deleted, only the pointer address of the previous node needs to be modified, and other nodes do not need to be changed. Meanwhile, as the pointers are adopted to point to the upper node and the lower node, discontinuous storage space can be adopted, namely, the storage is more flexible.
The data field of the node, the pointer field pointing to the father node, the pointer field pointing to the left child node and the pointer field pointing to the right child node are included, the pointer field of the father node is the storage address of the upper node of the tree data structure, and the pointer field of the left child node and the pointer field pointing to the right child node are the storage address of the left child node and the storage address of the right child node of the lower node of the tree data structure.
Specifically, adjacent array pointers: the link pointers between leaf nodes of the tree structure are used for carrying out range query and traversal after the leaf nodes in the tree structure are linked because the specific values of the corresponding electric energy parameters in the leaf node array are arranged in ascending order in the tree structure A.
The method comprises the following specific steps: acquiring the hierarchical relationship of the tree and the branch number of each layer of tree; the level in the tree structure corresponds to the number of array elements, the branch number of each layer of tree corresponds to the subscript of the level array, the hierarchical relationship of the tree and the branch number of each layer of tree are mapped into links represented by combining the array and the tree structure, and a tree data structure is established; storing the memory address of the stored data to leaf nodes of the tree data structure according to a link formed by the stored data; and sequentially linking the leaf nodes of the tree data structure.
The array tree data storage method utilizes the hierarchical relationship of the tree and the branch number of each layer of tree to map into an array tree storage link which is represented by combining an array and a tree structure so as to form a data storage mode which is convenient for retrieving data, each node in the array tree data storage method is an array, each array occupies 4 bytes, each tree node in the algorithm at least defines three pointers and one data, and therefore, the index of the array tree data storage method is smaller than the memory space occupied by the index of a conventional tree.
The hierarchical relationship of the tree and the branch number of each layer of tree are converted into different links in the tree structure, and the memory address (or the data set index) of the data is stored at the end of the link, wherein each tree node corresponds to an array. When searching, the corresponding data address is quickly found through the tree link according to the hierarchical relationship of the tree and the branch number of each layer of tree, thereby realizing the efficient data searching. The invention relates to an algorithm for realizing quick data searching by combining an array and a tree structure, which comprises the following steps: an array tree algorithm.
Nodes (arrays) in a tree structure: each pointer points to a next level (secondary) array (node), thereby forming a linked list tree structure.
Starting from a current leaf node, continuously searching a left secondary array pointer pointing to a left adjacent leaf node and a right secondary array pointer pointing to a right adjacent leaf node in a structural array of a father node of the current leaf node according to a link record;
judging whether the left secondary array pointer and the right secondary array pointer are valid or not;
if not, returning to the previous step, and continuing to search the structure array of the father node of the current leaf node;
if so, continuously searching the left adjacent leaf node in the secondary node array of the left secondary array pointer according to the found left secondary array pointer and the link record, and continuously searching the right adjacent leaf node in the secondary node array of the right secondary array pointer according to the found right secondary array pointer and the link record;
performing left and right links of the current leaf node; the left link is used for writing an array pointer of the current leaf node into an array head of a left adjacent leaf node of the current leaf node; the right link is to write an array pointer of a right adjacent leaf node of the current leaf node into an array header of the current leaf node.
Specifically, after the creation of an array tree link of one piece of data is completed, the leaf node (the array at the end of the array tree) is linked, i.e. the adjacent leaf nodes are linked from one direction.
Specifically, the tree array is obtained according to the hierarchical relationship of the tree and the branch number of each tree layer, the memory space occupied by the index in the algorithm is about 1/3 of the memory space occupied by the index in the conventional algorithm, and the retrieval efficiency of the algorithm is greatly superior to that of the binary algorithm (8-10 times of efficiency). The data address only exists in the leaf node array, and the logical operation of the non-leaf nodes is realized in the memory, so that the reading operation can be greatly reduced, and the retrieval efficiency is improved. In the tree structure of the algorithm, the non-leaf nodes are linked in one-way sequence, so that the functions of range searching, data traversing, data paging and the like can be conveniently realized. More specifically, when an array pointer is retrieved to be null or the current array length is less than the specified length, it is considered that no retrieval will be made, and a null value will be returned. If the last digit is retrieved and the pointer within the array is not null, the pointer, i.e., the memory address (or dataset number) of the data, is returned. The technical scheme only carries out basic description and demonstration on basic data structures and functions, and can be optimized and perfected according to the needs in practical application.
Based on the above embodiment, the searching the specific leaf position of the data in the multi-tree based on the same data structure includes:
judging whether all the layers and the current layer are searched, if not, respectively comparing the data identifier with the data identifier in the data table;
if not, comparing with the next data identifier until the next table is found or the next table is entered for analogized searching.
Fig. 9 is a schematic diagram of a traversal search method of an ordered multi-way tree of a data domain according to an embodiment of the present invention, as shown in fig. 9, assuming that the data has L layers, then the data identifier: DI (L) →DI (L-1) →DI (L-2) → … … →DI (0)
Searching corresponding branches in the first layer
SL01: determine that all hierarchy lookups are complete?
To SL10
No, to SL02
SL02: determine that the current hierarchy is found is complete?
To SL09
No, to SL03
SL03: judging that the data identifiers match? Comparing the data identifiers with the data identifiers in the data tables respectively
To SL04
No, return to SL02, compare with the next data identifier, and so on
SL04: obtaining the next-level table mark
[ can be 0x00, 0x01, 0xFF ]
SL05: determine that there is a next level table?
0x00 represents no next level of table SL06
No, 0x01 indicates that there is the next level of table SL07
No, 0xFF indicates the end of the table SL06
SL06: acquiring an execution function pointer
SL07: acquire the next level table to SL08
SL08: enter the next table, go to SL01, compare with the data identifier of the next table, and so on
SL09: indicating that the lookup in all identifiers of the current hierarchy table does not match the corresponding data field, i.e., the data identifier in the hierarchy command is illegal, the lookup is exited
SL10: indicating that the lookup in all tables of all levels does not match the corresponding data field, i.e., the data identifier in all level commands is illegal, the lookup is exited.
Assuming that the number of stages of the data fields is 4, namely the 3 rd stage, the 2 nd stage, the 1 st stage and the 0 th stage, the data fields of each stage can be named as DI 3- & gtDI 2- & gtDI 1- & gtDI 0 in sequence.
If DI 3-DI 2-DI 1-DI 0 is 0x 00-0 x00,
s1: find the corresponding branch in layer L-1 = 3
S101: is the data identifier matched? Comparing the data identifier DI3 = 0x00 with the data identifiers (0 x00, 0x01, 0x02,0x 03, 0x04, 0x05, 0x06, 0xFE, 0 xFF) of the respective branches
The result is that the present example DI3 = 0x00 finds a matching entry in the present level table, to S102
S102: obtaining the next-level table mark
0x01 to S103
S103: determine that there is a next level table?
0x01 represents that there is the next table, to S104
S104: obtaining the next level table
The next level of tables RDI_00XX ____, through S105
S105: enter the next level table RDI_00XX ____, through S2
S2: searching corresponding branches in the L-2=2 layer of the next-level table
S201: is the data identifier matched? Comparing the data identifier DI2 = 0x00 with the data identifiers (0 x00, 0x01, 0x02,0 xff) of the respective branches
The yes, the present example DI2 = 0x00 finds a matching entry in the present level table, to S202
S202: obtaining the next-level table mark
0x01 to S203
S203: there is a next level table?
0x01 indicates that there is the next table, to S204
S204: obtaining the next level table
The next level of tables read_0000XX __, through S205
S205: enter the next level table read_0000XX __, to S3
S3: searching corresponding branches in the L-3=1 layer of the next-level table
S301: is the data identifier matched? Comparing the data identifier DI1 = 0x00 with the data identifiers (0 x00, 0x01, 0x02,0x 03, 0x04, 0 xFF) of the respective branches
The result is that the present example DI1 = 0x00 finds a matching entry in the present level table, to S302
S302: obtaining the next-level table mark
0x01 to S303
S303: there is a next level table?
0x01 represents that there is the next table, to S304
S304: obtaining the next level table
The next level table is read_000000XX, through S305
S305: enter the next level table read_000000XX, through S4
S4: searching corresponding branches in the L-4=0 layer of the next-level table
S401: is the data identifier matched? Comparing the data identifier DI0 = 0x00 with the data identifiers (0 x00, 0x01, 0x02,0x 03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0 xFF) of the respective branches
The result is that the present example DI0 = 0x00 finds a matching entry in the present level table, to S402
S402: obtaining the next-level table mark
0x00 to S403
S403: there is a next level table?
No, 0x00 indicates no next table, to S404
S404: acquiring an execution function pointer
The execution function pointer is (void) read_00000000 for executing the reading of the (current) combined active total power
Fig. 10 is a schematic structural diagram of an intelligent terminal data communication system according to an embodiment of the present invention, as shown in fig. 10, including:
the multi-tree construction module 1001 is configured to obtain communication data, construct a data-domain ordered multi-tree based on the communication data, and divide data types and data values in the communication data into different multi-tree branches;
the data searching module 1002 is configured to construct a data structure of each level of the data domain ordered multi-tree, and search for the specific leaf position of the multi-tree based on the same data structure.
The specific how to implement the technical scheme of the embodiment of the data communication method of the intelligent terminal shown in fig. 1 through the multi-tree construction module 1001 and the data search module 1002 is similar to the implementation principle and the technical effect, and will not be described herein again.
Embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the method embodiments described above, for example comprising: acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches; and constructing a data structure of each level of the data domain ordered multi-way tree, and searching for a specific leaf position of the data located in the multi-way tree based on the same data structure.
Embodiments of the present invention provide a non-transitory computer readable storage medium storing computer instructions that cause a computer to perform the methods provided by the above-described method embodiments, for example, including: acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches; and constructing a data structure of each level of the data domain ordered multi-way tree, and searching for a specific leaf position of the data located in the multi-way tree based on the same data structure.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in each embodiment or some parts of the embodiment.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The intelligent terminal data communication method is characterized by comprising the following steps of:
acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, wherein the data types and data values in the communication data belong to different multi-branch tree branches;
and constructing a data structure of each level of the data domain ordered multi-way tree, and searching for a specific leaf position of the data located in the multi-way tree based on the same data structure.
2. The intelligent terminal data communication method according to claim 1, wherein the frame data structure of the communication data comprises:
the frame initiator, the slave station address field, the control code, the data length, the data field, the frame information longitudinal check code and the frame terminator.
3. The method for intelligent terminal data communication according to claim 2, wherein the obtaining communication data, constructing a data domain ordered multi-way tree based on the communication data, comprises:
establishing an array based on the communication data, wherein the number of elements of the array is the hierarchy of the multi-way tree;
the element concrete value of the array is the branch node number of each level of the multi-way tree;
and sorting the array elements from small to large, wherein the sequence of the array elements after sorting is that of each level of the multi-way tree.
4. The intelligent terminal data communication method according to claim 3, wherein the method further comprises:
sorting the types of each data field in the branch node number set of each level according to a bubbling sorting method to obtain a branch node number set of each level, wherein the bubbling sorting method is to compare two adjacent elements and exchange the element with a large value to the right.
5. The method for data communication of an intelligent terminal according to claim 1, wherein said constructing a data structure of each level of said data domain ordered multi-way tree comprises:
building a structural unit of basic data, a data unit of the same level and a data structure of all levels.
6. The method for data communication of an intelligent terminal according to claim 5, wherein said constructing a data structure of each level of said data domain ordered multi-way tree further comprises:
the data structure adopts a chained data structure and comprises a data domain of a node, a pointer domain pointing to a father node, a pointer domain pointing to a left child node and a pointer domain pointing to a right child node, and the pointer domain is added for constructing chained storage data; each node in the linked list contains the data for that node and pointers to the addresses of the previous node and the next node.
7. The method for communicating data between intelligent terminals according to claim 6, wherein the searching data is located at a specific leaf position of the multi-way tree based on the same data structure, comprising:
judging whether all the layers and the current layer are searched, if not, respectively comparing the data identifier with the data identifier in the data table;
if not, comparing with the next data identifier until the next table is found or the next table is entered for analogized searching.
8. An intelligent terminal data communication system, comprising:
the multi-branch tree construction module is used for acquiring communication data, constructing a data domain ordered multi-branch tree based on the communication data, and the data types and the data values in the communication data belong to different multi-branch tree branches;
and the data searching module is used for constructing a data structure of each level of the data domain ordered multi-tree, and searching the data to be positioned at the specific leaf position of the multi-tree based on the same data structure.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method for data communication of a smart terminal according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements the steps of the smart terminal data communication method according to any of claims 1 to 7.
CN202211198021.XA 2022-09-29 2022-09-29 Intelligent terminal data communication method and system Pending CN116028674A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211198021.XA CN116028674A (en) 2022-09-29 2022-09-29 Intelligent terminal data communication method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211198021.XA CN116028674A (en) 2022-09-29 2022-09-29 Intelligent terminal data communication method and system

Publications (1)

Publication Number Publication Date
CN116028674A true CN116028674A (en) 2023-04-28

Family

ID=86071128

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211198021.XA Pending CN116028674A (en) 2022-09-29 2022-09-29 Intelligent terminal data communication method and system

Country Status (1)

Country Link
CN (1) CN116028674A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101516086A (en) * 2008-02-21 2009-08-26 卓望数码技术(深圳)有限公司 Service matching method for mobile communication
CN111581215A (en) * 2020-05-07 2020-08-25 钟士平 Array tree data storage method, fast search method and readable storage medium
CN113760621A (en) * 2021-09-07 2021-12-07 四川中微芯成科技有限公司 Method and device for testing touch chip, computer equipment and storage medium
CN114443646A (en) * 2021-12-28 2022-05-06 许昌开普检测研究院股份有限公司 Bi-directional linear linked list directory retrieval based multi-way tree structure, electronic device and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101516086A (en) * 2008-02-21 2009-08-26 卓望数码技术(深圳)有限公司 Service matching method for mobile communication
CN111581215A (en) * 2020-05-07 2020-08-25 钟士平 Array tree data storage method, fast search method and readable storage medium
CN113760621A (en) * 2021-09-07 2021-12-07 四川中微芯成科技有限公司 Method and device for testing touch chip, computer equipment and storage medium
CN114443646A (en) * 2021-12-28 2022-05-06 许昌开普检测研究院股份有限公司 Bi-directional linear linked list directory retrieval based multi-way tree structure, electronic device and readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
田霆: ""基于PowerPC的电力载波路由器的实现"", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 04, pages 136 - 261 *
袁中明: ""可定制异步消息通信处理机制的研究与应用"", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 01, pages 138 - 492 *
邹学玉 等: ""基于Zigbee的数据监测上位机通信接口设计"", 《长江大学学报(自科版)》, vol. 11, no. 25, pages 36 - 40 *

Similar Documents

Publication Publication Date Title
CN109885576A (en) A kind of Hash table creation method and system calculate equipment and storage medium
CN108197313B (en) Dictionary indexing method for realizing space optimization through 16-bit Trie tree
CN103514201A (en) Method and device for querying data in non-relational database
CN111190904A (en) Method and device for hybrid storage of graph-relational database
CN114064984B (en) World state increment updating method and device based on sparse array linked list
CN104778258A (en) Data extraction method oriented to protocol dataflow
US11461317B2 (en) Method, apparatus, system, device, and storage medium for answering knowledge questions
CN105515997B (en) The higher efficiency range matching process of zero scope expansion is realized based on BF_TCAM
CN109934336A (en) Neural network dynamic based on optimum structure search accelerates platform designing method and neural network dynamic to accelerate platform
CN109325029A (en) RDF data storage and querying method based on sparse matrix
CN109815238A (en) The dynamic adding method and device of database are realized with strict balanced binary tree
CN107870949A (en) Data analysis job dependence relation generation method and system
CN112632015A (en) Data format conversion method and device, storage medium and electronic equipment
CN109933589B (en) Data structure conversion method for data summarization based on ElasticSearch aggregation operation result
EP2660729A1 (en) Device and method for storing mass data based on tree structure
CN116028674A (en) Intelligent terminal data communication method and system
CN114997360B (en) Evolution parameter optimization method, system and storage medium of neural architecture search algorithm
CN113535828B (en) Aggregation query method, system, equipment and storage medium of time sequence data
CN115599897A (en) Power distribution network equipment intelligent question-answering system construction method and system based on knowledge graph
CN114328486A (en) Data quality checking method and device based on model
CN112528082B (en) XML document production line XPath query method, terminal equipment and storage medium
CN113297204B (en) Index generation method and device
CN106383863A (en) Isomorphic sub-graph query optimization method
CN114595215A (en) Data processing method and device, electronic equipment and storage medium
CN110083603B (en) Method and system for realizing node path query based on adjacency list

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