Variables and fieldbus: Difference between revisions

From Axel Public Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 62: Line 62:
*Install the package (most part of the package is already installed by the LogicLab setup)
*Install the package (most part of the package is already installed by the LogicLab setup)
*Go into the "C:\Program Files (x86)\Axel PC Tools\Communication Library" folder
*Go into the "C:\Program Files (x86)\Axel PC Tools\Communication Library" folder
*A couple of implementation client application samples (C++ and VB .Net) are available
*A couple of implementations with source code (C++ and VB .Net) of very simple client applications are available
*The documentation of the communication libraries is available into the "Docs" folder of the installation directory
<br>[[File:WCLTest.png|300px|center]]<br>
The sample application implements the following functions:
*Communication parameters setup, either by dialog-box ("Config" button) or edit-box with communication setting string
*Object index, sub-index (where used) and data type for addressing a specific object of the PLC device
*Read and write value commands

Latest revision as of 14:34, 19 July 2018

INTRODUCTION

This article gives an overview of the relationship between the variables of a PLC application in the different fieldbus configurations either master or slave. The topics covered here mainly apply to the binary LLExec PLC runtime but can also be applied to most of the LogicLab PLC runtime portings.

FIELDBUS MASTER

When the device is configured as a fieldbus master (Modbus, CANopen, EtherCAT etc.), the basic concept relies on the mapping of PLC variables on the slave devices input and outputs datagrams.

Key points

The key points of fieldbus to PLC variables mapping onto slave fieldbus devices are the following:

  1. the fieldbus master exchanges datagrams with the slave devices
  2. the datagrams can be input datagrams (from slave to master) or output datagrams (from master to slave)
  3. input datagrams contain values that are read from specific data objects of the slave device
  4. output datagrams contain values that are written into specific data objects of the slave device
  5. the configuration of the datagrams exchanged with each slave device are defined by means of the LogicLab embedded fieldbus configurator
  6. the values in the datagrams are mapped on PLC global variables using the fieldbus configurator
  7. at run-time the values of the PLC variables are automatically updated from/written into the datagrams by the fieldbus master stack

FieldbusMapping.png

Mapping procedure

In the following description a Modbus TCP master example is used. The same concepts apply to almost all others fieldbus master configurations.
The goal of this example is to map two slave objects (ActualValue and StatusWord) onto two PLC variables using different procedures (new variable definition and existing variable mapping).

  1. enable the modbus TCP master stack on the Ethernet node
  2. add a slave node under the Modbus TCP master
  3. select the "Input" tab to configure the input datagram
  4. press the "Add" button to add a slave object to the input datagram
  5. select the desired object form the slave's object list
Map 01.png


  1. to map a new variable on the datagram: type the name of the variable into the variable field of the record and choose its data type
  2. Map 04.png

  3. to map an existing PLC variable: press the "Assign" button and choose the variable from the list that will appear
Map 03.png


A sample of PLC variables mapping is shown in the picture below:

Map 05.png


FIELDBUS SLAVE

When the device is configured as a fieldbus slave (Modbus, CANopen, etc.), the basic concept relies on the exchange of the elements defined in the object dictionary of the PLC application.

Object dictionary definition

The object dictonary is defined into the "Public objects" node of the device configuration. The object dictionary collects all the elements (Modbus registers, CANopen objects etc.) that the device make available for a connection with a fieldbus master.

Parameters.png


In the above picture an object dictionary with two elements is shown. These objects can be accessed for instance by a Modbus master as two holding registers with indexes 1000 and 1001 respectively. Public objects can be of two different types:

  • Parameters: are read/write objects whose values are also stored into permanent memory of the device. The values of parameters are loaded at boot-up.
  • Status variables: are read or read/write (depending on the setting of the "Read only" field) objects whose values are NOT stored into permanent memory.

The meaning of the fields in the "Public objects" definitions are:

  • Address: the index of the object used by the fieldbus master to address the object itself (e.g. register address for a Modbus TCP master)
  • Name: the name of the object, which corresponds to the name of the PLC variable that holds the value
  • Type: the data type of the object (using the PLC data types)
  • Size: the number of elements used with arrays
  • Default value: (only for parameters) the default value loaded at boot-up if a corresponding data value has not been stored yet
  • Min: the minimum allowed value of the object. If a fieldbus master tries to write a value below the minumum than a write error will be returned to the master (if blank noi limit is defined)
  • Max: the maximum allowed value of the object. If a fieldbus master tries to write a value over the maximum than a write error will be returned to the master (if blank noi limit is defined)
  • Read only: (only for status variables) indicates if the object can be written by a fieldbus master
  • Description: description of the object
  • Notes: additional description for the object

Master Windows application sample

Here below are the instructions in order to implement a Windows client application that connects to a "fieldbus slave enabled" PLC device/runtime:

  • Go to the Axel WEB site-download section (registration required)
  • Get the Axel WinCommLibs package from the sub-section "Other Software"
  • Install the package (most part of the package is already installed by the LogicLab setup)
  • Go into the "C:\Program Files (x86)\Axel PC Tools\Communication Library" folder
  • A couple of implementations with source code (C++ and VB .Net) of very simple client applications are available
  • The documentation of the communication libraries is available into the "Docs" folder of the installation directory


WCLTest.png


The sample application implements the following functions:

  • Communication parameters setup, either by dialog-box ("Config" button) or edit-box with communication setting string
  • Object index, sub-index (where used) and data type for addressing a specific object of the PLC device
  • Read and write value commands