LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use derivative block to derivative a signal?

Solved!
Go to solution

Good day everyone. I'd like to ask. I have a signal read from a strain gage sensor that has been filtered by LPF as shown in attached figure. I want to differentiate the signal by using derivative block. As a results, It outputs zero all the times. However, if I use integrator block, it outputs values. How to use the derivative block actually? Please advice. Thank you.intgrator block.PNG

0 Kudos
Message 1 of 20
(3,543 Views)

Hi mansamewoi,

 

which data did you wire to the dt input of the derivation function?

Did you notice that coercion dot?

Did you read the help for the wait function to know about the meaning of their output? (I guess you wired its output from the image…)

 

Generic advice: we cannot debug images using LabVIEW. Attach snippets or VIs to receive better help…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 20
(3,533 Views)

Hi

 

Reading the detailed help for the derivative block will give much more information (ctrl+h, hover over the block, and then press detailed help)

 

Without your actual code (please attach it) and a sample of some data I can't really help. The only things I can think at the moment are:

- Is there actually an array of data bigger than 3 elements in Data?

- What is the Y scale on your graph, set to autoscale or display the data as an array of numeric indicators to see exactly what is going on.

 

A couple of observations on your code

- Why are you reading the data from a local variable when the actual data terminal is just above in the same structure? This breaks the dataflow paradigm of LabView and I suspect it will also mean that the data displayed in Vib (mm) 4 and 5 will be one iteration behind the data in Data and Vib (volt).

- I don't know why you have got two Wait until next functions, you only need one

0 Kudos
Message 3 of 20
(3,529 Views)

Hi,

 

one more problem with your code:

Why are you using an ExpressVI (ConvertFromDynamicData) to convert a scalar value (your "Vib (mm)" reading) into an array of values?

 

Generic advice: ExpressVIs often produce more problems than they might solve…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 20
(3,525 Views)

Dear all, 

 

Thank you for the help. I have attached the VI as suggested. 

0 Kudos
Message 5 of 20
(3,463 Views)

Dear GerdW,

 

 

Which data did you wire to the dt input of the derivation function?

"data" is the signal from LPS's output as shown in Figure /VI.  Or you mean the data type?

 

Did you notice that coercion dot?

I did not notice till you mentioned about it. Thanks. But, I just read about it and yeah, it is not a big deal, I guess. I just want to know how to wire the derivative / integrator block. 

 

Did you read the help for the wait function to know about the meaning of their output? (I guess you wired its output from the image…)

Yes, I wired the output of the wait function to the dt of derivative blocks.

 

I read the help to understand the output : "This function makes asynchronous system calls, but the nodes themselves function synchronously. Therefore, it does not complete execution until the specified time has elapsed" .

 

Actually, I got no idea on how to wire the derivative/integrator block. But then, I refer to my senior's VI about its controller, how she wired them as shown in figure 1 below. I notice she used few blocks (blued circle) when wiring either  derivative or integrator block. Is it correct?

Figure 1.PNG

Generic advice: we cannot debug images using LabVIEW. Attach snippets or VIs to receive better help…

I have attached my VI for your reference. 

 

Regards,

Mansamewoi

0 Kudos
Message 6 of 20
(3,457 Views)

No, the use of those functions is not correct.

 

Wiring in a 1 set the timer to wait 1 millisecond. 

The output of that function returns the time in milliseconds of the overall PC timer.  Basically the number of milliseconds since the PC booted up.  Put a probe on that wire and see how large that number is.  And be sure to read the help file on that function like was mentioned earlier.

 

I have yet to see a use for the output of the timer unless you are using it to compare different times to see how much has elapsed between two iterations of a for loop by taking the difference between those values.  And when I want to do that, I just use the Tick Count function.

 

I think you need to have a little talk with your "senior" and clue her in.

 

 

0 Kudos
Message 7 of 20
(3,445 Views)

Hi RavensFan,

 


@RavensFan wrote:

I have yet to see a use for the output of the timer unless you are using it to compare different times to see how much has elapsed between two iterations of a for loop by taking the difference between those values.  And when I want to do that, I just use the Tick Count function.


I use that quite often: have a loop wait for a certain amount of time AND calculate the elapsed time for the last loop iteration. Why use two functions (Wait + TickCount) when one (Wait) provides all needed inputs/outputs?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 20
(3,438 Views)

Dear Niatross

 

Thank you for comments. I have read the help. I just do not understand on how to wire dt. I have attached my VI above for your reference. 

 

Regarding your questions: 

- Is there actually an array of data bigger than 3 elements in Data?

Pardon me, I don't get you what are you trying to ask.

 

- What is the Y scale on your graph, set to autoscale or display the data as an array of numeric indicators to see exactly what is going on.

It displays 0 all the times according to auto-scaled graph and also an array of numeric indicator. 

 

A couple of observations on your code

- Why are you reading the data from a local variable when the actual data terminal is just above in the same structure? 

Yes you are correct. It supposed to get the reading directly from the actual data terminal since they are in the same loop. But, actually I need to send the "data" reading to other loop to be derivative or integrated. 

 

-This breaks the dataflow paradigm of LabView and I suspect it will also mean that the data displayed in Vib (mm) 4 and 5 will be one iteration behind the data in Data and Vib (volt).

I think it should not be a problem. But I can fixed it later. The main thing is I wanted to connect  the derivative block correctly.

 

- I don't know why you have got two Wait until next functions, you only need one

Usually I put only one Wait for each loop that acts as a delay between iterations. However, as I said I just refer blindly my "senior's" coding  as shown in Figure below, she put wait function for every derivative or integrator block. This is why I don't understand. I could not manage to ask her as she already graduated and fly back to her country. 

Figure 1.PNG

0 Kudos
Message 9 of 20
(3,430 Views)

@GerdW wrote:

Hi,

 

one more problem with your code:

Why are you using an ExpressVI (ConvertFromDynamicData) to convert a scalar value (your "Vib (mm)" reading) into an array of values?

 

Generic advice: ExpressVIs often produce more problems than they might solve…



I just follow people's work blindly. What should it be? Is there any example for the correct one please? 

0 Kudos
Message 10 of 20
(3,428 Views)