[Nut-upsdev] Some questions on driver implementation and variable

Peter Selinger selinger at mathstat.dal.ca
Sun Feb 25 22:34:25 CET 2007


Arjen de Korte wrote:
> 
> Peter Selinger wrote:
> 
> > how do you propose that a client should compute the battery runtime?
> > That seems device specific to me. -- Peter 
> 
> Based on the same variables that the UPS is using? If this calculation
> is based on any presumption (ie, a value hard coded in the driver), we
> probably need to export that presumption, rather than trying to do the
> calculation in the driver.

Edgar had written:
> 
> I assume battery.runtime shold give the estimated runtime under  
> current load. I also have nominal on-battery runtime for 100% and 50%  
> load. Any names for those?

I think this is a judgment call. The options are: (1) don't provide
any information that is not directly provided by the device, (2) do
the calculation in the driver, (3) do the calculation in a client. 

In Edgar's case, the UPS exports nominal on-battery runtimes for 100%
and 50%, and one can reasonably use this to extrapolate an estimated
battery runtime from load and charge information. This calculation is
device-specific (I don't know any other device that exports these
parameters in this form). I agree with Carlos that device-specific
information belongs in the single driver that deals with this device,
and not in the (possible many) clients that don't know anything about
specific devices. So think (3) makes no sense in this situation;
whether one should choose (1) or (2) is arguable.

On the other hand, some calculation that can be done in a
device-independent way (like converting Celsius to Fahrenheit) seems
more of a candidate for (3). 

-- Peter




More information about the Nut-upsdev mailing list