LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to time a case structure?

Solved!
Go to solution

hi,

I am using cDAQ 9191 along with module 9205 for data acquisition. Attached with the post is my Lv code foe data aqcuisition and saving it to a measurement file. It is working fine. I start with running the code  and i can see the waveform of all my 9 channels. afterwards i can press record button to start recording the data and storing in TDMS file. everything is quite fine till this. Now i need to stop the recording after 6 seconds automatically( which i need to do manually at this stage-aborting execution or pressing stop button on front panel). I guess i need to "time" case structure containing "write to measurement file". But how to do it?

Can anyone help? Or any other solution , after looking into the attached code.I am new to LV. TQ

0 Kudos
Message 1 of 17
(4,997 Views)

hi,

I am using cDAQ 9191 along with module 9205 for data acquisition. Attached with the post is my Lv code foe data aqcuisition and saving it to a measurement file. It is working fine. I start with running the code  and i can see the waveform of all my 9 channels. afterwards i can press record button to start recording the data and storing in TDMS file. everything is quite fine till this. Now i need to stop the recording after 6 seconds automatically( which i need to do manually at this stage-aborting execution or pressing stop button on front panel). I guess i need to "time" case structure containing "write to measurement file". But how to do it?

Can anyone help? Or any other solution , after looking into the attached code.I am new to LV. TQ

0 Kudos
Message 2 of 17
(4,995 Views)

Hi irsa,

 

why don't you discuss this with Jawad?

 

I suggest to use ElapsedTime - it will tell you when the 6s are gone…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 17
(4,967 Views)

Actually both of us are solving the issue but cannot get something out of it. So i am doing it with express VIs.  Attached is the code using Elapsed time. But it is not working well. Still i need to stop the code manually to stop the writing measurement file VI. Can anyone look into the code and tell kindly whats wrong in it ?  

0 Kudos
Message 4 of 17
(4,941 Views)

Hi irsa,

 

then why don't you try to understand basic functions using some test VIs before implementing the "main" VI?

 

Try something like this:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 17
(4,933 Views)

Name the VI used to connect elapse time and write to measurement file?

0 Kudos
Message 6 of 17
(4,929 Views)

Hi irsa,

 

it's a function handling boolean signals. Why don't you look in the boolean functions palette?

Spoiler
NOT
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 17
(4,920 Views)

The code still not working. I have attached the code and tdms file view for code. 

TDMS file viewer shows clearly that each group of file contains 200 samples. For 6 sec data i should have 6000 samples in total as sampling rate is set to 1000 in DAQ settings. According to auto saving for 6 seconds only 6000 samples should be appearing in groups of tdms file shown in figure. 200 samples each group so total of 30 groups . But each time i run # of groups changes. how to fix this?

Download All
0 Kudos
Message 8 of 17
(4,856 Views)

Hi irsa,

 

But each time i run # of groups changes. how to fix this?

By debugging and correcting your VI…

 

The code still not working.

In my image I wired a FALSE to the AutoReset of ElapsedTime, but you wired a TRUE.

What's the reason behind this decision? And what is the result of that decision?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 17
(4,842 Views)

Either TRUE or FALSE of AUTO RESET do not have  any impact  on the result. The number of groups is still not fixed. I am still unable to get fixed number of samples.

0 Kudos
Message 10 of 17
(4,840 Views)