Re: [MODBUS][DISCUSS] Improving handling of datatypes ...

2020-09-06 Thread Christofer Dutz
Hi all,

well I doubt that we could really centrally handle this. 
If you have an idea how to unify this, I'd be happy for a suggestion.
I guess most will have to be handled in the individual drivers themselves.

But I really would like all drivers to support the same base-set of datatypes.

Chris

 

Am 06.09.20, 17:02 schrieb "Cesar Garcia" :

Hello,

I think it can be applied from several points of view, the one typified as
you indicate (HREGISTER: REAL) or (HREGISTER [2]), each one has its
advantage.

To be able to handle the types indifferently (specifically between Modbus
and S7), I modify the field of the Modbus driver so that it strictly adapts
to the PLC4X API. This prevents the user's App from having to implement
code to interpret the content of the records.

This is implemented in version 0.6.1 of  PLC4X, but the new version is
something else.

Best regards,

El dom., 6 sept. 2020 a las 10:03, Ben Hutcheson ()
escribió:

> Hi,
>
> I ran into this issue this morning when using the hello-world-write 
example
> and trying to write to a Modbus connection. It looks like it assumed the
> input value is a string whereas the Modbus protocol doesn't have support
> for it yet.
>
> I was thinking about expanding
>
> 
github/plc4x/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/DefaultPlcFieldHandler.java
> to include default handlers for the various IEEE 61131 data types, the
> specific protocols can then override them as necessary?
>
> Kind Regards
>
> Ben
>
> On Wed, Sep 2, 2020 at 9:36 AM Christofer Dutz 
> wrote:
>
> > Hi Julian,
> >
> > I agree ... if one driver would define an "INT" as 32bit integer and the
> > others would treat it as 16bit ... that could be a problem.
> > Perhaps having a statement of the project that we use the IEC 61131 
types
> > as a basis and if you want to use a given protocols different types, 
that
> > you can prefix them ..
> >
> > Assuming a driver for the famous "HURZ" protocol would use 32bit INTs,
> > then an "INT" could reference the 16bit version and a "HURZ_INT" could 
be
> > the 32bit version?
> >
> > Chris
> >
> >
> >
> >
> > Am 02.09.20, 15:26 schrieb "Julian Feinauer" <
> > j.feina...@pragmaticminds.de>:
> >
> > Hi,
> >
> > agree with your suggestion!
> > Although we have to be careful to not mix it up with specific
> > implementations of datatypes in some drivers.
> >
> > Julian
> >
> > Am 02.09.20, 15:21 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> >
> > Hi all,
> >
> > today I was at a customer’s site and used the Modbus driver to
> get
> > data. This generally worked fine.
> > The thing however I found a little complicated, was that the PLC
> > seemed to offer all values as 32Bit Floating point values.
> > So in order to correctly read them, I had to read an array of 
two
> > consecutive shorts and then manually convert them into a float.
> >
> > I bet we can do this better.
> >
> > So I thought … how about we use the same
> > https://en.wikipedia.org/wiki/IEC_61131-3 datatypes we are already using
> > in other drivers and for example if you write:
> >
> > holding-register:1:REAL
> >
> > it would automatically use modbus to read an array of two shorts
> > and to internally convert these to one REAL/float.
> >
> > What do you think? I think we could probably do this in most
> > drivers.
> >
> > Chris
> >
> >
> >
> >
> >
>


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



Re: [MODBUS][DISCUSS] Improving handling of datatypes ...

2020-09-06 Thread Cesar Garcia
Hello,

I think it can be applied from several points of view, the one typified as
you indicate (HREGISTER: REAL) or (HREGISTER [2]), each one has its
advantage.

To be able to handle the types indifferently (specifically between Modbus
and S7), I modify the field of the Modbus driver so that it strictly adapts
to the PLC4X API. This prevents the user's App from having to implement
code to interpret the content of the records.

This is implemented in version 0.6.1 of  PLC4X, but the new version is
something else.

Best regards,

El dom., 6 sept. 2020 a las 10:03, Ben Hutcheson ()
escribió:

> Hi,
>
> I ran into this issue this morning when using the hello-world-write example
> and trying to write to a Modbus connection. It looks like it assumed the
> input value is a string whereas the Modbus protocol doesn't have support
> for it yet.
>
> I was thinking about expanding
>
> github/plc4x/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/DefaultPlcFieldHandler.java
> to include default handlers for the various IEEE 61131 data types, the
> specific protocols can then override them as necessary?
>
> Kind Regards
>
> Ben
>
> On Wed, Sep 2, 2020 at 9:36 AM Christofer Dutz 
> wrote:
>
> > Hi Julian,
> >
> > I agree ... if one driver would define an "INT" as 32bit integer and the
> > others would treat it as 16bit ... that could be a problem.
> > Perhaps having a statement of the project that we use the IEC 61131 types
> > as a basis and if you want to use a given protocols different types, that
> > you can prefix them ..
> >
> > Assuming a driver for the famous "HURZ" protocol would use 32bit INTs,
> > then an "INT" could reference the 16bit version and a "HURZ_INT" could be
> > the 32bit version?
> >
> > Chris
> >
> >
> >
> >
> > Am 02.09.20, 15:26 schrieb "Julian Feinauer" <
> > j.feina...@pragmaticminds.de>:
> >
> > Hi,
> >
> > agree with your suggestion!
> > Although we have to be careful to not mix it up with specific
> > implementations of datatypes in some drivers.
> >
> > Julian
> >
> > Am 02.09.20, 15:21 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> >
> > Hi all,
> >
> > today I was at a customer’s site and used the Modbus driver to
> get
> > data. This generally worked fine.
> > The thing however I found a little complicated, was that the PLC
> > seemed to offer all values as 32Bit Floating point values.
> > So in order to correctly read them, I had to read an array of two
> > consecutive shorts and then manually convert them into a float.
> >
> > I bet we can do this better.
> >
> > So I thought … how about we use the same
> > https://en.wikipedia.org/wiki/IEC_61131-3 datatypes we are already using
> > in other drivers and for example if you write:
> >
> > holding-register:1:REAL
> >
> > it would automatically use modbus to read an array of two shorts
> > and to internally convert these to one REAL/float.
> >
> > What do you think? I think we could probably do this in most
> > drivers.
> >
> > Chris
> >
> >
> >
> >
> >
>


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


Re: [MODBUS][DISCUSS] Improving handling of datatypes ...

2020-09-06 Thread Ben Hutcheson
Hi,

I ran into this issue this morning when using the hello-world-write example
and trying to write to a Modbus connection. It looks like it assumed the
input value is a string whereas the Modbus protocol doesn't have support
for it yet.

I was thinking about expanding
github/plc4x/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/DefaultPlcFieldHandler.java
to include default handlers for the various IEEE 61131 data types, the
specific protocols can then override them as necessary?

Kind Regards

Ben

On Wed, Sep 2, 2020 at 9:36 AM Christofer Dutz 
wrote:

> Hi Julian,
>
> I agree ... if one driver would define an "INT" as 32bit integer and the
> others would treat it as 16bit ... that could be a problem.
> Perhaps having a statement of the project that we use the IEC 61131 types
> as a basis and if you want to use a given protocols different types, that
> you can prefix them ..
>
> Assuming a driver for the famous "HURZ" protocol would use 32bit INTs,
> then an "INT" could reference the 16bit version and a "HURZ_INT" could be
> the 32bit version?
>
> Chris
>
>
>
>
> Am 02.09.20, 15:26 schrieb "Julian Feinauer" <
> j.feina...@pragmaticminds.de>:
>
> Hi,
>
> agree with your suggestion!
> Although we have to be careful to not mix it up with specific
> implementations of datatypes in some drivers.
>
> Julian
>
> Am 02.09.20, 15:21 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
>
> Hi all,
>
> today I was at a customer’s site and used the Modbus driver to get
> data. This generally worked fine.
> The thing however I found a little complicated, was that the PLC
> seemed to offer all values as 32Bit Floating point values.
> So in order to correctly read them, I had to read an array of two
> consecutive shorts and then manually convert them into a float.
>
> I bet we can do this better.
>
> So I thought … how about we use the same
> https://en.wikipedia.org/wiki/IEC_61131-3 datatypes we are already using
> in other drivers and for example if you write:
>
> holding-register:1:REAL
>
> it would automatically use modbus to read an array of two shorts
> and to internally convert these to one REAL/float.
>
> What do you think? I think we could probably do this in most
> drivers.
>
> Chris
>
>
>
>
>