NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
mdstitt
Posts: 29
0 Kudos

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??
Active Participant
PhillipBrooks
Posts: 1,105

Re: Still trying to Communicate with APC Smartups

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 :smileyhappy:.


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

Member
wd8ivl
Posts: 166
0 Kudos

Re: Still trying to Communicate with APC Smartups

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
 
 
 
  
Member
mdstitt
Posts: 29
0 Kudos

Re: Still trying to Communicate with APC Smartups

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
Member
DavidBoyd
Posts: 162

Re: Still trying to Communicate with APC Smartups

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
Philips Respironics
Certified LabVIEW Developer
Member
DavidBoyd
Posts: 162

Re: Still trying to Communicate with APC Smartups

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
Philips Respironics
Certified LabVIEW Developer
Active Participant
PhillipBrooks
Posts: 1,105
0 Kudos

Re: Still trying to Communicate with APC Smartups

[ Edited ]
I only use the basic Windows UPS functionality with my stations. I specifically DO NOT install PowerChute because it becomes one more thing to configure, document and support. My stations are also "off-network" so the remote monitoring has never really come up. W/R/T to needing .NET 2.0, I did list it in the "other requirements:", but I guess its not as prominent as it should be :smileysad:

Thanks for sharing your experience. Its good to know that its possible to make this all work together when necessary. I've placed a link from the example back to this thread...


Message Edited by Phillip Brooks on 05-17-2007 07:05 AM


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

Member
DavidBoyd
Posts: 162
0 Kudos

Re: Still trying to Communicate with APC Smartups

Phil,

My point about the requirement for .NET 2.0 was my own "doh!" moment; I did see it in your original code posting as a requirement, and I did have it installed on my development machine.  I built a quick test app to run on the target computer, which had XP SP2 but was (initially) missing .NET 2.0.

Why APC's installer chooses to disable the generic Windows functionality is a mystery to me.  I'm fully in agreement with you that the user app should get its info from the OS, and not be dependent on a hardware manufacturer.  But after restoring the MS driver, everything works, including APC's stuff.

The APC PowerChute s/w seems to work OK for me so far.  It was pretty straightforward to install its components.  The remote console can manage multiple UPSes, and allows you to determine battery health, state of charge, percent of rated load, etc., plus gives you 24 hours' graph of incoming line voltage.  I'm fairly impressed by its functionality.  Of course, if your UPS-protected system is off-network, none of this info is available.

Thanks for posting the code which shows how to register for the .NET event.  I don't know about others' experiences, but I find the hierarchy of available methods/properties/events exposed by the OS through .NET to be difficult to browse.  I know how to set up the nodes, etc., but how do I quickly find what I need?  It's hit-or-miss for me when I go looking for solutions through MSDN.  Though I suppose I used to feel that way when I first started to use CLNs with the Win32 API.

Dave

David Boyd
Sr. Test Engineer
Philips Respironics
Certified LabVIEW Developer
Active Participant
Tim C.
Posts: 231
0 Kudos

Re: Still trying to Communicate with APC Smartups

I have setup communications via the SNMP toolkit. 
 
Best Regards
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
Member
fahrer
Posts: 2
0 Kudos

Re: Still trying to Communicate with APC Smartups

David,

many thanks for your support! It is precious, that you share your experience with the community and even your code!

Your VIs are working here on my system (XP with APC Back-UPS RS) like you said, when using the generic MS "HID UPS battery" driver.

I'd like just to comment for other users, who are not so familiar with all this (like me), that usage of the current APC software together with the VIs can cause problems. After some try&error, it turned out, that the quickstart-application for the APC-UPS replaces the driver by its own version **at each startup**. So just switching the driver once in the hardware manager is not sufficient. After the next re-login or reboot, you will remark, that the APC driver is back.
To avoid this, you must kickout the quickstart application from the Startup-Folder. You will have to live with this little restriction to use both in parallel.

Hope, this hint is useful to anyone,
Manuel
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page