LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: modbus communicate over USB

Solved!
Go to solution

Hi David,

 

This solution sounds great. I don't know what you mean by "Windows built-in UPS support" is this something I install, activate, access from the control panel? Thanks.

 

Regards,
Andrew

 

 

 

0 Kudos
Message 1 of 5
(315 Views)
Solution
Accepted by topic author ALD1

Andrew,

 

I had to go back and review that thread; it's been a while.  Let me make sure I know what you're after - do you just want to check status on a UPS attached to a computer running a Windows OS?  If so, at least for the APC UPSes I've encountered, attaching the UPS via USB should cause Windows to add a device under the "Batteries" class in Device Manager.  If that's so, you should be able to make use of the code I'm posting here.  It's UPS-manufacturer agnostic - in fact it'll also report on a laptop's battery.  It uses some pretty ancient Windows kernel32 call to query status of a backup battery.  The rest of it is a registration for a Windows System .NET event (power system status change), with a VI callback that does the kernel32 call to fetch updated state info.  I cobbled it together to have it handled within a LabVIEW user event.  It is somewhat derivative of work done by @PhillipBrooks (this guy), so send him a virtual beer first if you find it useful.

 

But, short answer, yes, Windows has had more-or-less generic support for UPS/backup power monitoring for several releases.

 

To all: please note, NONE of this is really related to the start of the thread, which was about someone trying to use a ModBus interface to talk to a specific manufacturer's UPS.

 

Best regards,

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 2 of 5
(271 Views)

ALD1,

 

This thread was last replied to 4.5 years ago so there's not a great chance of getting a direct reply.

 

However, what he probably meant was that Windows sees a UPS as a battery, somewhat like it works with a built-in battery on a laptop.  You can see a power percentage, and configure special things to happen at certain battery levels.

 

See this:

http://dontcodetired.com/blog/post/Installing-and-Configuring-a-UPS-with-Windows-10

 

 

0 Kudos
Message 3 of 5
(268 Views)

Luckily,  there is a way to split threads that have been accidentally posted to an unrelated zombie thread.   Unfortunately,  I can't really fix the title of the "Resurrection Post."


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 5
(236 Views)

Andrew,

 

Thanks for the kudos and the accepted answer!

 

No special installation, Windows just routinely adds a battery class device when a UPS is attached via USB.  My recollection is that the APC SmartUPS device driver seems to convert that device’s name into something brand-specific (if you install their driver), but it didn’t seem necessary.

 

Having a battery-class device enumerated in the Windows Device Manager appears to be sufficient to get the battery status icon to show up in the system tray. Which (I think) means the DLL call (system32, the routine is like GetPowerStatus() but don’t quote me, look in my code), will return valid values.

 

Best of luck!

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
0 Kudos
Message 5 of 5
(118 Views)