Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sincronize 3 Visa reads

Hi

I agree completely with Craig.

I saved his vi's for LV 2013.

Use save to textfile instead of lvmeasure file and see that the data from Craig can be saved with a timestamp for each measurement. In fact a timestamp (x) with two y-values.

And I don't think that it is difficult in matlab to read such files (maybe 3 different files) and combine that to a complete measurement.

greetings from the Netherlands
Download All
0 Kudos
Message 11 of 34
(2,218 Views)

Thanks for convert it for me.

I download it and I will see it now. 

I will see if there is a problem or doubts and I come back here.

0 Kudos
Message 12 of 34
(2,211 Views)

Well, I tried them and save the vector on .lvm.

The time vector was with some negative values. That I didn't understand why.

 

I get the files and plot on Matlab. Got the code for it here

https://www.mathworks.com/matlabcentral/fileexchange/19913-lvm-file-import

 

First, without get the time vector (Medicao.lvm), my pressure plot was this way. Because they are not close to each other, I think that they aren't syncronized.

Pressure without time - Medicao.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Than, I got the time vector (Medicao_3.lvm) and my plot stay the same, but I could see that there is a negative time. I didn't understand why you had subtract that time, but now it's negative.Data with time - Medicao_3.png

So I don't think that they are sincronized. What you guys think?

 

PS: I will put my matlab code here too.

0 Kudos
Message 13 of 34
(2,198 Views)

The negative time is my mistake, I subtracted time_intial - time_measurement, instead of the other way around since measurement is always > initial.  Fixed in the new get_data.vi backsaved to 2013.  (Thanks Albert for previous conversion!)

 

I don't know Matlab, but I don't think your script is correct.  I looks to be just plotting points versus measurement index.  I don't see how you tell the plot that Y values are associated with X values. (It would be nice to see your data file!)

 

I could be wrong, as I am not a big Matlab user and its been awhile since I used it at all, so I modified the LabVIEW to show you the data once the run is done.  And to save the data into a text file with 9 columns.  Try these..

 

Craig  

 

Craig

Download All
0 Kudos
Message 14 of 34
(2,179 Views)

Hi guys, again thanks for all the help.

 

This rev3 version when I open it, they ask me for "Write Delimited Spreadsheet (DBL).vi" and "Write Delimited Spreadsheet.vi"

When I search for it online, I found this:

https://zone.ni.com/reference/en-XX/help/371361R-01/glang/write_delimited_spreadsheet/

So I think it is only for Labview 2018 version.

 

With "High Resolution Relative Seconds.vi" I had a problem to. It works fine in Labview 2013 but I coundn't find it on my program, even using search block. Just to know, where is it?

 

Now asking about the Labview code.

Had you saved the initial time in the main vi code and remove it in each loop time?

 

Now talking about my Matlab code.

I get all the 10 column of the signal. Why is 10 column?

The code has 10 column because the first one is the index of each signal and than the other ones are the 9 signals. I got each channel apart and than I plot.

Because I wasn't paying attention, I comment it on pt-br. Sorry for that.

So I remade it to show you what I have done.

The 'b', 'r' and 'g' on the 'plot' code are for Blue, Red and Green color for the plot. Only that.

 

Now I will the code from rev3 and them I put here my answer and my doubts.

Thanks again for the help!

0 Kudos
Message 15 of 34
(2,167 Views)

"High Resolution Relative Seconds.vi" appeared a more recent version of LabVIEW.  If it doesn't work for your version,  then use "Get Date/Time In Seconds" from the Timing Pallette.  If you do this then the "get_data.vi" subvi will also need to be modified as well.  

(Edit I see it works, you just can't find it.) 

 

To find VIs, use CTRL+Space to open Quick Drop and search for VIs you can't find in the pallettes. That is if Quick Drop existed in 2013?  Otherwise, just make copies of the vi if you need it again.

 

Write Delimited Spreadsheet might be newer also, or changed since LV2013 so try this instead.  You need to transpose the array first, then use Arreay to Spreadsheet String, then Write to File.  

file_save_LV2013.png

 

>> I get all the 10 column of the signal. Why is 10 column?

That's because you use the Dynamic Data Express VI thingy.  I haven't looked into what it does, but it probably appends an index column.  In this new version that is not an issue.

 

>> Now talking about my Matlab code.

I don't have matlab installed to look at your *.m file.  But when you get the LabVIEW code running, post datafile and screen shots.  Or better yet, do your analysis in LabVIEW too! 😉

 

Craig

 

0 Kudos
Message 16 of 34
(2,159 Views)

Well, I tried with the same "Write to Measurement File.vi" just to know if the plot from Labview would be the same as my plot in Matlab.

I got these:

From LabviewPressure view from Labview - Medicao4.png

 

From Matlab without Time, only with Index Position as XPressure with Index Position - Medicao4.png

From Matlab with TimePressure with Time Position - Medicao4.png

From LabviewFlow view from Labview - Medicao4.png

From Matlab without Time, only with Index Position as XFlow with Index Position - Medicao4.png

From Matlab with TimeFlow with Time Position - Medicao4.png

So, I think that the data get from Labview is not a problem to use on matlab but I think that the red one (USB sensor) is not sincronize with the others.

What you guys think?

0 Kudos
Message 17 of 34
(2,157 Views)

So now you see 2/3 sensor match.  What are the specs for the sensor in terms of response and communication time?  Is your USB sensor much, much faster to respond or does the Bluetooth sensor have a built in lag/delay time?  Is one communicating so much faster that the data appears out of synch?  It certainly looks like one or the other.

 

The other possibility is the signal gets to the different sensors at different times.  Without a setup diagram and description of your setup I don't think I can figure that out.

 

How many data points in the USB data when compared to the Bluetooth?  Use an indicator inside each while loop to display "i" or just do array size at the output. 

 

Craig

0 Kudos
Message 18 of 34
(2,154 Views)

Can you attach a data file please?

0 Kudos
Message 19 of 34
(2,153 Views)

Sorry for the long time to respond.

I was watching my file and the USB Sensor is the channel 4-6.

I don't have the firmware of it but I only know that they were all sampled at 100 Hz. 

See if the zip helps with what you asked me. The data is Medicao_4.lvm.

If this is not the data file that you want, please tell me with is it.

 

I really don't know if the windows change how it get this samples of usb or bluetooth, or if is the sensor thats not working.

I am seeing if I can get another sensor here, but I don't know if is gonna be today.

 

PS: About matlab, you can open .m with notepad from windows because is only a .txt in the format of matlab.

 

0 Kudos
Message 20 of 34
(2,144 Views)