Introduction

DMX is a standard that is widely used for controlling lighting elements in stage and building services applications. Beckhoff offers the EL6851 DMX master terminal and the EL6851-0010 DMX slave terminal for this purpose.

ESTA (Entertainment Services and Technology Association) developed sACN (Streaming Architecture for Control Networks) to enable the benefits of Ethernet to be utilised. It transfers DMX universe data via UDP/IP. The DMX data are embedded in the sACN frame as a complete universe and tunnelled through UDP/IP via a further layer. sACN is defined through ANSI standard E1.31-2009 and represents a subset of the ACN standard (ANSI standard E1.17).

Further information can be found on our website at PC-based Control for Stage- and Show Technology


Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


FB_sACNMaster

This function block sends sACN telegrams via UDP.

VAR_INPUT

bEnable           : BOOL;
sSrvNetId         : T_AmsNetId;
sLocalHost        : STRING(15);
udiLocalPort      : UDINT;
sRemoteHost       : STRING(15);
udiRemotePort     : UDINT;
sSourceName       : STRING(64);
byPriority        : BYTE;
uiUniverse        : UINT;
pData             : POINTER TO ARRAY [1..512] OF BYTE;

bEnable: The block starts processing if a positive edge is encountered at this input. A negative edge terminates processing.

sSrvNetId: String containing the network address of the TwinCAT TCP/IP Connection Server. For the local computer (default) an empty string may be specified.

sLocalHost: The local IP address (IPv4) of the UDP client/server socket as a string (e.g. '192.168.0.5'). An empty string may be specified for the default network adapter.

udiLocalPort: The local IP port number of the UDP client/server socket (e.g. 200).

sRemoteHost: The remote IP address (IPv4) of the UDP client/server socket as a string (e.g. '192.168.0.6').

udiRemotePort: The remote IP port number of the UDP client/server socket (e.g. 5586).

sSourceName: Sender of sACN telegram.

byPriority: Priority of the sACN telegram (0 to 200).

uiUniverse: DMX universe for which the data are intended (1 to 63999).

pData: Pointer to a structure with the data to be sent.

VAR_OUTPUT

bBusy              : BOOL;
bError             : BOOL;
udiErrorId         : UDINT;

bBusy: Is set, if a valid sACN telegram is sent.

bError: Is set, if an error occurs during execution of the function block. The error code is contained in udiErrorId.

udiErrorId: Contains the error code of the last executed step. See Error codes.


FB_sACNSlave

This function block receives sACN telegrams via UDP.

VAR_INPUT

bEnable           : BOOL;
bJoinMCG          : BOOL;
sSrvNetId         : T_AmsNetId;
sLocalHost        : STRING(15);
udiLocalPort      : UDINT;
sMulticastGroup   : STRING(15);

bEnable: The function block starts processing if a positive edge is encountered at this input. A negative edge terminates processing.

bJoinMCG: If set, then it is tried to join the multicast group specified in sMulticastGroup. The function block must be restarted.

sSrvNetId: String containing the network address of the TwinCAT TCP/IP Connection Server. For the local computer (default) an empty string may be specified.

sLocalHost: The local IP address (IPv4) of the UDP client/server socket as a string (e.g. '192.168.0.6'). An empty string may be specified for the default network adapter.

udiLocalPort: The local IP port number of the UDP client/server socket (e.g. 5586).

sMulticastGroup: Multicast group to be joined.

VAR_OUTPUT

bBusy              : BOOL;
bError             : BOOL;
udiErrorId         : UDINT;
udiInvFrames       : UDINT;
pData              : POINTER TO ARRAY [1..638] OF BYTE;

bBusy: After activation of the block the output is set and remains active until the block is deactivated or switches to error state.

bError: Is set, if an error occurs during execution of the function block. The error code is contained in udiErrorId.

udiErrorId: Contains the error code of the last executed step. See Error codes.

udiInvFrames: Number of invalid received sACN telegrams.

pData: If validation of the received sACN telegram was successful it is available at this output.


FB_sACNUniverseDecode

This function block extracts the user data from an sACN telegram.

VAR_INPUT

uiUniverse        : UINT;
pData             : POINTER TO ARRAY [1..638] OF BYTE;

uiUniverse: DMX universe to which the function block is supposed to respond.

pData: Pointer to a structure containing an sACN telegram.

VAR_OUTPUT

sSourceName       : STRING(64);

sSourceName: Sender of sACN telegram.

VAR_IN_OUT

arrPropertyValues : ARRAY [1..512] OF BYTE;

arrPropertyValues: Structure to which the extracted user data are to be transferred.


FB_sACNObserver

This function block closes all UDP ports that were opened by the local TwinCAT PLC runtime system.

VAR_INPUT

bEnable           : BOOL;
bErrFlag          : BOOL;

bEnable: The block starts processing if a positive edge is encountered at this input. A negative edge terminates processing.

bErrFlag: A positive edge results in setting of output bEnFlag to FALSE and closing of all UDP ports of the local TwinCAT PLC runtime system. If no error occurred, bEnFlag is set to TRUE.

VAR_OUTPUT

bBusy             : BOOL;
bError            : BOOL;
udiErrorId        : UDINT;
tNextRetry        : TIME;
bEnFlag           : BOOL;

bBusy: Is set as long as the function block tries to close all UDP ports of the local TwinCAT PLC runtime system.

bError: Is set, if an error occurs during execution of the function block. The error code is contained in udiErrorId.

udiErrorId: Contains the error code of the last executed step. See Error codes.

tNextRetry: If closing of the UDP ports fails, the time remaining until the next attempt is displayed here.

bEnFlag: Is set until a positive edge is detected at bErrFlag.


Error Codes

Value (hex) | Value (dec) | Description
0x0000 | 0 | No error.
0x8001 | 32769 | The specified UDP port could not be opened.
0x8002 | 32770 | Ports opened by the TwinCAT PLC runtime system could not be closed.
0x8003 | 32771 | Invalid socket for receiving UDP telegrams.
0x8004 | 32772 | Invalid socket for sending UDP telegrams.
0x8005 | 32773 | Unable to join the Multicast Group.


Examples

Beckhoff Knowledge Base: sACN

sACN master and slave unicast

The example contains two PLC programs and a Lightjams project file (www.lightjams.com). The example supports general sending and receiving of sACN frames. The individual function blocks of the example are explained in the Programming section.

Thanks to several network interfaces the sACN slave is able to respond to several UDP telegrams and therefore several sACN masters. The sACN masters are represented through a further PLC program and a Lightjams project.

The TwinCAT supplement TwinCAT TCP/IP Server is required for the example.

Based on this example, the user data of the sACN frame can be linked with any PLC variables. Links enabled by the modular Beckhoff control system include

  • sACN to DMX (EL6851 and EL6851-0010)
  • sACN to dimmer (KL2761 and KL2751)
  • sACN to DALI (KL6811)
  • sACN to stepper or DC motor
  • sACN to digital IOs (e.g. 24 V or 230 V)
  • sACN to analog IOs (e.g. 0-10 V or 4-20 mA)
  • etc.

Download

TcKB_sACN_Sample01


Examples

Beckhoff Knowledge Base: sACN

sACN master and slave multicast

This example contains a PLC program with a Target Visualization and an MA Lighting RPU showfile (Beckhoff_pl&s.show.gz). It supports sending and receiving of sACN frames via multicast groups from a Beckhoff PLC to an MA Lighting RPU.
The basic principle of the setup: Both devices (MA RPU and Beckhoff Controller) have an own IP address (it does not have to be the same IP class). To “connect” the devices, the TCP/IP Multicast function is used. Multicast groups use class D networks (224.0.0.0 to 239.255.255.255) per definition. In Multicast groups the slaves join to a group (FB_SocketUdpAddMulticastAddress); the master sends the data to all connected slaves by sending a telegram to the multicast group network address.

In this sample we use two logical connections:
Beckhoff to MA RPU (in orange) and MA RPU to Beckhoff (in blue)

The full set up of the sample looks like the following:

On the left side you see the Beckhoff Controller with PLC and Target Visu (including two buttons and a bar graph). On the right side you see the MA Lighting RPU with display. When the attached showfile is loaded to the device, you see two execute buttons on the display.

1. The communication from Beckhoff to MA RPU is shown in orange. The Beckhoff Controller is the master that sends to the Multicast address 239.255.0.1. The MA RPU joins this group (this is done automatically in the showfile). The Beckhoff Controller uses sACN frames with the Universe ID 2 and two channels of user data. The user data is used to change the value of the execute buttons at the MA RPU. The sequence of the necessary bits is generated in the PLC program by the Function Block FB_selector. The buttons of the Target Visu are used to control these sequences. The result: By changing the value from the buttons of the Target Visu on the Beckhoff Controller, the value of the execute buttons at the MA RPU is changed (a remote control of the MA RPU is possible).

2. The communication from MA RPU to Beckhoff is shown in blue. The MA RPU is the master that sends to the address 239.255.0.1. The Beckhoff Controller joins this group as a multicast slave. The MA RPU uses sACN frames with the Universe ID 1 and twelve channels of user data. The user data is used to run two different lighting scenarios. These sequences (scenarios) of data are generated by the MA RPU. The result: A change of the value from the execute buttons results in different output values for the sACN frames send by the MA RPU. The sACN values are displayed at the Target Visu in a bar graph.

A final test can be done by changing the value of the buttons in the Target Visu. The result should be changing data sequences in the bar graph of the Target Visu.

Comment: Both directions use the same multicast group! The differentiation from which communication partner the frame is coming is done by the sACN Universe ID.

The individual function blocks of the example are explained in the programming section. The individual function blocks of the supplement TwinCAT TCP/IP Server are explained here:
http://infosys.beckhoff.com/content/1031/tcpipserver/html/tcplclibtcpip_fb_socketconnect.htm?id=28704

The TwinCAT supplement TwinCAT TCP/IP Server in Verison Version 1.0.64 (or higher) is required for this example. An MA Lighting RPU Hardware Unit is required. Basic knowledge in Network Technology (Multicast groups) is required.

Download

TcKB_sACN_Sample02