LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Notifiers (Labview 2019)

Hi @mcduff,

 

Thanks for the input.

 

I have been taking input from the forum and cleaning the code to make it  readable. Sorry about the mess.

Do you recommend passing data between loops using channels rather than variables?

You are right, I am missing my timing VI. (Shouldn't be missing)

Suggestion 1.Like the idea about reading multiple samples and doing an average. when i do log periodically i do not have to actually put in the samples/s. all i do is put in the time interval i want the data to log at.

so if the user says log every 0.25S.  I need to write 1 value to the file every 0.25S. my approach was to read the data with a loop timed at the user given interval and read 1 data point and write to the file, but you say the buffer is going to fill up. so I should read all the samples and average out.

 

For Changing the DAQ settings, I am not changing the settings on the fly. once the settings have been set, you start Acquisition and no DAQ settings should be changing. It is all configured before hand.

 

Thanks

0 Kudos
Message 11 of 15
(1,128 Views)

Hi Guys,

 

So I have taken the advice from the forum and implemented them in my project. I also made changes to my approach. I have also eliminated using local variables and property node as much as possible.

 

Instead of reading One sample while logging periodically, I decided to read them all and average them; however, I have run into an issue using the mean vi.

 

Looks like the output of the mean VI is a 1d array because of my auto indexing tunnel. I have 96 channels that i plan to use.

 

What will be the best approach to get the mean and write it to a tdms file in seperate columns instead of all the values in one column.(The way I have it now)

 

Secondly, how can I automatically create a new tdms file with the name indexed once the desired file size is reached. I'll sometimes be logging for days and I want to keep the file sizes to a manageable size. I see it is possible to do it using a write to measurement VI. Is that the only option?

 

Please Help.

 

Attached is my VI. Thanks in Advance.

 

PS. I have cleaned up the code so it should be easier to follow.

 

 

0 Kudos
Message 12 of 15
(1,095 Views)

Hi Paul,

 


@PGgautam1 wrote:

Looks like the output of the mean VI is a 1d array because of my auto indexing tunnel. I have 96 channels that i plan to use.

What will be the best approach to get the mean and write it to a tdms file in seperate columns instead of all the values in one column.(The way I have it now)


The Mean function outputs a scalar DBL value, it's the autoindexing FOR loop creating your array of 96 mean values for your 96 channels!

To place them in "several columns" instead of "on column" you should provide a 2D array to TDMSWrite: use BuildArray…

 


@PGgautam1 wrote:

Secondly, how can I automatically create a new tdms file with the name indexed once the desired file size is reached. I'll sometimes be logging for days and I want to keep the file sizes to a manageable size. I see it is possible to do it using a write to measurement VI. Is that the only option?


You can look into the File functions palette!

There is a function to determine the filesize, and there is a function to provide "indexed filenames"!

Once your filesize limit is reached you can close the current TDMS file, create a new filename and start a new TDMS file with this new filename…

 

General advice for more improvements:

 

NEVER delete the label of controls/indicators (like your listbox or graph)! You may hide the label on the frontpanel, but NEVER in the blockdiagram!

You still can improve your code using features available in LV2019 like this:

Use the EmptyString constant instead of plain empty strings to improve readability of the code.

I recommend to use FormatIntoString instead to combine NumericToString with ConcatStrings and a string constant.

You still use local variables, and several unused terminals in the block diagram…

Even it may work right now I still suggest not to use several event structures in your mainVI, especially as all of them are hidden inside case structures!

I recommend to switch of the "Icon view" of the block diagram terminals (in the LabVIEW options)…

Use AutoCleanup and consistent fonts…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 15
(1,067 Views)

@GerdW wrote:

I recommend to switch to the "Icon view" of the block diagram terminals


Icon view vs Terminal view is a very divisive topic. It is true that 'Icon view' is the more moderation option, however, I recommend sticking with the one you like better and don't mix the two.

---------------------------------------------
Certified LabVIEW Developer (CLD)
Message 14 of 15
(1,039 Views)

Hi GerdW,

 

Thanks for the assistance.

 

I had tried using the build array function but it wasn't working for me, I had to transpose the array to get it into separate columns.

 

I'll look into the TDMS file size issue when i get a chance.

 

Thanks Again

 

0 Kudos
Message 15 of 15
(1,027 Views)