Hello Community,
I am currently working with an OSGi framework based Open-Source Energy
Management System OpenEMS (https://openems.io/). As a part of the development
we wanted to integrate a Beckhoff PLC, which offers a ADS bridge-Modbus TCP
Protocol for communication. Although I found a DLL offered by Beckhoff
(https://infosys.beckhoff.com/index.php?content=../content/1031/tcadscommon/html/note.htm&id=),
it did not fit perfectly for the case of OpenEMS due to its OSGi Framework.
Thankfully I found the PLC4x adaptor. It really solves half the problem for me.
I would also like to mention I am quiet new to OSGi as well as JAVA to begin
with and am trying to figure things out on the go.
Now to my question. I wanted to use the PLC4j/ADS drivers and functionalities
in my code. I started with the basic setup mentioned in the "JAVA Getting
Started" page of the PLC4x. When I used the following code:
PLCDriverManager().getConnection("ads:tcp://xxx.xx.x.xx:502") to establish the
connection. I get an error saying "Unable to find driver for protocol 'ads'".
It was weird because if had added all (I hope so) the dependencies required as
follows:
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-api</artifactId>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-driver-ads</artifactId>
<version>0.8.0</version>
<scope>runtime</scope>
</dependency>
Later I found out that, for OSGi framework, the Drivers are required to be
activated
(https://github.com/apache/plc4x/blob/develop/plc4j/osgi/src/main/java/org/apache/plc4x/java/osgi/DriverActivator.java
), so that it creates a bundle. But now I am really not sure how this is done.
Could someone please help me out with this. If there are any tutorials or
examples for such a case, please share it.
As I said before, we intend in integrating a Beckhoff PLC running TwinCAT ADS,
into a JAVA OSGi based framework, which would be communicating with each other
over Modbus TCP protocol.
Viele Grüße
Laksh