Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How do I Implement a Discrete Derivative in my Simulation Loop?

Primary Software: LabVIEW Development Systems>>LabVIEW Professional Development System
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Modules>>Control Design and Simulation Module

Problem:
The LabVIEW Control Design and Simulation Module includes a Discrete Integrator for Discrete Linear Systems, but not a Discrete Derivative. The Module does include Integrator and Derivative functions for Continuous Linear Systems. How can I calculate a derivative for a Discrete Linear System in a Simulation Loop?

Solution:
You can calculate a discrete derivative in a Simulation Loop in many different ways. Perhaps 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.

You may also want to choose a fixed-step ODE Solver, such as Runge-Kutta 1 (Euler), in the Simulation Parameters tab of the Configure Simulation Parameters dialog box (accessible by double-clicking on the Input Node of the Simulation Loop).

You can find the Derivative x(t) PtByPt.vi on the Block Diagram Functions Palette under Signal Processing»Point By Point»Integral & Differential PtByPt.

Another method for calculating a discrete derivative inside a Simulation Loop involves using the Discrete Unit Delay VI. You may refer to the attached DiscreteDerivs.vi program for a demonstration of how to use each method for calculating a discrete derivative inside of a Simulation Loop. Please note that the Derivative x(t) PtByPt.vi uses a 2nd Order Central derivative method where the derivative is calculated over two time steps instead of a single time step. The 2nd Order Central method is described in the detailed help for the Derivative x(t).vi as follows:

The differentiation f(t) of a function F(t) is defined as

Let Y represent the sampled output sequence dX/dt.
If method is 2nd Order Central, Y is given by the following equation:

for i = 0, 1, 2, …, n – 1,
where n is the number of samples in x(t), x–1 is the first element in initial condition, and xn is the first element in final condition.

Related Links:
NI LabVIEW Control Design and Simulation Module

Attachments:
DiscreteDerivs.vi
DerivFP.jpg
DerivBD.jpg




Report Date: 12/28/2007
Last Updated: 01/11/2008
Document ID: 4GR8P7Q7

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit