You are on page 1of 4

OpenStax-CNX module: m12977

LabVIEW 3D Control Simulation

using SolidWorks 3D Models


Erik Luther
This work is produced by OpenStax-CNX and licensed under the
Creative Commons Attribution License 2.0

Abstract
Importing a SolidWorks VRML into LabVIEW gives engineers and students the ability to integrate
the power of SolidWorks 3D computer aided design with LabVIEW simulation. It is extremely useful
for test and simulation applications that require complex visualization of a 3D model. To combine 3D
visualization with simulation, you can use a combination of LabVIEW, the Simulation Module and the
3D Picture Control Toolkit.

1 3D Control Simulation in LabVIEW


The LabVIEW development environment is an ideal platform for prototyping, designing, and deploying
control alogithms. As part of the prototyping step, 3D simulation can be used to assist in visualizing both
the behavior of the plant and the eects of the control algorithm on the control plant. In this demonstration,
the LabVIEW Simulation Module and LabVIEW 3D Picture Control Toolkit are used to simulate the
behavior and control of a Quanser Linear Inverted Pendulum1 .
Download the source code for the Linear Inverted Pendulum 3D Simulation2 here. This VI was created
in LabVIEW 8.2 using the 3D Picture Control Toolit add-on which is not a supported feature.3
NEW: An updated version of this 3D demo, using the new supported 3D Picture Control,
now ships with the Control Design and Simulation Module and can be found using the Example
Finder within LabVIEW.
Version

1.4: Apr 1, 2009 10:58 am -0500

http://creativecommons.org/licenses/by/2.0/

1 http://www.quanser.com
2 See the le at <http://cnx.org/content/m12977/latest/LIP_Demo.zip>
3 See the le at <http://cnx.org/content/m12977/latest/http://zone.ni.com/devzone/cda/tut/p/id/4411>

http://cnx.org/content/m12977/1.4/

OpenStax-CNX module: m12977

LabVIEW LIP Simulation Front Panel

Figure 1: Matrix A,B,C, and D dene the controller for the simulation. The Acceration of Gravity
and Pendulum Length in centimeters can be cutomized by editing the plant model. The Array of inital
states allow the angle, angular velocity, and linear velocity variables to be dened before the simulation
is executed. The gains K1, K2, and K3 respresent the gain for the controller.

http://cnx.org/content/m12977/1.4/

OpenStax-CNX module: m12977

LabVIEW LIP Simulation Block Diagram

Figure 2: This simulation utilizes the LabVIEW Simulation Module with the RK1 continuous time
solver. The controller is containined inside the 'Insert Control Code Here' box allowing students to
design their own unique controller while the plant model and 3D simulaiton model are preserved.

When downloading this VI, you must have a minimum of LabVIEW 8.0.1 with the LabVIEW Simulation Module installed, as well as the free 3D Picture Control Toolkit. This 3D simualtion is one of many
developed for educational purposes. Other demonstrations include the 3D helicopter, auto suspension, and
3D rotational inverted pendulum.

2 Creating Your Own 3D Simulations


To create LabVIEW simulations using SolidWorks VRML97 export le format, you will need to create a
program that contains three VI's. The top level VI contains the simulation loop and the state-space matrices
information; the rst subVI draws and updates the picture in accordance with the simulation parameters;
the third and lowest level VI imports and parses the VRML97 le to create objects names and parent/child
relationships for each object in your system.
For the lowest level VI, you can load WRL les into LabVIEW using the 3D picture control toolkit
VI called Read WRL le.vi, which reads a WRL le and creates the data necessary to render the scene
into a picture control. It is located in the Objects Functions Palette. You can add objects to the system
using the Insert Into Array.vi. The rst step needed in the VRML parser subVI is an indexed for loop
with an unbundle.vi followed directly by a bundle.vi and you need to manually name each component of the
system for reference. After this is completed, use the Find Object.vi to create object refnums for each object
and connect those to a case structure with an identical unbundled/bundle feature to assign parent/child
relationships (this allows for the pendulum to move when the base moves and not the other way around).
After you have successfully parsed the VRML97 le, the drawObject subVI can take your object array.
http://cnx.org/content/m12977/1.4/

OpenStax-CNX module: m12977

Once again use the Find Object.vi to create references for each object you would like move with the movement
VI's such as Translate Object To.vi and Rotate Object To.vi. The drawObject.vi creates the camera and its
controller as well as the light source. It also performs the scene rendering and scene drawing.
The top level VI is responsible for the simulation parameters and equations that describe the system.
The simulation dynamics can be altered on the y using the CD Create State-Space Model.vi located in the
Control Design Toolkit. This VI allows the user to enter variable formulae into the state-space matrices and
then alter the system very quickly by changing the variable values. Combined with the 3D picture control
toolkit, you can witness the visual eects of the variable values on the system immediately.
This roughly outlined method describes the basic functions needed to perform a LabVIEW simulation
with 3D visualization provided by SolidWorks VRML97 export. The VRML parsing is only necessary because
at the time of this writing, SolidWorks software does not provide object names and parent/child relationships
with VRML97 export.

http://cnx.org/content/m12977/1.4/

You might also like