On Mar 18, 2014, at 10:37 AM, Rob Groner wrote:

> Things are going along well, but there is one remaining area of 
> confusion….”units”.  I understand exponents now…it’s basically how you pass 
> decimal values.  That’s easy enough.
>  
> But “units”….in other words, I have a voltage I want to put in a report.  If 
> I include in the report descriptor the fact that it is actually a voltage, 
> with units of “volts”, then I’m suddenly also inheriting an exponent of 7?  
> So to represent 120 volts, I’d actually have to send the value 1200000000, so 
> that on the NUT side it would apply a -7 exponent to get it to come out as 
> 120?
>  
> I know I could add a -7 exponent to “counteract” the units exponent, but I’m 
> trying to understand WHY it’s like this, based on the table in 3.2.3 of the 
> PDC HID doc.  Why did they think that volts needs an exponent of 7 in them? 

Sorry for the delay in getting back to you.

I think most UPSes add that -7 exponent in the descriptor - I'd have to check. 
I think it's one of those weird SI base units things, where some of the units 
will be absurdly large unless they have an exponent.

Also, which PDC HID document are you looking at? I see a "Table 1" in 
pdcv10.pdf.

The first column is the unit that they expect to be measured, with the second 
column being the "standard" unit. The exponent column assumes you are using the 
units from the first column.
 
> I also noticed that current (amps) is listed as centiAmp, with a -2 unit 
> exponent in the HID doc….however, the table in libhid.c which contains 
> HIDUnits does not include anything for amps, just voltage and power. 
 
I think that means that if you are measuring the UPS current in centiAmps, you 
would apply an exponent of -2 to scale to amps. It's a question of how many 
digits you want to the right of the decimal point.

To that end, we don't do a good job of indicating how many significant figures 
are in a measurement. (On the other hand, Arjen, one of the usbhid-ups 
developers, always used to say "an UPS is not a measurement device", so...)

> I’m wondering if there is even any real value in specifying units, because it 
> seems like more of an obstacle to easy value understanding than anything 
> else.  Any why does the NUT library use the 7 exponent for voltages, but not 
> the -2 for amps?
 
I think the main motivation is to eliminate extra math operations from the UPS 
side. If you are computing values in a microcontroller anyway, I agree, it just 
adds confusion.

-- 
Charles Lepple
clepple@gmail




_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to