LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop loop from feedback

Hi,

 

I am very new to LabView and would appreciate assistance in the problem I am having.

 

I have created a pressure testing rig for a tube, where I will be pulsing a pressure from 0 - 250 mmHg with the use of a solenoid valve controlled in LabView. I am using the USB-6009 to control the solenoid valve (normally closed). Additionally I have pressure and temperature gauge controlled by the NI 9237. I have attached my vi of pulsing the solenoid with 5V and 0V with a 1 sec delay in between and put it in a  while loop. I also have another loop where the pressure and temperature readings are displayed.

 

What I want to do:

 

In an event of a rupture of the tube, I want to output a 0V to close the solenoid valve and stop the loop. A rupture or leak can be detected if the pressure does not reach 250 mmHg. But because the test is pulsing the pressure and is not constant, I cannot say 'stop if it falls below 250 mmHg'. So I am kinda stuck with this. Any help would be much appreciated 🙂

0 Kudos
Message 1 of 6
(2,666 Views)

First you need to freeze the algorithm to control the SOV based on the pressure level. Draw a flow chart or list down the steps and check the logic to control the SOV and then come for programming, which is always a good way to start the coding. This is applicable for any type of programming. Parallely go through the LabVIEW basic courses which available online as given in this Thread. Make another try and come back if you get stuck somehwere.

 

Go for LabVIEW examples and check for data acquisition examples, take time and understand the LabVIEW environment and then start.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 6
(2,660 Views)

Pretending that I am Lynn ( ), I would tell you that something this critical should have a HARDWARE solution to this problem and the only thing the software should do is report the failure.  What happens if the computer freezes?

 

Unfotunately I am NOT him, so I cannot tell you how to rig one.

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.
Message 3 of 6
(2,630 Views)

Sure it's pulsing.  But, that means you have two expected values: 0 or the input value.

 

You can't just say "check to make sure it's less than the input value" because any time between pulses will cause a stop.  The way you described a failure, it will report a value greater than 0, but less than the desired value.  You can easily test for both conditions.

Less than input value reports True if the output falls below that value
Greater than value to be treated as zero reports True for any non-zero value.  (value to be treated as zero to handle noise without treating "everything" as zero)

 

You only want to shutdown if both of these are true.  Use the AND.  It will output false if either of these are false or both are false.  It'll output true only when both are true.

Message 4 of 6
(2,618 Views)

Bill,

 

Thanks for filling in for me while I have been unavailable.

 

jaygaus,

 

Bill is correct that when a fault in the equipment can cause danger or damage, a hardware safety circuit is much better than software. These may sometimes be called watchdog timers.  Because of the time-varying nature of your valve control signal, you need to account for the time.

 

It appears that you have the time delays set to 1 second. You do not indicate how quickly the pressure changes after the valve is opened, how much tolerance you have around the 250 mmHg setting, or how quickly you need to respond to a fault. Do you need different behavior for "leaks" and "ruptures"?  All of those things affect the design of the fault response system, whether hardware or software.

 

As an example I will use the following assumptions: 

1. The pressure reaches steady state within 250 ms after the valve open command.

2. A fault is indicated if the pressure is below 90% of the nominal value when the valve has been open for more than 250 ms. (pressure < 225 mmHg)

3. The valve must be closed within 250 ms of the detection of a fault.

4. A separate system will be used to manage software failures. (Such as a relay which removes power from the valve circuit if the AO does not go high at least once every three seconds.)

 

Parts 1, 2, and 3 can be implemented in software. (Note that other values in the assumptions above, such as a response time of 10 ms would require hardware or a real-time operating system rather than software).Replace the valve control loop with a state machine. The states include Initialize DAQ AO, Write AO, Wait, Clear DAQ AO, and Halt. You could also add Idle and Error Handling states. The Wait state would include a Wait (ms) set to no longer than 250 ms - to meet the response time requirement. After each wait check to see if the desired pulse duration has occurred, possibly using Elapsed Time.vi. When the pulse duration is complete, change the valve control voltage, change the elapsed time target, and go to the Write AO state. If the Stop button is pressed or a fault signal is received from the other loop, then immediately set the valve control voltage to zero, the elapsed time target to -1, and go to the Write AO state (setting the valve to off). When the Wait state sees an elapsed time setting of -1, it will immediately switch to Clear DAQ AO followed by Halt states.

 

The AI loop should also be a state machine. The states include Initialize DAQ AI, Read AI, Analyze, Clear DAQ AI, and Halt. After initializing it will begin a pattern of Read AI, Analyze, Read AI, Analyze... In addition to temperature and pressure add a channel which monitors the AO line controlling the valves. In the Analyze state look for the valve control line to be high. After it has been high for 250 ms, check that the pressure is above the limit (225 mmHg in this example). If the pressure drops below the limit anytime after the first 250 ms while the AO line remains high, send a Notification to the valve control loop to shut down.  The same notifier could also be used to stop the valve control loop when the Stp 2 button is pressed in the AI loop, eliminating the need for two stop buttons. The Wait (ms) in the valve control loop Wait state could be replaced with the Wait on Notification with a 250 ms timeout.

 

Lynn

Message 5 of 6
(2,608 Views)

Hi John,

 

Thank you very much for the information, I will look to implement a hardware safety circuit alongside the software. I shall attempt to use the information you have given me on the software side to. 

 

Thank you very much.

0 Kudos
Message 6 of 6
(2,562 Views)