LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

align and resample slow and uneven serial scalar reading with higher speed, continuous, constant dt waveform readings

I have a serial measurement coming from a scale which is a little finicky in reading. The code required to get valid data for every data point forces data points to come a irregular times (sometimes 1 second dt, sometimes 4 seconds, etc.).

 

I have the scale reading in one loop which runs on its own, with a separate loop running a continuous acquisition and control for a mass flow controller. What I thought might work would be to form the scalar into a waveform then align and resample the waveform in my main loop via a local variable from my slower serial scale loop. I have all but given up on the align and resample VIs. I think they really only work for a constant dt. Before I just write to two different datafiles and merge them later using MATLAB, does anybody have any other ideas on how to approach this? 

 

I would like the slowly changing scale readings to just duplicate once for every data point which comes in during the continuous acquisition in the main loop.

 

i.e. something like this, where eventually the scale reading would drop to 999...

 

time voltage scale reading

0.0 1 1000

0.1 2 1000 

0.2 3 1000

0.3 2 1000

0.4 1 1000

0.5 2 1000

0.6 3 1000

0.7 2 1000 

 

I'm just not sure the easiest way to do this. I have attached my code, though I don't expect people to spend a lot of time understanding all that's there, I just don't have time right now to make a simplified version (sorry!) 

0 Kudos
Message 1 of 6
(3,530 Views)
MFC project and Matlab. Are you sure you are in the correct forum;)


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 6
(3,512 Views)
Yeah, MFC_Project as in "Mass Flow Controller". The code is all Labview. And although I love using Labview for data acquisition and control, I use MATLAB for most post processing needs because I find it easier to manipulate large datasets after the fact and make plots to my liking. The TDMS viewer is a little clunky in my opinion.
0 Kudos
Message 3 of 6
(3,495 Views)

Hi Ryan,

 

That would be very helpful if you could post a strapped down version of your code! It's a little hard to understand it and come up with a better solution since we are not familiar with the application. Also I am a little confused about the table of values you posted, can you be more specific please.

 

Thanks and have a great day.   

 

 

 

0 Kudos
Message 4 of 6
(3,475 Views)

Okay, I took the time to simplify this problem to isolate how to solve it. In the process, I managed to get it working. I'm not sure what I did differently this time other than use a different reference signal (with the same timebase). But it's working so I'm not complaining. For reference, the basic idea is attached.

 

 

0 Kudos
Message 5 of 6
(3,468 Views)

Without digging into your code, how are you getting the MFC data?  In situations like this I've done what you're thinking of doing: update some data storage structure (FG, Local, pick your poison) at its native rate in one loop, and poll it along with the faster data so that you're acquiring the value of the slow data at every point of the fast data.

 

if you're getting data one sample at a time from the MFC, it should be very straightforward. (1 to 1)

if you're getting it in chunks and your chunk time is at or below the rate of the slower data stream, use initialize array to create a same-sized chunk with all the same value for the slow data. (many to 1)

many to many: split the MFC data into subarrays that correspond to each sample of scale data, then do #2. 

 

 

-Barrett
CLD
0 Kudos
Message 6 of 6
(3,462 Views)