CN115208958A - Protocol automatic segmentation method and device - Google Patents

Protocol automatic segmentation method and device Download PDF

Info

Publication number
CN115208958A
CN115208958A CN202210652741.2A CN202210652741A CN115208958A CN 115208958 A CN115208958 A CN 115208958A CN 202210652741 A CN202210652741 A CN 202210652741A CN 115208958 A CN115208958 A CN 115208958A
Authority
CN
China
Prior art keywords
segmentation
protocol data
characteristic value
protocol
data
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.)
Granted
Application number
CN202210652741.2A
Other languages
Chinese (zh)
Other versions
CN115208958B (en
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.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
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 Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202210652741.2A priority Critical patent/CN115208958B/en
Publication of CN115208958A publication Critical patent/CN115208958A/en
Application granted granted Critical
Publication of CN115208958B publication Critical patent/CN115208958B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 

Abstract

The application relates to a protocol automatic segmentation method and a device; the method comprises the following steps: acquiring a preset characteristic value formula; segmenting the whole protocol data according to a preset segmentation rule to obtain at least two segmented protocol data; calculating a first characteristic value of the overall protocol data and a second characteristic value of the segmented protocol data according to the characteristic value formula; judging whether the segmentation protocol data meet the segmentation condition or not according to the first characteristic value and the second characteristic value; and if the segmentation condition is met, segmenting the segmented protocol data serving as the new overall protocol data again until the segmentation condition is not met. The scheme of the application is based on the abstract structure of the universal protocol data frame, a unified segmented calculation model is designed, the support of multiple protocols can be realized, the application range is wide, and the application range is suitable for various different scenes; by the scheme, the data is read after being segmented, so that reading equipment can automatically read discontinuous address points, and the reading efficiency is greatly improved.

Description

Protocol automatic segmentation method and device
Technical Field
The present application relates to the field of data communication technologies, and in particular, to a method and an apparatus for automatically segmenting a protocol.
Background
The building automation system integration usually needs to access to protocol gateways of various third parties, and status information of equipment (common in-industry protocols such as modbus, bacnet and the like) is obtained by reading data in the protocol gateways. Generally, a protocol gateway has a lot of data, each data has a corresponding address, and a building automatic control system needs to acquire required data information according to the addresses. Therefore, when the building autonomous system integrates the protocol gateway of the third party, the address corresponding to the required data is configured in the system according to the point table provided by the third party, and the required data is input after protocol arrangement by personnel in the process.
After the address of the data is input into the building automatic control system, the system reads the states of the equipment one by one according to the address information, and at the moment, if the address of the data is a discontinuous address, the system needs to read the data one by one, so that the efficiency is very low, and the real-time performance of data updating is poor; if the data addresses are continuous or partially continuous, manual segmentation is needed, and segmentation information is configured into the system, the system can read a plurality of data at one time, efficiency is improved, but manual segmentation is needed by personnel, and if the quantity of point location data is increased, another high-intensity labor work can be brought to the manual segmentation. Some artificial subjective judgments also exist in the manual segmentation process, if the number of hollow point locations in one segment is large and the number of actually effective point locations is small, the processing of subsequent point locations is not changed, and the reading efficiency of a single frame is also reduced.
In the related art, the existing scheme reads data by using a single point location address point or only reads continuous address point locations, and at present, no solution for automatically reading discontinuous address point locations exists, and the existing scheme has low automation degree and low efficiency.
Disclosure of Invention
In order to solve the problem that the discontinuous address points cannot be automatically read in the related technology, the application provides a protocol automatic segmentation method and a device.
According to a first aspect of embodiments of the present application, there is provided a protocol automatic segmentation method, including:
acquiring a preset characteristic value formula;
segmenting the whole protocol data according to a preset segmentation rule to obtain at least two segmented protocol data;
calculating a first characteristic value of the overall protocol data and a second characteristic value of the segmented protocol data according to the characteristic value formula;
judging whether the segmentation protocol data meet the segmentation condition or not according to the first characteristic value and the second characteristic value;
and if the segmentation condition is met, segmenting the segmented protocol data serving as new overall protocol data again until the segmentation condition is not met.
Further, the obtaining of the preset feature value formula includes:
obtaining communication performance data;
determining a segment type according to the communication performance data;
and determining a corresponding characteristic value formula according to the segmentation type.
Further, the communication performance data includes: average communication time t1 and average reading time t2;
the determining a segment type according to the communication performance data includes:
if t1> t2, the segmentation type is loose type segmentation;
otherwise the segment type is compact.
Further, the eigenvalue formula corresponding to the compact segment is:
Figure BDA0003688233000000021
wherein i is the serial number of the effective points, n is the number of the effective points, l i The data length of each effective point is; j is the serial number of all the point locations, N is the number of all the point locations, l j The data length of each point location; dl is protocol constant data; s is the sum of all the lengths of the voids.
Further, the eigenvalue formula corresponding to the loose type segment is:
Figure BDA0003688233000000031
wherein N is the number of valid point locations, N is the number of all point locations, and dl is protocol constant data.
Further, the preset segmentation rule comprises a first segmentation rule; the first segmentation rule comprises:
determining the segmentation position according to the length of each vacancy in the overall protocol data;
the overall protocol data is split into two pieces of segmented protocol data from the segmentation location.
Further, the determining the segment position according to the lengths of the respective gaps in the overall protocol data includes:
searching the space with the longest length in the whole protocol data as a segmentation position;
if there are at least two of the longest nulls, the null closest to the middle position is taken as the segmentation position.
Further, the first segmentation rule further comprises:
and if the whole protocol data is not empty, segmenting the whole protocol data according to the preset maximum protocol length.
Further, the determining whether the segmentation protocol data satisfies the segmentation condition according to the first characteristic value and the second characteristic value includes:
judging whether the segmented protocol data meets a first segmentation condition or not according to the first characteristic value and the second characteristic value;
and if the first segmentation condition is not met, judging whether a second segmentation condition is met according to the length of the segmentation protocol data.
Further, the first segmentation condition includes:
and if the second characteristic value is greater than the first characteristic value, the segmentation protocol data corresponding to the second characteristic value meets a first segmentation condition.
Further, the second segmentation condition includes:
and if the length of the segmentation protocol data is greater than the preset maximum protocol length, a second segmentation condition is met.
Further, the preset segmentation rules also comprise a second segmentation rule;
the re-segmenting the segmented protocol data as new overall protocol data includes:
when the segmentation protocol data meets a first segmentation condition, segmenting the segmentation protocol data according to a first segmentation rule;
and when the segmentation protocol data meets the second segmentation condition, segmenting the segmentation protocol data according to a second segmentation rule.
Further, the second segmentation rule includes:
judging whether the segmented protocol data has a null state or not;
if the null exists, segmenting according to a first segmentation rule;
and if no gap exists, segmenting according to the preset maximum protocol length.
According to a second aspect of embodiments of the present application, there is provided a protocol automatic segmentation apparatus, including:
the acquisition module is used for acquiring a preset characteristic value formula;
the segmentation module is used for segmenting the whole protocol data according to a preset segmentation rule to obtain at least two pieces of segmented protocol data;
the characteristic calculation module is used for calculating a first characteristic value of the whole protocol data and a second characteristic value of the segmented protocol data according to the characteristic value formula;
the judging module is used for judging whether the segmentation protocol data meet the segmentation condition according to the first characteristic value and the second characteristic value;
the segmentation module is also used for segmenting the segmented protocol data as new overall protocol data again when the segmentation condition is met until the segmentation condition is not met.
According to a third aspect of embodiments herein, there is provided a computer device comprising a memory and a processor; the memory is used for storing a computer program, and the processor is used for executing the computer program in the memory to realize the operation steps of the protocol automatic segmentation method according to any one of the above embodiments.
According to a fourth aspect of the embodiments of the present application, there is provided a building automation system, including: the system comprises an upper computer, a core controller and field equipment;
the upper computer is used for executing the protocol automatic segmentation method in any one of the embodiments and sending segmented protocol information to the core controller;
the core controller is used for receiving and reading segmented protocol information so as to determine point location addresses corresponding to the field devices.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
the scheme of the application is based on the abstract structure of the universal protocol data frame, a unified segmented calculation model is designed, the support of multiple protocols can be realized, the application range is wide, and the application range is suitable for various different scenes; by the scheme, the data is read after being segmented, so that reading equipment can automatically read discontinuous address points, and the reading efficiency is greatly improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow diagram illustrating a protocol auto-segmentation method in accordance with an exemplary embodiment.
Fig. 2 illustrates an abstract structure of a protocol frame, according to an example embodiment.
Fig. 3 is a diagram illustrating a network topology of a communication system in accordance with an exemplary embodiment.
FIG. 4 is an illustration of an unsegmented full dot representation, according to an exemplary embodiment.
Fig. 5 is a flowchart illustrating a detailed implementation of a segmentation method according to an example embodiment.
Fig. 6 is a schematic diagram of data segmentation according to one of the protocols shown in fig. 4.
Fig. 7 is a block diagram illustrating a protocol auto-segmentation mechanism in accordance with an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of methods and apparatus consistent with certain aspects of the present application, as detailed in the appended claims.
FIG. 1 is a flow diagram illustrating a protocol auto-segmentation method in accordance with an exemplary embodiment. The method may comprise the steps of:
s1, acquiring a preset characteristic value formula;
s2, segmenting the whole protocol data according to a preset segmentation rule to obtain at least two pieces of segmented protocol data;
s3, calculating a first characteristic value of the overall protocol data and a second characteristic value of the segmented protocol data according to a characteristic value formula;
s4, judging whether the segmentation protocol data meet the segmentation condition or not according to the first characteristic value and the second characteristic value;
and S5, if the segmentation condition is met, segmenting the segmented protocol data serving as new overall protocol data again until the segmentation condition is not met.
The scheme of the application is based on the abstract structure of the universal protocol data frame, a unified segmented calculation model is designed, the support of multiple protocols can be realized, the application range is wide, and the application range is suitable for various different scenes; by the scheme, the data is read after being segmented, so that reading equipment can automatically read discontinuous address points, and the reading efficiency is greatly improved.
It should be understood that, although the steps in the flowchart of fig. 1 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
To further detail the technical solution of the present application, a protocol frame is first briefly introduced.
As shown in fig. 2, the solution of the present application divides information of existing communication protocols (such as modbus, bacnet, etc.) into four parts: (1) Frame interval, which represents the minimum interval data bit between protocol frames; (2) The frame attribute section can contain related information such as a frame header flag bit, a frame length, a functional frame, an effective data length and the like, and the part is a part with a fixed length in a protocol; (3) a frame data segment containing the content of the frame in actual communication; (4) And the frame ending section comprises a frame ending flag bit, a check bit and the like.
As shown in fig. 3, in some embodiments, the method of the present application can be applied to a system as shown, which includes three parts: host computer, core controller and field device.
The upper computer is provided with software which is responsible for configuring the relevant attributes of the core controller and uniformly issues the point location list to the core controller after the point location is configured. The point location table includes information such as an address of a device to be read by the controller, a protocol corresponding to the device, and a point location corresponding to the protocol. The upper computer is used for realizing the protocol segmentation method, segmenting the protocol containing point location, and issuing the segmented point location information to the core controller.
The core controller can receive the configuration information sent by the upper computer, read data of the downstream field equipment according to the point location protocol segmentation information, process related protocol data, and analyze the point location data according to the point location address to perform logic operation.
A field device: the field devices may communicate data with the core controller according to different protocols (e.g., modbus, bacnet, etc.).
The point location information is the sum of the memory address (point location address) of the physical point location that can be controlled, the data type, the valid data (point location data), and other information. A frame data segment in a communication protocol may carry one or more point location information. Point location address: is a kind of virtual mapping memory address marked in the controller for the actual physical pin frequency feedback, usually 16-system integer calibration. Point location data: the data is the data after the electric digital processing of the actual memory pin, such as the temperature of an air conditioner, the frequency of a water pump and the like. The point location protocol refers to a protocol frame containing point location information; the segmentation information refers to frame protocol information segmented according to the distribution condition of point location addresses after point location information in a protocol is read.
The point bit table contains the point bit address and the segment information. The point-to-point address is a virtual number mapping, and usually, when the controller reads data, the controller reads a single point-to-point address, or only reads continuous address points. The invention provides a mode capable of reading discontinuous address points, so that the reading efficiency can be greatly improved. After reading the data (usually some digital semaphore), the controller reloads the data into the protocol frame of the feedback as feedback information.
As shown in fig. 4, in some embodiments, a frame data segment (containing complete points that need to be configured) of an unsegmented protocol frame is shown. The solid line boxes in fig. 4 represent the actual valid point location addresses, i.e. the point location information that the controller needs to read; the dotted part box indicates the space between address bits between the real point bits; the widths of the solid and dashed boxes are used to illustrate the length and to calculate the assignment principle. The frame data section of the protocol frame can contain various data structures; for example, in the figure, I indicates a data structure, occupying 4 bytes, 32bits; s denotes another data structure, occupying 2 bytes, 16bits.
It should be noted that, before the segmentation, which portions in the frame data segment of the protocol frame are valid point addresses and which portions are empty are determined. The bits are initially removed, which involves numerous operations for slicing and splicing the data bits, which are very inefficient operations in computers. The scheme of the application does not involve the cutting and splicing of data bits when the data is read, so that the time can be saved.
In order to make the objects, technical solutions and advantages of the present invention more clear, an embodiment of the present invention is described in further detail below with reference to the accompanying drawings, as shown in fig. 5 a.
Step one, after the upper computer finishes the point location information of a core controller (a protocol automatic segmentation processing device) and clicks a point location information table to issue, the upper computer sends an instruction, field equipment and the core controller carry out m-time communication according to a general protocol, the average time t1 of the m-time communication is calculated, the instruction is sent, the core controller reads a protocol frame with a specified length, and the average value t2 of the processing time of the o-time core controller is recorded.
That is, before the formal segmentation, step one of the present solution issues a protocol frame that is not segmented to perform communication to test the communication performance of the system, and the purpose of step one is to determine which segmentation method the used protocol is more suitable for. Wherein, the 'specified length' is a preset length value; since the longest frames that different protocols support to transmit are defined differently, the "specified length" needs to be defined within the longest frame of the protocol frame.
As shown in fig. 5b, in some embodiments, the specific steps of step S1 include: obtaining communication performance data; determining a segment type according to the communication performance data; and determining a corresponding characteristic value formula according to the segmentation type.
If t1> t2, it is indicated that the communication between the controller and the field device is time-consuming compared with the processing of the point location values of the data segment, so a loose segmentation mode can be selected, each frame contains effective data as much as possible, and meanwhile, the high utilization rate of the point location address is ensured, otherwise, a compact segmentation mode is selected.
In some embodiments, the communication performance data comprises: an average communication time period t1 and an average reading time period t2. Accordingly, determining a segment type from the communication performance data includes: if t1> t2, the segmentation type is loose type segmentation; otherwise the segment type is compact.
1. The compact segmentation eigenvalue calculation formula is as follows:
Figure BDA0003688233000000091
wherein i is the serial number of the effective points, n is the number of the effective points, l i The data length of each effective point is; j is the serial number of all the point locations, N is the number of all the point locations, l j The data length of each point location; dl is protocol constant data; s is the sum of all the lengths of the voids.
2. The eigenvalue calculation formula of the loose type segment is as follows:
Figure BDA0003688233000000092
wherein N is the number of valid point locations, N is the number of all point locations, and dl is protocol constant data.
And step two, calculating the R1 value of the whole address field bit according to the formula. It is worth noting that there are some differences in the calculation process between compact and decentralized.
In the compact segmentation mode, dl1= bit1+ bit2+ bit3; wherein, bit1 represents the length of frame interval bit, bit2 represents the length of frame attribute segment bit, and bit3 represents the length of frame ending segment bit. In the case of a segmented approach of the loose type,
Figure BDA0003688233000000093
wherein bit max The maximum value of the bit length of the various data types in the protocol is represented,
Figure BDA0003688233000000094
indicating a ceiling operation.
And step three, after R1 is calculated, searching for the idle region with the longest length in the whole address bits, and removing the idle region, thereby dividing the whole into two address segment bits. If the comparison shows that the regions with the same length are empty, the empty region closest to the middle position is selected for segmentation. Referring to fig. 6, a schematic diagram of the whole protocol data is shown, and after the invalid region with the longest length is removed, two address field bits of the segmented protocol data A1 and the segmented protocol data A2 are obtained.
In some embodiments, the preset segmentation rule comprises a first segmentation rule; the first segmentation rule includes: determining the segmentation position according to the length of each vacancy in the overall protocol data; the overall protocol data is split into two pieces of segmented protocol data from the segmentation location. Specifically, searching the space with the longest length in the whole protocol data, and taking the space as a segmentation position; if there are at least two of the longest nulls, the null closest to the middle position is taken as the segmentation position.
In practical applications, the first segmentation rule further includes: and if the whole protocol data is not empty, segmenting the whole protocol data according to the preset maximum protocol length.
Step four, respectively carrying out R2 value calculation on the two segmented protocol data to obtain R2 1 、R2 2 Provided that R2 is 1 、R2 2 If one of the values is larger than the value of R1, the segmentation is carried out according to a preset segmentation rule. Referring to fig. 6, it is necessary to separately calculate the second characteristic value R2 of the segmentation protocol data A1 1 And a second characteristic value R2 of the segmentation protocol data A2 2 (ii) a Then R2 is 1 、R2 2 And respectively comparing the size of the data with that of the R1, and respectively carrying out subsequent processing on the segmented protocol data A1 and the segmented protocol data A2 according to the comparison result. If R2 is 1 If the total protocol data is larger than R1, taking the corresponding segmented protocol data A1 as new overall protocol data to carry out the next round of segmentation; in the same way, if R2 2 If the data size is larger than R1, the corresponding segmented protocol data A2 is taken as a new integral protocolThe conference data proceeds to the next round of segmentation.
In some embodiments, step S4 specifically includes: judging whether the segmented protocol data meets a first segmentation condition or not according to the first characteristic value R1 and the second characteristic value R2; and if the first segmentation condition is not met, judging whether a second segmentation condition is met according to the length of the segmentation protocol data.
In practical applications, the first segmentation condition includes: if the second characteristic value R2 is greater than the first characteristic value R1, the segmentation protocol data corresponding to R2 meets the first segmentation condition. The second segmentation conditions include: and if the length of the segmentation protocol data is greater than the preset maximum protocol length, meeting a second segmentation condition.
If none of the values is greater than R1 (R2) 1 、R2 2 Both smaller than R1), a comparison is started whether the total length of the segments (A1, A2) is larger than the maximum length supported by the protocol (i.e. the protocol type of the overall protocol data, which maximum length is supported). If the length is greater than the maximum length, finding out whether the segment is empty, if yes, returning to the second step to continue the recursion process, if not, dividing the address segment according to the maximum length to form two segments, then judging whether the segmented address is longer than the maximum protocol segment, and carrying out recursion judgment. If the protocol frame is less than the maximum length, the original segment is reserved, and the segmentation process is ended.
In some embodiments, the preset segmentation rules further include a second segmentation rule. The second segmentation rule includes: judging whether the segmentation protocol data is empty or not; if the null exists, segmenting according to a first segmentation rule; and if no gap exists, segmenting according to the preset maximum protocol length.
In practical application, segmenting the segmented protocol data again as new overall protocol data includes: when the segmentation protocol data meets a first segmentation condition, segmenting the segmentation protocol data according to a first segmentation rule; and when the segmentation protocol data meets the second segmentation condition, segmenting the segmentation protocol data according to a second segmentation rule.
And step five, finally, dividing a frame data segment (comprising a plurality of point data) in the communication protocol into a plurality of segments (each segment comprises a point data) according to a recursion mode by segmentation, sending the segmentation configuration table to a core controller by the upper computer, and reading data by the core controller according to the segments to ensure that the reading efficiency is highest.
Fig. 7 is a block diagram illustrating a protocol auto-segmentation apparatus in accordance with an exemplary embodiment. Referring to fig. 7, the apparatus includes: the device comprises an acquisition module, a segmentation module, a feature calculation module and a judgment module.
And the acquisition module is used for acquiring a preset characteristic value formula. And the segmentation module is used for segmenting the whole protocol data according to a preset segmentation rule to obtain at least two pieces of segmented protocol data. And the characteristic calculation module is used for calculating a first characteristic value of the whole protocol data and a second characteristic value of the segmented protocol data according to a characteristic value formula. And the judging module is used for judging whether the segmentation protocol data meet the segmentation conditions according to the first characteristic value and the second characteristic value. And the segmentation module is also used for segmenting the segmented protocol data serving as new overall protocol data again when the segmentation condition is met until the segmentation condition is not met.
With regard to the apparatus in the above embodiment, the specific steps in which the respective modules perform operations have been described in detail in the embodiment related to the method, and are not described in detail herein. The modules in the protocol automatic segmentation device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In some embodiments, the present application also provides a computer device. The computer device includes a processor, a memory, and a communication interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device 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 communication interface of the computer device is used for connecting the core controller so as to be in communication connection with an external core controller. The computer program is executed by a processor to implement a protocol auto-segmentation method.
In some embodiments, the present application further provides a building automation system, comprising: host computer, core controller and field device. The upper computer is used for executing the protocol automatic segmentation method in any embodiment, and sending the segmented protocol information to the core controller. The core controller is used for receiving and reading the segmented protocol information so as to determine the point location address corresponding to each field device. The scheme is applied to the building automatic control system, can automatically perform segmentation processing on the input protocol, and submits the input protocol to the building automatic control system, so that efficient data reading can be realized.
In summary, the application designs a uniform segmented computation model based on the abstract structure of the universal protocol data frame; by abstracting various common protocols (such as modbus, bacnet and the like) visible on the market and unifying the processing flow of protocol segmentation, the support of multiple protocols is realized by replacing constant factors of a unified calculation formula aiming at each protocol, and the calculation modes of the multiple protocols are quickly realized. Therefore, point position automatic segmentation of different protocols (such as modbus, bacnet and the like) can be realized, and automatic segmentation under different use scenes can be realized.
The method and the device can dynamically adjust the segmentation mode according to the performance of the communication network and hardware. Based on two different segmentation modes (compact and loose), the balance adaptation between the network communication performance and the processing performance of the controller is achieved, and the maximum operation efficiency is achieved on the premise that the protocol content is not modified under standard protocols (such as modbus, bacnet and the like).
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that, in the description of the present application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present application, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (16)

1. A method for automatic segmentation of a protocol, comprising:
acquiring a preset characteristic value formula;
segmenting the whole protocol data according to a preset segmentation rule to obtain at least two segmented protocol data;
calculating a first characteristic value of the overall protocol data and a second characteristic value of the segmented protocol data according to the characteristic value formula;
judging whether the segmentation protocol data meet the segmentation condition or not according to the first characteristic value and the second characteristic value;
and if the segmentation condition is met, segmenting the segmented protocol data serving as the new overall protocol data again until the segmentation condition is not met.
2. The method of claim 1, wherein obtaining the preset eigenvalue formula comprises:
acquiring communication performance data;
determining a segment type according to the communication performance data;
and determining a corresponding characteristic value formula according to the segmentation type.
3. The method of claim 2, wherein the communication performance data comprises: average communication time t1 and average reading time t2;
the determining a segment type according to the communication performance data includes:
if t1> t2, the segmentation type is loose type segmentation;
otherwise the segment type is compact.
4. The method of claim 3, wherein the compact segment corresponds to an eigenvalue formula of:
Figure FDA0003688232990000011
wherein i is the serial number of the effective points, n is the number of the effective points, l i The data length of each effective point is; j is the serial number of all the point locations, N is the number of all the point locations, l j The data length of each point location; dl is protocol constant data; s is the sum of all the lengths of the voids.
5. The method of claim 3, wherein the loose type segment corresponds to an eigenvalue formula of:
Figure FDA0003688232990000021
wherein N is the number of valid point locations, N is the number of all point locations, and dl is protocol constant data.
6. The method according to any one of claims 1 to 5, wherein the preset segmentation rule comprises a first segmentation rule; the first segmentation rule comprises:
determining the segmentation position according to the length of each vacancy in the overall protocol data;
the overall protocol data is split into two pieces of segmented protocol data from the segmentation location.
7. The method of claim 6, wherein determining the segment position according to the length of each null in the overall protocol data comprises:
searching the empty data with the longest length in the whole protocol data as a segmentation position;
if there are at least two of the longest length nulls, the null closest to the middle position is taken as the segmentation position.
8. The method of claim 6, wherein the first segmentation rule further comprises:
and if the whole protocol data is not empty, segmenting the whole protocol data according to the preset maximum protocol length.
9. The method of claim 6, wherein the determining whether the segmentation protocol data satisfies the segmentation condition according to the first characteristic value and the second characteristic value comprises:
judging whether the segmented protocol data meets a first segmentation condition or not according to the first characteristic value and the second characteristic value;
and if the first segmentation condition is not met, judging whether a second segmentation condition is met according to the length of the segmentation protocol data.
10. The method of claim 9, wherein the first segmentation condition comprises:
and if the second characteristic value is greater than the first characteristic value, the segmentation protocol data corresponding to the second characteristic value meets a first segmentation condition.
11. The method of claim 9, wherein the second segmentation condition comprises:
and if the length of the segmentation protocol data is greater than the preset maximum protocol length, meeting a second segmentation condition.
12. The method of claim 9, wherein the preset segmentation rules further include a second segmentation rule;
the segmenting the segmented protocol data as new overall protocol data again includes:
when the segmentation protocol data meets a first segmentation condition, segmenting the segmentation protocol data according to a first segmentation rule;
and when the segmentation protocol data meets the second segmentation condition, segmenting the segmentation protocol data according to a second segmentation rule.
13. The method of claim 12, wherein the second segmentation rule comprises:
judging whether the segmented protocol data has a null state or not;
if the null exists, segmenting according to a first segmentation rule;
and if no gap exists, segmenting according to the preset maximum protocol length.
14. An apparatus for automatically segmenting a protocol, comprising:
the acquisition module is used for acquiring a preset characteristic value formula;
the segmentation module is used for segmenting the whole protocol data according to a preset segmentation rule to obtain at least two pieces of segmented protocol data;
the characteristic calculation module is used for calculating a first characteristic value of the whole protocol data and a second characteristic value of the segmented protocol data according to the characteristic value formula;
the judging module is used for judging whether the segmentation protocol data meet the segmentation condition according to the first characteristic value and the second characteristic value;
and the segmentation module is also used for segmenting the segmented protocol data serving as new overall protocol data again when the segmentation condition is met until the segmentation condition is not met.
15. A computer device, comprising:
a memory for storing a computer program;
a processor for executing the computer program in the memory to carry out the operational steps of the method of any one of claims 1 to 13.
16. A building automation system comprising: the system comprises an upper computer, a core controller and field equipment; the method is characterized in that:
the upper computer is used for executing the method of any one of claims 1 to 13 and sending the segmented protocol information to the core controller;
the core controller is used for receiving and reading segmented protocol information so as to determine point location addresses corresponding to the field devices.
CN202210652741.2A 2022-06-10 2022-06-10 Protocol automatic segmentation method and device Active CN115208958B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210652741.2A CN115208958B (en) 2022-06-10 2022-06-10 Protocol automatic segmentation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210652741.2A CN115208958B (en) 2022-06-10 2022-06-10 Protocol automatic segmentation method and device

Publications (2)

Publication Number Publication Date
CN115208958A true CN115208958A (en) 2022-10-18
CN115208958B CN115208958B (en) 2023-08-25

Family

ID=83576234

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210652741.2A Active CN115208958B (en) 2022-06-10 2022-06-10 Protocol automatic segmentation method and device

Country Status (1)

Country Link
CN (1) CN115208958B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597734A (en) * 2019-09-23 2019-12-20 电子科技大学 Fuzzy test case generation method suitable for industrial control private protocol
CN112291101A (en) * 2020-11-06 2021-01-29 珠海格力电器股份有限公司 Communication node and communication framing optimization method of upper computer to lower computer
CN112631767A (en) * 2019-10-09 2021-04-09 华控清交信息科技(北京)有限公司 Data processing method, system, device, electronic equipment and readable storage medium
CN113194038A (en) * 2021-04-06 2021-07-30 重庆芯力源科技有限公司 Data forwarding method of intelligent edge gateway
WO2022027480A1 (en) * 2020-08-06 2022-02-10 华为数字能源技术有限公司 Data collection method and apparatus, modbus system, and storage medium
CN114116001A (en) * 2021-11-25 2022-03-01 南京天溯自动化控制系统有限公司 Configuration method and device for controlling priority reading of associated data based on master-slave answer mode protocol, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597734A (en) * 2019-09-23 2019-12-20 电子科技大学 Fuzzy test case generation method suitable for industrial control private protocol
CN112631767A (en) * 2019-10-09 2021-04-09 华控清交信息科技(北京)有限公司 Data processing method, system, device, electronic equipment and readable storage medium
WO2022027480A1 (en) * 2020-08-06 2022-02-10 华为数字能源技术有限公司 Data collection method and apparatus, modbus system, and storage medium
CN112291101A (en) * 2020-11-06 2021-01-29 珠海格力电器股份有限公司 Communication node and communication framing optimization method of upper computer to lower computer
CN113194038A (en) * 2021-04-06 2021-07-30 重庆芯力源科技有限公司 Data forwarding method of intelligent edge gateway
CN114116001A (en) * 2021-11-25 2022-03-01 南京天溯自动化控制系统有限公司 Configuration method and device for controlling priority reading of associated data based on master-slave answer mode protocol, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
武亚奇;戎洲汉;王景成;: "协议宏在分布式供能系统中的应用", 自动化仪表, no. 07, pages 37 - 39 *

Also Published As

Publication number Publication date
CN115208958B (en) 2023-08-25

Similar Documents

Publication Publication Date Title
CN108694021A (en) The system and method for configuring storage device using baseboard management controller
US6611866B1 (en) Management object for aggregated network device status
CN103078898B (en) File system, interface service device and data storage service supplying method
JP2000330858A (en) Image processor and program storage medium
WO2020042612A1 (en) Method and device for storing and reading a message, server, and storage medium
WO2021114025A1 (en) Incremental data determination method, incremental data determination apparatus, server and terminal device
CN111130962A (en) Automatic configuration method, equipment, system and storage medium for switch
CN115114219B (en) PCI-E topology method, device, equipment and storage medium
CN110837488B (en) Message transmission method and device
CN112527450B (en) Super-fusion self-adaptive method, terminal and system based on different resources
CN111651126B (en) Memory writing operation method, system, electronic device and medium
CN110502187A (en) A kind of snapshot rollback method and device
US7047359B1 (en) Method, system and product for managing a virtual storage system
CN115208958A (en) Protocol automatic segmentation method and device
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
CN113051244B (en) Data access method and device, and data acquisition method and device
CN115604070A (en) Message transmission method, device, equipment and medium based on MCTP (Multi-function peripheral protocol)
CN113271323B (en) Cluster capacity expansion method and device and storage medium
CN114416656A (en) Method, equipment and storage medium for remotely operating folder
CN114625474A (en) Container migration method and device, electronic equipment and storage medium
CN114254164A (en) Graph data storage method and device
CN115221360A (en) Tree structure configuration method and system
CN112527780A (en) Redis cluster creating and managing method, system, computer device and storage medium
WO2020155538A1 (en) Video processing method and system, computer device and storage medium
CN114500688B (en) Method, device, terminal and storage medium for identifying equipment protocol

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
GR01 Patent grant
GR01 Patent grant