LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inputs/Outputting from within Case Structure

I'm trying to graph data that is being taken within a case structure. The reason it is in this case-structure was I thought it'd be more manageable to write the data to a single plot from within the structures but in reality its only purpose is sequence - if it would plot in real-time, I would be fine with not having the case structure at all.

That said, I'll explain my situation. Each of the two cases will measure data through a NI5133 Scope and display data on the graph. However, the data itself will be processed differently before being displayed. I need the data to be displayed in real-time though, because each case structure contains a loop wherein the data is collected and must be displayed. Is this possible to have these write out to the same graph?

 

In the same bucket, I'm also outputting handled by a USB-6009 digital I/O. Inside of each case structure and inside of the nested loop therein, I need to turn this output on at the start of each iteration and off at the end of the iteration. This works fine going through the first case, but when it goes into the second case it will only turn on and off once.

Any ideas?

I've attached the VI, it's horribly messy right now but you can see what I mean about the case structures being there only for ordering.

Thanks,

Wolley

0 Kudos
Message 1 of 4
(2,595 Views)

Looking at your VI, which data is the data you want to display on the same graph?  If it's data from the two iterations of the main for loop, you can display the data from the first iteration, save it in a shift register, then add the data from the second iteration and display all the data.

 

For the DIO, it would be better to create the tasks ouside the loop, like what is done for the Reset Channel task.  For all the tasks, they should be cleared after the loop exits.  So the only thing being done in the loops/structures is the writing to the tasks.

0 Kudos
Message 2 of 4
(2,560 Views)

The data that I want to plot is in the deepest loop of each case.

This may make more sense to explain why I need these in order - I want to take noise measurements before connecting my apparatus to the what it is supposed to test, and so all of the noise measurements have to be done first. The noise measurements are aggregated, then once every line has the noise measurements performed, the apparatus will be connected. I know there are better ways of filtering, this is just what was initially suggested - as I am not immediately sure how I would perform, for example FFT filtering, and then perform the integral after that using the Scope functions. While I know how I would perform signal averaging and integral calculation manually, it'd be ideal to just have the Scope take care of these.

 

That said - so the first iteration of the primary For loop is to get the noise measurements. The deepest level loop in this iteration is performed to get an "average noise" to eliminate. Basically gets the aggregated average signal for x (50 for now) records. As we have a general characteristic of what we should see during these measurements, it's useful to see these plotted as a way of validating the apparatus before performing measurements (as it will take a few minutes to complete, it would be ideal to not just see that there was a bad measurement only collecting all of the data). That's why I want this data to be displayed in the graphs.

 

The second iteration of the primary For loop is started after the apparatus is hooked up. In the deepest loop of this iteration, measurements are taken again where what is plotted is the difference between the instantaneous records and the noise averages, i.e. what should be the clean signal. These clean signals should certainly be displayed on the graphs.

 

Ideally these would be the same graphs so the user won't have to scroll through the front panel in the middle of the operation.

 

So, can this be done using Shift registers? If so, would you mind explaining how? I'm considerably new to Labview, so a lot of details like that are still beyond me.

 

Also, if I were to make that change to the DIO implementation, would I have only the first and last blocks of the chain (ie the channel specification and whichever the last block is? (I am not currently at a computer with Labview so I can't look at what exactly it's called off the top of my head)).

 

Thanks,

Wolley

0 Kudos
Message 3 of 4
(2,525 Views)

Wolley,

 

I see where you're taking 60 interations in the inner loop, but not where it's averaging them.  I think you've git the right idea about using a shift register.  I'd move the write to the graphs so the're still inside the outer for loop but outside the case structure.  That way the'll update with the average from the first iteration.  In the second iteration you can append the acquired data and display both the cal data and apparatus data when it updates the graphs.

0 Kudos
Message 4 of 4
(2,511 Views)