[Nut-upsdev] zero-prepended values - why oh why?

Niklas Edmundsson nikke at acc.umu.se
Tue Feb 28 12:58:00 UTC 2006


On Tue, 28 Feb 2006, Arjen de Korte wrote:

>> Given this experience, I think it would be a good thing to document
> suggested format strings in docs/new-names.txt. Something like %.1f for
> measurements. The question is how to handle stuff with only
>> integer output, do we want those to stick to integers or do we want them
> to produce similarly formatted output? I tend to prefer the latter,
> consistent output is a good thing. However, since my taste isn't the
> Universal Truth<tm> I expect a lengthy thread debating this :)
>
> You asked for it, so here we go. Where analog values (voltage, current,
> temperature) are measured, you may have a point, although I would rather
> leave this up to the driver to decide. If the UPS can't measure a value
> with decimal precision, I'd prefer not to add a decimal. On the other
> hand, if it can measure a value more precisely I don't see what value
> there is in truncating it.

I seriously doubt that there are any UPS devices that can do accurate 
voltage/current measurements with two decimals.

A Fluke 87 multimeter (which is a rather expensive one) has an 
accuracy of +/- 0.7% plus 2 digits when measuring AC voltage, +/- 1.0% 
plus 2 digits when measuring AC current.

0.7% of 120V is 0.84V, so showing a second decimal makes little sense.

As a reference, cheap multimeters usually have +/- 2% +/- 2 digits. 
This is probably more like what you'll find in a UPS.

Given this, it's probably no use to display a second decimal for the 
current either (yes, I assume that a small/cheap UPS has less exact 
measurement capability ;).

Frequency measurements are easier to get more exact, so two decimals 
there probably makes sense.

In general, the trend seems to be that expensive devices (like our 
120kW APC Silcon UPS) tend to be rather honest with the accuracy of 
the measurement capabilities and provides voltage like integers and 
frequency with one decimal. Some cheap devices however spits out 
measurements with two decimals but the minimum step seems to be 
multiple-integer... So there's a big difference in what the ups 
outputs and the actual accuracy. I find it better to be rather 
conservative.

So, to be really honest, voltage measurements should probably have no 
decimals at all ;)

> Regarding integer values, I would hate to see something like "number 
> of batteries installed 4.0" or "outputs active 2.0". So where exact 
> counts/numbers are involved, I think it is not a good idea at all to 
> add a decimal. Of course, for display purposes you can truncate or 
> add whatever decimal positions you like, but the drivers should not 
> be limited in that respect.

This is actually what triggered my investigation into this issue. The 
snmp-ups driver told me this horrid thing:
battery.packs 	: 	001.0

So yes, I agree with integers are integers. Ie, use %d or %.0f as 
format string depending on what you use for internal driver storage.

That said, I'd still prefer a rather unified output from the drivers 
so we won't have to add an additional formatting layer to unify the 
measurement display. Having suggested format strings for the variables 
might help us getting there, and hopefully we'd never have to see a 
new driver output something like "battery.packs.bad 01.000" ;)

/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke at acc.umu.se
---------------------------------------------------------------------------
  When Money talks... it says GOODBYE!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the Nut-upsdev mailing list