01-05-2010 10:17 AM
Hello,
I'm fairly new to Labview, so this may seem elementary to some. I am pulling real-time data from an airflow sensor and I want to manipulate the data in the following way:
1) after starting the program, I want to release one of 3 valves to trigger the sequence
2) delay for 10 seconds
3) grab one data point at a given interval (every second?) over period of 10 seconds (20 seconds total time elapsed)
4) average the data and spit out a value
I've been trying for a while to get this working for a while. Any tips would be much appreciated. Once again, I'm new at this, so please bare with me.
Thank you.
Mark
01-05-2010 12:42 PM
Specifically, what part of it is giving you problems? Have you tried to Highlight Execution, or to step through the program? You don't have the Error Clusters wired on the DAQ Assistants; that would be the first thing I would do.
Without having the hardware hooked up, it would be difficult for anyone here to fully troubleshoot this.
Ed
01-05-2010 02:23 PM
The biggest issue I am having is the case structure. I have been playing around with the program, and I can use a "for Loop" to pull values. The problem is that it's putting the rest of the program on hold. I want to be able to trigger the sub-routine without stopping the functionality of the other controls. I tried branching wires off the Serial port to another seperate loop but that didn't seem to work.
Highlight execution has helped a bit. I will try wiring the error clusters and see if that helps.
THanks.
01-05-2010 02:46 PM - edited 01-05-2010 02:48 PM
There are a number of things in your code that I'm confused by. We'll start at the left and work back. I see an "average" in the left frame of the sequence structure. All it will show is the average of a single value, replicated "iteration" times, not an average of the received flow meter data, as you will only get one reading for each pass through the outer loop, then it will take that one reading, build an array of iteration length of that value, then divide the summation of that array by iteration, to give you (unless the computer is broken) the original value. The elapsed time doesn't show you anything either, just what the current time millisec count is. If you want to show elapsed time (what elasped time?, the time through a loop, which will be determined, in part, by how long you wait to press the "boolean5" button. What are you doing with the DAQ assistant?
Remember, LabVIEW is a data flow language, which means if you have things "wired" in series, that is the order they will execute. When you say release one of the valves to trigger the sequence, any valve, how is the valve released in your program? Are you waiting the "10 Sec" to allow external conditions to settle? Grab which data points every 10 secs, the serial reads, or something with the DAQ assistant? If the "data" is that received from the serial communications you don't want a manually triggered write/read.
01-05-2010 03:44 PM
Basically the test setup is this...I am testing air pressure through a mechanical venturi. There are 3 venturis in the machine at the same time. The DAQ assistant communicates with the NI USB-6009 only (no data collection). THis is used to activate the solenoids that clamp and pressurize the test pieces. When one of the nozzles (nozzle1, 2, 3) is released, air flow through and the Omega FMA-1611A flow sensor picks up pressure and flow rate. This is what is connected to the serial port.
What I'm trying to do is streamline the process. Right now, I am reading a number off a visible indicator, which is causing user error. I'm trying to make it so that as soon as I release one of the nozzles (boolean nozzle1, 2, 3), a sub-routine will execute that waits 10 seconds (for the air flow to normalize) then takes a reading once every second for 10 seconds. Then I want to display and record the average of these data points. I want to be able to do this without ending the program (the flowmeter should still be reading continuously). I've gotten to the point where the program works perfectly with the just the visible displays. All I need to do is add the secondary sub-routine I explained.
I did try highlight execution per reccomendation and I now see what you are saying about data flow. I tried just taking data points without averaging or time delays and I still seem to be bogging down the program somehow. Do I need to build another case structure outside of the main loop? I think I can get through the delays and the mathematics...my biggest issue is taking a reading at a set interval (i.e. 1 second) and saving the readings so that I can calculate the average and display it. Do I use an array? The "for loop" uses bracketing, but as you stated, only takes one reading.
I'm an ME guy, so while I can build the test setups without issue...obviously programming is another story
I will continue to play around with the programming. I have gotten far enough to make the program work in its basic form, so I think I can do this, but any tips you can provide would be extremely helpful.
Thanks again,
Mark