Top Banner
2015 PFH Windows Sp z o. o. 5/19/2015 OPC to Modbus TCP
20

OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

Apr 18, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

2015

PFH

Windows Sp z o. o.

5/19/2015

OPC to Modbus TCP

Page 2: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

2 OPC To Modbus TCP | Windows Sp z o. o.

OPC To Modbus TCP

Contents OPC To Modbus TCP ............................................................................................................................ 2

About this manual ................................................................................................................................ 5

Copyrights ........................................................................................................................................ 5

Trademarks ...................................................................................................................................... 5

General ............................................................................................................................................. 5

Intended audience ........................................................................................................................... 5

Related documents .......................................................................................................................... 5

Document revisions ......................................................................................................................... 5

Scenarios .............................................................................................................................................. 6

Modbus Master to Modbus slave to OPC client to OPC Server ....................................................... 6

Features........................................................................................................................................ 6

Modbus Slave to Modbus Master to OPC client to OPC Server ...................................................... 6

Features........................................................................................................................................ 6

Modbus Master & Slave integrating data to OPC Server ................................................................ 7

Features........................................................................................................................................ 7

Alternative configuration ................................................................................................................. 7

Definitions ............................................................................................................................................ 8

Installation ........................................................................................................................................... 8

Backup .............................................................................................................................................. 8

Software activation .......................................................................................................................... 8

Configuration ....................................................................................................................................... 8

Modbus Register Address Format ................................................................................................... 9

40001: Modicon convention notation for Modbus registers ...................................................... 9

Modbus address space..................................................................................................................... 9

Named items .................................................................................................................................. 10

Name aggregation ...................................................................................................................... 10

Complex data values ...................................................................................................................... 10

Int32 ........................................................................................................................................... 10

IEEE 754 Floating point .............................................................................................................. 10

Supported complex values ......................................................................................................... 10

Data type conversion, OPC to Modbus .......................................................................................... 10

Page 3: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

3 OPC To Modbus TCP | Windows Sp z o. o.

SI Units ........................................................................................................................................... 12

Endianness ..................................................................................................................................... 12

Master ............................................................................................................................................ 12

Slave ............................................................................................................................................... 12

Sample ............................................................................................................................................ 12

Modicon Adressing .................................................................................................................... 13

Drag & Drop OPC to Modbus ......................................................................................................... 13

Dragging Information Objects within the Modbus TCP Windows ............................................. 14

Colliding Register Addresses ...................................................................................................... 14

Import & Export of configuration data .......................................................................................... 16

Clipboard, Paste ......................................................................................................................... 16

Clipboard, Copy .......................................................................................................................... 16

Documentation of configuration data ....................................................................................... 16

Copying XML configuration files ................................................................................................ 16

TCP ..................................................................................................................................................... 16

Questions ........................................................................................................................................... 16

Security ........................................................................................................................................... 16

Timestamp ......................................................................................................................................... 16

Quality ................................................................................................................................................ 16

Data request strategy ........................................................................................................................ 16

Modbus Master .............................................................................................................................. 16

Modbus Slave ................................................................................................................................. 17

Read ........................................................................................................................................... 17

Write .......................................................................................................................................... 17

OPC ................................................................................................................................................. 17

Subscription ............................................................................................................................... 17

Data coherence: ............................................................................................................................. 17

Modbus Function codes ................................................................................................................. 17

Error handling .................................................................................................................................... 18

Security ............................................................................................................................................... 19

Modbus .......................................................................................................................................... 19

OPC ................................................................................................................................................. 19

Interoperability .................................................................................................................................. 19

Diagnostics ......................................................................................................................................... 19

Page 4: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

4 OPC To Modbus TCP | Windows Sp z o. o.

Logging ........................................................................................................................................... 19

Console mode ................................................................................................................................ 19

Scheduled restart ............................................................................................................................... 20

System Requirements: ....................................................................................................................... 20

Page 5: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

5 About this manual | Windows Sp z o. o.

About this manual

Copyrights

This document is the property of Windows Sp. z o. o, thus Windows Sp. z o. o is the copyright holder. The information in this document is subject to change without notice and should not be construed as a commitment by the copyright holder. The copyright holder assumes no responsibility for any errors that may appear in this document. In no event shall the copyright holder be liable for direct, indirect, special, incidental, or consequential damages of any nature or kind arising from the use of this document, nor shall the copyright holder be liable for incidental or consequential damages arising from use of any software or hardware described in this document. This document and parts thereof must not be reproduced or copied without written permission from the copyright holder, and the contents thereof must not be imparted to a third party nor used for any unauthorized purpose. The software or hardware described in this document is furnished under a license and may be used, copied, or disclosed only in accordance with the terms of such license. © Copyright 2014. All rights reserved.

Trademarks

All brand or product names mentioned in this document may be trademarks or registered trademarks of their respective holders and are used for reference only.

General

This manual provides thorough information on the Modbus to OPC protocol converter and the central concepts and instructions related to it. The basic operation procedures are also discussed.

Intended audience

Information in this user’s manual is intended for application engineers who configure Modbus and OPC protocol converters. As a prerequisite, you should understand Modbus protocol, OPC DA and the basic procedures in configuring software.

Related documents

MODBUS APPLICATION PROTOCOL SPECIFICATION V 1.1b

Document revisions

Date Version Who Action

20141101 1.0 PFH Created first version

20141103 1.0.0.1 PFH Event log entries updated.

Page 6: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

6 Scenarios | Windows Sp z o. o.

Scenarios “OPC To Modbus” links several Modbus devices to one or more OPC servers, both Modbus Slave and Master devices are supported. Modbus Register data is linked to OPC items via Names. Virtual data types; like Floating point (IEEE 754), Int32 are supported on Modbus 16 bit register data.

Modbus Master to Modbus slave to OPC client to OPC Server

Features

Connects a Modbus Master PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to utility.

Modbus Slave to Modbus Master to OPC client to OPC Server

Features

Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to utility.

Vestas Server Modbus Slave

Modbus2OPC

Vestas Online OPC DA Server

DCOM

PLC Modbus Master Modbus TCP

OPC Client DA

Vestas Server Modbus Master

Modbus2OPC

Vestas Online OPC DA Server

DCOM

OPC Client DA

Modbus TCP

PLC Modbus Slave

Page 7: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

7 Scenarios | Windows Sp z o. o.

Modbus Master & Slave integrating data to OPC Server

Features

Integrates data from one Modbus Slave and one Modbus master into an OPC Server

Alternative configuration

Matrikon Linkmaster and Matrikon Modbus To OPC

Vestas Server

PLC Grid meter Modbus Slave Active power, kW Reactive power, kVAr Cos φ Voltage, kV Frequency, Hz

PLC Utility Modbus Master Set-points Active power Cos Phi Handshake Feed back Active production Reactive production Average wind speed Possible active power Active power Cos Phi set-point Possible Reactive power cap. Possible Reactive power ind. Handshake signal

DCOM

Modbus Master Gridmeter

Modbus Slave Utility

Ad

apter

OP

C C

lient

DA

OneView ECU

Page 8: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

8 Definitions | Windows Sp z o. o.

Definitions Master Connects to a slave listening on port 502

Slave Listening for incoming connections on port 502, processes read and write requests but does not issue commands on its own initiative.

Unit Identifier The MODBUS ‘slave addresses’ field usually used on MODBUS Serial Line is replaced by a single byte ‘Unit Identifier’ within the MBAP Header. The ‘Unit Identifier’ is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent MODBUS end units.

Installation The software is installed with the installation package. The user installing the package must have Administrator rights. If a previous version was installed on the computer it may be required to remove this version before the new software is installed. The installer must provide the correct license information during installation so that the software may install automated and perform the necessary Software license activation. Please refer to the Software license activation guide from the software vendor. Depending on the operating system on the target computer, user rights and access rights to the file system must be configured for the software to function correctly. Please note that security settings are likely to change in future releases of Windows operating systems and the engineer installing the software must consider these changes during installation and configuration. The service must be configured to restart automatically after a software failure.

Backup

Once the system has been configured and verified, the configuration of the namespaces as well as the software settings must be stored and used in a possible future systems restore process. The license .pdf document containing the software serial number must be included in the backup for later reinstallation and reactivation of the software. The following files types contain site specific configuration information:

exe.config,

xml

Software activation

If there is an open Internet connection the software activation usually is done without user interaction. Please note that this may require a user interaction on the side of the owner of the software rights. The license key is stored in the registry under the service settings.

Configuration After a successful installation the Installer must perform the site adaptations to the namespace definitions. Depending on the security policy applied on the operating system, there may be additional steps to take regarding access by the software to windows registry, disk directories etc.

Page 9: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

9 Configuration | Windows Sp z o. o.

Please remember that the software is configured to run as a Windows NT. Service under a specific user account. The access rights of this account vary under different operating systems and may be different from the interactive user installing and configuring the software. In Windows XP the software should run under the System account. In Server environments like windows 2008 Server, the account under which the service is running MUST have full access to the folder in which the configuration files are located.

Modbus Name space

Modbus Register Address Format

40001: Modicon convention notation for Modbus registers

Modbus was originally developed by Gould-Modicon, which is presently Schneider Electric. The notation originally used by Modicon is still often used today, even though considered obsolete by present Modbus-IDA standards. The advantage in using the Modicon notation is that two pieces of information are included in a single number: (a) The register type; (b) The register number. A register number offset defines the type.

0x Coil 000001-065535

1x Discrete Input 100001-165535

3x Input Register 300001-365535

4x Holding Register 400001-465535

When using the extended register referencing, it is mandatory that all register references be exactly six digits. This is the only way the software will know the difference between holding register 40001 and coil 40001. If coil 40001 is the target, it must appear as 040001(Six digits).

Modbus address space Primary tables Object

type Action Comments

Page 10: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

10 Configuration | Windows Sp z o. o.

Discrete Input Single bit Read-Only This type of data can be provided by an underlying I/O system.

Coils Single bit Read-Write This type of data can be alterable by an application program.

Input Registers

16-bit word

Read-Only This type of data can be provided by an underlying I/O system

Holding Registers

16-bit word

Read-Write This type of data can be alterable by an application program.

The Modbus address spaces are implemented as separate tables and NOT overlapping

Named items

Modbus does not work with named items; however names are used to identify complex data items that are to be propagated to OPC or other IEC servers.

Name aggregation

The names are aggregated in the following way Station name/Unit name/Information Object, Example: WT_OPCserver/WT01/WTUR.W

Complex data values

Modbus was designed based on devices with a 16-bit register length. Consequently, special considerations are required when implementing 32-bit data elements. This implementation settled on using two consecutive 16-bit registers to represent 32 bits of data or essentially 4 bytes of data. It is within these 4 bytes of data that single-precision floating point data can be encoded into a Modbus RTU message. Data types requiring more than one register, where each register is a two byte value, are modeled as two or more consecutive registers. An Integer (Int32) is a 4 byte value and thus consumes two registers and a float will also store as two registers.

Int32

Int32 values are stored as two consecutive registers.

IEEE 754 Floating point

Floating point values are stored as IEEE 754 floats. Reference: http://en.wikipedia.org/wiki/Decimal32_floating-point_format.

Supported complex values

Type Register size Description

Float 2

Int32 2

UInt32 2

Boolean Coil

Double 4

Int16 2

Date 4

Data type conversion, OPC to Modbus The following applies when translating data values from OPC to Modbus

Modbus

Page 11: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

11 Configuration | Windows Sp z o. o.

OPC Coil Register Int32 float

VT_EMPTY 0 0 0 0 0.0

VT_NULL 1 0 0 0 0.0

VT_I2 2 0, if == 0

1, if != 0

No

conversion

No

conversion

Convert to

float

VT_I4 3 0, if == 0

1, if != 0

Native

VT_R4 4 0, if == 0

1, if != 0

Convert to

int32

Native

VT_R8 5 0, if == 0

1, if != 0

Convert to

int32

Convert to

float

VT_CY 6

VT_DATE 7

VT_BSTR 8 N/A N/A N/A N/A

VT_DISPATCH 9 N/A N/A N/A N/A

VT_ERROR 10 N/A N/A N/A N/A

VT_BOOL 11

VT_VARIANT 12

VT_UNKNOWN 13 N/A N/A N/A N/A

VT_DECIMAL 14

VT_I1 16

VT_UI1 17

VT_UI2 18

VT_UI4 19

VT_I8 20

VT_UI8 21

VT_INT 22

VT_UINT 23

VT_VOID 24 0 0 0 0

VT_HRESULT 25

VT_PTR 26

VT_SAFEARRAY 27

VT_CARRAY 28

VT_USERDEFIN

ED

29 N/A N/A N/A N/A

VT_LPSTR 30 N/A N/A N/A N/A

VT_LPWSTR 31 N/A N/A N/A N/A

VT_RECORD 36 N/A N/A N/A N/A

VT_INT_PTR 37 N/A N/A N/A N/A

VT_UINT_PTR 38 N/A N/A N/A N/A

VT_FILETIME 64 N/A N/A N/A N/A

VT_BLOB 65 N/A N/A N/A N/A

VT_STREAM 66 N/A N/A N/A N/A

VT_STORAGE 67 N/A N/A N/A N/A

VT_STREAMED_

OBJECT

68 N/A N/A N/A N/A

VT_STORED_OB

JECT

69 N/A N/A N/A N/A

VT_BLOB_OBJE

CT

70 N/A N/A N/A N/A

VT_CF 71 N/A N/A N/A N/A

VT_CLSID 72 N/A N/A N/A N/A

VT_VERSIONED

_STREAM

73 N/A N/A N/A N/A

VT_BSTR_BLOB 0x

ff

f

N/A N/A N/A N/A

VT_VECTOR 0x N/A N/A N/A N/A

Page 12: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

12 Configuration | Windows Sp z o. o.

10

00

VT_ARRAY 0x

20

00

N/A N/A N/A N/A

VT_BYREF 0x

40

00

N/A N/A N/A N/A

SI Units Each named variable also has a SI unit that the adapter uses to do a unit conversion to the target unit; this may be from kW to MW or similar. The SI unit conversion is done in the adapter layer, but relies on the proper configuration of engineering units in the OPC server.

Endianness

MODBUS uses a ‘big-Endian’ representation for addresses and data items. This means that when a numerical quantity larger than a single byte is transmitted, the most significant byte is sent first. So for example register size value 16 - bits 0x1234 the first byte sent is 0x12 then 0x34 This is important for client software on for instance mobile devices where the processor is “non Intel”. Reference http://en.wikipedia.org/wiki/Endianness.

Master The master name space represents names on a connected Modbus device The data must be polled from the connected device at regular intervals. Data may be pushed from an OPC server by creating a subscription on the OPC server with the named data found in the Master name space.

Slave The slave name space represents names on the machine where the software is running. Data may be pushed from an OPC server by creating a subscription on the OPC server with the named data found in the Slave name space. When a Modbus Master Reads register data that maps to named variables, the current value of the registers are returned to the Master, if the timestamp is older than the refresh threshold, the variables are actively read from the OPC server.

Sample

This sample contains both a Modbus master and a Modbus slave Devices

|-Master (192.168.2.101:502)

|-Station 01 (Kepware.KEPServerEX.V5)

|-Discrete Inputs

|-Coils

|-Input Registers

|-Holding Registers

|-00000(ECU.WAPC.SetPlW, float, kW)

|-00001 |-00002(ECU.WRPC.Set, float, none)

Page 13: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

13 Configuration | Windows Sp z o. o.

|-00003

|-Slave (127.0.0.1:502)

|-Station 01 (Kepware.KEPServerEX.V5)

|-Discrete Inputs

|-Coils

|-Input Registers

|-00000(Grid.ActivePower, float, kW) |-00001

|-00002(Grid.ReactivePower, float, kVAr)

|-00003 |-Holding Registers

Modicon Adressing Devices

|-Master (192.168.2.101:502)

|-Station 01 (Kepware.KEPServerEX.V5)

|- Registers

|-400000(ECU.WAPC.SetPlW, float, kW)

|-400001 |-400002(ECU.WRPC.Set, float, none)

|-400003

|-Slave (127.0.0.1:502)

|-Station 01 (Kepware.KEPServerEX.V5)

|- Registers

|-300000(Grid.ActivePower, float, kW) |-300001

|-300002(Grid.ReactivePower, float, kVAr)

|-300003

Drag & Drop OPC to Modbus

Adding information objects to the Modbus TCP side is best done by dragging them from the OPC server explorer and then dropping the objects onto the Modbus TCP tree. Dragging ensures that the right names are created and that data types are mapped correctly. The object dragged, referred to as the source and the target referred to at the destination determine the operation performed. Some operations are not permitted. During the drag operation; the description of the operation is displayed in the status bar.

Clipboard: Copy, Paste As an alternative to using the mouse for drag & drop operations, the clipboard can be used in a similar manner.

OPC Server onto an Station Sets the name of the Out Station to the name of the OPC server, creates a Station 0 if it does not exist; adds all OPC browse elements to the Station.

OPC Browse Element (Directory) to a Station Dropping a directory on the Out Station will create a new Station with the name of the Directory; the Station ID will be the next unused ID, all the child browse elements are created as Information Objects in the Station. Fast way to create a lot of Information Objects, however the indexes are auto generated in sequence.

OPC Browse Element (Directory) to a Station Hmmm, can’t do that

Page 14: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

14 Configuration | Windows Sp z o. o.

OPC Browse Element (Item) to a Station Creates the OPC Item as an Information Object in the Station, the data type is mapped according to data type mappings. The Index is created as the first free Index in the Station.

OPC Browse Element (Item) to an Information Object Same as dropping on a Station, adds the element,

Drag & Drop action allowed Between OPC and Modbus TCP

Ou

t Station

Station

Info

rmatio

n

Ob

ject

Temp

late

Server Yes No No no

Browse element Item

No Yes Yes Yes

Browse element Directory

Yes Yes No Yes

Group Yes Yes No Yes

Dragging Information Objects within the Modbus TCP Windows

The Indexes, Station relation etc, of the Information objects can be changed by drag and drop within the Modbus TCP configuration window.

Information Object to Information object, same station Changes the Index of Object A to the Index of object B, objects between the two are moved one index.

Information Object to Information object, different station Moves the Information Object from the source Station to the target Station.

Colliding Register Addresses

Indexes are the address at which an Information Object is stored within a Station; thus two Information Objects cannot have the same Register Address. If, during configuration two Information Objects have the same Index the Tree Icon is changed to Collision: and the status bar is displaying a text telling which two objects have the same Index. It is possible to change the index with the edit dialog. OPC Coil Register Int32 float

VT_EMPTY 0 0 0 0 0.0

VT_NULL 1 0 0 0 0.0

VT_I2 2 0, if == 0

1, if != 0

No

conversion

No

conversion

Convert to

float

VT_I4 3 0, if == 0

1, if != 0

Native

VT_R4 4 0, if == 0

1, if != 0

Convert to

int32

Native

VT_R8 5 0, if == 0

1, if != 0

Convert to

int32

Convert to

float

Page 15: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

15 Configuration | Windows Sp z o. o.

VT_CY 6

VT_DATE 7

VT_BSTR 8 N/A N/A N/A N/A

VT_DISPATCH 9 N/A N/A N/A N/A

VT_ERROR 10 N/A N/A N/A N/A

VT_BOOL 11

VT_VARIANT 12

VT_UNKNOWN 13 N/A N/A N/A N/A

VT_DECIMAL 14

VT_I1 16

VT_UI1 17

VT_UI2 18

VT_UI4 19

VT_I8 20

VT_UI8 21

VT_INT 22

VT_UINT 23

VT_VOID 24 0 0 0 0

VT_HRESULT 25

VT_PTR 26

VT_SAFEARRAY 27

VT_CARRAY 28

VT_USERDEFIN

ED

29 N/A N/A N/A N/A

VT_LPSTR 30 N/A N/A N/A N/A

VT_LPWSTR 31 N/A N/A N/A N/A

VT_RECORD 36 N/A N/A N/A N/A

VT_INT_PTR 37 N/A N/A N/A N/A

VT_UINT_PTR 38 N/A N/A N/A N/A

VT_FILETIME 64 N/A N/A N/A N/A

VT_BLOB 65 N/A N/A N/A N/A

VT_STREAM 66 N/A N/A N/A N/A

VT_STORAGE 67 N/A N/A N/A N/A

VT_STREAMED_

OBJECT

68 N/A N/A N/A N/A

VT_STORED_OB

JECT

69 N/A N/A N/A N/A

VT_BLOB_OBJE

CT

70 N/A N/A N/A N/A

VT_CF 71 N/A N/A N/A N/A

VT_CLSID 72 N/A N/A N/A N/A

VT_VERSIONED

_STREAM

73 N/A N/A N/A N/A

VT_BSTR_BLOB 0x

ff

f

N/A N/A N/A N/A

VT_VECTOR 0x

10

00

N/A N/A N/A N/A

VT_ARRAY 0x

20

00

N/A N/A N/A N/A

VT_BYREF 0x

40

00

N/A N/A N/A N/A

Page 16: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

16 TCP | Windows Sp z o. o.

Import & Export of configuration data

Clipboard, Paste

It is possible to paste information previously copied from Excel onto for instance Input registers.

Clipboard, Copy

Device data, Station data, Registers may be copied to the clipboard in txt format.

Documentation of configuration data

Using the clipboard to copy configuration data and pasting into a Word document is the easy way to document configuration data.

Copying XML configuration files

If many similar sites are to be configured it is possible to deploy the xml namespace definitions after the software is installed and then replace the installed configuration files.

TCP The default port for listening on incoming connections for the Modbus Slave is 502. The port can be configured differently but 502 is the standard port to use.

Questions Start up conditions, caching set-points for (Vestas) OPC server?

Security Accept Modbus TCP connections from all addresses?

Timestamp Modbus does not implement a timestamp for the data read. The data in the internal namespace definition is time stamped in order to ensure a correct data polling sequence where the oldest data is refreshed first. But a Modbus Master does not have access to the timestamp information. Time stamps are also propagated to the Adapter layer, so that registers written will have the local server timestamp.

Quality Modbus does not implement a quality model regarding register information.

Data request strategy The Modbus protocol does not implement any kind of active reporting mechanisms, thus the data must be polled at regular intervals.

Modbus Master

Polling Data will be updated in a separate thread that will read the current namespace sequentially and update the Holding registers accordingly.

Page 17: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

17 Data request strategy | Windows Sp z o. o.

This will ensure that the Modbus client will get a response quickly, but there may be an offset in time. If there is more than one Modbus client requesting data it will only create one set of data requests to the turbine. The polling frequency should not be higher than 1 Hertz. The polling frequency is controlled by the ScanRate setting in the appconfig. MessageTimeout in the settings controls how long the software will wait for a response to a Request message. The default message timeout is 1000 milliseconds (1 Second). When the timeout time is exceeded for a message, the message is discarded and the Adapter is signalled with bad data quality for the items in the request. Data is polled from the Modbus Slave at a high rate, so to avoid overloading the OPC server with data that has not changed; only data items that have changed value are written to the OPC server.

Modbus Slave

The Modbus slave does not contain a data request scheme; instead it relies on a data contract being created on the OPC server.

Read

When processing an incoming Read Holding Register request; data will be read the from the internal data cache.

Write

When data is written to the Modbus Slave, the register or coil data is transformed into their named data item representation and published to the Adapter layer which in turn will write to the OPC server. All writes are handled as synchronous writes to the data source.

OPC

Subscription

Generally a subscription should be created on the OPC server, so that data that we are interested in is supplied when the data changes.

Data coherence:

A single Modbus telegram, Read Holding Registers, can only contain a limited number of registers, thus there is the risk that data read with two or more consecutive telegrams will contain data from different time ranges. When constructing the register layout, this should be considered so that data that should be read in a single transaction are located within the possible range of a Read Holding registers command. Data from the OPC server are processed in a single transaction and the Modbus registers are updated in a single transaction.

Modbus Function codes Code Description Implemented

0x00 Not valid

0x01 Read Coils Yes

0x02 Read Discrete Inputs Yes

Page 18: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

18 Error handling | Windows Sp z o. o.

0x03 Read Holding Registers Yes

0x04 Read Input Registers Yes

0x05 Write Single Coil Yes

0x06 Write Single Register Yes

0x07 Read Exception Status (Serial Line only) N/A

0x08 Diagnostics (Serial Line only) N/A

0x0B Get Comm Event Counter (Serial Line only) N/A

0x0C Get Comm Event Log (Serial Line only) N/A

0x0E Read Device Identification

0x0F Write Multiple Coils Yes

0x10 Write Multiple registers Yes

0x11 Report Slave ID (Serial Line only) N/A

0x14 Read File Record No

0x15 Write File Record No

0x16 Mask Write Register N/A

0x17 Read/Write Multiple registers Yes

0x18 Read FIFO Queue No

0x2B Encapsulated Interface Transport No

43 / 14 (0x2B / 0x0E) Read Device Identification SDSDJKS

Error handling Code Name Meaning

01 ILLEGAL FUNCTION The function code received in the query is not an allowable action for the server. This may be because the function code is only applicable to newer devices, and was not implemented in the unit selected. It could also indicate that the server is in the wrong state to process a request of this type, for example because it is un configured and is being asked to return register values.

02 ILLEGAL DATA ADDRESS The data address received in the query is not an allowable address for the server. More specifically, the combination of reference number and transfer length is invalid. For a controller with 100 registers, the PDU addresses the first register as 0, and the last one as 99. If a request is submitted with a starting register address of 96 and a quantity of registers of 4, then this request will successfully operate (address-wise at least) on registers 96, 97, 98, 99. If a request is submitted with a starting register address of 96 and a quantity of registers of 5, then this request will fail with Exception Code 0x02 “Illegal Data Address” since it attempts to operate on registers 96, 97, 98, 99 and 100, and there is no register with address 100.

03 ILLEGAL DATA VALUE A value contained in the query data field is not an allowable value for server. This indicates a fault in the structure of the remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register.

04 SLAVE DEVICE FAILURE An unrecoverable error occurred while the server (or slave) was attempting to perform the requested action

Page 19: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

19 Security | Windows Sp z o. o.

Security

Modbus

Security is a major concern in the design of power systems, as there is no “built in” security mechanism in Modbus, special care must be taken in the design of the network to ensure network security on the link layer and physical layer.

OPC

OLE for Process Control has defined interfaces for Data Access Servers, Event Servers, and Historical Data Access Servers. These servers provide information that is valuable to the enterprise and if improperly updated, could have significant consequences to plant processes. Therefore, there is a need to control client access to these servers in order to protect this sensitive information and to guard against unauthorized modification of process parameters. Security must be provided in a standard manner, consistent among implementations of OPC Servers by various vendors, to permit the implementation of portable client applications. Security must be well integrated with Windows NT and be as transparent as possible to the client application. Ideally, security should “just be there” with no special actions by the client application required in order for security to be enforced. The purpose of this document is to specify how OPC Servers should implement security using operating system facilities. In addition, usage guidelines are provided for the OPC Client implementation to interact with a security aware OPC Server. This specification is analogous to the OPC Common specification in that it applies to all of the defined OPC Servers.

Interoperability The software solution has been tested with a range of OPC servers; OPC Foundation, Matrikon; VestasOnline OPC server.

Diagnostics There are two main sources of information regarding the operational status of the Service; the Windows system log and the log files found in the application path. Logging may be configured to show the full communication both in and out with the byte sequence and the telegram de-coding. This MUST be switched OFF for production use as this option will produce gigabytes of data on the HDD within hours.

Logging

Logging modes can be set individually to a combination of the following

Console mode

A second option is to run the service exe with the –console option and thus starting it in console mode. This will give you a view of the PDU’s processed as well as an indication of when a Master station is connecting. The –console option is not to be used for production mode or performance analysis.

Page 20: OPC to Modbus TCP To Modbus TCP.pdf · Connects a Modbus Slave PLC to Vestas online OPC server for communicating Set-point information from utility side and available power back to

20 Scheduled restart | Windows Sp z o. o.

Scheduled restart Procedure: 1. Create a Restart.bat file with the following content echo Attempting to Restart

sc stop OPCToModbus

TIMEOUT /T 10

echo Attempting to Start

sc start OPCToModbus

echo Restart script finished

2. Use the windows Scheduler to schedule a restart every day if needed. The service name in the batch file must match the service name installed.

System Requirements: PC Hardware The following minimum PC Hardware is required:

Intel® Pentium® 4 Processor

512 MB RAM

Minimum 32 MB of available hard disk space

CD-ROM driver

Super VGA (800 × 600) or higher-resolution monitor with 256 colours

Mouse pointing device The software will run on the following Windows Operating Systems

Windows XP, Windows 7, Windows 8

Windows Server 2008 and better And probably a few more