LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

automatic start of a VI

Hi, all.  I've just run into something I'd never thought of before.  I have a LabVIEW-based test station that monitors temperature, speed, and current on twenty small motors, on a 24-7 basis.  The PC running my test croaked, and I replaced it yesterday.  After having installed the software and verifying that data was being taken and recorded, I walked away from it overnight.  This morning I noticed that the last time stamp on the data file was around 11:15 yesterday morning.  (This system should be writing to the file once an hour.)
 
When I went over to the PC to check on it, it was in the Windows logon state.  Once I logged on, a yellow box popped up in the lower right-hand corner telling me that Windows had been updated and the update required a restart.  That's all fine, but upon restart my VI (naturally) did not restart.  Had I not been in the mode of "let's check on the newly-installed machine," it could have been weeks before we noticed that the system was not recording data.
 
My question is this: is there a way to have a VI start as soon as power is applied to a PC?  I'm not particularly well-versed in the habits of Windows, but I think even making the VI into an executable would require a user to log on before it could run.  Am I right?  Or is there a better solution? 
 
This tidbit may or may not add some complexity: this PC is on a corporate network.
 
Thank you in advance for your help.
 
-Dan
0 Kudos
Message 1 of 7
(3,231 Views)

Have a look at this:

http://support.microsoft.com/?kbid=314488

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 2 of 7
(3,216 Views)

Thank you for the Microsoft link.  As I read over the article, it appears that either method requires a user to log in before the program will run.  Am I correct?

The reason I have to ask is that this test station is left unattended for long periods of time.  Having the test program execute as soon as power is restored (or the PC is automatically rebooted, in yesterday's case), without human intervention, is my goal. 

More help?  Thank you.

-Dan

0 Kudos
Message 3 of 7
(3,202 Views)
I would also highly suggest to turn off automatic installation of updates for computers used in this way. 😉


@Arrington wrote:
.... it could have been weeks before we noticed that the system was not recording data.

OK, here's a bigger problem. There are many other cases where it could stop recording data that have nothing to do with an automatic restart. What if only LabVIEW crashes and the PC keeps running? What is somebody trips over the power cord, accidentally disconnecting it for good? What is the fuse blows? What if the power suppy gives out?
 
If it is important that this machine is always recording data, you might want to e.g. implement a watchdog timer (within your LabVIEW code!) that registers at regular intervals with a monitoring program that runs elsewhere (e.g. via UDP). The supervisor program would then raise an alarm if it has not heard from the PC in X amount of time.
0 Kudos
Message 4 of 7
(3,208 Views)
C:\Documents and Settings\<user>\Start Menu\Programs\Startup\<shortcut to application>
Above, shows an example of where the startup directory is but it will slightly vary for any specific computer (in red). On a PC, you need to place a shortcut (to the application) in the Startup directory.  This will instruct the PC to run any program you want... at startup.
0 Kudos
Message 5 of 7
(3,198 Views)
You need to run your program as a service. Here's a better article:
 
Message 6 of 7
(3,194 Views)

The NT Service looks like a winner.  I'll try to get together with our IT guru and discuss it.

Turning off auto-updating has been suggested.  This machine is on the corporate network, so that might get a little fuzzy, but I have discussed it with our IT guru.  And yes, there are other cases in which data logging could stop.  We will still have to maintain some diligence over checking the station's physical components periodically (to make sure the cords are connected and the PC is still at least running, etc.).  The next thing I have to figure out is the bit about having the UPS restart the machine following a "blackout" shutdown. 
 
Another topic we have discussed (albeit briefly) is the possibility of having a LabView watchdog send a message to a cascading list of emails or cell phone numbers when something goes foul (extreme temperature, for instance).  When Labview is recording, having the ability to notify someone that something is wrong is surely a good thing.  I haven't done it before, and again the corporate network may muddle things a bit, but it's certainly a topic for future. 
 
Thanks to all for the help,
 
-Dan
0 Kudos
Message 7 of 7
(3,178 Views)