Vous êtes sur la page 1sur 9

COMMUNICATION PROTOCOL

1.1 Introduction YD2010A Communication Protocols in detail described this machine serial mouth communication to read, to write the forms of field orders and internal information data definition, in order to the third party development use. 1.1.1 The compatibility of PLC ModBus Mudbugs communication protocols enable YD2010A Intelligence power meter with SchneiderSiemensAB GEModicon of eminence trademark's programmable controller(PLC)RTUSCADA systemDCS or the third party have the compatible of ModBus supervisory system the information and dates to deliver effectively. If you have YD2010A Intelligence power meter, only to increase a suit of central communication top management display software based on PC (or engineering control equipment) which can build up a set of supervision system. 1.1.2 Broad communication integration YD2010A Intelligence power meter offer the compatible of ModBus communication protocols with the Modicon system, this protocols by widespread achievement system integration standard. Compatible RS-485/232C connection programmable logical controller ModBus communication protocols permission information and data in YD2000 intelligence table and Modicon programmable logic controller (PLC), RTU, The SCADA system, the DCS system and between other concurrently MODBUS communication protocols system carries on the effective transmission. 1.2.1 Basic rules of ModBus All RS485 communication return route all should obey the host/sub way. Press this way, the data may in a master station (for instance: YD2010A) between transmits. 1.2.2 The master station will initialize and control all information which transmits in the RS485 communication return route. 1.2.3 Any once communication cannot start from sub-station. 1.2.4 All communications in RS485 return route transport by the "information frame" way. 1.2.5 If the master-station or the sub-station receive the information frame include the unknown order, then does not give to respond. The information frame is by the data frame (each byte is the string of characterwhich a data frame) constitution string of character (at most 255 bytes), is constituted by the Information head standard asynchronous serial data which and transmits by information, this communication way is also compatible with the RTU communication protocols.

1.3 Data frame form The communication transmission is the asynchronous way, and take the byte (data frame) as the unit. Each data frame transmits which between the master station and the sub- station all is 11 serial data streams. Data frame form: Start bit Data bit Stop position 1 bit 8 bit (low position firsthigh position follow) 1 bithave ODD EVEN check2 bithave no ODD EVEN check

ODD EVEN check 1 bithave ODD EVEN checknullhave no ODD EVEN check

-1-

Has the verification position the succession chart:


Stop Start

D0

D1

D2

D3 Data

D4

D5

D6

D7

D8

End

Start

Parity

End

Does not have the verification position the succession chart:


Stop Start

D0

D1

D2

D3 Data

D4

D5

D6

D7

End

Start

End

1.4 YD2010A communication protocols When communication order send to power meter, conforms to the corresponding address equipment receive communication order, and remove the address, read-message, if have not made a mistake, then carry out the corresponding task; then carries out the result to the receiver. Returns in the information which include the address, carries out the movement function code, carries out the movement data as well as the wrong verification code (CRC). If makes a mistake it will not transmit any information. 1.4.1 Information frame form START Time delay(up to 4 bytes time) ADD 1byte 8 bit CS 1byte 8 bit DATA N bytes N8 bit CRC bytes 16bit END Time delay(up to 4 bytes time)

1.4.1.1 Accessibility and Dissemination of Data (ADD) Accessibility and Dissemination of Data (ADD) is the first data frame (8z) which communication transmits information frame for each time, from 0 to 255. This byte indicated the sub-machine which hypothesis address code by users will receive the information which transmits by the host. And each sub machine all has the only address, and responds delivers by respective address indicated the sub-machine address which will transmit to. But the address code transmits by the sub-machine indicated the sub-machine address which loop back. 1.4.1.2 Function code (CS) The function code is the second data frame which in the communication transmission information frame each time. The ModBus communication protocols definition function code is 1 ~ 127 (01H ~ 7FH). YD2010A power meter uses part of function codes. As the host request transmission, tells the sub-machine through the function code to carry out any movement. As the sub-machine response, which the sub-machine transmits the function code as the same as the host, and indicated the sub-machine responded the host to carry on the operation. If the sub-machine transmits the function code highest order is 1 (function code > 127), then indicated the sub-machine response or error. The function codes listed in following form are all concrete meaning and operation. MODBUS part of function codes Function code 03H 06H 10 H a) 03 Reads the register
-2-

DEF Reading register Writing one register Writing multi-registers

Operation Reading data from one or more register Writing into the single register 16 binary numbers Writing into the multi-registers 16 binary numbers

The YD2010A power meter use the ModBus communication protocols; utilize the communication protocols may read (to maintain register or to return to value inputs register). The function code 03H mapping list range maintenance and the input register value all is 16 bit (2 bytes). So the register value which reading from YD2000 all is 2 bytes. Reading the register number at most is 125. Because some programmable controllers do not use function code 03, therefore the function code 03 utilized as reading and returns the value. The command format of the sub-machine responds is the sub-machine address, the function code, the list range and the CRC code. All data of the list range is double byte counts which every 2 bytes a group, and high byte in front. b) 06 Writes the single register The host uses this order to preserve the simple point data to the YD2000 intelligence electric power monitors the meter the memory. The sub-machine also uses this function code to return to the host deliver the information. c) 10 Writes the multi-points continual register The host utilizes this order preserve the multi-points monitors to the YD2010A power meters memory. In the Modbus communication protocols register refers is 16 bits (namely 2 bytes), and top digit in front. So all the spot of the YD2010A series intelligence electric power meter is two bytes. Use one order to preserve biggest points lie on the sub-machine. Because the Modbus communication protocols premise preserves 60 registers, such YD2000 series intelligence electric power meter allows time to be most may preserve 60 registers. The command format of the YD2000 intelligence electric power meter is the sub-machine address, the function code, the list range and the CRC code. 1.4.1.3 List range (DATA) The list range is different along with the function code. Transmits by the host reads order (03H) the information frame list range and the sub-machine reply information frame list range is different, transmits by the host writing order (06H,10H) the information frame list range and the sub-machine reply information frame list range is the quite same. The list range contains needs the sub-machine to carry out the information which any movement or reason machine gathering needs to return. The information may be value, reference address and so on. For example, the function code tells the sub-machine reading the register the value, then the list range must contain must reading the register the start address and reading the length (register number). a) Data area format corresponding to the function code 03 u Host send Data ordering Data definition Byte number u Sub-machine reply Data ordering Data definition Byte number Data ordering Data definition Byte number Data ordering Data definition Byte number 1 2 1 Start address 2 2 2 1 Start address 2 1 Loop back bytes 1 2 Data writing into register 2 N 2 Reading register 2 2 register data 2N

b) With function code 06 correspondences list range forms

c) With function code 10 correspondences list range forms Data ordering Data definition Byte number 1 Start address 2 Start address Data writing into register

1.4.1.4 Error check codes (CRC)


-3-

The host or the sub-machine may use the verification code to carry on the distinction receive information whether makes a mistake. Sometimes, because of the electronic noise or other some disturbances, the information could have the slight change in the transmission process, the CRC guarantee the host or the sub-machine to the information which made a mistake in the transmission process does not have an effect but increased the system security and the efficiency. The CRC uses the CRC-16 verification method. Two bytes wrong verifications codes, low byte in front, and high byte in after. Attention The information frame form all is same: Address, function code, list range and wrong verification code. 1.5 Error checking The cyclic Redundancy check (CRC) contains 2 bytes, viz. 16 binary systems. The CRC code by the transmitting end computation, lays aside in the transmission information rear part. The receiving end equipment recompilation receives again to the information CRC code, obtains the CRC code compared with the computation whether with receives to tallying, if the two do not tally, then indicated makes a mistake. The CRC code computational method is: initializes 16 registers first, and then carries on every 8 figures according to the information processing gradually. When carries on the CRC code computation only uses 8 figures according to the position, the outset position and stops the position, like has the parity check position the speech also to include the parity check position, all does not participate in the CRC code computation. When calculates the CRC code, 8 figures according to sare different with the register data or, obtains the result to lowly moves, with 0 fills the highest order. Again inspects the most low position, if the most low position is 1, is different the register content and the initialization number or, if the most low position is 0, does not carry on different or the operation. This process duplicates continuously 8 times. After 8th shifting, next 8th are again different with the present register in equivalence, this process above duplicates equally with on 8 times. After all data message processes, the final register content is the CRC code value. 1.6 Computation step for CRC-16 code a) Sets 16 registers for hexadecimal system FFFF (namely all is 1). Called this register is the CRC register. b) Sets 8 figures with 16 CRC register low position in equivalence, puts the result in the CRC register. c) (Faces low position) register content right lateral, with 0 fills the highest order, the inspection lowest position (emigration position). d) If the most low position is 0: Duplicate 3rd step (shifts once more). If the most low position is 1: The CRC register and multinomial A001 (1,010. million 0,001) carries on in equivalence. e) The redundant step 3 and 4, until right lateral 8, then entire 8 figures according to has carried on processing completely. f) The redundant step 2 to the step 5 and carries on next 8 processing. Finally obtains the CRC register is the CRC code, low byte in front, and high byte in after. 1.7 Example for information frame form 1.7.1 Function code 03 The sub-machine address is 01, start address 0,032 3 registers The register data address in this example is address data(hexadecimal) 0032 EA60 0034 0036 Host sending Sub-machine address Function code byte number 1 1 01 03
-4-

C350 DB6C Example (hexadecimal) Send to sub-machine 01 Reading register

Start address Reading number CRC code

2 2 2

00 32 00 03 A4 04

Start address is 0032 3 register(6 bytes in all) CRC code computes by sub-machine

Sub-machine response Sub-machine address Function code Reading bytes Register data 1

byte numbe 1 1 1 2 2 01 03 06 EA 60 C3 50 2 DB 6C 2 D1 3F

Example (hexadecimal) Send to sub-machine 01 Reading register 3 register(6 bytes in all) 0032 address content 0034 address content 0036 address content CRC code computes by sub-machine

Register data 2 Register data3 CRC code 1.7.2 Function code 06

The sub-machine address is 01, Preserve 2 values in start address 0,002. In this example, after the data preservation, the address 0,002 in sub-machine content is 0,002. Host sending Bytes Example(Decimal system) Sub-machine address Function code Start address Save data CRC code 1 1 2 2 2 01 06 00 02 00 02 A9 CB Sub-machine response Sub-machine address Function code Start address Save data CRC code 1.7.3 Function code 10 The sub-machine address is 01, 0,064 preserves to the address 0,000. In this example, after the data preservation had ended, the address is the information which in 01 YD2000 series intelligence electric power meter preserves is:
-5-

Send to sub-machine 01 Preserve single data(2 bytes) Start address is 0002 Saving data is 0002 CRC code computes by host

byte 1 1 2 2 2 01 06 00 02 00 02 A9 CB

Example(Decimal system) From sub-machine 01 Save by single point Start address is 0002 Saving data is 0002 CRC code computes by host

address 0000 Host sending Sub-machine address Function code Start address Saving data number bytes Save data1 Save data 2 CRC code bytes 1 1 2 2 1 2 2 2 01 10 00 00 00 02 04 00 64 00 00 B2 70 Sub-machine response Sub-machine address Function code Start address Saving data number CRC code bytes 1 1 2 2 2 01 10 00 00 00 02 41 C8 1.8 Mistake processing

Data(Decimal system) 0064 Example(Decimal system) Send to sub-machine 0001 Save by multi-points Start address is 0000 Save 2 points (4 bytes)

Data address is 0002 Data address is 0000 CRC code computes by host

Example(Decimal system) From sub-machine 01 Save by multi-points Start address is 0000 Save 2 points(4 bytes in all) CRC code computes by sub-machine

When the YD2010A series intelligence electric power meter examined the error which beyond the CRC code mistake, must return the information to the host, the function code highest order is 1, viz. the sub-machine returned the function code to the host is the foundation code which delivered adds 128 in the host. These codes indicated have the accident error occurrence below.If receives from the host to the information have CRC error, will neglected by the YD2010A series intelligence electric power meter. The sub-machine returns the error code form which delivers to be as follows (except the CRC code) Address code Function code Error code CRC code 1byte 1 byte(top digit is1) 1byte 2 bytes

-6-

01

The YD2010A series digital multi-purpose electric power meter responds as follows Illegal function code Receiving function code YD2010Aseriesintelligence electric power meter nonsupport. Illegal data position. The assign data position surpasses the YD2010A series intelligence electric power meter scope Illegal data value The receiving data value which transmits to the main engine surpasses the corresponding address the data scope.

02

03

Table Data and Address Data area mapped by Function code 03Hbasic parameters
Basic Parameters No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Address 0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H 0008H 0009H 000AH 000BH 000CH 000DH 000EH 000FH 0010H 0011H 0012H 0013H 0014H 0015H 0016H 0017H 0018H 0019H 001AH 001BH 001CH 001DH 001EH 001FH Item Ua Uca Ia Fa Pa PFa Qa Sa Ub Uab Ib Fb Pb PFb Qb Sb Uc Ubc Ic Fc Pc PFc Qc Sc Description Phase Voltage Ua Line Voltage Uca Phase A Current Phase A Active Power Phase A Power Factor Phase A Reactive Power Phase A Apparent Power Phase Voltage Ub Line Voltage Uab Phase B Current Phase B Active Power Phase B Power Factor Phase B Reactive Power Phase B Apparent Power Phase Voltage Uc Line Voltage Ubc Phase C Current Phase C Active Power Phase C Power Factor Phase C Reactive Power Phase C Apparent Power
Three Phases Voltage Average value Three Phases Voltage Average value Three Phases Current Average value

Ux Uav Iav F Psum PFav Qsum Ssum

Frequency Three Phases Active Power Three PhasesTotal Power Factor Three Phases Reactive Power Three Phases Apparent Power

-7-

Table Data area mapped by Function code 03Henergy


No. Address 1 0021H 2 0022H 3 0023H 4 0024H 5 0025H 6 0026H 7 0027H 8 0028H Item +Wh(L) +Wh(H) -Wh(L) -Wh(H) +Varh(L) +Varh(H) - Varh(L) - Varh(H) Description Accumulated Import Value of Active Energylower bit Accumulated Import Value of Active Energyhigher bit Accumulated Export Value of Active Energylower bit Accumulated Export Value of Active Energyhigher bit Accumulated Import Value of Reactive Energylower bit Accumulated Import Value of Reactive Energyhigher bit Accumulated Export Value of Reactive Energylower bit Accumulated Export Value of Reactive Energyhigher bit

Table Data area mapped by Function 03Hsystem parameters


Address Item Number of words 1 Description 1247 0Three Phase Four Wire 1Single Phase Two Wire 2Three Phase Three Wire 3Three Phase Three Wire BAL 4Single Phase Three Wire 5Three Phase Four Wire BAL 0N 1O 2E 01200 12400 24800 39600 419200 110000 110000 Initial state 1

0300H Local address

0301H

Network type

0303H

Parity bit

0304H

Baud Rate

0307H PT 0309H CT 0316H Reserved by 035FH manufacturer

1 1

1 1

Table Analog output address(Function code 06)


NO. Address Descriptions 1 0330H Output upper value 2 0331H Output lower value 0332H Note 20mA (corresponding value) 4mA (corresponding value,nomarly is zero) 0-no,1-Ua,2-Uca,3-Ia,4-Fa,5-Pa,6-Pfa,7-Qa,8-Sa, Parameter codes 9-Ub,10-Uab,11-Ib,12-Fb,13-Pb,14-Pfb,15-Qb,16-Sb, mapped by Analog 17-Uc,18-Ubc,19-Ic,20-Fc,21-Pc,22-Pfc,23-Qc,24-Sc, output 25-Ux,26-Ul,27-I,28-F,29-P,30-Pf,31-Q,32-S, 33-Upper value,34-Lower value,35-Fixed value. 0-20mA(Any fixed 0-20000 output value) Output upper system 0xFB00 value Output lower system 0xC400 value

4 5 6

0333H 0334H 0335H

-8-

Table Data area mapped by Function 06H


Address 0000H Item Local address Description 0247 03P4W 11P2W 23P3W 33P4W BAL 41P3W 53P4W BAL 0 Prohibited 1 Permitted 01200 12400 24800 39600 419200(unused) 110000 110000 Reserved by manufacturer

0001H

Network type

0002H

Clear Max./Min. values

0004H

Baud rate

0007H 0009H 0016H 005FH

PT CT

Table Data conversion


Data responded and outputted from YD2010AA is regulated to Rx in 2 bytes, except for energy, which is 4 bytes in length. NO
1 2 3 4 5 6 7 8

Item
Voltage V CurrentA FrequencyHz Power Factor PF Active Power W Reactive Power Q Apparent Power S Energy Wh

Formula
U = RxPT0.01 I =RxCT0.0001 F=Rx0.00106813 PF =Rx0.0001 P= RxPTCT0.4 Q =RxPTCT0.4 S= RxPTCT0.2 Wh = RxPTCT

Range
065535 065535 065535 -1000010000 -3276832767 -3276832767 065535 0109

Data type
Unsigned Unsigned Unsigned Signed Signed Signed Unsigned Unsigned

Note

-9-