Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

BaSyx / DataBridge PLC4X

PLC4X integration with AAS using DataBridge

The apache PLC4X can be integrated with DataBridge. Apache PLC4X allows you to communicate directly with your industrial Hardware without retrofitting it 1. For more information please refer to Apache PLC4X

Apache PLC4X

PLC4X is a set of libraries for communicating with industrial programmable logic controllers (PLCs) using a variety of protocols but with a shared API 1.

Supported Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7


Note:

  • Few of the protocols are fully supported and few are supported by simulation. For more information on this, please refer to Protocols.
  • Also, not all the features such as Read Single Address Value, Read Multiple Address Values, etc. are supported by every protocol mentioned above. For details about the features please check Features

Virtual Modbus PLC

This section will demonstrate the configuration of the Modbus PLC virtual simulator ModbusPal. If you don’t have any PLC you can configure this virtual PLC and get started with integration of PLC with the Asset Administration Shell (AAS).

Setting up the virtual Modbus

1. Download the ModbusPal software as a Jar from Source Forge

2. Execute the Jar using the below command

 java -jar ModbusPal.jar

3. When it is launched, the UI would look like this:

MainScreen.png

Here the port is set to default i.e. 502 (default Modbus port), you can change it as per your need.

4. Now, click on Add to add slaves

5. A new window would appear like below, input the Slave name and IP address of the slave (For Modbus TCP), for Modbus RTU please refer to the links as specified to the right of the window:

AddingNewSlave.png

6. Now click on the eye icon marked in below image to add new registers:

AddRegisters.png

7. Click on Add to add the holding registers, here put the number of registers you want to create (10 registers are created in below image):

AddRegistersDetails.png

8. Once it is added you can add value to it like:

AddValue.png

9. Similarly switch the tab to Coils and follow the same procedure to add coils:

AddCoils.png

10. Now click on Run to make your slave communicate:

ClickRun.png

11. As a last step, it is advisable to check the console by clicking on the Console:

HighlightConsole.png

This console shows you the log for every important event, for e.g. getting new connections from PLC4X:

Console Modbus.png


For more information on these steps, please refer to Apache PLC4X with a virtual Modbus PLC

Integration with AAS using DataBridge

As you have configured the virtual Modbus, you can easily integrate this with the AAS using the DataBridge.

IntegrationScenario.png

In PLC4X the notation for addresses is as follows Source:

AddressSyntax.png

For e.g. as in the above configuration, we have added 10 Holding registers from 1 to 10. So, the notation for this would be:

 holding-register:1 or holding-register:2 and so on

Similarly, for Coils:

 coil:1 or coil:2 and so on

You can simply integrate this virtual Modbus with AAS by specifying below attributes in DataBridge configurations:

  • Server URL
  • Server port
  • Driver
  • Service Path (If available)
  • Options (*) (If required)
  • Tags (**)

(*) : There are several options you can specify here. For more information on options please refer to Endpoint options

(**) : Tags contain the key-value pair, the key would be the name or alias you want to give to the address for making it more readable, and the value is the address itself which you want to read from the PLC.

So, based on the above configurations we did we can identify the above attributes like below:

  • Server URL -> 127.0.0.1 (The URL of the slave)
  • Server port -> 502 (The specified port)
  • Driver -> modbus-tcp (We are using modbus protocol)
  • Service Path -> None (As we haven’t configured any service path with the Server URL)
  • Options -> None
  • Tags -> name = value_1 (Arbitrary Name), value = holding-register:1


Now the last step is to specify these attributes in a configuration file plc4xconsumer.json as defined in the PLC4X Protocol, along with other protocols supported by the DataBridge.

An example scenario demonstrating this is also available on GitHub.

Back to the top