For floats, I have only seen IEEE format. But can't rule out other. On Thu, Jul 16, 2020, 14:57 Christofer Dutz <christofer.d...@c-ware.de> wrote:
> Guess it should be possible for plc4x to interpret INT as two shorts long > as four... In that case it could probably also handle half precision floats > (16 bit), full floats and double, if the encoding is somewhat standard > (which I assume it's not) > > Chris > ________________________________ > Von: Niclas Hedhman <nic...@hedhman.org> > Gesendet: Donnerstag, 16. Juli 2020 08:33 > An: dev@plc4x.apache.org <dev@plc4x.apache.org> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register > addresses have an offset of 1 (Not reading the correct address) > > To make things worse, there is equipment on the market with both 32-bit > numbers as well IEEE floats. > > And many clients are incapable of doing something meaningful with those... > > > And then there is equipment that uses one register to indicate the > magnitude of one or more other registers, say 1="divide by 1", 2="divide by > 10"... > > > > Niclas > > On Thu, Jul 16, 2020, 14:28 Christofer Dutz <christofer.d...@c-ware.de> > wrote: > > > Hi Ben and Otto, > > > > First off all, thank you Ben for that very detailed explanation. It does > > seem as if we should extend the parser to support the different numeric > > variants. I don't see any problems in supporting both the hex-like one as > > well as the pure numeric one. > > > > I think we have 6 separate memory areas. Do you have a mapping, That I > > could use? I mean which first digit represents which memory area? > > > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts > > (registers)... Haven't seen a somewhat standard way to encode anything > else. > > > > Chris > > ________________________________ > > Von: Otto Fowler <ottobackwa...@gmail.com> > > Gesendet: Donnerstag, 16. Juli 2020 06:41 > > An: dev@plc4x.apache.org <dev@plc4x.apache.org> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register > > addresses have an offset of 1 (Not reading the correct address) > > > > Don’t forget embedded protocols are possible, > > different devices format floats differently > > some devices don’t want persistent connections > > etc etc > > > > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) > wrote: > > > > Hi, > > > > Answering some of the questions:- > > *I guess what would be interesting, would be what address is going over > the > > wire for "30001" for example.* > > The address that gets sent over the wire is the address starting from 0 > i.e > > 300001 would be address 0. I didn't know that. > > > > *Also as a register is always a 16 bit value, the increments by two sort > of > > puzzle me.* > > The Modbus registers are numbered 300001 thru to 365536 (or whatever the > > highest is for the device), they are 16 bit registers they don't > increment > > by 2. If you were mapping 32-bit data types to the registers then of > course > > you would increment by two but I don't know of any other situation or > > device that increments the addresses by 2. > > > > > > *Looooong time ago, back when the Modbus came to life it was simply a > > memory area* > > I do vaguely remember working on a device that didn't differentiate > between > > the memory areas and would just use the address when reading and writing, > > the leading digit would just specify data type. 000001 would be a bit in > > 400001. > > > > > > *so would you suggest we leave things the way they are or should we > change > > something?* > > I would, it is the most commonly used. I think I have also seen the > format > > 0x00001, 4x00001 being used but is less common. > > > > *I guess we might think about adding different address parser flavors in > > the future. So we could use the current one per default, but we could > add a > > Schneider Field parser that helps convert %MW1 to our > > holding-register:4000001 ... or whatever the scematics are.* > > You would want to be careful doing this because a lot of the times the > > mapping between Modbus Registers and the internal addresses is > > configurable. Newer Schnieder PLCs I think have an option to start the > > numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping > > table so you can select the data table the Modbus addresses get mapped > to. > > > > Some other things that might not have come up, > > There is also an extended memory (Leading digit 6) area on some devices. > > Schneider Quantum controllers I know use this. > > > > There are a lot of devices that support Modbus, but the quality of some > of > > the implementations can be very poor. I wouldn't be relying on some of > the > > non-essential fields (Transaction Ids, Lengths) as they can sometimes not > > be populated. > > > > I also wouldn't assume that every device supports all the function codes. > > Some devices (Honeywell C200/C300) allow you to select which function > codes > > you want to use for each device to try and work around this. > > > > For Modbus TCP, some servers won't allow more than a certain number of > > connections at any one time. Sometimes this number is 1. It can be very > > annoying to troubleshoot. > > > > Kind Regards > > > > Ben > > > > > > > > > > > > On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman <nic...@hedhman.org> > wrote: > > > > > Let me try again; There is no 3xxxx addresses in the products. It is a > > > notation written with text, by people. the first written digit convey > the > > > type. That's it. > > > > > > Looooong time ago, back when the Modbus came to life it was simply a > > memory > > > area that one could read and possibly write. And then documentation > > > specified what was in each bit/byte/word. And with such approach, it is > > > probably possible to implement Modbus in less than 100 bytes of very > > > expensive (E)PROM back then. Not until later was there address validity > > > checks and what not. > > > > > > FTR; It is completely beyond me how Modbus became as popular as it has, > > and > > > that this happened decades after it was introduced on the market. When > I > > > was part of a startup and we were developing a serial protocol in > > > 1984/1985, we knew of Modbus and thought it was a really poor protocol > > > (couldn't even do floating point numbers). I don't like it, but just > > about > > > every electric thing can be purchased with Modbus option... > > > > > > Cheers > > > Niclas > > > > > > On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz < > > christofer.d...@c-ware.de > > > > > > > wrote: > > > > > > > Hi Niclas, > > > > > > > > Protocol-wise the numbers could be up to 65535 as they use an > unsigned > > 16 > > > > bit integer as an address. > > > > > > > > I guess what would be interesting, would be what address is going > over > > > the > > > > wire for "30001" for example. > > > > Also as a register is always a 16 bit value, the increments by two > sort > > > of > > > > puzzle me. > > > > > > > > I think Modbus is an extremely simple protocol but we need to get a > > > > feeling for it's usages. > > > > > > > > It does seem as if the industry tends to wrap some aspects in > software > > > > bubble-wrap ... we gotta find out what's below. > > > > > > > > Chris > > > > > > > > > > > > Am 15.07.20, 15:23 schrieb "Niclas Hedhman" <nic...@hedhman.org>: > > > > > > > > It is a common format in equipment documentation. I am currently > > > > working > > > > with an electric meter. See screenshot from its manual; > > > > > > > > > > > > > > https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk > > > > > > > > At protocol level, there are no such "high numbers", just that the > > > > industry > > > > got used to write "4" instead "holding register". It is a "people > > > > thing", > > > > not a technical one. > > > > > > > > HTH > > > > Niclas > > > > > > > > On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz < > > > > christofer.d...@c-ware.de> > > > > wrote: > > > > > > > > > Hmmm ... > > > > > > > > > > Regarding: 10012 being a coil and 4xxxx a register. > > > > > > > > > > Well the coils and registers are completely different things ... > > > > They are > > > > > accessed via completely different requests. > > > > > That might be some sort of convenience convention, but I wouldn't > > > > call > > > > > that a standard (I've actually never seen it before) > > > > > Would you then just subtract 40000 from every register or would you > > > > just > > > > > configure registers starting with numbers 40000? > > > > > > > > > > What do the others think? The address format does reference > > > > registers ... > > > > > should we be doing the translation? > > > > > > > > > > I guess that the general use-case would be that someone has a look > > > > at his > > > > > Modbus config and says that he wants "Register X" > > > > > and not "The Register Y references" (which seems to be one less) > > > ... > > > > I > > > > > might even swing my vote in favor to using register numbers instead > > > > of > > > > > addresses. > > > > > > > > > > But then I ask myself: How can I address register 0 in ModbusPal > > > ... > > > > that > > > > > would require an address that's impossible to send. > > > > > > > > > > Chris > > > > > > > > > > > > > > > Am 15.07.20, 11:51 schrieb "Niclas Hedhman" <nic...@hedhman.org>: > > > > > > > > > > Personall, I prefer that Register Numbers are used in APIs and > > > > that the > > > > > address is only seen if you analyze the over-the-wire format, > > > > but maybe > > > > > that is just me. A big reason for this is that any interface > > > > presented > > > > > to > > > > > an operator would need to use RegNumbers, as most (possibly > > > all) > > > > > documentation of equipment has RegNumbers and some are lacking > > > > the > > > > > addresses. It is also common that the register type is part of > > > > the > > > > > Register > > > > > Number, such as 10012, where the first 1 indicates "coil" > > > > (IIRC). and > > > > > holding registers are in 4xxxx. Ideally(!), this is also > > > handled > > > > by the > > > > > register/address parser. > > > > > > > > > > Niclas > > > > > > > > > > On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz < > > > > > christofer.d...@c-ware.de> > > > > > wrote: > > > > > > > > > > > Hmm .. so are we doing it correctly? > > > > > > > > > > > > I mean Wireshark isn't the ideal reference here as I have > > > > several > > > > > valid > > > > > > packets in the KNX space, where WireShark just says "corrupt > > > > > package". > > > > > > > > > > > > So if you enter an "holding-register:42" address it tries to > > > > read the > > > > > > register number 43 in ModbusPAL. > > > > > > > > > > > > I guess as we are reading an "address" we are correct and > > > > probably as > > > > > > ModusPAL says register number, that might be correct too? > > > > > > > > > > > > Chris > > > > > > > > > > > > > > > > > > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" < > > > > nic...@hedhman.org>: > > > > > > > > > > > > The issue with 1-offset is that the "Register Number" > > > > found in > > > > > > documentation is at an "Address" one position less. So > > > Reg > > > > 41 has > > > > > > Address > > > > > > 40. Som libraries expect Register Numbers and some expect > > > > > Register > > > > > > Address. > > > > > > And every so often, one mixes that up. > > > > > > > > > > > > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz < > > > > > > christofer.d...@c-ware.de> > > > > > > wrote: > > > > > > > > > > > > > .... > > > > > > > > > > > > > > While looking for more Infos I found out I once wrote a > > > > > tutorial > > > > > > page for > > > > > > > PLC4X __ > > > > > > > > > > > > > > > > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html > > > > > > > > > > > > > > I so totally hate searching the web and getting my > > > > answers > > > > > answered > > > > > > by > > > > > > > myself. > > > > > > > > > > > > > > Chris > > > > > > > > > > > > > > Am 15.07.20, 08:31 schrieb "Christofer Dutz" < > > > > > > christofer.d...@c-ware.de>: > > > > > > > > > > > > > > Hi Niclas, > > > > > > > > > > > > > > when preparing a workshop for the Building IoT we > > > > were > > > > > looking > > > > > > for > > > > > > > something where you could simulate a Modbus Slave. > > > > > > > Most of these were Windows only solutions, so > > > > ModbusPAL > > > > > was one > > > > > > of the > > > > > > > very few solutions that were pure-java. > > > > > > > > > > > > > > Don't quite understand what the thing with the > > > > offset is > > > > > however > > > > > > ... > > > > > > > should be easy to fix ... I mean if I say address 42 in > > > > PLC4X, > > > > > > Wireshark > > > > > > > says 42, but in Modbus Pal I think it has to be 43 ... > > > > don't > > > > > quite > > > > > > get it. > > > > > > > > > > > > > > Chris > > > > > > > > > > > > > > > > > > > > > > > > > > > > Am 15.07.20, 03:54 schrieb "Niclas Hedhman" < > > > > > nic...@hedhman.org > > > > > > >: > > > > > > > > > > > > > > What is ModbusPAL? > > > > > > > > > > > > > > The 1-offset in Modbus has caused a lot of > > > > confusion > > > > > over the > > > > > > > years. > > > > > > > > > > > > > > On Tue, Jul 14, 2020 at 11:03 PM Christofer > > > Dutz > > > > < > > > > > > > christofer.d...@c-ware.de> > > > > > > > wrote: > > > > > > > > > > > > > > > Sorry for the noise ... > > > > > > > > > > > > > > > > this was a false positive ... the driver was > > > > doing > > > > > things > > > > > > > correctly. > > > > > > > > It seems the ModbusPAL was just off by one > > > ;-) > > > > > > > > > > > > > > > > Chris > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Am 14.07.20, 15:51 schrieb "Christofer Dutz > > > > (Jira)" < > > > > > > > j...@apache.org>: > > > > > > > > > > > > > > > > Christofer Dutz created PLC4X-214: > > > > > > > > ------------------------------------- > > > > > > > > > > > > > > > > Summary: [Modbus] Holding > > > > register > > > > > > addresses > > > > > > > have an > > > > > > > > offset of 1 (Not reading the correct address) > > > > > > > > Key: PLC4X-214 > > > > > > > > URL: > > > > > > > https://issues.apache.org/jira/browse/PLC4X-214 > > > > > > > > Project: Apache PLC4X > > > > > > > > Issue Type: Bug > > > > > > > > Components: Driver-Modbus > > > > > > > > Affects Versions: 0.7.0 > > > > > > > > Reporter: Christofer Dutz > > > > > > > > Assignee: Christofer Dutz > > > > > > > > Fix For: 0.8.0 > > > > > > > > > > > > > > > > > > > > > > > > If I set holding the following holding > > > > registers > > > > > to: > > > > > > > > > > > > > > > > 1000: 41 > > > > > > > > 1001: 42 > > > > > > > > 1002: 43 > > > > > > > > > > > > > > > > And then read: holding-register:1001 ... > > > I > > > > get > > > > > the > > > > > > value 43 > > > > > > > returned. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > This message was sent by Atlassian Jira > > > > > > > > (v8.3.4#803005) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >