lraynal Posted January 26, 2007 Report Share Posted January 26, 2007 Hello! I have a program developped in LabVIEW 7.1 and running on a remote computer with LabVIEW RT (but I suppose it could be the same question for a PXI, Fieldpoint controller, ...). I need to be able to stop and close my LabVIEW program, then to shut down the computer. In fact, if an electrical blackout occur, the computer is on a safe electrical system, but the program need to stop properly and shut down the computer to avoid using to much of the safety power. Thanks for your help! Laurent Quote Link to comment
Donald Posted January 26, 2007 Report Share Posted January 26, 2007 If the RT OS is a win32 compatible one, you can probably use a win32 function call. The attached VI is an example of a possible solution. There are various similar VIs available on the net. I there is a cmd interface available on this RT system you can also the System Exec.vi to start a batch-script (the command string will be "cmd.exe /c shutdown -s - t 0" or something similar depending on your needs) Download File:post-2015-1169810418.vi Quote Link to comment
Ton Plomp Posted January 26, 2007 Report Share Posted January 26, 2007 What about the 'exit LabVIEW' function? But I don't think you can shutdown the RT computer. One option might be close all references, and just finish your BD. Externally use a time-relais that after missing of digital output of the RT-system will give you 5 minutes of power and then cuts the power. Ton Quote Link to comment
Mellroth Posted January 26, 2007 Report Share Posted January 26, 2007 What about the 'exit LabVIEW' function? If you execute the "Exit LabVIEW" function in LabVIEW RT 7.1, the RT controller will reboot. To read a DI line to detect power failure, seems to be a good way to be able to clear things up, before power is cut. /J Quote Link to comment
i2dx Posted January 26, 2007 Report Share Posted January 26, 2007 If you execute the "Exit LabVIEW" function in LabVIEW RT 7.1, the RT controller will reboot.To read a DI line to detect power failure, seems to be a good way to be able to clear things up, before power is cut. /J I politely disagree: The Exit LabVIEW is NOT intended to be used on RT machines, therefore it is not included in the RT-View of the Appcontrol palette. Using the exit LabVIEW primitive on an RT machine is not recommended, because it can lead to weird behaviour. I have experienced that such VIs can restart occasionally, e.g. if you connect to the RT machine via MAX. Maybe it could reboot the machine, but thus is not intended. The LabVIEW Runtime Engine closes automatically when all VIs have stopped, so you don't need any mechanism to close the Runtime Engine explicitly. So the answer to the question could be: stop all your VIs (e.g. with occurences) if you detect the power down and exit your application "the normal way". If you don't have a normal way, it would be wise to create one Quote Link to comment
Mellroth Posted January 26, 2007 Report Share Posted January 26, 2007 I politely disagree:The Exit LabVIEW is NOT intended to be used on RT machines, therefore it is not included in the RT-View of the Appcontrol palette. Using the exit LabVIEW primitive on an RT machine is not recommended, because it can lead to weird behaviour. I have experienced that such VIs can restart occasionally, e.g. if you connect to the RT machine via MAX. Maybe it could reboot the machine, but thus is not intended. I actually don't think you disagree , since I did not mean that you should use the Exit LabVIEW primitive. I just pointed out that if you do use it (as suggested by tcplomp), the RT-target will reboot (not shut down) when called. In LabVIEW 7.1 there is no RT-view of the application palette, so you can use it on an RT target by mistake. I actually did that a while back and asked NI about it, here is the reponse: As far as 'Quit LabVIEW' goes, it is supposed to reboot the controller, becassue of the shutting down of the RT engine when LabVIEW shuts down. Regarding the last part of your comment; The LabVIEW Runtime Engine closes automatically when all VIs have stopped, so you don't need any mechanism to close the Runtime Engine explicitly. So the answer to the question could be: stop all your VIs (e.g. with occurences) if you detect the power down and exit your application "the normal way". If you don't have a normal way, it would be wise to create one I totally agree /J Quote Link to comment
i2dx Posted January 27, 2007 Report Share Posted January 27, 2007 I totally agree thx I just pointed out that if you do use it (as suggested by tcplomp), the RT-target will reboot (not shut down) when called. are you shure? I have my "knowledge", because in one of my last RT projects with LV 7.1, I had to learn, that using the exit LabVIEW primitive in the RT main VI can lead to that "weird behavoiur" (the startup.exe was restarted in parts when connecting with MAX). I did not experience, that the exit LabVIEW primitive forced a controler reboot Quote Link to comment
Mellroth Posted January 27, 2007 Report Share Posted January 27, 2007 are you shure? I have my "knowledge", because in one of my last RT projects with LV 7.1, I had to learn, that using the exit LabVIEW primitive in the RT main VI can lead to that "weird behavoiur" (the startup.exe was restarted in parts when connecting with MAX). I did not experience, that the exit LabVIEW primitive forced a controler reboot I'm quite sure (not 100% as this project was a few years back). In that project I called "Exit LabVIEW" to shut down. When the controller rebooted I contacted NI, and got the response I quoted in my previous post, i.e. that the RT-controller is supposed to reboot when this primitive is called. I'll see if I can find that old project in ClearCase on monday... /J Quote Link to comment
Mellroth Posted January 29, 2007 Report Share Posted January 29, 2007 I'm quite sure (not 100% as this project was a few years back).In that project I called "Exit LabVIEW" to shut down. When the controller rebooted I contacted NI, and got the response I quoted in my previous post, i.e. that the RT-controller is supposed to reboot when this primitive is called. I'll see if I can find that old project in ClearCase on monday... /J Now I'm 100% sure, the RT target rebooted when the "Quit LabVIEW" primitive was called (at least in LabVIEW 7.1.1). When the RT target rebooted while the FrontPanel of the RT application was displayed, I had to kill the LabVIEW-RT process in "Task manager" before I could start my RT application again (using the command line interface). /J Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.