Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: upd(4): add more sensors (load, power..)
To:
Landry Breuil <landry@openbsd.org>
Cc:
Walter Alejandro Iglesias <wai@roquesor.com>, tech@openbsd.org
Date:
Thu, 21 Nov 2024 17:28:52 +0000

Download raw body.

Thread
On 2024/11/21 18:02, Landry Breuil wrote:
> Le Tue, Nov 19, 2024 at 10:51:00AM +0000, Stuart Henderson a écrit :
> > On 2024/11/19 10:19, Walter Alejandro Iglesias wrote:
> > > On Sat, Nov 16, 2024 at 12:30:47PM +0100, Landry Breuil wrote:
> > > > so if you have an upd(4) somewhere and you have sensors, i'll be glad to
> > > > know if:
> > > > - you get more sensors and they make sense
> > > > - you get values that make more sense than before
> > > > - you had a value for RunTimeToEmpty that made sense and now doesn't
> > > >   (same for AtRateTimeToEmpty/AtRateTimeToFull if you have them)
> > > > - it now breaks/detaches/reattaches
> > > > 
> > > 
> > > With your patch RunTimeToEmpty now tells the true.
> > > 
> > > I guess PercentLoad is ok.
> 
> Thanks for the report, that seems to confirm that all EATON UPSs need
> the same treatment.
> 
> > > Regarding VoltageDc and ConfigApparentPower I don't know what they mean.
> > 
> > VoltageDc is the voltage at the battery (could either be DC charger
> > voltage or battery voltage I suppose). Unless your batteries are on
> > several rows of shelves, that's not reported correctly. ($work 40kVA
> > UPS has several rows of shelves and DC voltage is 270V so 828V would
> > be a huge one :-)
> > 
> > Apparent power is related to the current drawn (whereas "true" power
> > depends on power factor). It should be somewhere in the region of W
> > drawn but not exactly the same.
> > 
> > The unit for apparent power should be VA, not W.
> 
> Oh.. that explains why the strange values. Would it make sense then to
> convert (and how) those VA to W for "end-user values" ?

You need further information to convert between VA and W (i.e. the
power factor of the equipment connected). They're kind-of comparable
units - but as mentioned in 4.1.2 in pdcv10.pdf, "apparent power"
"units are Volt-Amps" and active power "units are Watts".

It doesn't make sense to do that kind of calculation in the driver -
just report what's coming from the power device.

If it's a sensor reporting real / active / RMS power (not that RMS...
root mean square :-) then W, if it's apparent power then VA.
(The difference is particularly important when you're trying to figure
out if the device is overloaded - they usually have a VA maximum which
is the limiting factor, even if the things plugged into it use fewer W).

> > I'm not sure if "ConfigApparentPower" would be actual use or the max
> > allowed by the UPS; "Config" suggests possibly the latter.
> 
> After rereading the spec and a bit of the nut code, it seems to me that
> ConfigApparentPower correspond to the max allowed by the UPS. I don't
> think it really makes sense to report a constant in sensors, so i'd be
> tempted to leave that one out.

I don't mind either way really. Might occasionally be useful but then
it can usually be looked up based on the device name.

> I managed to configure nut to talk to my UPS and it reports sensible
> values (eg ones that match the LCD values):
> ups.load: 16
> ups.power: 98
> ups.power.nominal: 650
> ups.realpower: 63
> battery.runtime: 2050
> 
> i'll have to digest the laaarge output produced by usbhid-ups -DDDDD to
> understand what is read from which usb register/reportid, and how those
> are converted to the end-user values.

:)

> my idea would be to:
> - enable the PercentLoad sensor

Fine with me.

> - fix RunTimeToEmpty for EATON models

I'd be interested to see how RunTimeToEmpty looks with some other
vendors. I think so far we've had results from Cyberpower and Eaton
which isn't enough to tell which is the unusual one :)