Hi Palaniswamy,

Welcome to the list of PLC4X,

As Lukasz very well points out, the design of the PLC4X drivers for Java
are based on SPI, so they present some details for their use in an OSGi
environment.

I work with Karaf, I do not know the container that you indicate but I will
take the time to evaluate it since it is in my line of work.

The Apache Aries SPI project supports SPI in an OSGi environment so it is a
matter of following what the manual establishes.

There are cases of dependencies and accesses between instances that tend to
be a bit cumbersome, but generally solvable.

In the development branch 0.9.0-SNAP ... I am incorporating what is
required for the libraries to work in Karaf, eventually a dependency
problem is already solved and I have the S7 Driver working.

What is my recommendation:

1. Be patient. :-)
2. Incorporate the required <SPI-consumer> * </SPI-consumer> and
<SPI-Provider> * </SPI-Provider> instructions into the POMs, this allows
Apache Aries to do its magic. For example "plc4j-transport-tcp" is a
<SPI-Provider> and the library "plc4j-spi" is <SPI-consumer>.
3. Use the appropriate libraries required by PLC4X, you must deploy them as
the case may be (I use the "features" functionality of Karaf).
4. Avoid using <Embed-Dependency>. Better to use <Private-Package>, as the
case may be.

Well as you can see, there are only a few steps for the library to work.

In [1] you can see the work that I am doing for the S7 Driver and it can
serve as a reference.

Best regards,

1. https://github.com/glcj/plc4x/tree/s7event



El mié, 9 jun 2021 a las 15:33, Palaniswamy, Lakshimi Narayanan (ETI) (<
lakshimi.palanisw...@kit.edu>) escribió:

> 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
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*

*Cel: +58 414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automat...@siemens.com
<support.aan.automat...@siemens.com>*

Reply via email to