Showing results for 
Search instead for 
Did you mean: 

rate of change calculated channel

Go to solution

Hi, I tried to make a plugin based on one for standard deviation that I got some help with on here - but it's not working.


I don't understand the problem, I've replaced the standard deviation vi with one for dx/dt but using a sine wave signal on daq mx it's not right.  The output looks like a comb - I wonder if I could get some help?

0 Kudos
Message 1 of 6

One thing that can be tricky is that the length of the waveforms passed to your PE can change (assuming they are coming from the DAQ plugin). You may want to add some code to ensure the waveform length is consistent so you do the Standard Deviation on a consistent waveform length every time your PE does the analysis (i.e. you don't want to analyze 1 second worth of data one time and 10ms worth another time and produce a Std Dev point for each since that can likely result in comb type waveforms). Although, I was also thinking about Std Dev. for a Sinewave and it seems like depending on where the sinewave portions are sent to your Plugin, it might be expected to produce a comb type result with higher values when the sinewave goes from one tip to the next and smaller values if the waveform is around the tip when the Y values don't change as much. I wrote a Plugin to do FFT analysis, where the incoming waveform had to be a consistent size for the FFT algorithm and this example might provide some helpful ideas on how you might change your code. It currently only supports a single channel, but you could use the idea to ensure your analysis is always done on a consistent waveform size (try with just a single channel first to see if this produces the results you expect. You may need to change your Plugin timing since the process VI can be called several times before returning any data. Also, make sure to include all your VIs, project, library files if you need more help. You can also add debug print calls to save info to disk if you need to run at full speed and want to investigate later why you got the results you did...I often find this helpful for debugging.

Hope this helps,


0 Kudos
Message 2 of 6

I'm sorry, I've uploaded my project again as a zip file.

Note it's named 'Standard Deviation' but I'm trying to modify it to provide the rate of change, using a dx/dt vi instead of the S.D. VI.  The Standard Deviation plugin was working well, which is why I've used it as the basis for this new function I'm after.


I suspect it is something related to the waveform length as you suggest, I have a lack of understanding how this is accessed in process.vi


I would really appreciate any insight.  

Download All
0 Kudos
Message 3 of 6

Here is the original working standard deviation plugin


0 Kudos
Message 4 of 6

Here's a modified Rate of Change Plugin. The Derivative.vi needs the Initial Condition and Final Condition wired in (i.e. the value that comes before the array and the value that comes after). I added a map with the channel name and the last value to the private data of the class. This way we can keep track of the final data point (which is used as the Final Condition to the VI) and we can store this value and use it as the Initial condition for the next iteration. I also renamed your Plugin to "Rate of Change". There are still some rough edges when you configure multiple channels and haven't mapped them all yet, but I'll let you add the bells and whistles to make it behave how you like.


Hope this helps,


0 Kudos
Message 5 of 6
Accepted by topic author staylor77

Thanks very much for this Brad, I think I understand the issue now.


Will take it from here

0 Kudos
Message 6 of 6