LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single Shot .NET Assembly

Ok - so the title of this message is awful, but I couldn't think of a better one!

 

My problem is that I am trying to query the state of a UPS from a well know manufacturer, and have discovered a .NET dll that ships with the UPS that will let me do this.

 

I call a constructor from the dll, call the appropriate method to get the status value, then call dispose() and close reference - works great.

 

However, that is only the case if I call it running in a VI where I press the run button, allow the VI to fully execute then fully stop.

 

If I place the code in a while loop for instance, it will get the correct value the first time, but then latches so that all successive iterations return the first value regardless of the state of the UPS.

 

As a backup I am re-installing a copy of Visual Studio that I have to see if it helps if I wrap the dll in another assembly, but in the meantime, I don't suppose anyone out there has a way I can stop this from happenning? I've also tried placing the code in a vi and changing the call setup to load every time, but to no avail. I assume it's principally due to the way in which labVIEW handles .dlls by copying them am keeping them in memory, but don't know if there's any way around this.

 

Thanks in advance for any help,

 

Dave

David Clark
CLA | CTA
Genesee Technologies Ltd
Hampshire, England
0 Kudos
Message 1 of 4
(3,217 Views)

A long time ago I modified the original System Power Status VI. It registered for the .NET powermodechanged event and would generate a LabVIEW notification.

 

Just downloaded it, ran in LV2014 and tested using my laptop AC input, stil works!

 

I used the native Windows UPS driver.

 

David Boyd tried to use APCC drivers and had issues (almost 10 yeays ago now) http://forums.ni.com/t5/LabVIEW/Still-trying-to-Communicate-with-APC-Smartups/m-p/521666#M247554

 

Maybe this will help you along...

 

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

 

 

Message 2 of 4
(3,209 Views)

Hi Phillip,

 

Thanks alot for the reply - I did find that post earlier, but although it didn't error, it didn't match what the APC UPS was reporting as it's status, but having read a bit more it looks as though it may be due to me having installed powerchute whereas if I'm understanding correctly there is already a Windows driver that can interface to UPS'.

 

I'll go through the rest of the forum thread and see if I can figure out how to get it working - I am frustratingly close!

 

Thanks again,


Dave

David Clark
CLA | CTA
Genesee Technologies Ltd
Hampshire, England
0 Kudos
Message 3 of 4
(3,195 Views)

Hi Phillip (and anyone else reading this post),

 

I have have sorted out my problem of reading the status of the APC UPS - and I should really chage the title of the post as it's not really a .NET issue!

 

It turns out that PowerChute stores the status of the UPS in the registry - for my particular version at this location :-

 

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\APC\PowerChute Personal Edition\3.02.00\UPSUtilityStatus\ACPresent

 

Thanks alot once again for the help.


Dave

 

 

David Clark
CLA | CTA
Genesee Technologies Ltd
Hampshire, England
0 Kudos
Message 4 of 4
(3,094 Views)