CN107231347B - Method and system for data stream transmission service - Google Patents
Method and system for data stream transmission service Download PDFInfo
- Publication number
- CN107231347B CN107231347B CN201710310725.4A CN201710310725A CN107231347B CN 107231347 B CN107231347 B CN 107231347B CN 201710310725 A CN201710310725 A CN 201710310725A CN 107231347 B CN107231347 B CN 107231347B
- Authority
- CN
- China
- Prior art keywords
- service
- parameter
- sds
- type
- primitive
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/03—Protocol definition or specification
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
本发明涉及一种数据流传输服务的方法及系统。首先,定义服务数据流的格式:SDS类型+SDS对应服务原语+SDS参数;而后,依据服务请求服务原语,将服务参数编码成服务数据流;最后,接收端收到服务数据流,需将服务数据流解码,以获取服务参数。本发明为《通用服务协议》标准所描述的数据流交互方法发明了一种可具体实现方法及系统,解决了该标准没有具体解决该标准中所提到通过数据流传输服务的问题;本发明还可解决需要进行多项复杂数据进行整体交互或表达问题。
The invention relates to a method and system for data stream transmission service. First, define the format of the service data flow: SDS type + SDS corresponding service primitive + SDS parameter; then, according to the service request service primitive, encode the service parameters into the service data flow; finally, the receiving end receives the service data flow, needs Decode the service data stream to obtain service parameters. The present invention invents a concretely implementable method and system for the data stream interaction method described in the "Universal Service Agreement" standard, and solves the problem that the standard does not specifically solve the problem of data stream transmission services mentioned in the standard; the present invention It can also solve problems that require multiple complex data for overall interaction or expression.
Description
技术领域technical field
本发明属于电力自动化技术领域,涉及面向服务(SOA)架构体系的信息交互等双方需要进行复杂数据交换的信息交互场合,具体为一种数据流传输服务的方法及系统。The invention belongs to the technical field of electric power automation, and relates to information interaction occasions where both parties need to exchange complex data, such as information interaction of a service-oriented (SOA) architecture system, and specifically a method and system for data stream transmission services.
背景技术Background technique
随着计算机和网络技术的发展,电网的智能化水平和要求不断提升,传统的针对电力系统某些特定应用所设计的通信协议和信息交互机制已不能满足需要,需要不断的为这些协议做出非标准的扩充,导致系统不能互操作,采用面向服务(SOA)架构体系的信息交互机制已经成为一个发展方向,为此我国发布了《电力系统简单服务接口规范》(DL/T1233)为这个发展奠定了基础,待发布的《电力系统通用服务协议》标准又为解决这个问题提出了解决方案,但《电力系统通用服务协议》没具体的通过数据流实现服务传输的解决方案。本发明在《电力系统通用服务协议》基础上对如何通过数据流实现服务传输的问题提出了解决方案。With the development of computer and network technology, the intelligence level and requirements of the power grid are constantly improving. The traditional communication protocols and information interaction mechanisms designed for some specific applications in the power system can no longer meet the needs. It is necessary to continue to make these protocols The non-standard expansion leads to the non-interoperability of the system. The information interaction mechanism of the service-oriented (SOA) architecture system has become a development direction. For this reason, my country has issued the "Power System Simple Service Interface Specification" (DL/T1233) for this development. The foundation has been laid, and the "General Service Agreement for Power System" standard to be released has proposed a solution to this problem. However, the "General Service Agreement for Power System" has no specific solution for service transmission through data streams. The invention proposes a solution to the problem of how to realize service transmission through data flow on the basis of "General Service Agreement for Electric Power System".
发明内容Contents of the invention
本发明的目的在于提供一种解决了《通用服务协议》标准没有具体解决该标准中所提到通过数据流传输服务的问题的数据流传输服务的方法及系统。The purpose of the present invention is to provide a data stream transmission service method and system that solves the problem that the "Universal Service Agreement" standard does not specifically solve the problem of the data stream transmission service mentioned in the standard.
为实现上述目的,本发明的技术方案是:一种数据流传输服务的方法,包括如下步骤,In order to achieve the above object, the technical solution of the present invention is: a method for data stream transmission service, comprising the following steps,
S1、定义服务数据流的格式:SDS类型+SDS对应服务原语+SDS参数;S1. Define the format of the service data stream: SDS type + SDS corresponding service primitive + SDS parameter;
S2、依据服务请求服务原语,将服务参数编码成服务数据流,即:首先,判断需形成的服务数据流类型;而后,获取与服务数据流类型相应的服务请求服务原语;再而,根据需形成的服务数据流类型对SDS类型进行赋值;然后,将服务请求服务原语的服务名写入SDS对应服务原语中;最后,依据服务请求服务原语中服务请求参数的类型和顺序,查询服务参数编码表,并依据所查到的编码方法,将相应的服务请求参数进行编码后写入SDS参数中,形成服务数据流;S2. Encode the service parameters into a service data stream according to the service request service primitive, that is, firstly, determine the type of service data stream to be formed; then, obtain the service request service primitive corresponding to the service data stream type; and then, Assign the SDS type according to the type of service data flow to be formed; then, write the service name of the service request service primitive into the corresponding service primitive of the SDS; finally, according to the type and order of the service request parameters in the service request service primitive , query the service parameter encoding table, and according to the found encoding method, encode the corresponding service request parameter and write it into the SDS parameter to form a service data stream;
S3、接收端收到服务数据流,需将服务数据流解码,以获取服务参数,即:首先,解析服务数据流首字节,获取服务数据流的SDS类型;而后,按STRING类型格式解析服务数据流,获取服务请求服务原语的服务名,进而获取服务请求服务原语;最后,依据SDS类型、服务请求服务原语对服务数据流进行解析,获取相应的服务参数。S3. After receiving the service data stream, the receiving end needs to decode the service data stream to obtain service parameters, namely: firstly, parse the first byte of the service data stream to obtain the SDS type of the service data stream; then, parse the service according to the STRING type format Data flow, obtain the service name of the service request service primitive, and then obtain the service request service primitive; finally, analyze the service data flow according to the SDS type and service request service primitive, and obtain the corresponding service parameters.
在本发明一实施例中,所述服务参数编码表包括基本参数类型编码表和组合参数类型编码表,其中,基本参数类型编码表由基本参数类型、该基本参数类型对应的编码方法以及占数据流的字节数构成;组合参数类型编码表由组合参数类型、该组合参数类型对应的编码方法以及占数据流的字节数构成。In an embodiment of the present invention, the service parameter coding table includes a basic parameter type coding table and a combined parameter type coding table, wherein the basic parameter type coding table consists of the basic parameter type, the coding method corresponding to the basic parameter type, and the accounting data The number of bytes of the stream; the combination parameter type encoding table is composed of the combination parameter type, the encoding method corresponding to the combination parameter type, and the number of bytes occupying the data stream.
在本发明一实施例中,所述SDS类型的长度为一个字节;SDS对应服务原语的长度可变,其格式为STRING类型;SDS参数包含多段,段的个数由服务请求服务原语中参数的个数确定,各个段的格式由服务请求服务原语中各个参数的类型确定。In one embodiment of the present invention, the length of the SDS type is one byte; the length of the SDS corresponding service primitive is variable, and its format is a STRING type; the SDS parameter includes multiple segments, and the number of segments is determined by the service request primitive The number of parameters in is determined, and the format of each segment is determined by the type of each parameter in the service request service primitive.
在本发明一实施例中,所述SDS类型取值包括I、D、O,其中,I表示IN参数,为客户端到服务端方向;O表示OUT参数,为服务端到客户端方向;D表示无IN,OUT参数标识的数据块。In an embodiment of the present invention, the value of the SDS type includes I, D, O, wherein, I represents an IN parameter, which is the direction from the client to the server; O represents an OUT parameter, which is the direction from the server to the client; D Indicates a data block without IN and OUT parameters.
在本发明一实施例中,所述SDS参数的段的个数,通过如下方式决定:In an embodiment of the present invention, the number of segments of the SDS parameter is determined in the following manner:
若SDS类型取值为I时,SDS参数的段的个数为服务请求服务原语中标识为IN的参数的个数;If the value of the SDS type is 1, the number of segments of the SDS parameter is the number of parameters identified as IN in the service request service primitive;
若SDS类型取值为O时,SDS参数的段的个数为服务请求服务原语中标识为OUT的参数的个数;If the value of the SDS type is 0, the number of segments of the SDS parameter is the number of parameters marked as OUT in the service request service primitive;
若SDS类型取值为D时,SDS参数的段的个数为服务请求服务原语中所有参数的个数。If the value of the SDS type is D, the number of segments of the SDS parameter is the number of all parameters in the service primitive of the service request.
在本发明一实施例中,所述步骤S2中,若客户端向服务端发服务请求时,即需形成服务请求数据流时,将服务参数编码成服务数据流的具体方式如下:In an embodiment of the present invention, in the step S2, if the client sends a service request to the server, that is, when the service request data stream needs to be formed, the specific method of encoding the service parameters into the service data stream is as follows:
1)获取服务请求数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service request data flow;
2)将SDS类型赋值为I;2) Assign the SDS type as I;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)查询服务参数编码表,依次将服务请求服务原语中标识为IN的对应参数,写入SDS参数中,直到所有标识为IN的参数全部写入SDS参数中。4) Query the service parameter encoding table, and write the corresponding parameters marked as IN in the service request service primitive into the SDS parameters in turn, until all the parameters marked as IN are written into the SDS parameters.
在本发明一实施例中,所述步骤S2中,若服务端向客户端发服务响应时,即需形成服务响应数据流时,将服务参数编码成服务数据流的具体方式如下:In an embodiment of the present invention, in the step S2, if the server sends a service response to the client, that is, when it is necessary to form a service response data stream, the specific method of encoding the service parameters into a service data stream is as follows:
1)获取服务响应数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service response data flow;
2)将SDS类型赋值为O;2) Assign the SDS type to O;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)查询服务参数编码表,依次将服务请求服务原语中标识为OUT的对应参数,写入SDS参数中,直到所有标识为OUT的参数全部写入SDS参数中。4) Query the service parameter encoding table, and write the corresponding parameters marked as OUT in the service request service primitive into the SDS parameters in turn, until all the parameters marked as OUT are written into the SDS parameters.
在本发明一实施例中,所述步骤S2中,若需形成复杂数据传输使用时,将服务参数编码成服务数据流的具体方式如下:In an embodiment of the present invention, in the step S2, if complex data transmission needs to be formed, the specific method of encoding the service parameters into a service data stream is as follows:
1)获取服务响应数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service response data stream;
2)将SDS类型赋值为D;2) Assign the SDS type to D;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)查询服务参数编码表,依次将服务请求服务原语中参数,写入SDS参数中。4) Query the service parameter encoding table, and write the parameters in the service primitive of the service request into the SDS parameter in turn.
本发明还提供了一种数据流传输服务的系统,包括:The present invention also provides a data stream transmission service system, including:
服务数据流定义单元,用于定义服务数据流的格式,服务数据流的格式:SDS类型+SDS对应服务原语+SDS参数;The service data flow definition unit is used to define the format of the service data flow, the format of the service data flow: SDS type + SDS corresponding service primitive + SDS parameter;
服务参数编码单元,依据服务请求服务原语以及服务数据流定义单元所定义的服务数据流格式,将服务参数编码成服务数据流,具体即:首先,判断需形成的服务数据流类型;而后,获取与服务数据流类型相应的服务请求服务原语;再而,根据需形成的服务数据流类型对SDS类型进行赋值;然后,将服务请求服务原语的服务名写入SDS对应服务原语中;最后,查询服务参数编码表,依据服务请求服务原语、SDS类型将服务参数编码表中对应的参数写入SDS参数中,形成服务数据流;The service parameter encoding unit encodes the service parameters into a service data stream according to the service request service primitive and the service data stream format defined by the service data stream definition unit, specifically: first, judge the type of service data stream to be formed; then, Obtain the service request service primitive corresponding to the service data flow type; then, assign a value to the SDS type according to the service data flow type to be formed; then, write the service name of the service request service primitive into the corresponding service primitive of the SDS ;Finally, query the service parameter code table, write the corresponding parameters in the service parameter code table into the SDS parameter according to the service request service primitive and SDS type, and form the service data flow;
服务数据流解码单元,将服务数据流解码,以获取服务参数,具体即:首先,解析服务数据流首字节,获取服务数据流的SDS类型;而后,按STRING类型格式解析服务数据流,获取服务请求服务原语的服务名,进而获取服务请求服务原语;最后,依据SDS类型、服务请求服务原语对服务数据流进行解析,获取相应的服务参数。The service data flow decoding unit decodes the service data flow to obtain service parameters, specifically: first, parses the first byte of the service data flow to obtain the SDS type of the service data flow; then parses the service data flow according to the STRING type format to obtain The service name of the service request service primitive, and then obtain the service request service primitive; finally, analyze the service data flow according to the SDS type and the service request service primitive, and obtain the corresponding service parameters.
在本发明一实施例中,所述SDS类型的长度为一个字节;SDS对应服务原语的长度可变,其格式为STRING类型;SDS参数包含多段,段的个数由服务请求服务原语中参数的个数确定,各个段的格式由服务请求服务原语中各个参数的类型确定。In one embodiment of the present invention, the length of the SDS type is one byte; the length of the SDS corresponding service primitive is variable, and its format is a STRING type; the SDS parameter includes multiple segments, and the number of segments is determined by the service request primitive The number of parameters in is determined, and the format of each segment is determined by the type of each parameter in the service request service primitive.
在本发明一实施例中,所述SDS类型取值包括I、D、O,其中,I表示IN参数,为客户端到服务端方向;O表示OUT参数,为服务端到客户端方向;D表示无IN,OUT参数标识的数据块;所述SDS参数的段的个数,通过如下方式决定:In an embodiment of the present invention, the value of the SDS type includes I, D, O, wherein, I represents an IN parameter, which is the direction from the client to the server; O represents an OUT parameter, which is the direction from the server to the client; D Indicates a data block without IN and OUT parameter identification; the number of segments of the SDS parameter is determined by the following method:
若SDS类型取值为I时,SDS参数的段的个数为服务请求服务原语中标识为IN的参数的个数;If the value of the SDS type is 1, the number of segments of the SDS parameter is the number of parameters identified as IN in the service request service primitive;
若SDS类型取值为O时,SDS参数的段的个数为服务请求服务原语中标识为OUT的参数的个数;If the value of the SDS type is 0, the number of segments of the SDS parameter is the number of parameters marked as OUT in the service request service primitive;
若SDS类型取值为D时,SDS参数的段的个数为服务请求服务原语中所有参数的个数。If the value of the SDS type is D, the number of segments of the SDS parameter is the number of all parameters in the service primitive of the service request.
相较于现有技术,本发明具有以下有益效果:本发明为《电力系统通用服务协议》标准所描述的数据流交互方法发明了一种可具体实现方法,解决了该标准没有具体解决该标准中所提到通过数据流传输服务的问题;本发明还可解决需要进行多项复杂数据进行整体交互或表达问题。Compared with the prior art, the present invention has the following beneficial effects: the present invention invents a concretely implementable method for the data stream interaction method described in the standard "General Service Agreement for Electric Power Systems", and solves the problem that the standard does not specifically address the standard The problem of transmitting services through data streams mentioned in the above; the present invention can also solve the problem of requiring multiple complex data for overall interaction or expression.
附图说明Description of drawings
图1为本发明将服务描述原语到SDS的转换方法示意图。FIG. 1 is a schematic diagram of the method for converting service description primitives to SDS in the present invention.
具体实施方式Detailed ways
下面结合附图,对本发明的技术方案进行具体说明。The technical solution of the present invention will be specifically described below in conjunction with the accompanying drawings.
如图1所示,本发明的一种用于传输服务的数据流形成方法,包括如下步骤,As shown in FIG. 1, a method for forming a data stream for a transmission service according to the present invention includes the following steps,
S1、定义服务数据流的格式:SDS类型+SDS对应服务原语+SDS参数,其中,SDS类型的长度为一个字节;SDS对应服务原语的长度可变,其格式为STRING类型;SDS参数包含多段,段的个数由服务请求服务原语中参数的个数确定,各个段的格式由服务请求服务原语中各个参数的类型确定。S1. Define the format of the service data flow: SDS type + SDS corresponding service primitive + SDS parameter, wherein, the length of the SDS type is one byte; the length of the SDS corresponding service primitive is variable, and its format is STRING type; SDS parameter Contains multiple segments, the number of segments is determined by the number of parameters in the service request service primitive, and the format of each segment is determined by the type of each parameter in the service request service primitive.
S2、依据服务请求服务原语,将服务参数编码成服务数据流,即:首先,判断需形成的服务数据流类型;而后,获取与服务数据流类型相应的服务请求服务原语(服务请求服务原语存储于服务管理中心,发送端、接收端均可通过服务管理中心调取相应的服务请求服务原语);再而,根据需形成的服务数据流类型对SDS类型进行赋值;然后,将服务请求服务原语的服务名写入SDS对应服务原语中;最后,依据服务请求服务原语中服务请求参数的类型和顺序,查询服务参数编码表,并依据所查到的编码方法,将相应的服务请求参数进行编码后写入SDS参数中,形成服务数据流;S2. According to the service primitive of the service request, encode the service parameters into the service data flow, namely: firstly, judge the type of the service data flow to be formed; then, obtain the service request primitive corresponding to the type of the service data flow (service request service Primitives are stored in the service management center, and the sender and receiver can call the corresponding service request service primitives through the service management center); then, assign the SDS type according to the type of service data flow to be formed; then, the The service name of the service request service primitive is written into the corresponding service primitive of the SDS; finally, according to the type and order of the service request parameters in the service request service primitive, query the service parameter coding table, and according to the found coding method, put The corresponding service request parameters are encoded and written into the SDS parameters to form a service data stream;
S3、接收端收到服务数据流,需将服务数据流解码,以获取服务参数,即:首先,解析服务数据流首字节,获取服务数据流的SDS类型;而后,按STRING类型格式解析服务数据流,获取服务请求服务原语的服务名,进而获取服务请求服务原语;最后,依据SDS类型、服务请求服务原语对服务数据流进行解析,获取相应的服务参数。S3. After receiving the service data stream, the receiving end needs to decode the service data stream to obtain service parameters, namely: firstly, parse the first byte of the service data stream to obtain the SDS type of the service data stream; then, parse the service according to the STRING type format Data flow, obtain the service name of the service request service primitive, and then obtain the service request service primitive; finally, analyze the service data flow according to the SDS type and service request service primitive, and obtain the corresponding service parameters.
上述过程中,在通信双方采用预先约定传输类型和服务请求服务原语的情况下,数据流可以简化掉“SDS类型+SDS对应服务原语”部分,采用纯“SDS参数”形式传输服务;即相当于认为“SDS类型+SDS对应服务原语”为已知;In the above process, in the case where the communication parties adopt the pre-agreed transmission type and service request service primitive, the data flow can simplify the part of "SDS type + SDS corresponding service primitive" and use the pure "SDS parameter" form to transmit the service; that is It is equivalent to considering "SDS type + SDS corresponding service primitive" as known;
在本发明一实施例中,所述服务参数编码表包括基本参数类型编码表和组合参数类型编码表,其中,基本参数类型编码表由基本参数类型、该基本参数类型对应的编码方法以及占数据流的字节数构成;组合参数类型编码表由组合参数类型、该组合参数类型对应的编码方法以及占数据流的字节数构成;组合参数类型即不属于基本参数类型的参数类型(具体的表例可参见表2、表3,其中,表2即基本参数类型编码表,表3即组合参数类型编码表)。In an embodiment of the present invention, the service parameter coding table includes a basic parameter type coding table and a combined parameter type coding table, wherein the basic parameter type coding table consists of the basic parameter type, the coding method corresponding to the basic parameter type, and the accounting data The number of bytes of the stream; the combined parameter type encoding table is composed of the combined parameter type, the encoding method corresponding to the combined parameter type, and the number of bytes in the data stream; the combined parameter type is the parameter type that does not belong to the basic parameter type (specifically Table examples can be found in Table 2 and Table 3, among which, Table 2 is the basic parameter type coding table, and Table 3 is the combination parameter type coding table).
所述SDS类型取值包括I、D、O,其中,I表示IN参数,为客户端到服务端方向;O表示OUT参数,为服务端到客户端方向;D表示无IN,OUT参数标识的数据块;所述SDS参数的段的个数,通过如下方式决定:The value of the SDS type includes I, D, O, wherein, I represents the IN parameter, which is the direction from the client to the server; O represents the OUT parameter, which is the direction from the server to the client; D represents no IN, OUT parameter identification Data block; the number of segments of the SDS parameter is determined in the following manner:
若SDS类型取值为I时,SDS参数的段的个数为服务请求服务原语中标识为IN的参数的个数;If the value of the SDS type is 1, the number of segments of the SDS parameter is the number of parameters identified as IN in the service request service primitive;
若SDS类型取值为O时,SDS参数的段的个数为服务请求服务原语中标识为OUT的参数的个数;If the value of the SDS type is 0, the number of segments of the SDS parameter is the number of parameters marked as OUT in the service request service primitive;
若SDS类型取值为D时,SDS参数的段的个数为服务请求服务原语中所有参数的个数。If the value of the SDS type is D, the number of segments of the SDS parameter is the number of all parameters in the service primitive of the service request.
所述步骤S2中,若客户端向服务端发服务请求时,即需形成服务请求数据流时,将服务参数编码成服务数据流的具体方式如下:In the step S2, if the client sends a service request to the server, that is, when the service request data stream needs to be formed, the specific method of encoding the service parameters into the service data stream is as follows:
1)获取服务请求数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service request data stream;
2)将SDS类型赋值为I;2) Assign the SDS type as I;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)依次将服务请求服务原语中标识为IN的对应参数,写入SDS参数中,直到所有标识为IN的参数全部写入SDS参数中。4) Write the corresponding parameters marked as IN in the service request service primitive into the SDS parameters in turn, until all the parameters marked as IN are written into the SDS parameters.
所述步骤S2中,若服务端向客户端发服务响应时,即需形成服务响应数据流时,将服务参数编码成服务数据流的具体方式如下:In the step S2, if the server sends a service response to the client, that is, when the service response data stream needs to be formed, the specific method of encoding the service parameters into the service data stream is as follows:
1)获取服务响应数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service response data stream;
2)将SDS类型赋值为O;2) Assign the SDS type to O;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)依次将服务请求服务原语中标识为OUT的对应参数,写入SDS参数中,直到所有标识为OUT的参数全部写入SDS参数中。4) Write the corresponding parameters marked as OUT in the service request service primitive into the SDS parameters in turn until all the parameters marked as OUT are written into the SDS parameters.
所述步骤S2中,若需形成复杂数据传输使用时,将服务参数编码成服务数据流的具体方式如下:In the step S2, if complex data transmission needs to be formed, the specific method of encoding the service parameters into a service data stream is as follows:
1)获取服务响应数据流相应的服务请求服务原语;1) Obtain the corresponding service request service primitive of the service response data flow;
2)将SDS类型赋值为D;2) Assign the SDS type to D;
3)将服务请求服务原语的服务名,按STRING类型格式写入SDS对应服务原语中;3) Write the service name of the service request service primitive into the corresponding service primitive of SDS in the format of STRING type;
4)依次将服务请求服务原语中参数,写入SDS参数中。4) Write the parameters in the service primitives of the service request into the SDS parameters in turn.
本发明还提供了一种数据流传输服务的系统,包括:The present invention also provides a data stream transmission service system, including:
服务数据流定义单元,用于定义服务数据流的格式,服务数据流的格式:SDS类型+SDS对应服务原语+SDS参数;The service data flow definition unit is used to define the format of the service data flow, the format of the service data flow: SDS type + SDS corresponding service primitive + SDS parameter;
服务参数编码单元,依据服务请求服务原语以及服务数据流定义单元所定义的服务数据流格式,将服务参数编码成服务数据流,具体即:首先,判断需形成的服务数据流类型;而后,获取与服务数据流类型相应的服务请求服务原语;再而,根据需形成的服务数据流类型对SDS类型进行赋值;然后,将服务请求服务原语的服务名写入SDS对应服务原语中;最后,查询服务参数编码表,依据服务请求服务原语、SDS类型将服务参数编码表中对应的参数写入SDS参数中,形成服务数据流;The service parameter encoding unit encodes the service parameters into a service data stream according to the service request service primitive and the service data stream format defined by the service data stream definition unit, specifically: first, judge the type of service data stream to be formed; then, Obtain the service request service primitive corresponding to the service data flow type; then, assign a value to the SDS type according to the service data flow type to be formed; then, write the service name of the service request service primitive into the corresponding service primitive of the SDS ;Finally, query the service parameter code table, write the corresponding parameters in the service parameter code table into the SDS parameter according to the service request service primitive and SDS type, and form the service data flow;
服务数据流解码单元,将服务数据流解码,以获取服务参数,具体即:首先,解析服务数据流首字节,获取服务数据流的SDS类型;而后,按STRING类型格式解析服务数据流,获取服务请求服务原语的服务名;最后,依据SDS类型赋值对服务数据流进行解析,获取相应的参数。The service data flow decoding unit decodes the service data flow to obtain service parameters, specifically: first, parses the first byte of the service data flow to obtain the SDS type of the service data flow; then parses the service data flow according to the STRING type format to obtain The service name of the service request service primitive; finally, analyze the service data flow according to the SDS type assignment to obtain the corresponding parameters.
所述SDS类型的长度为一个字节;SDS对应服务原语的长度可变,其格式为STRING类型;SDS参数包含多段,段的个数由服务请求服务原语中参数的个数确定,各个段的格式由服务请求服务原语中各个参数的类型确定。The length of the SDS type is one byte; the length of the corresponding service primitive of the SDS is variable, and its format is a STRING type; the SDS parameter includes multiple segments, and the number of segments is determined by the number of parameters in the service request primitive, each The format of the segment is determined by the type of each parameter in the service request service primitive.
所述SDS类型取值包括I、D、O,其中,I表示IN参数,为客户端到服务端方向;O表示OUT参数,为服务端到客户端方向;D表示无IN,OUT参数标识的数据块;所述SDS参数的段的个数,通过如下方式决定:The value of the SDS type includes I, D, O, wherein, I represents the IN parameter, which is the direction from the client to the server; O represents the OUT parameter, which is the direction from the server to the client; D represents no IN, OUT parameter identification Data block; the number of segments of the SDS parameter is determined in the following manner:
若SDS类型取值为I时,SDS参数的段的个数为服务请求服务原语中标识为IN的参数的个数;If the value of the SDS type is 1, the number of segments of the SDS parameter is the number of parameters identified as IN in the service request service primitive;
若SDS类型取值为O时,SDS参数的段的个数为服务请求服务原语中标识为OUT的参数的个数;If the value of the SDS type is 0, the number of segments of the SDS parameter is the number of parameters marked as OUT in the service request service primitive;
若SDS类型取值为D时,SDS参数的段的个数为服务请求服务原语中所有参数的个数。If the value of the SDS type is D, the number of segments of the SDS parameter is the number of all parameters in the service primitive of the service request.
以下对本发明的方案进行详细描述。The solutions of the present invention are described in detail below.
本发明提出了把DL/T 1233(《电力系统简单服务接口规范》)(简称:S语言)描述的抽象服务接口原语,转换到数据流的方法。发明内容包括服务的数据流(Service DataStream,简称SDS)格式和依据服务S语言原语,把参数编码形成SDS的方法。解决了《电力系统通用服务协议》没有具体解决该标准中所提到通过数据流传输服务的问题。The invention proposes a method for converting the abstract service interface primitive described in DL/T 1233 ("Power System Simple Service Interface Specification") (abbreviation: S language) to a data stream. The content of the invention includes the service data stream (Service DataStream, referred to as SDS) format and the method of encoding parameters to form SDS according to the service S language primitive. Solve the problem that the "General Service Agreement for Electric Power System" does not specifically address the transmission of services through data streams mentioned in the standard.
1)服务数据流(SDS)格式1) Service Data Stream (SDS) format
SDS格式如表1所示,具体说明如下:The SDS format is shown in Table 1, and the details are as follows:
表1服务的数据流(SDS)格式Table 1 Service Data Stream (SDS) format
(1)SDS类型:S段,长度一个字节ASCII码,含义如下:(1) SDS type: S segment, the length is one byte ASCII code, the meaning is as follows:
a)S=“I”:表示IN参数,为客户端到服务端方向;a) S="I": Indicates the IN parameter, which is the direction from the client to the server;
b)S=“O”:表示OUT参数,为服务端到客户端方向;b) S="O": indicates the OUT parameter, which is the direction from the server to the client;
c)S=“D”:表示无IN,OUT参数标识的数据块;c) S="D": indicates a data block without IN and OUT parameter identification;
d)S还可为其它值,以留扩展使用。d) S can also be other values for extended use.
(2)SDS对应服务原语:ServiceName段,可变长度,其格式同STRING类型参数;(2) SDS corresponding service primitive: ServiceName segment, variable length, its format is the same as STRING type parameter;
(3)SDS参数:Par-1到Par-n段,段的个数和每个段的格式,取决于相应的S语言描述的参数个数和类型:(3) SDS parameters: Par-1 to Par-n segments, the number of segments and the format of each segment depend on the number and type of parameters described in the corresponding S language:
a)S=I时,参数段的个数为服务描述中标识为IN的参数个数;a) When S=I, the number of parameter segments is the number of parameters identified as IN in the service description;
b)S=O时,参数段的个数为服务描述中标识为OUT的参数个数;b) When S=O, the number of parameter segments is the number of parameters identified as OUT in the service description;
c)S=D时,参数段的个数为服务描述中所有参数的个数;c) When S=D, the number of parameter segments is the number of all parameters in the service description;
2)依据服务描述原语,把服务参数编码形成SDS的方法2) According to the service description primitive, the method of encoding service parameters to form SDS
(图1)为依据服务描述原语形成SDS的转换方法示意图,方法如下:(Figure 1) is a schematic diagram of the conversion method for forming SDS based on service description primitives, the method is as follows:
A、当客户端向服务端发服务请求时需形成服务请求数据流,编码方法如下:A. When the client sends a service request to the server, it needs to form a service request data stream. The encoding method is as follows:
(1)获取相应的服务请求服务原语;(1) Obtain the corresponding service request service primitive;
(2)把数据流类型S赋予(数据流头字节)为“I”(图1中①);(2) Assign the data stream type S (data stream head byte) to "I" (① in Figure 1);
(3)把服务请求原语的服务名,按(表2)STRING类型格式编入数据流(图1中②);(3) Compile the service name of the service request primitive into the data stream according to (Table 2) STRING type format (② in Figure 1);
(4)依次把服务原语中标识为IN的对应参数,依照(表2)和(表3)的编码格式编入数据流,直到所有标识为IN的参数全部编入数据流(图1中③);(4) In turn, encode the corresponding parameters marked as IN in the service primitives into the data stream according to the coding formats (Table 2) and (Table 3), until all the parameters marked as IN are compiled into the data stream (Figure 1 ③);
上述(1)-(3)形成的数据流即为服务请求数据流。The data flow formed by (1)-(3) above is the service request data flow.
B、当服务端向客户端发服务响应时需形成服务响应数据流,编码方法如下:B. When the server sends a service response to the client, it needs to form a service response data stream. The encoding method is as follows:
(1)获取相应的服务请求服务原语;(1) Obtain the corresponding service request service primitive;
(2)把数据流类型S赋予(数据流头字节)为“O”(图1中④);(2) Assign the data stream type S (data stream head byte) to "O" (④ in Figure 1);
(3)把服务请求原语的服务名,按(表2)STRING类型格式编入数据流(图1中⑤);(3) Compile the service name of the service request primitive into the data stream according to (Table 2) STRING type format (⑤ in Figure 1);
(4)依次把服务原语中标识为OUT的对应参数,依照(表2)和(表3)的编码格式编入数据流,直到所有标识为OUT的参数全部编入数据流(图1中⑥);(4) In turn, encode the corresponding parameters marked as OUT in the service primitives into the data stream according to the coding formats (Table 2) and (Table 3), until all the parameters marked as OUT are compiled into the data stream (Figure 1 ⑥);
上述(1)-(3)形成的数据流即为服务响应数据流。The data flow formed by the above (1)-(3) is the service response data flow.
C、当数据流作为复杂数据传输使用时,编码方法类似,只是数据流类型为“D”,编码时不判断IN或OUT标识(通常原语中无IN,和OUT)。C. When the data stream is used as complex data transmission, the encoding method is similar, except that the data stream type is "D", and the IN or OUT flag is not judged during encoding (usually there is no IN and OUT in the primitive).
3)依据服务描述原语,对SDS解码,获取参数的方法3) According to the service description primitive, the method of decoding the SDS and obtaining the parameters
接收端收到数据流后,从数据流获取参数的解码过程如下:After the receiving end receives the data stream, the decoding process of obtaining parameters from the data stream is as follows:
(1)解析数据流首字节,获得数据流类型;(1) Analyze the first byte of the data stream to obtain the data stream type;
(2)按STRING类型格式解析数据流,获取服务原语名;(2) Parse the data stream according to the STRING type format to obtain the service primitive name;
(3)获取相应的服务请求服务原语;(3) Obtain the corresponding service request service primitive;
(4)依据数据流类型,按照服务原语中相应的标识(“I”对应IN参数,“O”对应OUT参数)参数类型和顺序对数据流进行解析,获取相应的参数。(4) According to the data stream type, analyze the data stream according to the corresponding identification in the service primitive ("I" corresponds to IN parameters, "O" corresponds to OUT parameters) parameter types and order, and obtain corresponding parameters.
4)参数段的数据格式4) Data format of the parameter section
参数段的数据格式也就是每个参数的编码格式,以编码库方式进行描述。编码库包含所有S描述的服务参数的编码方法,从类型上分为基本参数类型和特殊(组合)参数类型。The data format of the parameter segment is also the encoding format of each parameter, which is described in the form of an encoding library. The encoding library contains encoding methods for all service parameters described by S, which are divided into basic parameter types and special (combined) parameter types in terms of types.
a)基本参数类型a) Basic parameter type
需支持的基本参数类型、对应的编码方法以及占数据流的字节数如(表2)(参考GSP基本数据类型定义,可根据需要扩充):The basic parameter types to be supported, the corresponding encoding methods, and the number of bytes in the data stream (Table 2) (refer to the GSP basic data type definition, which can be expanded as needed):
(表2)基本参数类型编码表(Table 2) Basic parameter type coding table
b)特殊(组合)参数类型b) special (composite) parameter types
支持的特殊(组合)参数类型、对应的编码方法以及占数据流的字节数如(表3)(可根据需要扩充):Supported special (combined) parameter types, corresponding encoding methods, and the number of bytes in the data stream (Table 3) (can be expanded as needed):
(表3)特殊(组合)参数类型编码表(Table 3) Special (combined) parameter type encoding table
5)S语言的扩充5) Expansion of S language
S语言(DLT 1233只能描述简单参数描述,无法满足描述特殊(组合)参数类型的需要,扩充如下:S language (DLT 1233 can only describe simple parameter descriptions, and cannot meet the needs of describing special (combined) parameter types. The expansion is as follows:
1、用IN表示服务请求输入参数(客户端到服务端方向的参数);1. Use IN to represent the service request input parameters (parameters from the client to the server);
2、用OUT表示服务响应返回参数(服务端到客户端方向的参数);2. Use OUT to indicate the service response return parameters (parameters from the server to the client);
3、增加特殊参数类型;3. Add special parameter types;
4、结构数据类型;4. Structural data type;
5、增加数组及结构数组参数。5. Add array and structure array parameters.
示例1:带特殊参数类型的服务原语Example 1: Service primitive with special parameter types
< GetSubstationChIEDSCDFile ( //服务名< GetSubstationChIEDSCDFile ( // service name
IN STRING: IEDName, //IED名称IN STRING: IEDName, //IED name
OUT STRING:fileName, //文件名OUT STRING: fileName, //file name
OUT FILEDATA:fileDate, //IED的SCD文件内容,特殊参数类型OUT FILEDATA: fileDate, //IED SCD file content, special parameter type
)" 获取变化IED的SCD文件"/>)" Get the SCD file of the changed IED"/>
示例2:带扩充结构数组的服务原语Example 2: Service Primitive with Array of Augmented Structures
< GetSubstationIEDlist ( //服务名< GetSubstationIEDlist ( // service name
IN STRING: SubstationName, //变电站名称IN STRING: SubstationName, //substation name
OUT int16:IEDnumber, //IED数量OUT int16:IEDnumber, //IED number
OUT struct IEDlist{ STRING:IEDname,STRING:IEDdesc}[],//IED清单,结构数组OUT struct IEDlist{ STRING:IEDname, STRING:IEDdesc}[], //IED list, structure array
)" 获取IED清单"/>)" Get IED list"/>
示例3:作为复杂数据表达使用的原语Example 3: Primitives used as complex data representations
< authPara( //身份认证参数<authPara(//Authentication parameters
STRING Identity, //身份标识 STRING Identity, //Identity
INT8U signType, //签名类型 INT8U signType, //signature type
TIME currentTime, //当前时间 TIME currentTime, //current time
STRING signValue, //签名值 STRING signValue, //signature value
)" 认证参数"/>。)"Authentication Parameters"/>.
本发明的技术方案具体应用如下:The specific application of technical scheme of the present invention is as follows:
(1)结合《通用服务协议》实现面向服务架构下的应用服务传输;(1) Combining with the "Universal Service Agreement" to realize the transmission of application services under the service-oriented architecture;
(2)用于加密和安全认证,通过SDS,把多项数据或参数,编码成一个数据流,以实现一次性对多项数据进行加密和数字签名;(2) For encryption and security authentication, multiple data or parameters are encoded into a data stream through SDS, so as to encrypt and digitally sign multiple data at one time;
(3)作为一种信息帧格式,嵌入已有应用通信协议,以实现传输协议规定外的数据传输,如把SDS嵌入DL/T634.5104、DL/T 476通信协议。(3) As an information frame format, embed existing application communication protocols to realize data transmission beyond the provisions of the transmission protocol, such as embedding SDS into DL/T634.5104 and DL/T 476 communication protocols.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a Means for realizing the functions specified in one or more steps of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart flow or flows and/or block diagram block or blocks.
以上是本发明的较佳实施例,凡依本发明技术方案所作的改变,所产生的功能作用未超出本发明技术方案的范围时,均属于本发明的保护范围。The above are the preferred embodiments of the present invention, and all changes made according to the technical solution of the present invention, when the functional effect produced does not exceed the scope of the technical solution of the present invention, all belong to the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710310725.4A CN107231347B (en) | 2017-05-05 | 2017-05-05 | Method and system for data stream transmission service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710310725.4A CN107231347B (en) | 2017-05-05 | 2017-05-05 | Method and system for data stream transmission service |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107231347A CN107231347A (en) | 2017-10-03 |
CN107231347B true CN107231347B (en) | 2019-09-27 |
Family
ID=59934096
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710310725.4A Active CN107231347B (en) | 2017-05-05 | 2017-05-05 | Method and system for data stream transmission service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107231347B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112422560A (en) * | 2020-11-17 | 2021-02-26 | 中国电力科学研究院有限公司 | Secure communication method and system for lightweight substation based on secure socket layer |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1254151A (en) * | 1998-11-13 | 2000-05-24 | 特克特朗尼克公司 | Multimedia data flow code conversion system |
CN105553967A (en) * | 2015-12-11 | 2016-05-04 | 邦彦技术股份有限公司 | Method and device for network meeting |
CN105978893A (en) * | 2016-06-27 | 2016-09-28 | 深圳云创车联网有限公司 | Data communication method of mobile terminal as well as mobile terminal and communication system thereof |
-
2017
- 2017-05-05 CN CN201710310725.4A patent/CN107231347B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1254151A (en) * | 1998-11-13 | 2000-05-24 | 特克特朗尼克公司 | Multimedia data flow code conversion system |
CN105553967A (en) * | 2015-12-11 | 2016-05-04 | 邦彦技术股份有限公司 | Method and device for network meeting |
CN105978893A (en) * | 2016-06-27 | 2016-09-28 | 深圳云创车联网有限公司 | Data communication method of mobile terminal as well as mobile terminal and communication system thereof |
Also Published As
Publication number | Publication date |
---|---|
CN107231347A (en) | 2017-10-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111683069B (en) | Customized communication protocol and service method based on netty framework | |
KR102161681B1 (en) | Device identifier dependent operation processing of packet based data communication | |
CN103686210B (en) | Method and system for achieving audio and video transcoding in real time | |
CN111967244B (en) | FAST protocol decoding method, device and equipment based on FPGA | |
CN106603198A (en) | Blockchain distributed storage method and system with network coding | |
CN102546612B (en) | Remote procedure call implementation method based on remote direct memory access (RDMA) protocol in user mode | |
CN117478765A (en) | Information interaction method based on Internet of things multi-protocol adaptation | |
CN108040041B (en) | Image difference transmission protocol design system and method based on service drive | |
CN107231347B (en) | Method and system for data stream transmission service | |
CN109683873B (en) | Aerospace Information Interface Coding Method and System Architecture Using ASN1 Rules | |
CN109803119B (en) | Method and device for monitoring information transmission | |
CN104767710B (en) | The transmission payload extracting method of HTTP block transmissions coding based on DFA | |
CN102438048B (en) | Method and system for calling remote service from Internet | |
CN117938911A (en) | Data processing method, meter reading system and equipment terminal of Internet of things equipment | |
CN105024923B (en) | The method and device that message category based on XMPP extension message is realized | |
CN109376086B (en) | Netty-based performance test platform and communication method thereof | |
CN115865897A (en) | Cross-system batch file efficient interaction method | |
CN103929447B (en) | A kind of method of the parsing HTTP chunked coded datas based on PEEK operations | |
CN114827287B (en) | Data compression method and system | |
CN109802990A (en) | A kind of resource log reading/writing method and device reducing data redundancy | |
CN105183750B (en) | Close-coupled XML resolution system | |
CN111130773A (en) | Key management server, client and system based on KMIP protocol | |
CN114884927B (en) | A method and device for improving DL/T 698.45 protocol transmission efficiency | |
CN115086101B (en) | Distributed system and method supporting mass modbus tcp connection | |
CN109413137A (en) | A method of the PHP based on avro requests Python |
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 |