Table of Contents

FieldbusBridge

Namespace
ZApplication

The fieldbus bridge offers an interface to control several ethercat master instances, which are instantiated in the application. It is possible to communicate through publish and subscribe structures from external applications (i.e. HMI) or other PLCs. In a Zeugwerk Application communication structures are instantiated in ZGlobal.com, in general these structure should be instantiated in a location that is accessible by external application.

This object is often needed for diagnosing ethercat-fieldbus issues like crc errors or faulty ethercat slaves.

FUNCTION_BLOCK FieldbusBridge

Constructor

FB_init

In order to let the fieldbus bridge function correctly, it is neccessary to call its cyclic method somewhere in the application For Zeugwerk Framework application this is done by an object manager which gets initialized by providing its instance here with the parent input

METHOD FB_init (
 bInitRetains : BOOL,
 bInCopyCode : BOOL,
 parent : ZCore.IManagedObject) : BOOL

Inputs

bInitRetains BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

parent IManagedObject

Interface to a valid parent, which usually forwards this instance to an ObjectManager

Returns

BOOL

Properties

LoadBalancer

Returns the load balancer of this bridge, which in turn can be used to adjust how the bridge updates its componeents

PROPERTY LoadBalancer : ILoadBalancer

Property Value

ILoadBalancer

Methods

AddEthercatMaster

This method adds an ethercat master instance and its communication structures for publish and subscribe to the fieldbus bridge. The publish and subscribe structures have to be accessible for other applications, PLCs or also protocols like OPC-UA. In a Zeugwerk Application communication structures are generally instantiated in ZGlobal.com.

METHOD AddEthercatMaster (
 ethercatMasterRef : REFERENCE TO ZEquipment.EthercatMaster,
 publishRef : REFERENCE TO EthercatMasterComPublish,
 subscribeRef : REFERENCE TO EthercatMasterComSubscribe)

Inputs

ethercatMasterRef REFERENCE TO EthercatMaster

Instance of an ethercat master instantiated in the plc

publishRef REFERENCE TO EthercatMasterComPublish

ethercat master publish structure instantiated in the plc (usually separated from the actual application code like Global.com)

subscribeRef REFERENCE TO EthercatMasterComSubscribe

ethercat master subscribe structure instantiated in the plc (usually separated from the actual application code like Global.com)

SetLogger

Setting a logger instance allows this instance to log commands that it ultimately forwards to an ethercat master. Leaving this function block without a logger instance (logger=0) disables logging for this object.

METHOD SetLogger (
 logger : ZCore.ILogger)

Inputs

logger ILogger

interface to a logger instance

SetSynchronizationPeriod

This method can be used to adjust how often the ethercat master should refresh the statistical data, which is provided in its communication publish struct. This method can be used to distribute load, if there are a lot of ethercat master instances configured. The index of the first ethercat master that has been added to the bridge with AddEthercatMaster is 0.

To change the synchronization period of all ethercat masters, use SetSynchronizationPeriodAll.

METHOD SetSynchronizationPeriod (
 ethercatMasterIndex : INT,
 timeout : LREAL)

Inputs

ethercatMasterIndex INT

selected ethercat master. Valid from 0 to (MaxEthercatMasterCount)[xref:ZApplication.ParameterList#MaxEthercatMasterCount]

timeout LREAL

period between data refreshs

SetSynchronizationPeriodAll

This method can be used to adjust how often the ethercat masters that have been added to this bridge, should refresh their statistical data. The later is provided in its communication publish struct. This method can be used to distribute load, if there are a lot of ethercat master instances configured.

To change the synchronization period of a distinct ethercat masters, use SetSynchronizationPeriod

METHOD SetSynchronizationPeriodAll (
 timeout : LREAL)

Inputs

timeout LREAL

period between data refreshs