LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to average data coming from a lock in and plot it...

Need to average data coming from a lock in and plot it (the y axis) Vs data coming from a voltmeter.  I have a vi that does it, but when I hook the instruments with their respective drivers, everything goes wrong and no average or plotting can be achieved.  Can anybody share a sample code where some of this issues are addressed.  Thank you.
0 Kudos
Message 1 of 9
(3,530 Views)
I'm confused by your question you say "I have a vi that does it" and then "when I hook the instruments with their respective drivers, everything goes wrong ". Do you mean that the VI that does it is working with some simulated instrument or do you mean something else? And when you say "everything goes wrong", how do you mean? Do you get errors, wrong data, smoke from the instrument, or what exactly. Please be more precise. Why don't you attach the code you've written so someone can look to see what you might have done wrong.
0 Kudos
Message 2 of 9
(3,518 Views)

Hi Dennis,

Thank you for your prompt response and sorry for the vagueness of the question.  Attached is a vi that simulates what I meant in my previous post.  When i say that everything goes wrong is that I can not get the average and plot the data because the vi (with the real data from instruments) does not build the proper arrays and plots only one point at a time, instead of a continuous line as the simulated vi does.  I have the drivers for my instruments but my real problem is that i don't know where exactly to place them in my vi.  I need to replace the random numbers inside the for loop with data continuously coming from a lock in amplifier, this is my Y axis, and my x-axis is the data I need to build from the voltmeter.

0 Kudos
Message 3 of 9
(3,514 Views)

I'm not sure what you're trying to do. You say you're trying to read data from two different instruments. What is the purpose of the ramp that you created? What is this supposed to do? Is there another instrument that you are trying to set? In the example, the random number generator is behaving like a measured value and the number from the ramp array is acting like a setting for an instrument which does quite make sense since you have it labeled volts and it would presumably mean a voltmeter reading.

Your existing VI plots one point at a time. It does this every 100 msec according to the Delay Time setting. It plots 30 points (the size of the ramp array), and then repeats the same thing for a total of five.

0 Kudos
Message 4 of 9
(3,508 Views)

The ramp is simulating the voltage output from my instrument.  I let it run five times, this is just for averaging purposes.  The random number is suppose to simulate the intensity from the lock in.  The way my experiment works is as follows:  I start a DAQ device that will sweep from 0 to 10 volts (in the example I have 0-300 but this is irrelevat), at the same time, I detect a signal from a sample with a lock in amplifier.  I can directly plot the intensity of the signal Vs time from the lock in using a waveform graph, but what I really need is the intensity of the lock in (Y-axis), Vs the voltage (X axis).  As you can see, I need to have two instruments attached and I think the data from them is different and I don't quite know how to build the arrays of the same type to be able to plot them in an xy graph.  When I attach the voltmeter driver (instead of the ramp) and the lock in driver (instead of the random number generator), I run into the problems I described before.   Thank you very much Dennis.

0 Kudos
Message 5 of 9
(3,504 Views)
Is the lock in returning a single measurement or is it returning an array? The way you've got your program written, you can only handle a scalar (single reading) from either instrument. What's the make and model of the lock in instrument? What driver and function are you using to read from it? If it's returning an array, can you take an average, take the min or max?
0 Kudos
Message 6 of 9
(3,496 Views)

 

Attached are the two instrument drivers I am using, one is a gaussmeter (this is the voltage reading, volts get converted to gauss and viceversa) it is an SGL.  The lock in returns a 1D array of DBL.

The truth is I am not sure if I am using the correct vi s, from the gaussmeter driver I pick the Getting Started Gaussmeter. vi, and I wire the field reading to the x-axis of the xy graph; from the SR830 lock in, I use the Dta Storage Example.vi, and I wire the channel points to the Y axis of my xy graph.  This is where the conflict between data sets arises.  Thanks.

 

Download All
0 Kudos
Message 7 of 9
(3,493 Views)
Well, that output from the SR830 VI returns an array. I don't know much about the instrument or anything at all about your application. Like I said, in order for your VI to work as is, you would need to convert the array to a scalar. I don't know what information from the lock-in amplifier is of interest to you. There are a lot of ways to get a scalar from an array. If you wire the Mean function to an array, you will get a single value (the mean) out. If you need to plot the entire results returned from the lock-in, you will have to change the reading from the gausemeter to an array.
Message 8 of 9
(3,488 Views)
OK Dennis.  Thanks a lot for your help. I'll try what you suggest in terms of converting arrays to scalars.
0 Kudos
Message 9 of 9
(3,485 Views)