Skip to content Skip to navigation

OpenStax-CNX

You are here: Home » Content » LabVIEW 3D Control Simulation using SolidWorks 3D Models

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

LabVIEW 3D Control Simulation using SolidWorks 3D Models

Module by: Erik Luther. E-mail the author

Summary: 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.

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 effects 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 Pendulum.

Download the source code for the Linear Inverted Pendulum 3D Simulation here. This VI was created in LabVIEW 8.2 using the 3D Picture Control Toolit add-on which is not a supported feature.

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.

Figure 1: Matrix A,B,C, and D define 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 defined before the simulation is executed. The gains K1, K2, and K3 respresent the gain for the controller.
LabVIEW LIP Simulation Front Panel
LabVIEW LIP Simulation Front Panel (LinearInvPendulum.gif)
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.
LabVIEW LIP Simulation Block Diagram
LabVIEW LIP Simulation Block Diagram (LIP-bd.jpg)

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.

Creating Your Own 3D Simulations

To create LabVIEW simulations using SolidWorks VRML97 export file 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 first subVI draws and updates the picture in accordance with the simulation parameters; the third and lowest level VI imports and parses the VRML97 file to create objects names and parent/child relationships for each object in your system.

For the lowest level VI, you can load WRL files into LabVIEW using the 3D picture control toolkit VI called Read WRL file.vi, which reads a WRL file 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 first 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 file, the drawObject subVI can take your object array. 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 fly 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 effects 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.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks