Saturday, September 25, 2010

LabVIEW 3D Control Simulation using SolidWorks 3D Models

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.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers