CN105653616B - Communication protocol conversion method of power system master station - Google Patents

Communication protocol conversion method of power system master station Download PDF

Info

Publication number
CN105653616B
CN105653616B CN201510991463.3A CN201510991463A CN105653616B CN 105653616 B CN105653616 B CN 105653616B CN 201510991463 A CN201510991463 A CN 201510991463A CN 105653616 B CN105653616 B CN 105653616B
Authority
CN
China
Prior art keywords
data
type
data segment
attribute
attribute value
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.)
Active
Application number
CN201510991463.3A
Other languages
Chinese (zh)
Other versions
CN105653616A (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.)
Changsha Wasion Information Technology Co ltd
Original Assignee
Changsha Wasion Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changsha Wasion Information Technology Co ltd filed Critical Changsha Wasion Information Technology Co ltd
Priority to CN201510991463.3A priority Critical patent/CN105653616B/en
Publication of CN105653616A publication Critical patent/CN105653616A/en
Application granted granted Critical
Publication of CN105653616B publication Critical patent/CN105653616B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Abstract

The invention discloses a communication protocol conversion method of a main station of an electric power system, which comprises the steps of decomposing user data into data segments according to function types according to a communication protocol; limiting the data type of the data segment to obtain a data model; matching the data model with the communication protocol, forming an XML configuration file according to the matched data model and labeling the XML configuration file; loading an XML configuration file according to the user data identification, and traversing the data segments to obtain a matching result; the master station loads an XML configuration file according to the user data identification of the communication protocol to be converted to obtain a matching result of the XML file and the data segment; and carrying out protocol analysis on the communication frame to obtain target data, and carrying out protocol packaging on the target data to finish the conversion of the communication protocol. The method is suitable for all types of communication protocols, is particularly suitable for occasions with complex communication data, complex communication protocols or frequent communication protocols needing to be converted, is simple and easy to implement, and can quickly finish the conversion of the communication protocols.

Description

Communication protocol conversion method of power system master station
Technical Field
The invention belongs to the field of communication, and particularly relates to a communication protocol conversion method of a master station of an electric power system.
Background
With the development of national economic technology and the improvement of the living standard of people, electric energy becomes essential secondary energy for production and life of people. The electric energy meter is used as an instrument for measuring electric energy, is distributed at each terminal user nearby and is used for measuring the electricity consumption of the users and uploading data, and the electric power system personnel can count the electricity consumption and collect the electricity cost conveniently.
At present, a remote meter reading technology is widely applied to meter reading of an electric power system, each terminal device transmits information of each terminal device to a master station through a certain communication protocol through a common signal, and the master station realizes functions of data acquisition, analysis, statistics, control and the like.
However, at present, due to the national conditions of China, the communication protocol versions existing in the power grid of China are many, such as the IEC version, the electric power industry association version, the national power grid company version, the southern power grid company version, the enterprise standard version, the provincial versions of the power company, and the like. With such a plurality of protocol versions, the difference between the protocol versions is very large, and the protocol versions are difficult to unify. The existence of such many stipulations versions leads to the communication system development degree of difficulty of electric power system main website very big, can't be applicable to the communication stipulations of polymorphic type, in case need modify the stipulations that communication system supported, the extension in main website communication system later stage and the work load of maintaining are huge moreover, and the cost is high.
At present, the general method of protocol processing is as follows: analyzing or packaging the binary data stream according to the frame structure combination of a message header, an address field, a user data identifier, user data, a message tail and the like; however, complex user data is extremely difficult to process, and a general protocol processing method can only design a data structure for each type of data due to various user data types and very large format difference, and cannot achieve generalization and configurability.
Disclosure of Invention
The invention aims to provide a communication protocol conversion method of a power system main station, which can support multiple protocols and can quickly realize the mutual conversion among the multiple communication protocols.
The communication protocol conversion method of the main station of the power system provided by the invention comprises the following steps:
s1, according to the stipulations of various types of power grid communication protocols on user data, decomposing the user data into data segments according to function types;
s2, according to the data segments obtained in the step S1, limiting the data types of the data segments, so as to obtain a data model of the user data;
s3, matching the data model obtained in the step S2 with the communication protocol according to the regulation of each communication protocol, forming an XML configuration file according to the matched data model, and labeling the XML file according to the user data identification in the communication protocol;
s4, loading the XML configuration file obtained in the step S3 according to the user data identification in the communication protocol, traversing the step S1 according to the loaded XML configuration file to obtain a data segment, and obtaining a matching result of the XML file and the data segment obtained in the step S1.
And S5, according to the matching result in the step S4, carrying out protocol analysis on the communication frame needing to be analyzed or carrying out protocol packaging on the data needing to be sent, and finishing the processing of the communication protocol.
The data segments described in step S1 include an encoding type data segment, a display type data segment, an encoding length data segment, a decimal number data segment, a sign bit position data segment, a unit data segment, a maximum value data segment, a minimum value data segment, an independent bit structure type start bit data segment, an independent bit structure type bit length data segment, an independent bit structure type end flag data segment, an inversion indication data segment, an enumeration type and enumeration item correspondence data segment, an independent bit structure type correspondence data segment, a reduced 645 frame format data identification type data segment, a data block length data segment, a time format data segment, and an available data segment.
The data type limitation on the data segment in step S2 is to perform data type limitation on the data segment by using table 1:
TABLE 1 data section schematic table
Figure BDA0000890573380000021
Figure BDA0000890573380000031
The protocol parsing in step S5 is to take out specific data in communication frames one by one for the communication frames that need to be parsed, and perform data parsing according to the matching result in step S4.
The protocol packet in step S5 is to form byte streams bit by bit according to the matching result in step S4 for the data to be sent, and finally complete the protocol packet of the data.
The invention provides concepts of user data models and data segments with strong universality by analyzing commonalities and differences of existing communication protocols, forms XML configuration files according to requirements of all communication protocols and matching results of the user data models and the data segments, and can rapidly perform protocol analysis, protocol group package or protocol conversion according to the configuration files by calling the edited XML configuration files when protocol processing is required, such as communication frame analysis, data protocol group package or data protocol conversion. The method is suitable for all types of communication protocols, particularly suitable for occasions with complex communication data, complex communication protocols or frequent communication protocols needing conversion, is simple and easy to implement, and can quickly finish the processing of the communication protocols.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
FIG. 1 shows a flow chart of the method of the present invention: the communication protocol conversion method of the main station of the power system provided by the invention comprises the following steps:
s1, according to the stipulations of various types of power grid communication protocols on user data, decomposing the user data into data segments according to function types;
the data segments comprise an encoding type data segment, a display type data segment, an encoding length data segment, a decimal digit data segment, a sign bit position data segment, a unit data segment, a maximum value data segment, a minimum value data segment, an independent bit structure type start bit data segment, an independent bit structure type bit length data segment, an independent bit structure type end mark data segment, an inversion indicating data segment, an enumeration type and enumeration item corresponding relation data segment, an independent bit structure type corresponding bit data segment, a 645 protocol frame format data identification type data segment, a data block length data segment, a time format data segment and an available data segment.
S2, according to the data segments obtained in the step S1, limiting the data types of the data segments, so as to obtain a data model of the user data;
the data type limitation of the data segment is to adopt table 1 to limit the data type of the data segment:
TABLE 1 data section schematic table
Figure BDA0000890573380000032
Figure BDA0000890573380000041
S3, matching the data model obtained in the step S2 with the communication protocol according to the regulation of each communication protocol, forming an XML configuration file according to the matched data model, and labeling the XML file according to the user data identification in the communication protocol;
s4, the master station loads corresponding XML configuration files according to user data identification in the communication protocol to be converted, and traverses the step S1 to obtain data segments according to the loaded XML configuration files, so as to obtain the matching result of the XML files and the data segments in the step S1;
and S5, according to the matching result in the step S4, carrying out protocol analysis on the communication frame needing to be analyzed to obtain data needing to be sent, and carrying out protocol packaging on the obtained data to complete the processing of the communication protocol.
The protocol analysis is to take out specific data in the communication frames one by one and analyze the data according to the matching result in step S4 for the communication frames to be analyzed.
The protocol packet is to form byte streams bit by bit according to the matching result in step S4 for the data to be sent, and finally completes the protocol packet of the data.

Claims (5)

1. A communication protocol conversion method of a power system master station comprises the following steps:
s1, according to the regulation of each type of communication protocol to the user data, the user data is decomposed into data segments according to the function type;
s2, according to the data segments obtained in the step S1, the data types of the data segments are limited, and therefore a data model of the user data is obtained;
s3, according to the stipulation of each communication protocol, matching the data model obtained in the step S2 with the communication protocol, forming an XML configuration file according to the matched data model, and labeling the XML file according to the user data identification in the communication protocol;
s4, the master station loads respective corresponding XML configuration files according to the user data identification in the communication protocol to be converted, and traverses the step S1 to obtain data segments according to the loaded XML configuration files, so as to obtain the matching result of the XML files and the data segments in the step S1;
and S5, according to the matching result in the step S4, carrying out protocol analysis on the communication frame needing to be analyzed to obtain the data needing to be sent, and carrying out protocol packaging on the obtained data to complete the processing of the communication protocol.
2. The method according to claim 1, wherein the data segments in step S1 include an encoding type data segment, a display type data segment, an encoding length data segment, a decimal number data segment, a sign bit position data segment, a unit data segment, a maximum value data segment, a minimum value data segment, an independent bit structure type start bit data segment, an independent bit structure type bit length data segment, an independent bit structure type end flag data segment, an inversion indication data segment, an enumeration type and enumeration item correspondence data segment, an independent bit structure type correspondence data segment, a 645 protocol frame format data identification type data segment, a data block length data segment, a time format data segment, and an available data segment.
3. The method for converting communication protocols of a primary station of an electric power system according to claim 1 or 2, wherein the data type of the data segment is defined in step S2, specifically, the data type of the data segment is defined by using the following rules:
the item attribute of the data segment is a codetype, the attribute value of the data type is BIN, and the data type is indicated to be a BIN code;
the item attribute of the data segment is codetype, the attribute value of the data type is BCD, and the data type is indicated as BCD code;
the item attribute of the data segment is codetype, the attribute value of the data type is ASCII, and the data segment is indicated to be ASCII code;
the item attribute of the data segment is a codetype, the attribute value of the data type is BUFFER, and the data segment is indicated to be a message text type;
the item attribute of the data segment is a codetype, and the attribute value of the data type is a data format 01, which indicates that the data segment is a self-defined type;
the item attribute of the data segment is a codetype, and the attribute value of the data type is a data format 02, which indicates that the data segment is a self-defined type;
the item attribute of the data segment is type display type, the data type attribute value is array, and the data segment is indicated as a data block;
the item attribute of the data segment is a type display type, the data type attribute value is struct, and the data type attribute value is used for indicating that the data segment is a data block index;
the item attribute of the data segment is a type display type, and the attribute value of the data type is multi, which indicates that the data segment is an enumeration type;
the item attribute of the data segment is type display type, the attribute value of the data type is single, and the data type is indicated to be enumerated;
the item attribute of the data segment is type display type, the attribute value of the data type is multis, and the data type is indicated to be independent bit combination;
the item attribute of the data segment is type display type, the data type attribute value is DateTime, and the data type attribute value is time;
the item attribute of the data segment is type display type, the data type attribute value is int, which indicates that the data segment is shaped;
the item attribute of the data segment is type display type, the data type attribute value is uint, and the data segment is described as unsigned shaping;
the item attribute of the data segment is type display type, the data type attribute value is string, and the data type attribute value is string, which indicates that the data segment is a character string;
the item attribute of the data segment is type display type, the attribute value of the data type is double, and the data type is long integer;
the item attribute of the data segment is a type display type, and the data type attribute value is IP, which indicates that the data segment is an IP address;
the item attribute of the data segment is type display type, the attribute value of the data type is phone, which indicates that the data segment is a telephone number;
the item attribute of the data segment is type display type, the attribute value of the data type is options, and the data type is described as a command selection field;
the item attribute of the data segment is codelength coding length, and the data type attribute value is decimal number, which indicates that the data segment is the length of the data subentry or the number of bytes occupied;
the item attribute of the data segment is codelength coding length, and the data type attribute value is PreDataValue, which indicates that the data segment is the value of the previous parameter subentry;
the item attribute of the data segment is codelength coding length, the data type attribute value is depth, and the data type attribute value is indicated to be routing depth;
the item attribute of the data segment is codelength coding length, and the data type attribute value is DataLen, which indicates that the data segment is variable data field length;
the item attribute of the data segment is decimals, the data type attribute value is a decimal number, and the decimal number is indicated as a decimal digit number;
the item attribute of the data segment is sign bit, the data type attribute value is decimal number, and the data type attribute value is a sign bit position;
the item attribute of the data segment is unit, the data type attribute value is a character string, and the data type attribute value is a unit;
the item attribute of the data segment is max, the data type attribute value is decimal number, which shows that the data segment is maximum value and the integer is effective;
the item attribute of the data segment is min, the data type attribute value is decimal number, which shows that the data segment is the minimum value, and the integer is effective;
the item attribute of the data segment is bitstart, the data type attribute value is decimal number, which shows that the data segment is an independent bit structure type initial bit;
the item attribute of the data segment is bitlength, the data type attribute value is decimal number, and the decimal number indicates that the decimal number is the bit length of an independent bit structure type;
the item attribute of the data segment is bitend, the attribute value of the data type is True or False, and whether the attribute is an independent bit structure type ending mark or not is shown;
the item attribute of the data segment is reverse, and the data type attribute value is True or False, which indicates whether the data segment is an inversion indication;
the item attribute of the data segment is values, the data type attribute value is value, item | value and item …, and the data type attribute value is the corresponding relation between the enumeration type value and the enumeration item;
the item attribute of the data segment is values, the data type attribute value is item | item | item | item …, which indicates that the data segment is an independent bit structure type corresponding bit;
the item attribute of the data segment is type, the attribute values of the data type are 0, 1 and 2, which indicates that the data segment is 645 reduced frame format data identification type;
the item attribute of the data segment is structlength, the data type attribute value is a 10-system number, and the data type attribute value is the length of the data block;
the item attribute of the data segment is codemark, and the data type attribute value is a time format character string, which indicates that the data segment is in a time format;
the item attribute of the data segment is enable, and the data type attribute value is True or False, which indicates whether the data segment is available or not.
4. The method of claim 1 or 2, wherein the protocol parsing in step S5 is to take out specific data in communication frames one by one for the communication frames to be parsed, and perform data parsing according to the matching result in step S4.
5. The method of claim 1 or 2, wherein the protocol packet of step S5 is formed into byte stream bit by bit according to the matching result of step S4 for the data to be transmitted, and finally the protocol packet of the data is completed.
CN201510991463.3A 2015-12-25 2015-12-25 Communication protocol conversion method of power system master station Active CN105653616B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510991463.3A CN105653616B (en) 2015-12-25 2015-12-25 Communication protocol conversion method of power system master station

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510991463.3A CN105653616B (en) 2015-12-25 2015-12-25 Communication protocol conversion method of power system master station

Publications (2)

Publication Number Publication Date
CN105653616A CN105653616A (en) 2016-06-08
CN105653616B true CN105653616B (en) 2020-06-09

Family

ID=56477891

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510991463.3A Active CN105653616B (en) 2015-12-25 2015-12-25 Communication protocol conversion method of power system master station

Country Status (1)

Country Link
CN (1) CN105653616B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959305B (en) * 2016-07-01 2019-04-19 国网山东省电力公司博兴县供电公司 A kind of substation's communication protocol converting system
CN107888595A (en) * 2017-11-15 2018-04-06 许昌智能继电器股份有限公司 A kind of embedded equipment CAN stipulations analytic methods based on XML technology
CN110290127A (en) * 2019-06-20 2019-09-27 云南电网有限责任公司电力科学研究院 A kind of message forwarding method and message converting system
CN111597411B (en) * 2020-05-13 2024-03-19 国家电网有限公司 Method and system for distinguishing and identifying power specification data frames
CN112333231A (en) * 2020-09-18 2021-02-05 许继集团有限公司 Method and system for realizing configured universal protocol based on mqtt Internet of things
CN114615344B (en) * 2022-02-08 2023-07-28 广东智有盈能源技术有限公司 Intelligent protocol conversion method and device for electric power instrument

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532749A (en) * 2013-10-09 2014-01-22 广州供电局有限公司 Main station information management system
CN104468508A (en) * 2014-10-29 2015-03-25 云南电网公司电力科学研究院 Automatic-adapting protocol converter
CN104735172A (en) * 2013-12-18 2015-06-24 易讯科技股份有限公司 Protocol conversion method of intelligent electricity using information collecting terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105162252B (en) * 2015-08-28 2018-03-02 珠海许继电气有限公司 The method of plug and play distribution terminal information realization automatic mapping based on CID files

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103532749A (en) * 2013-10-09 2014-01-22 广州供电局有限公司 Main station information management system
CN104735172A (en) * 2013-12-18 2015-06-24 易讯科技股份有限公司 Protocol conversion method of intelligent electricity using information collecting terminal
CN104468508A (en) * 2014-10-29 2015-03-25 云南电网公司电力科学研究院 Automatic-adapting protocol converter

Also Published As

Publication number Publication date
CN105653616A (en) 2016-06-08

Similar Documents

Publication Publication Date Title
CN105653616B (en) Communication protocol conversion method of power system master station
CN103379136B (en) Compression method and decompression method of log acquisition data, compression apparatus and decompression apparatus of log acquisition data
CN101459492B (en) Data transmission method and system, data sending terminal
US8060652B2 (en) Extensible binary mark-up language for efficient XML-based data communications and related systems and methods
CN110445860B (en) Message sending method, device, terminal equipment and storage medium
CN100425081C (en) Code-conversion method for shortmessage receiving and transmitting and network apparatus used thereof
CN111970353A (en) Data processing method and device for heterogeneous equipment in Internet of things of cloud computing platform
CN104123364A (en) Method and device for transmitting and receiving data through mobile terminal
CN101247434B (en) Traffic analyzing method and system
CN105046032A (en) Method and system for drawing power distribution network based on CAD
CN106789898A (en) Remote data transmission terminal, system and its coding, coding/decoding method
CN103399934A (en) Form data transmission and storage method
CN107463706A (en) A kind of storage of magnanimity recorder data and parsing method and system based on Hadoop
CN112632015A (en) Data format conversion method and device, storage medium and electronic equipment
CN110826299B (en) General template log analysis method based on classification
CN112214516A (en) Method and device for data serialization and deserialization
CN105389606A (en) Data generation and analysis methods, device and system based on open standards
CN104021121A (en) Method, device and server for compressing text data
CN104735172A (en) Protocol conversion method of intelligent electricity using information collecting terminal
CN205160805U (en) Radio communication gateway
CN114726380A (en) Monitoring data lossless compression method, device, equipment and readable storage medium
CN103167001A (en) Network data transmission method based on extensive makeup language (XML)
CN113067794B (en) Method and device for processing high-speed train data general protocol
CN108322331B (en) Communication method and system capable of dynamically adjusting interactive measuring points
CN113190961B (en) Implementation method for distribution network abnormal movement multitask model reconstruction

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant