1 introduction

Q/GDW 376.1 Master Station Communication With Data Acquire Terminal Communication Protocol defines the frame format, data coding and transmission rules for data transmission between the master station and the acquisition terminal of the power user electricity information acquisition system. The related national standards are DL/T 698.41 communication protocol between the master station and the electrical energy information acquisition terminal.

2 Communication Protocol

2.1 the term

The address code of a terminal device ina system, referred to as the terminaladdress.

Masterstationaddress Codes of objects (such as workstations and application function modules) that have communication requirements in the masterstation.

Measuredpoint is a sequential electrical connection point between a measuring device and a terminal where a unique set of electrical values can be measured. When a physically identical electrical connection point is measured by multiple devices, or when measured by a single device but transmitted to the terminal by multiple means, Each measurement point has a unique logical location code, which is the unique object identifier of the device’s parameter configuration and data application in the terminal.

An object information that represents a parameter or data, such as a measurement point, a total group, a control cycle, a DC analog quantity shunt, etc.

Informationtype represents classified information about parameters or data. An information class may be a parameter or data or a set of parameters or data.

2.2 Communication Interface

1) TCP and UDP transmission interface: The login link and heartbeat detection of this type of interface adopts the link test service, and the link test period can be set. 2) Serial communication transmission interface: byte transmission is carried out in an asynchronous manner, which contains 8 data bits, 1 start bit “0”, 1 parity bit P and 1 stop bit “1”. 3) Infrared communication and transmission interface: When infrared communication is adopted to realize local data transmission, the byte format is the same as that of serial communication. When sending data, 1 ~ 4 FEH is added before the valid data frame as the leading code.

2.3 Data Link Layer

The Q/GDW 376.1-2012 protocol supports both unbalanced transport and balanced transport rules. This scheme mainly describes the unbalanced transmission mode.

2.3.1 frame format

Frame is the basic unit of information transmission, using GB/T18657.1-2002 6.2.4ft1.2 asynchronous transmission frame format. The following figure shows the frame format.

Length L D0=0 and D1=1. The length of user data L1 consists of D2 to D15 and is coded in BIN. It is the total number of bytes of user data (application layer) in the control domain, address domain, and link. Control domain C definition

DIR=0, indicates that this frame is a downlink packet sent by the master station. DIR=1: indicates that this frame is an uplink packet sent by the terminal. PRM=1, indicating that the frame message is from the initiator; PRM=0, indicating that the frame message is from the slave station. FCV=1, indicating that the FCB bit is valid. When the starting station transmits a new transmission service of send/acknowledge or request/response to the same slave station, the FCB is taken as the opposite value. If FCV=0, the FCB bit is invalid. ACD=1 indicates that the terminal has important events waiting for access, and the additional information domain contains the event counter EC. ACD=0 indicates that no event data is waiting to be accessed.

Address domain A is defined

2.3.2 Transmission Mode

Transmission order: all data items transmit low byte first, then transmit high byte. Type of Transmission service:

2.4 the application layer

Q/GDW376.1-2012 Format definition of application layer (link user data)

Definition of application layer function code AFN

Other data items are defined in the Q/GDW376.1-2012 protocol.

3 test project preparation

3.1 Basic protocol preparation

3.1.1 Protocol Classification

Using the function of protocol incentive of gesi debugging wizard software, the Q/GDW376.1-2012 communication protocol is classified and organized according to the tree structure, which makes the management more organized and the search more convenient. Firstly, according to the definition of Q/GDW376.1-2012 communication protocol application layer function code, the protocol is classified, and 15 basic protocol sets such as AFN01 to AFN10 are established. Then, the specific protocol is added to the base protocol set.

3.1.2 Agreement preparation

According to the protocol frame format, in order to facilitate control and, according to the agreement of the data of fixed broken up into frame start operator, length, control domain, address domain, application function code, the frame sequence domain, data unit, check code and frame end nine parts, is part of the dynamic increase or decrease in data unit domain, can be further split according to the specific orders. Example 1: Compiling method of command “AFN0D-F1 positive/reactive electric energy indicating value, one/four quadrant reactive electric energy indicating value”.

The master downlink request frame

Terminal uplink reply frame

Example 2: Compiling methods for the “AFN02-F3 heartbeat” command (the master is a slave command).

Terminal uplink request frame

Host downlink acknowledge reply frame

3.1.3 Common Protocol Library

Through the compilation, testing and verification of basic protocols, a common protocol library composed of basic protocols is established.

3.2 Compilation of test cases

A Test Case is a set of Test inputs, execution conditions, and expected results compiled for a specific purpose to Test a program path or verify that a specific requirement is met. Communication protocol testing belongs to black box testing, and the basic methods commonly used in black box testing such as equivalence class division method, boundary value analysis method, error inference method, cause-and-effect diagram method and so on can be used to design test cases.

After the design of the test scheme is completed, Gesi debugging wizard software can use the compilation of the completed common protocol library, using building blocks, by copying and pasting commands can be very fast to create test cases. Test cases are usually organized in a tree structure according to the design hierarchy of the test scheme.

4 Test Methods

4.1 Test system composition

4.2 Individual test and overall test

Guessy debug Sprite software supports individual and collective testing, one test item at a time or the entire test suite. To do this, select the test item or test set that you want to test, and then execute the incentive command. The following uses afN09-F1 Terminal Version information as an example.

Protocol data parsing interface

Protocol incentive reporting interface

4.3 Single test and cycle test

Gesi debugging wizard software support single test and loop test, can well meet the needs of various debugging testing and performance testing. To do this, select the test item or test set that you want to test, and then execute the drive or loop drive command.

4.4 Script control tests

Gesi debugging wizard software support protocol script, can use C#, VB, Jscript three languages to control the test process, set and manage communication parameters and protocol frame data, call plug-in extension test function. Protocol scripts can call managed code components based on the Microsoft.net Framework for extended testing. Plugins are very convenient to use. By copying compiled components to the Plugins directory, you can call the common services provided by the plug-in directly in the functions of the script. For example, the time of the request frame “Time Label – Start frame Time mark” of the “AFN09-F1 Terminal Version Information” command is the system time.

4.5 Slave site simulation test

Gussie debug Sprite software supports driven device (that is, passively waiting for a request, send a response to the device) excitation simulation. The following uses the AFN02-F3 heartbeat command as an example. Refer to Section 3.1 for the compilation method of protocol items. The test method is to select the command under test, execute the cyclic excitation command, wait for the local communication module to initiate the command, and after receiving the command, the software will automatically parse and respond according to the requirements of the test case.

Download the sample