eXpertmeter EM720. Коммуникационный протокол Modbus. Справочное руководство (англ.)

eXpertmeter EM720. Коммуникационный протокол Modbus. Справочное руководство (англ.)

2 Modbus Protocol Implementation

For detailed information about Modbus protocol, Modbus message framing and error checking, refer to the "Modicon Modbus Protocol Reference Guide". It can be downloaded from the Modbus-IDA Website at

http://www.modbus.org/

. The following paragraphs outline some issues concerning the implementation of the Modbus protocol in the EM720.

2.1 Transmission Modes

The EM720 can be set up to communicate on a Modbus network using RTU transmission mode. Refer to the "EM720 Operation Manual" on how to select the transmission mode in your meter.

2.2 Address Field

The address field contains a user assigned address of the instrument (1-247) on a

Modbus network. Broadcast mode using address 0 is not supported.

2.3 Function Field

The Modbus functions implemented in the EM720 are shown in Table 2-1. Function 04 can be used in the same context as function 03.

Table 2-1 Modbus Function Codes

Code (decimal)

03

04

06

16

08

1

Meaning in Modbus

Read holding registers

Read input registers

Preset single register

Preset multiple registers

Loop-back test

Action

Read multiple registers

Read multiple registers

Write single register

Write multiple registers

Communications test

1

The EM720 supports only diagnostic code 0 - return query data.

2.4 Exception Responses

The instrument sends an exception response when an error is detected in the received message. To indicate that the response is notification of an error, the high order bit of the function code is set to 1.

Implemented exception response codes:

01 - Illegal function

02 - Illegal data address

03 - Illegal data value

04 - Device failure

When the character framing, parity, or redundancy check detects a communication error, processing of the master's request stops. The instrument will not act on or respond to the message.

2.5 Modbus Register Addresses

The EM720 Modbus registers are numbered in the range of 0 to 65535. From the

Modbus applications, the EM720 Modbus registers can be accessed by simulating holding registers of the Modicon 584, 884 or 984 Programmable Controller, using a 5digit “4XXXX” or 6-digit “4XXXXX” addressing scheme. To map the EM720 register address to the range of the Modbus holding registers, add a value of 40001 to the

10

EM720 register address. When a register address exceeds 9999, use a 6-digit addressing scheme by adding 400001 to the EM720 register address.

2.6 Data Formats

The EM720 uses three data formats to pass data between a master application and the instrument: 16-bit short integer, 32-bit long integer and 32-bit modulo-10000 formats.

Binary values and counters are always transmitted in 32-bit registers, while analog values can be read both in 32-bit and in 16-bit scaled registers.

Analog registers 256 through 308 and 6656 through 10935 contain scaled 16-bit values.

2.6.1 16-bit Scaled Integer Format

16-bit scaled analog data is transmitted in a single 16-bit Modbus register being scaled to the range of 0 to 9999. To get a true reading, a reverse conversion should be done using the following formula:

Y =

X × ( HI − LO )

9999

+ LO where:

Y - True reading in engineering units

X - Raw input data in the range of 0 to 9999

LO and HI - Data low and high scales in engineering units

The engineering scales are indicated for every scaled 16-bit register. Refer to Section 4

“Data Scales and Units” for applicable data scales and measurement units. The default voltage scale in the device is 144V (120V+20%). It can be changed through register

242 (see Section 3.1, Device Data Scales), or via the supplemental PAS software. The recommended voltage scale is 120V+20% = 144V for using with external PT’s, and

480V+25% = 600V for a direct connection to power line.

CONVERSION EXAMPLES

1. Voltage readings

a) Assume device settings (direct wiring): PT ratio = 1; Voltage scale = 600V (480V + 25%).

Voltage engineering scales (see Section 4):

HI_ENG = Vmax = 600.0 × PT ratio = 600.0 × 1 = 600.0V

LO_ENG = 0V

If the raw data reading is 2000 then the voltage reading in engineering units will be as follows:

Volts reading = 2000 × (600.0 - 0)/(9999 - 0) + 0 = 120.0V b) Assume device settings (wiring via PT): PT ratio = 14,400V : 120V = 120; Voltage scale =

144V.

Voltage engineering scales (see Section 4):

HI_ENG = Vmax = 144.0 × PT ratio = 144 × 120 = 17,280V

LO_ENG = 0V

If the raw data reading is 8314 then the voltage reading in engineering units will be as follows:

Volts reading = 8314 × (17,280 - 0)/9999 + 0 = 14,368V

2. Current readings

Assume device settings: CT primary current = 200A.

Current engineering scales (see Section 4):

HI_ENG = Imax = CT primary current × 2 = 200.00 × 2 = 400.00A

LO_ENG = 0A

11

If the raw data reading is 250 then the current reading in engineering units will be as follows:

Amps reading = 250 × (400.00 - 0)/(9999 - 0) + 0 = 10.00A

3. Power readings

a) Assume device settings (direct wiring): Wiring 4LL3; PT = 1; CT primary current = 200A;

Voltage scale = 600V.

Active Power engineering scales (see Section 4): kW

HI_ENG = Pmax = Vmax × Imax × 2 = (600.0 × 1) × (200.00 × 2) × 2 = 662,400W = 480.000

LO_ENG = -Pmax = -480.000kW

If the raw data reading is 5500 then the power reading in engineering units will be as follows:

Watts reading = 5500 × (480.000 - (-480.000))/(9999 - 0) + (-480.000) = 48.053 kW

If the raw data reading is 500 then the power reading in engineering units will be as follows:

Watts reading = 500 × (480.000 - (-480.000))/(9999 - 0) + (-480.000) = -431.995kW b) Assume device settings (wiring via PT): Wiring 4LN3; PT = 120; CT primary current = 200A.

Active Power engineering scales (see Section 4):

HI_ENG = Pmax = Vmax × Imax × 3 = (600 × 120) × (200.00 × 2) × 3/1000 = 86,400 kW

LO_ENG = -Pmax = -86,400 kW

If the raw data reading is 5500 then the power reading in engineering units will be as follows:

Watts reading = 5500 × (86,400 - (-86,400))/(9999 - 0) + (-86,400) = 8,650 kW

If the raw data reading is 500 then the power reading in engineering units will be as follows:

Watts reading = 500 × (86,400 - (-86,400))/(9999 - 0) + (-86,400) = -77,759 kW

4. Power Factor readings

Power factor engineering scales (see Section 3.3):

HI_ENG = 1.000.

LO_ENG = -1.000.

If the raw data reading is 8900 then the power factor in engineering units will be as follows:

Power factor reading = 8900 × (1.000 - (-1.000))/(9999 - 0) + (-1.000) = 0.78

2.6.2 32-bit Long Integer Format

32-bit long integer data is transmitted in two adjacent 16-bit Modbus registers as unsigned (UINT32) or signed (INT32) whole numbers. The first register contains the low-order word (lower 16 bits) and the second register contains the high order word

(higher 16 bits). The low-order word always starts at an even Modbus address. The value range for unsigned data is 0 to 4,294,967,295; for signed data the range is -

2,147,483,648 to 2,147,483,647.

If your Modbus driver does not support a 32-bit long integer format, you can read the two 16-bit registers separately, and then convert them into a 32-bit value as follows

(using C notation):

32-bit value = (signed short) high_order_register × 65536L + (unsigned short) low_order_register

Examples

1. Unsigned 32-bit Values

If you read unsigned Voltage V1 of 69,000V from registers 13952-13953, then the register readings will be as follows:

(13952) = 3464

(13953) = 1

12

The 32-bit value is (1 x 65536 + 3464) = 69000V.

2. Signed 32-bit Values

If you read signed kW of -789kW from registers 14336-14337, then the register readings will be:

(14336) = 64747 (unsigned)

(14337) = 65535 (unsigned) or -1(signed value).

To take the high order register as a signed value, compare it with 32767. If the value is less or equal to 32767, use it as is. If it is greater than 32767, then this is a negative number in a two's complement code (like in our example) - just subtract it from 65536 to get the original negative value.

The 32-bit reading is (-1 x 65536 + 64747) = -789kW.

Fractional 32-bit data is transmitted using a decimal pre-multiplier to pass fractional numbers in an integer format. Fractional numbers are pre-multiplied by 10 to the power N, where N is the number of digits in the fractional part. For example, the frequency reading of 50.01 Hz is transmitted as 5001, having been pre-multiplied by

100. Whenever a data register contains a fractional number, the register measurement unit is given with a multiplier ×0.1, ×0.01 or ×0.001, showing the weight of the least significant decimal digit. To get an actual fractional number with specified precision, multiply the register value by the given multiplier. To write a fractional number into the register, divide the number by the given multiplier.

2.6.3 32-bit Modulo-10000 Format

Energy counters 287-294 and 301-302 are read in two contiguous 16-bit registers in a modulo-10000 format. The first (low order) register contains the value mod 10000, and the second (high order) register contains the value/10000. To get the true energy reading, the high order register value should be multiplied by 10,000 and added to the low order register.

2.7 User Assignable Registers

The EM720 has 120 user assignable registers in the address range of 0 to 119, any of which you can map to any register address accessible in the instrument. Registers that reside in different locations may be accessed by a single request by re-mapping them to adjacent addresses in the user assignable registers area.

The actual addresses of the assignable registers, which are accessed via addresses 0 through 119, are specified in the register map (registers 120 through 239), where register 120 contains the actual address of the register accessed via register 0, register 121 contains the actual address of the register accessed via register 1, and so on. The assignable registers and the map registers themselves may not be re-mapped.

To build your own register map, write to map registers 120 to 239 the actual addresses you want to read from or write to via the assignable area (registers 0 to

119). 32-bit long registers should always be aligned at even addresses. For example, if you want to read registers 7136 (1-second V1 voltage, scaled short integer) and

14720-14721 (kWh Import, long integer) via registers 0-2, do the following:

- write 14720 to register 120

- write 14721 to register 121

- write 7136 to register 122

Reading from registers 0-2 will return the kWh reading in registers 0 (low 16 bits) and

1 (high 16 bits), and the voltage reading in register 2.

2.8 Password Protection

The EM720 has a password protection for setups, cumulative registers and log files from being changed or cleared via communications. Refer to the EM720 Operation

Manual for details.

13

A user password must be written into the 32-bit device authorization register (44378-

44379) before another write request is issued. If the correct password is not supplied, the meter will respond to all write requests directed to the meter setup and reset registers with the exception code 01 (illegal operation). It is recommended to clear the authorization register after you have completed your changes in order to activate password protection.

2.9 Data Recording and File Transfers

2.9.1 Log File Organization

Historical files are stored to the non-volatile flash memory. Memory is allocated for each file statically when you set up your files and will not change unless you reorganize the files. The EM720 automatically performs de-fragmentation of the memory each time you re-organize your files. This prevents possible leakage of memory caused by fragmentation.

Data records in a file are arranged in the order of their recording. Each record has a unique 16-bit sequence number that is incremented modulo 65536 with each new record. The sequence number can be used to point to a particular record in the file, or to check the sequence of records when uploading files from the device.

Each file has a write position pointer that indicates the place where the next record will be recorded, and a read position pointer that indicates the place from where the current record will be read. Both pointers show sequence numbers of the records they point to rather than record offsets in the file.

After acknowledging a record you have read, the read pointer automatically advances to the next record in the file. When the read pointer gets to the record to which the file write pointer points, the end-of-file (EOF) flag is set. It is automatically cleared when a new record is added to the file, or when you explicitly move the read pointer to any record within a file.

If a file has a wrap-around attribute (circular file), the most recent records can overwrite the oldest records. When this happens at the current read position, the read pointer automatically advances forward in order to point to the oldest record in the file.

The EM720 keeps a separate read pointer for each communication port so that access to the same file through a different port will not affect current active sessions for other ports.

Multi-section Files

Log files can have one or more (up to 20) sections for multi-channel recording. An ordinal file consists of a single section. Some files, such as daily profile log files and waveform log files, are arranged as multi-section files.

A multi-section file is subdivided into multiple sections of the same structure, one section per recording channel. The number of sections in each file is defined at the time you set up your files and may not change unless you re-organize the file. Each section within a multi-section file can be addressed by a section number, or by a section channel ID.

A multi-section file has a single write position pointer for all sections and stores data in all sections simultaneously. This means that records with the same sequence number in all sections are associated with the same event. A multi-section file has also a single read position pointer for all sections.

Data Log Files

Conventional data log files can store up to 16 measured parameters per a record. Any data measured by the device can be stored in the log file. The number of parameters that each record will hold and the list of parameters you want to be recorded in the file can be selected through the Data log setup registers for a particular file.

Recording data to data log files can be triggered through the setpoints, either on a time basis, or upon any event detected by the setpoints.

14

Billing/TOU Profile Data Log Files

Data log files #15 and #16 are factory configured for monthly and daily profile logs of the energy/usage and maximum demand registers. A profile log file is organized as a multi-section file that has a separate section for each energy and maximum demand register. The number of sections is taken automatically from your Summary/TOU

Registers setup. Since each Summary/TOU energy register has a shadow maximum demand register, the number of sections in the file can be twice the number of the allocated Summary/TOU registers.

A profile log file stores the summary (total of all tariffs) data and/or all tariff data for each configured Summary/TOU register.

Waveform Log Files

Waveform log files are organized as multi-section files that store data for each recording channel in a separate section. A waveform log file can record up to six AC channels simultaneously: three voltage and three current waveforms. The number of sections in a file, or channels that a file can store, is defined when you set up the file.

The channels that a file will record are selected in the waveform log setup. All selected channels are recorded in successive file sections.

A waveform file has a single read pointer for all sections, so that data from all channels of a single record can be read together without repositioning the file pointer. When you point to a particular file record, data from all sections related to the same event are all available for a read. Moreover, the EM720 takes all channel data for the currently accessed record to a separate buffer, so that even when the record is overwritten at the time of reading, you are still prevented from receiving partially updated data.

A single waveform record for a channel can contain up to 512 points of the sampled input signal. Refer to the line frequency field in the channel header record to correctly set up the time scale for the waveforms.

If a waveform log is configured to record more samples per event than a single record can hold, the waveform recorder will store as many records per event as required to record the entire event. All waveform records related to the event are merged in a series and have the same series number, so that they can be plotted together. Each record within a series has a unique serial number that allows tracking the sequence of records in a series. A single waveform series can hold up to 81,920 points (2,560 cycles at a rate of 32 samples per cycle) of a sampled AC signal.

2.9.2 File Transfers

File transfer protocol provides both data transfer and information services. File transfer is performed through two blocks of registers: a 32-word master request block and a

288-word read-only file response block. After a master application has written the request into the file request block, the requested data is available for a read through the file response block registers. File transfer functions allow changing the file or section position in order to point to the desired record.

The information services use separate 8-word file info request and 200-word file info response blocks. The extended file information is available including current file pointers’ positions, file contents, the number of records in the file, allocated file size, time of the last file update, and more.

Common File Transfer

Log files can be read either in a sequence record-by-record, or in a random order. Each

Read-File request fills the file response block with the data of the record pointed to by the file (or section) read pointer. If you want to begin reading a file from a particular record, which sequence number is known, you can change the pointer position by issuing the Set-File-Position request with the desired sequence number. If you want to read a file from the beginning, send the Reset-File-Position request that moves the pointer to the oldest file record. If you do not change the file position, then you will continue reading the file from the record following the one you have read the last time you accessed the file.

15

You need not explicitly move the file position to the following record if you want to continue reading a file in sequence after you have uploaded the current record.

Instead, issue an acknowledgment request that automatically advances the file pointer to the next record, and then read the record data through the file response block.

The file response block can contain more than one record. The number of records available in the block and the file record size in words are always reported in the block heading. There are no special rules on how to read records from the file transfer block.

You can read a single record or all records together, or begin reading from the last record and end with the first record. However, you should remember: 1) after an acknowledgment, the file position moves to the record following the last one you have accessed in the file transfer block; and 2) data in the file transfer block does not change until you either issue an acknowledgment, or explicitly change the file position by the Set-File-Position or Reset-File-Position requests.

The file transfer is completed after you have read the last record of the file. Before storing a file record to your database, always check bit 9 in the record status word, which contains the end-of-file (EOF) flag. This bit set to 1 indicates that the file read pointer does not point to any record within the file, and you should not store any record that has this bit set. The EOF flag is set only after you have acknowledged the last record of the file, so that testing for end-of-file requires one extra read. If you wish to stop the transfer just after storing the last file record, acknowledge the record and check bit 0 in the record status word. Bit 0 is set to 1 only once when you read the last record of the file.

The following gives a summary of steps you should do to read an ordinal log file:

1. If you want to begin reading a file from a particular record or from the first record, use either the Set-File-Position request with the desired record sequence number, or the Reset-File-Position request. Preset a section number and channel ID to zero.

2. Write the Read-File request with a section number and channel ID set to zero.

3. Read the record data from the file response block.

4. Write an acknowledgment for the file. You need not fill all the request fields: only the file function is required. The file pointer will be moved to the next file record.

5. Repeat steps 3-4 until all the file records are read.

Reading a Multi-section Billing/TOU Profile Log File

In a multi-section data profile file, all user requests including an acknowledgment; the

Read-File, Set-File-Position and Reset-File-Position requests, relate to a particular file section rather than to the file itself. The only request that affects the entire file is the

Erase-File that clears all the file sections together.

A file section can be requested either by a section number, or by a section channel ID.

If you use a channel ID, preset the section number field to 0xFFFF. If a section number is specified, the channel ID field will not be checked. The device returns both fields in the response block heading, so you can always identify what channel data is being read from the present file section. If you want to know which channels are recorded to the file sections, check the file channel mask in the file info block. This is a bitmap that contains one in a bit position if a channel with an ID equal to the bit number is recorded to the file, and contains zero if it is not.

The following gives a summary of steps for reading a multi-section data log file:

1. If you want to begin reading a file section from a particular record or from the first record, use either the Set-File-Position request with the desired record sequence number, or the Reset-File-Position request. Specify either a section number, or the channel ID for the section from where you want to read data. If you use a channel

ID, preset the section number field to 0xFFFF.

2. Write the Read-File request with the section number and channel ID as shown in the previous step.

3. Read the record data from the file response block.

16

4. Write an acknowledgment for the file. The file section pointer will be moved to the next record.

5. Repeat steps 3-4 until all the section records are read.

Reading Multi-section Waveform Files

Waveform files can be read as conventional multi-section files in the order described above. Another way is to take advantage of the fact that waveform files have a single read pointer for all file sections, so you can read records of all the channels related to the same event at once without repositioning the file pointer. The following gives a summary of steps for reading waveform files:

1. If you want to begin reading a file from a particular record or from the first record, use either the Set-File-Position request with the desired record sequence number, or the Reset-File-Position request. Preset the section field to zero.

2. Write the Read-File request. Address you request to the first file section (its number is always zero), or to the first file channel (if you know channel’s ID). If you use a channel ID, preset the section number field to 0xFFFF.

3. Read the channel’s data from the file response block. Store the received record’s sequence number.

4. Write the Read-File request for the next file section or channel using the stored record sequence number. The file response block will be refilled with the data for the requested channel that is related to the record with the same sequence number.

5. Repeat steps 3, 4 until all the channel records with the current sequence number are read.

6. Write an acknowledgment. The file pointer will be moved to the next record.

Repeat steps 2-6 until all the file records are read.

Reading Real-time Waveforms

Real-time waveforms are accessed through the same transfer blocks just like the waveform log files by addressing file 128. Writing the Read-File request for file 128 provides a simultaneous capture of 6 real-time waveform records – three voltage and three current waveforms – into a communication buffer that can be read through the common file response block. The following gives a summary of steps for reading realtime waveforms:

1. Write the Read-File request for file 128. Address you request to the first file section

(its number is always zero), or to the first file channel (if you know channel’s ID).

If you use a channel ID, preset the section number field to 0xFFFF.

2. Read the channel’s data from the file response block.

3. Write the Read-File request for the next file section or channel. The file response block will be refilled with the data for the requested channel.

4. Repeat steps 3, 4 until all the channel records are read.

5. Write an acknowledgment to release the buffer.

17

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement

Table of contents