What if your input isn’t quite the right scaling?

As of groov 3.2, there are a couple of gadgets that let you scale your input so you can have 50,000 gallons coming in from your tag, say, and have the gadget’s units show 0-50 tens of thousands of gallons, for example. That can work for any type of tag.

If you’re using Modbus tags, you can do linear or square root scaling on the tag itself. But what if you’re not sure how to scale? Or if you have an offset in the calculation? Math to the rescue!

Let’s start with an easy one, before I crank up the algebra…

For one power monitoring application, the Modbus device (a Liebert) provided Hz x10 for the units, but the customer wanted to just show Hz. So… here’s how I did the linear scaling on that one:

Raw Input to Scaled Result high/low:

High: 700 (hz x10) to 70 (hz)

Low: 500 (hz x 10) to 70 (hz)

Another Modbus device, a Caterpillar EMCP generator controller, included offsets for some of the scaling calculations.

In particular, for Power Factor, the Caterpillar manual gave the formula:

**PF = Input/16384 - 1 (offset is -1)**

The range is -1 to 1 for the output.

So to figure out the appropriate scaling in groov for this one, we just need to do a little algebra where we solve for the Input high/low given the output/Result high low. Easy! You remember the rule of… oh I don’t remember what it’s called. You do the same thing to both sides of the equation.

In this case we want to know the input on the high end of the range, and the low end of the range for our desired output range of -1 to 1. Staring w/the high PF of 1, we plug that in to the formula and solve for the high input:

1 = input_high/16384 - 1

[add one to both sides]

2 = input_high/16384

[multiply both sides by 16384]

**32,768 = input_high**

then we plug in the low output/Result and solve for the Input:

-1 = input_low/16384 - 1

[add one to both sides, multiply by 16384 again]

**0 = input_low**

So that’s how we got:

Input to result/output:

High: 32768 to 1

Low: 0 to -1

Make sense? Math + Modbus = fun w/scaling!!

-OptoMary