Alex Rydzewski
2023-Jan-13 10:09 UTC
[Nut-upsuser] battery.voltage Powercom Macan MRT-3000
Hello! I left this line uncommented in powercom-hid.c for battery voltage: { "battery.voltage", 0, 0, "UPS.Battery.Voltage", NULL, "%.2f", 0, NULL }, and got some data different from the input voltage values The Powercom support staff gave the following response to my question: Dear Alex, First of all , thank you for purchasing PCM MRT-3000 ups. Regarding of your question, see our reply in below ==> Please take your data with below rules : ? DEX : 5378 ? HEX : 1502 (Low : 15 / High : 02) ? Battery one cell voltage : [High + (Low/100)] : 2.21 ? Battery voltage : 2.21 * 6 * 6 = 79.56 Vol (1 package with 6 cells / MRT has 6 packages) Best regards Sandy Chang, Powercom Taiwan HQ -----Original Message----- From: Alex Rydzewski [mailto:arydzewski at elyland.net] Sent: Thursday, January 12, 2023 5:47 PM To:pcm.eu at upspowercom.com Subject: MRT-3000 USB battery.voltage Hello! I have the MRT-3000 UPS and try to get real battery voltage through USB. USB protocol reference has specify for battery.voltage: report id | Usage | Usage Name | Data Access | Length 26 0X8430 Battery Voltage R/O 3 Byte But I get for this position the next data: 0.544555 [D4] Entering libusb_get_report 0.549533 [D3] Report[get]: (3 bytes) => 1a 02 15 0.549550 [D5] PhyMax = 0, PhyMin = 0, LogMax = 9216, LogMin = 2304 0.549561 [D5] Unit = 00000000, UnitExp = 0 0.549569 [D5] Exponent = 0 0.549576 [D5] hid_lookup_path: 00840004 -> UPS 0.549583 [D5] hid_lookup_path: 00840012 -> Battery 0.549591 [D5] hid_lookup_path: 00840030 -> Voltage 0.549603 [D1] Path: UPS.Battery.Voltage, Type: Feature, ReportID: 0x1a, Offset: 0, Size: 16, Value: 5378 Suggest me, please, how I can interpret the battery.voltage value "5378? How I can get real battery.voltage data? Perhaps it is possible implement this algorithm to "nut" project for a UPS like this? On 10.01.23 19:14, Jim Klimov wrote:> I suppose that should have read "correct battery.voltage" ;) > > Not sure really - this is the standard endpoint for that info, so > firmware is broken for USB HID power device support. > > If you start the driver with higher debug verbosity, it prints the > reports from USB. If you can decipher those (online tools exist but I > don't have a link handy), maybe some other field (possibly with an > untranslated hex name) conveys data that looks like what you need. > > Jim > > On Tue, Jan 10, 2023, 18:09 Alex Rydzewski <arydzewski at elyland.net> wrote: > > Thank You for your attention, Jim! > I compiled and ran the 2.8.0 version with this part uncomment > ?*??? { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, > "%.2f", 0, NULL }, > ?*??? { "battery.voltage", 0, 0, "UPS.Battery.Voltage", NULL, > "%.2f", 0, NULL }, > ?*??? { "battery.voltage.nominal", 0, 0, > "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, > NULL }, > ?*??? { "battery.voltage.nominal", 0, 0, > "UPS.Battery.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, > from powercom-hid.c, and it is so, it is duplicates for > output.voltage. > > Is there anything I can do to find the correct output.voltage? > > On 10.01.23 14:12, Jim Klimov wrote: >> Hello, >> >> ? One thing that pops out in your report is that NUT 2.7.2 is >> used, which is pretty old now. If you have a chance to install >> 2.8.0 or newer (custom build of current git master) to confirm if >> the problem is still there, it could be helpful. >> >> ? Other than that, current source says at >> https://github.com/networkupstools/nut/blob/1deab1638322e9e64a0cf3200dadc93dbe3a3f41/drivers/powercom-hid.c#L362-L368 >> that "battery.voltage" is served in USB reports, but is not >> useful (same as output voltage). Nearby, "battery.runtime" and >> "battery.mfr.date" do come from USB reports, but per >> https://github.com/networkupstools/nut/issues/1644 the latter was >> previously wrongly reported as "battery.date" (for replacement). >> Note that generally fixes are based on user reports about devices >> which misbehaved; if a vendor has multiple devices with different >> behaviors (including bug fixes in newer firmwares) it can get >> messy and need some more elaborate fixes :-\ >> >> ? Something in your question does ring a bell - please revise >> https://github.com/networkupstools/nut/issues?q=label%3APowercom >> <https://github.com/networkupstools/nut/issues?q=+label%3APowercom> >> and/or https://github.com/networkupstools/nut/issues?q=powercom >> to see if that was discussed earlier in more detail. >> >> Hope this helps, >> Jim Klimov >> >> >> On Tue, Jan 10, 2023 at 11:42 AM Alex Rydzewski >> <arydzewski at elyland.net> wrote: >> >> Hello! >> >> I have not been able to get the battery.voltage data from the >> Powercom >> Macan MRT-3000, although there is data in the log that does >> not match >> the value I see on the device's display. Please tell me how I >> can >> control this. And please tell me, if possible, how to get the >> absolute >> value of the load on this device. >> Debug log is attached >> >> ~ # upsc 004-0D9F-000 >> Init SSL without certificate database >> battery.charge: 100 >> battery.charge.low: 10 >> battery.charge.warning: 30 >> battery.date: 2014/01/15???????????? I'm not sure that it is >> right >> battery.runtime: 800??????????????????? Is this data from the >> device or >> from the driver? >> battery.type: PbAc >> battery.voltage.high: 81.60 >> battery.voltage.low: 63.60 >> battery.voltage.nominal: 75.60 >> device.mfr: POWERCOM Co.,LTD >> device.model: HID UPS Battery >> device.serial: 004-0D9F-000 >> device.type: ups >> driver.name <http://driver.name>: usbhid-ups >> driver.version: 2.7.2 >> driver.version.data: PowerCOM HID 0.4 >> driver.version.internal: 0.38 >> ... >> >> -- >> ? ?????????? ???????????, ????????? ??????????? |With best >> regards, Mr. Alexander Rydzewski,? ? |? ?????????? >> ???????????, ????????? ?????????? >> ????????? ?? ????????? ???????, Elyland ltd. |System and >> Network Engineer at Elyland ltd. |????????? ? ??????? >> ???????, Elyland ltd. >> > -- > ? ?????????? ???????????, ????????? ??????????? |With best regards, Mr. Alexander Rydzewski, |? ?????????? ???????????, ????????? ?????????? > ????????? ?? ????????? ???????, Elyland ltd. |System and Network Engineer at Elyland ltd. |????????? ? ??????? ???????, Elyland ltd. >-- ? ?????????? ???????????, ????????? ??????????? |With best regards, Mr. Alexander Rydzewski, |? ?????????? ???????????, ????????? ?????????? ????????? ?? ????????? ???????, Elyland ltd. |System and Network Engineer at Elyland ltd. |????????? ? ??????? ???????, Elyland ltd. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20230113/898fa250/attachment.htm>
That makes sense to me. The field needs to be split into bytes. The low byte is the integer part of voltags, and the high part is units of 10 mV. And this is per cell. Probably the unit is measuring the total and then dividing by 36. But volts per cell will have the same interpretation for varying cell counts, so it's a nice representation.