Beyond basic arithmetic for inputs

When reading holding registers containing numbers from Solaredge inverters, there is often an associated “Scale Factor” register. Over the last few days I’ve seen this number change between a specific scale factor and zero, but I would presume other scale factors could be used as well. Which is to say, the scale is not fixed. Unfortunately the scale is presented as a signed integer that represents the number of decimal places to move and I don’t see an existing way to process that.

For example:

Value: 12345
Scale: -2
Result: 123.45

Value: 6789
Scale: 3
Result: 6789000

If the scale was present similar to how Emonhub is configured, we could just multiply the two inputs, however in this case I need to take inputs A and B and multiple A with 10^B. There are input processors for basic arithmetic, but not for exponents. I can see having input processors for every mathematical operation would get exhausting.

It would be convenient to perform this calculation earlier so the right number could be sent to emoncms.org as well without relying on an optional emoncms module for the input processor.

I’m interested on opinions on how to best solve this. I could do the work.
a) exponent input processor, e.g. given n from user input, n^input
b) arithmetic input processor, i.e. take a user input with operators and evaluate it
c) emonhub scale variable support for registers, e.g.

rName = production, production_sf
register = 40084, 40085
scale = $production_sf, 1

d) something else?

d) something else

I could be completely missing something here but I presume you are pulling the data from the inverter with a python script or similar? Couldn’t you just do the scaling calc at the time of reading the registers and then send it off to emoncms.org. I do a similar thing with another brand of inverter.

1 Like

I’m pulling using Modbus over TCP directly from Emonhub.