LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Still trying to Communicate with APC Smartups

I have found several threads here on the discussion forums for communicating with an APC SmartUPS, but no one has said whether they were successful or not. Has anyone had any luck with this? I have the protocol, and I wrote a small serial driver for this application, but my VISA driver does not communicate with the ups. I get zero bytes in return. I also tried using NI-MAX and Windows HyperTerminal both with no success. Any advice from the experts??
0 Kudos
Message 1 of 33
(14,524 Views)
I had a similar problem, but my APC UPS has a USB interface.

If you're running under Windows, you could use API calls to get the status of the UPS. I posted a .NET example that uses an OS callback routine and generates a LabVIEW notifier that you can use as needed. There is also a link to an original NI example that polls the UPS status. An advantage with either is that you wouldn't be locked into the APCC solution Smiley Happy.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 33
(14,509 Views)
I'm not an expert, but this is what I did for the Back-UPS (I'm sure others are similer).
 
The "Back-UPS" uses an RJ to RS232 cable, and their software watches the "RI" & "CTS" pins.
 
When the input power is removed from the UPS, the "RI" & "CTS" pins go high.
 
I monitor those pins and act on them when they go high...in my case, I run a utility (Wizmo) to make the PC shutdown gracefully.
 
I can't post a link to the code, but could email you waht I did.
 
Hope it helps.
Mike
 
 
 
  
0 Kudos
Message 3 of 33
(14,504 Views)
Thanks for the help. I did find that VI and tried to run it but, unfortunately it did not work either. The PC knows when it has been switched to battery power, but for some reason the call library function in LabVIEW does not report it. I have not figured out why yet. If anyone has something to email to me you may do so at mds24@psu.edu. I'll keep trying for now and if I have any success, I'll post it here.
 
Thanks again,
 
Mark
0 Kudos
Message 4 of 33
(14,500 Views)
Figured I'd add my 2 cents' worth to this thread...
 
I recently added an APC SmartUPS to a test position and attached it via USB.  I started with Phil Brooks approach - registering a callback VI to catch the Microsoft.win32.SystemEvents.SystemPowerChanged event., then within the callback VI I call GetSystemPowerStatus from kernel32.dll.  I then post a LV user event with the info I retrieve.  This makes it easy to manage power events from a LV event structure which could be handling lots of other activity.
 
I developed and tested my code on my laptop, which doesn't have an external UPS, but when I connected and disconnected mains power it worked quite well and reported laptop battery remaining, etc.
 
Things I found out:
 
Make sure you have the .NET Framework 2.0 installed on the target computer.  Otherwise, the .NET event registration fails.
The code worked correctly on the target system *until* I installed the APC PowerChute Business Edition Agent 7.04.  The Agent apparently disables the Windows native UPS support, after which the .NET events stop firing.  I uninstalled the PowerChute drivers and got it to work again.  In my case, I can live without the Agent, though it would've been nice for the remote monitoring and logging features.
 
I don't know if this problem is peculiar to APC - I would like to think that any vendor's UPS miniport driver would continue to support the Windows-generic SystemPowerChanged interface.
 
Best regards,
 
Dave
David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 5 of 33
(14,336 Views)
Additional information which others may find useful...
This problem (losing the power status events with PowerChute Agent installed) seems to be related to the replacement, by the APC installer, of the battery-class device driver, rather than the UPS driver and/or service.  When I first attached the APC SmartUPS (via USB), Windows added a generic "HID UPS Battery" device under the battery class.  After the PCBE Agent installation, this is replaced by a device entry for "APC Battery BackUP".  When I did the "Update Drivers" dance on this and forced it to use the Microsoft-provided "HID UPS Battery" drivers, the Power Meter functionality and the .NET event triggering came back.  So far, I haven't found any ill effects on the PowerChute Agent with this substitution, though I've only used its webserver interface to observe it.
 
Hope this helps sombody.
 
Dave
David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message