LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get PC power supply status

I have a test application which needs to run continously for several months. To allow this I plan to add a UPS which allows to overcome power failures for up to about 10 minutes. Typically the UPS show up as battery in windows, so there should be a way to monitor the battery status. How to do this in LabVIEW?

Two principal ideas:

  1. The minimum information I would need is to know the PC/Notebook is running on AC or on battery, so I can start my own timer to shut down the test after some time, e.g. 5 or 10 Minutes depending on the age of the UPS battery.
  2. If setting a proper warning level it might also be fine just to get the warning event windows will generate if the time left gets below the level set in the power properties in Windows.
  3. Much better would be to know the estimated time the battery will be able to run the system, which is known to windows.

Notes:

  1. It might not be enough time to do a proper shut down of the test running waiting for the 'Application close' event (I expect this will arrive shortly before the application is killed by the shutdown process).
  2. As the external test hardware is driven from the UPS waiting for the power getting critical on the PC will fail using a notebook, as this event will be thrown some time after the UPS switched off when the internal battery status gets critical as well. So in principal it would be the best to directly monitor the UPS status which should show up as 2nd battery on notebooks. Removing the notebooks internal battery might help, but with several new notebooks (e.g. ultrabooks) this is no longer possible.
  3. We also won't like to start a shut down immediately after an AC failure, as most of the AC failures should be short enough to keep the test running using the UPS.
  4. I'm not interrested in solutions directly communicating with the UPS. This part of another approach I am already investigating. As such the question above will also help on systems using internal battery only e.g. with USB based DAQ / USB powered hardware (no external power supply for test hardware).

Any Ideas?  Thanks in advance!

0 Kudos
Message 1 of 8
(4,951 Views)
0 Kudos
Message 2 of 8
(4,941 Views)

Hi r_exler,

 

did you even look for "check battery status" here in the forum?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(4,940 Views)

Thanks to both, this is at least a good thing to start with.

 

This will work fine on desktop PC's but it still does not solve the need to know when the external UPS will be drained on notebooks. But maybe I find some extension to this interface to monitor a specific battery (the UPS will most likely show up as battery #2 - I will be able to test this later this day if it arrived).

0 Kudos
Message 4 of 8
(4,933 Views)

Why dont you run your PC on UPS only then see the behaviour of VI?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 8
(4,929 Views)

As already mentioned in my first post the user might not want to remove the notebook's battery or won't be able to do so at all (e.g. my Toshiba ultrabook has a built in battery which can't be removed).

 

While this ultrabook is a great thing even for development use (1.2 kg of weight, i7 processor, 256 GByte SSD and up to 8 hours running on battery if you do not need the processing power provided, e.g. surfing on the web) the posted solution would completely disable use of up to date notebooks like this with the software.

0 Kudos
Message 6 of 8
(4,921 Views)

I am not asking you to remove battery of your laptop as this is worst way to test your code. We are not intersted in your laptop configuration. What I mean to say is first understand the working of systempower.vi and modify accordingly . In all cases it is accessing dll file and providing information.

 

Nice laptop configuration. Smiley Wink 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 8
(4,917 Views)

Bad news trying this VI on my (older) Win7 notebook.

  1. First of all it does not recognise if main power fails switching to the UPS system (even with the UPS monitoring software installed).
  2. It also does not recognise the notebooks battery being charged or not.
  3. The time remaining display changes randomly between about 400 and 2500 even running on the notebooks internal battery and the UPS monitoring cable disconnected.

Of course I don't know which part of the misfunction is caused by Windows and/or the UPS monitoring software installed.

I've now tried to contact APS, hopefully one of the DLL's they installed with their monitoring software will allow to read the estimated time status left and input AC directly.

I will also try to get more information on the installed batteries using the functions in the powrprof.dll as used in the example below. It looks like providing access to the batteries installed, so if the UPS shows up as second battery or AC adapter it might work (have to check this in device manager).

https://decibel.ni.com/content/docs/DOC-19540

 

 

0 Kudos
Message 8 of 8
(4,884 Views)