LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a paralell loop

I have a LV VI that uses a GPIB bus to talk to several pieces of equipment to apply and read voltages from a device under test.  I want to add an emergency stop button that when pressed will turn off all voltage supplies (assuming the bus is not hung up) and kill LabVIEW if a hazardous condition occurs.  My plan is to have a parallel event structure outside the main VI state machine react to the switch being pressed.  The problem is, shutting off the voltage sources takes time and every once and a while the main loop turns the supply back on after the emergecy case turned it off.  Does anyone have an idea how I can stop the loop and still complete the emergency event?

0 Kudos
Message 1 of 14
(4,084 Views)

troubleshoot your vi by highlight execution ,use probes,breakpoints and retain wire values,ect.,....post your VI, so we can have a look at it

0 Kudos
Message 2 of 14
(4,080 Views)

Personally, I'd wire my E-Stop with hardware rather than software.  You can still read the switch status in software, but opening hazardous circuits should be done with hardware.

 

Because like you mentioned, the bus could be hung up and the signal wouldn't get through... or the computer crashes, or timing prevents the circuits from opening fast enough to stop damage from occuring...

 

...but that's just me. :dunno

Message 3 of 14
(4,076 Views)

@pd110 wrote:

 

...kill LabVIEW if a hazardous condition occurs....

 



this is not a very good idea...it will probably leave the equipment in the same hazardeous condition. LabVIEW will properly shutting down the equipment as you programmed it to do, that being said...you probably incorrectly programmed the VI to do so. Also, think about cutting your power from the breaker box? are you properly handling errors as they occur?

0 Kudos
Message 4 of 14
(4,064 Views)

Snowmule is right.  In a situation such as you have described the emergnecy stop should be done in hardware with the software monitoring the stop switch.  Once the switch has been pressed, the software should go to a safe state (if it is running) and the hardware should stay locked out until both the software and hardware have been reset.

 

Lynn

Message 5 of 14
(4,060 Views)

Thanks to everyone who has responded so far.  I would have rather done this with hardware as well.  Unfortunately, I inherted about a hundred test fixtures, all without an e-stop.  It isn't really feasable right now to retrofit this all.  Besides, our test bays all have a master power switch.  I was hoping to give the operator another power down option though.  Also, if the e-stop is on the FP, someone will use it not because there is an emergency, but just because they don't want to finish the test in progress.  So, from that prospective, even though I understand that shutdown should be a state in my state machine and not interupt the current process, can I stop the main VI loop and just execute the powerdown and end labview VI's?

 

Sorry, I can't post my VI's, but I might be able to mock something up if it helps to solve my problem.

0 Kudos
Message 6 of 14
(4,048 Views)

@pd110 wrote:

Thanks to everyone who has responded so far.  I would have rather done this with hardware as well.  Unfortunately, I inherted about a hundred test fixtures, all without an e-stop.  It isn't really feasable right now to retrofit this all.  Besides, our test bays all have a master power switch.  I was hoping to give the operator another power down option though.  Also, if the e-stop is on the FP, someone will use it not because there is an emergency, but just because they don't want to finish the test in progress.  So, from that prospective, even though I understand that shutdown should be a state in my state machine and not interupt the current process, can I stop the main VI loop and just execute the powerdown and end labview VI's?

 

Sorry, I can't post my VI's, but I might be able to mock something up if it helps to solve my problem.


Probably an abort button that brings to to the main screen so you can shut down gracefully?  That and an update to the test procedure stating that the big red handle/button is to be used only in an emergency?

 

My assumption is that this isn't really an E-stop like you said, but a "C" (convenience)-stop instead.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(4,029 Views)

It sounds like you are on the right track.  The concept of an event structure in a parallel loop is a good way to have a system which is responsive to user inputs.

 

The Producer/Consumer (Events) Design Pattern shows how this can be done.

 

The problem you may encounter is that your existing code may not be easily modified to accept the Shutdown Now! command.  You hinted at this when you said the main loop sometimes turns things back on.  The event should just send a command to the module which controls the instruments.  Because of the slow response of some of the instruments, the communications with the instruments should not be in the event case.

 

Without seeing your code, or at least having a good description of the architecture, it is impossible to tell you how you might be abel to make it work.

 

Lynn

0 Kudos
Message 8 of 14
(4,019 Views)

this vi handles instantly a stop condition by sending out an abort notification to stop a subvi loop, also handles any errors (press status switch during run time to simulate error) by shutting down equipment and generating dynamically a stop to the producer loop...

 

ProducerConsumerEvents 1.png

0 Kudos
Message 9 of 14
(4,008 Views)

I've mocked up a vi representitive of what I'm trying to do.  Note the glitch that happens in the process indicator when you click on the E Stop button.  The VI doesn't run exactly the way I'd like it to, but it shows the main state machine continues to run as the process is attempting to be stopped (and "STOP" to be written to the process).  So what I would like to have happen is have something like "POWESTOP" show up in the process indicator instead of "POWESRT UOPP", what is what I get currently.  This won't make a whole lot of sense until you run the vi.

0 Kudos
Message 10 of 14
(3,966 Views)