Node-RED Nodes for the sysWORXX CTR-700

Using I/Os directly from Node-RED with the IoT Edge Controller sysWORXX CTR-700

The Edge controller sysWORXX CTR-700 supports classic programming languages such as C/C++, C#, Java and OpenPCS (according to IEC 61131-3) as well as graphical programming in Node-RED. The nodes created by SYS TEC electronic allow the inputs and outputs of the sysWORXX CTR-700 to be addressed directly from Node-RED. In addition, data exchange with OpenPCS, i.e. the IEC 61131-3 Runtime, is supported at variable level. This allows, for example, to use a dashboard created in Node-RED as a GUI for the PLC program.

In addition, all other Node-RED functionalities are available to the PLC program. For example, data from a PLC program can easily be transferred via HTTP nodes to a rest-based web interface, OPC-UA services can be used or weather data can easily be retrieved from the Internet.

What is Node-RED?

Node-RED is a graphical programming environment that uses nodes as program blocks. The program flow takes place exclusively through the processing and transmission of messages and is therefore also referred to as flow. The program flow results from the connection of the nodes by linking the output of a predecessor node with the input of a successor node.

The beginning of such a chain is always a node that generates a message based on a certain event. Such events can be, for example, the change of a digital input, the expiration of a timer or the reception of a message from an external server - such as the arrival of an MQTT message. At the end of such a chain there is always a node that triggers a certain action based on the received message. This includes setting a digital output or writing a value to a database. Any number of other nodes can be located between the start and end nodes of a flow, which process the message received at the input and forward the result to the output.

Using the I/O nodes of the sysWORXX CTR-700

The I/O-Nodes allow direct access to the interfaces of the sysWORXX CTR-700. The following Nodes and Functions are available:

toggle fullscreen

Node

Access to

ctr700_di

Digital inputs and outputs

ctr700_do

ctr700_ai

Analog inputs

ctr700_led

RUN and ERROR LEDs

ctr700_switch

State of the RUN switch of the PLC control

The following example describes in detail the basic use of the I/O nodes. The configuration process is identified by the numbering in the text and image.

Configuration of the I/O nodes

  1. One of the existing channels must be selected. In addition to the digital inputs 0 to 15, the relays 0 and
  2. are available. It must be set on which edge a signal is triggered.
  3. The activation behaviour can be adapted as required. By default, the node is High-Active.
  4. Finally, you can adjust the topic to which the node reacts.

The configuration of the node for the digital output is similar:

  1. A channel must be selected. All 16 digital outputs are available.
  2. The initial state used after program start can be adapted. By default, it is set to inactive.
  3. The activation behavior, again High-Active by default, can be adjusted.
  4. The topic to which the node reacts can be adjusted.

Program sequence:

The following figure shows the example program. There you can see how a digital input is connected to an output.

If input DO0 has a "true" value, output DI0 will also be set to "true" and the corresponding LED of the digital output will light up accordingly.

All I/O nodes are configured accordingly and are individually adaptable. Any extension of the program is also possible, such as inverting the input, interposing a logic, etc.

Access to OpenPCS variables with the IPC nodes

The IPC nodes provide access to the variables used by the OpenPCS:

  • openpcs_read
  • openpcs_write

The following example will explain how to use the nodes. Prerequisite: The program "Runlight" is executed on the sysWORXX CTR-700. The corresponding project is included by default in the installation scope of OpenPCS (SYS TEC electronic Extension), which can be downloaded from the SYS TEC electronic website.

The runlight program writes a group of variables to the digital outputs of the sysWORXX CTR-700. Three of the variables contained therein are always "high", depending on the state of the program. At regular intervals, the variable compound is "moved further" by one position. This is how the running light is created.

The Node-RED of the sysWORXX CTR-700 can now be used to retrieve a variable used in the OpenPCS program via the IPC nodes. For this the "openpcs read"-node is used and entered there according to the variable path. This consists of the program name and the function module in which the variable is used. In the following example, the name is "RUNLIGHT.BLEDGROUP0". The variable shows the constantly changing status of the chaser LEDs.

The variable is read out after each cycle. The topic can be defined arbitrarily. The picture below shows a simple flow that fulfills the described function. The debug node only serves to visualize the data flow.

An application is required at a remote station to evaluate this data. Here again Node-RED is used on a local PC - in principle, any software can be used which supports MQTT.

For the next step, an MQTT node is used which subscribes to the corresponding topic set on the sysWORXX CTR-700. A simple converter translates the chaser position into a numerical value, here 0 to 7, and transmits this to a slider node.

The slider node is part of the Node-RED package "node-red-dashboard" and can also be installed as described above.

This node behaves within defined limits like the chaser on the sysWORXX CTR-700. In the dashboard, the slider button moves one position forward with each movement of the chaser and starts from the beginning when the end is reached.

Unlimited application possibilities

Our simple example applications should clarify what the nodes for the sysWORXX CTR-700 basically enable. In a real application, the level of a liquid container or the status of a machine traffic light, for example, can be integrated instead of a running light. The visualization can be realized via a graph (available in the dashboard). The control of the inputs and outputs can also be extended as required. With Node-RED, a visualization - even of the PLC - can be generated without much effort, without having to rely on additional licenses or cloud connections. Essentially, the possibilities and freedoms for implementation are virtually unlimited.

In addition, many other freely available standard nodes can also be included. The following nodes in particular have been tested with the sysWORXX CTR-700:

toggle fullscreen

Nodes

Function

Modbus

Use of Modbus communication via sysWORXX CTR-700, for example for energy meters

OPC-UA

Base DA communication via OPC-UA - an adjustment for use with the sysWORXX CTR-700 is still made

S7

Allows reading and writing on a Siemens S7 controller

MySQL

Access to a MySQL database in a Docker container on the sysWORXX CTR-700

Installation and update of nodes

The libraries of the nodes are hosted on GitHub and can be easily installed directly from the palette manager integrated in Node-RED in case of an update or reinstallation:

  1. Open the menu at the top right of the user interface (three horizontal stripes).
  1. Select the menu item "Manage Palette" and its sub-item "Install".
  2. In the search field you can search for the node packages.

The following libraries are specially available for the sysWORXX CTR-700:

  • "node-red-contrib-ctr700-io"

Allows access to the inputs and outputs of the sysWORXX CTR-700.

  • "node-red-contrib-ctr700-ipc"

Allows the data exchange between OpenPCS and Node-RED.

Your Salesteam from SYS TEC electronic

We would be glad to help you.