Scaling Modbus Tag Data in Groov

Did everything you suggested including setting up two gadgets. Keep in mind that I’m using a third-party Modbus device, not an Opto22 one. Secondly the holding registers are only 16-bit, not 32. In any case, when comparing the two registers (which now read 122. This is a live device) the scaled one reads 12, the unscaled one 12.

At this point I’m ready to concede defeat because it’s not working. This is a deal killer for the app we’re considering using Groov for, because if we can’t do simple scaling like this, we won’t be able to present data in the form necessary for our app.

Bother. Would you be up for sharing your Modbus tag configuration? There’s an “Export” button in the Modbus tag editor that will let you download a CSV file containing all the configured tags. Mine looks like this right now:

Raw Integer,32-bit Unsigned Integer,402048,Read/Write
Scaled Float,32-bit Unsigned Integer,402048,Read/Write,"Linear,Float,0,300,0,30,false"

The first column is the tag name, followed by data type, register address (the leading 4 means Holding Register), whether to allow gadgets that will write to it, and the scaler configuration.

Secondly the holding registers are only 16-bit, not 32.

Yeah, we support reading/writing multiple registers at once to store values larger than Modbus’ register size. I just grabbed 32-bit at random for the above test.

Sure. Here it is:

Z-Axis Peak Freq,16-bit Unsigned Integer,400059,Read/Write,Linear,Float,0,300,0,30,false
Control,16-bit Unsigned Integer,400059,Read/Write


One more thing. These values are displayed in a Text Area gadget in Groov. Could that be an issue? It was the only way I could get a value in Groov Build without a tag label associated with it.

Aha! The Text Area might explain it: what does your formatting string look like? A single # will truncate to an integer, while #.# will give you one digit after the decimal point. Add more # for as many decimal points as you like.

Oh, and you should be able to get rid of the label on any gadget by just deleting the default string that’s there.

The #.# works like a champ!

Thanks for all your help. Simple fix for what was going to be a big problem for me. :relaxed:


I followed all of this and got my own scaling working mostly. My value from the modbus device is in absolute pressure and I need to scale it to gauge pressure (subtract 14.7) The complete scale formula would be ((x/10)-14.7) How would I do that? I tried to simply subtract it in the scale area, but that doesn’t work.

I figured out the correct scaling, but it drops my decimal during input… Also, if I am not paying attention, the tag editor wants to re-assign and save this as a float value.

You may want to try putting the Raw Low to 0 and the Limit Low to -14.7 if you need to be able to read vacuum.

If I do that, it reads correctly, but the input is not correct ie. if I enter “30.5” the compressor updates to “29.5”. It is displayed correctly, but the output doesn’t match the input.

Video of behavior

I can’t think of a reason why it would do that. Looks like a bug to me.

The scaling doesn’t appear to effect the value limits. When I leave it as I originally had it, I can go into negative and the compressor displays inHg (inches of mercury, ie. vacuum). The kicker is that anything right of the decimal gets truncated.

If however, I set it as you suggested, wackiness ensues, but the decimals seem to work.

Will it accept 0.0 as the low limit - wondering if that will affect the decimal? (I haven’t used scaling in groov before)

No. I try and it sets it to “0” Also, it keeps trying to force the data type to ‘Float’.

Send an email to support if you can and see if they can figure out what is going on as this doesn’t seem to be working as it should.

The forcing looks like a bug: I can reproduce it here, and it doesn’t look like it happens if you’re using a read-only tag.

Two quick things to look at:

  1. When you were ending up with 29.5 written after entering 30.5, was your high limit still at 185.3?
  2. If you look at your logs, can you find the line where it reports what you’re writing to that tag? It’ll look something like this:

2018-02-20, 15:32:05 GMT-08:00 INFO groov.Audit - User 'jfischer' wrote value 'true' to tag 'bool Variable A' on 'DATA_SIMULATOR'.


2018-02-20, 16:31:19 GMT-08:00 INFO groov.Audit - User ‘NICKV’ wrote value ‘32’ to tag ‘Comp1 Mode1 Setpoint’ on ‘Compressor 1 ( (id 1)/MODBUS)’.
2018-02-20, 16:31:14 GMT-08:00 INFO groov.Audit - User ‘NICKV’ wrote value ‘29.2’ to tag ‘Comp1 Mode1 Setpoint’ on ‘Compressor 1 ( (id 1)/MODBUS)’.
2018-02-20, 16:31:07 GMT-08:00 INFO groov.Audit - User ‘NICKV’ wrote value ‘33.5’ to tag ‘Comp1 Mode1 Setpoint’ on ‘Compressor 1 ( (id 1)/MODBUS)’.
2018-02-20, 16:30:36 GMT-08:00 INFO groov.Audit - User ‘NICKV’ wrote value ‘32.5’ to tag ‘Comp1 Mode1 Setpoint’ on ‘Compressor 1 ( (id 1)/MODBUS)’.

Has this been addressed at all? It seems to be an issue with the read/write tags. I can set read only tags and they are fine, but when I try to set a R/W tag exactly the same it is all kinds of crazy.

I’m in the midst of addressing it now, along with a bunch of general cleanup on all the drivers. Next feature release is currently due around September.