LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialising savitzky-Golay vi

Hi,
I am using the Savitzky-Golay filter (ptbypt vi) within one of my programs (the savitzky-golay filter is found in the Analyse> ptbypt> time domain menus). In this vi there is a bolean to initinitialize the internal state of the VI when TRUE. I have this vi within a while loop that runs my program continuously and a button that ask me to import the data file, without stopping the program. So I want the initialisation of the savitky-golay filter to occur automatically without me having to activate it and while the program is still running. How do I do this? I will appreciate whatever help I can get as I am relatively new to LView programing.
Cheers
0 Kudos
Message 1 of 8
(3,008 Views)
RVR,

What do you want to triger the initialization of your savitky-golay.vi? We could use a parallel loop with a "wait on notification"...or it could be as simple as an imbedded T/F case structure. Let me know what has to happen in your program before the initialization and I should be able to tell you the best way to do it.

Thanks for posting!!!

Brett Burger
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(2,992 Views)
Hi Brett B.
thanks for the reply. yes I want to trigger the initialisation of the savitzky-golay vi. using my 'get file' (bolean) button, which is inside a while loop that keeps the program running. The reason it is inside the loop is that I don't want to stop the program everytime I need to get a new file into it. The savitzky-golay vi. is inside a couple of for loops to process 1D array data. Hope my explanations help. it is a bit hard. I appreciate your help.
Regards
RVR
0 Kudos
Message 3 of 8
(2,980 Views)
RVR,

Thanks for using NI products...hopefully you will find our support as quality as the products.

I probably could have asked this the first time...but once triggered...is this savitzky-golay.vi going to be a parallel process?

If so...you could have a parallel while loop with an event structure in it. (If you are not familiar with events let me know...or there are several posts/docs out there that explain it) Your "Get File" boolean could trigger an event to start the savitzky-golay.vi. Now...the data for the savitzky-golay.vi would have to be moved to the parallel loop via queue or local variable or the like.

Let me know if this is making sense...if not let me know what else I can help with.

-Brett Burger
Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(2,976 Views)
Hi Brett,
well, the sav-gol.vi is inside a case structure as an option to filtering. I have other techniques in other cases. So the way it runs:
1. the progrma is running...2. In one case structure I have options for data linearisation using a number of techniques, 3. then in second case structure there are options for filtering the data e.g. the savit-golay.vi, 4. in a third case structure there are options for detrending.... Now everytime i want to import a file i press the 'get file' bolean and the program outputs the signal with the selected proprocessing methods from each of the case structures. The problem with the savitz-golay.vi is that it needs reinitialisation everytime I 'get file'. If the program stopped after each 'run' then it would not be a problem but becasue I have a while loop to run the program continuously, there is the initialisation problem so I am not sure how to trigger the initialisation of the savit-golay.vi without having to press the initialisation bolean everytime or stopping the program. There should be a way to initialise this vi every time i press the 'get file' bolean. I hope that this explains thing better. i appreciate your help.
RVR
0 Kudos
Message 5 of 8
(2,972 Views)
RVR,

I guess I don't understand what you mean by "reinitialize"...because if this VI needs to be initialized every time I would think it would be the first thing to happen in the case structure that calls it. How do you initialize this VI...is it just writing zeroes to the VI??

With a while loop you can use shift-registers to store data from iteration to iteration...these are often used to maintain data then zeroed out..or "re-initialized" via a case structure on the last step. It is starting to sound like this may be the path we need to take. If stopping the program re-initializes the VI...there might be an un-initialized shift-register somewhere in the VI...which would cause this issue.

-Brett
0 Kudos
Message 6 of 8
(2,965 Views)
Hi Brett
if oyu take a look at the Savitzky-Golay.vi you will see that it has a bolean for the internal initialisation of the vi.
Cheers
RVR
0 Kudos
Message 7 of 8
(2,956 Views)
RVR,

Sorry...I should have gone back to look at the earlier post, I forgot we were dealing with a LV function.

Look at the attached code and see if that is what you are looking for....if not...let me konw what is wrong with it as I think I am having a little difficulty understanding what you are trying to do.

-Brett
0 Kudos
Message 8 of 8
(2,938 Views)