LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I take a derivative of discrete indexer data in a simulation loop?

We have a counter value coming in from a DAQ assistant measuring revolutions of a flywheel with 23 indexing slots.  We attempted to use the derivitave x(t) vi in a simulation loop to provide a fourth-order central difference derivative of the counter values with respect to time, but this has not worked in any configurations we've tried so far.  Does anyone have any ideas on taking the derivative of discrete data?
0 Kudos
Message 1 of 5
(3,180 Views)
Attached is a Vi of the method we are trying to use.
Download All
0 Kudos
Message 2 of 5
(3,172 Views)
Since you are using SIM loop, why dont you try using Derivative in CD&Sim?
Andy Chang
National Instruments
0 Kudos
Message 3 of 5
(3,160 Views)

Well, we used the "s" derivative in CD&Sim, but with discrete values, the derivative vi returned large spikes in the derivative value.  We are trying to obtain smoother data with the derivative x(t) vi.

0 Kudos
Message 4 of 5
(3,157 Views)

I see. To implement discrete derivative, you can do the following

 

The simplest way is to drop down a Derivative x(t) PtByPt.vi into the Simulation Loop. After inserting the Derivative x(t) PtByPt.vi, right-click on this VI, select SubVI Node Setup..., and choose Discrete under Simulation subVI execution type.  Choose a fixed-step ODE Solver, such as Runge-Kutta 1 (Euler), in the Simulation Parameters tab of the Configure Simulation Parameters dialog box

Andy Chang
National Instruments
0 Kudos
Message 5 of 5
(3,129 Views)