Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Tutorial: Getting Started with Simulation (Control Design and Simulation Module)

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

This tutorial shows you how to construct a simulation diagram that represents the behavior of a dynamic system. This dynamic system consists of a spring with one end fixed and the other end attached to a mass. Because a damper inhibits the movement of the mass, this dynamic system is called a spring-mass damper system.

If you are new to LabVIEW, consider completing the exercises in the Getting Started with LabVIEW manual before proceeding with this tutorial.

You can complete this tutorial in approximately 30 minutes.
Note  You can print this tutorial by right-clicking this page and selecting Print from the shortcut menu.

Background Information

A dynamic system model is a differential or difference equation that describes the behavior of the dynamic system. In this tutorial, the following differential equation describes the dynamic system.

F(t) – cx'(t) – kx(t) = mx''(t)

where t is the simulation time, F(t) is an external force applied to the system, c is the damping constant of the spring, k is the stiffness of the spring, m is a mass, and x(t) is the position of the mass. x' is the first derivative of the position, which equals the velocity of the mass. x'' is the second derivative of the position, which equals the acceleration of the mass.

The following illustration shows this dynamic system.

The goal of this tutorial is to use the LabVIEW Control Design and Simulation Module to view the position x(t) of the mass m with respect to time t. You can calculate the position by integrating the velocity of the mass. You can calculate the velocity by integrating the acceleration of the mass. If you know the force and mass, you can calculate this acceleration by using Newton's Second Law of Motion, given by the following equation:

Force = Mass × Acceleration


Acceleration = Force / Mass

Substituting terms from the differential equation above yields the following equation:

x''(t) = (F(t) – cx'(t) – kx(t))/m

In this tutorial you will construct a simulation diagram that iterates the following steps over a period of time.

  1. Divides a known force by a known mass to calculate the acceleration of the mass.
  2. Integrates acceleration to calculate the velocity of the mass.
  3. Integrates velocity to calculate the position of the mass.

Performing these integrations over a period of time requires an ordinary differential equation (ODE) solver. LabVIEW includes several ODE solvers you can use in a simulation. Each ODE solver has properties that make it suitable for different tasks. For example, some ODE solvers have variable step sizes. During a simulation, these ODE solvers can adjust the points in time at which the Control Design and Simulation Module evaluates the simulation diagram. Conversely, ODE solvers with fixed step sizes cannot make this change.

Complete the steps in the following sections to build a simulation diagram that simulates the spring-mass damper dynamic system model.

1. Creating the Simulation Diagram


 Was this document helpful?  submit
  Helpful Not Helpful