Simulation and Animation of Mechanical Systems Very IMP
Simulation and Animation of Mechanical Systems Very IMP
Simulation and Animation of Mechanical Systems Very IMP
Jan Danek1 HUMUSOFT, Prague, Czech Republic Arkadiy Turevskiy2 and Terry Denery3 The MathWorks, Inc., Natick, MA, 01760
This paper introduces a process for simulating and animating mechanical components in the context of a larger system. Using the NASA HL-20 flight vehicles main landing gear as an example, the paper shows how the CAD assembly can be used as a starting point for creating a dynamic model as well as a realistic animation of the mechanical components. The paper also describes how a dynamic model created from the CAD assembly can be integrated into the larger model of the overall flight vehicle and how the animation created from the CAD assembly can be incorporated into a larger flight vehicle animation. The resulting model and animation are used for detailed analysis and visualization of a main landing gear collapse due to a sudden wind gust shortly before landing.
Nomenclature
I(n) = Unity matrix of n rows and n columns, with diagonal elements equal to one and off-diagonal elements equal to zero.
I. Introduction
ODELING of mechanical systems and components often starts with CAD tools. These tools are useful for specifying the detailed three-dimensional (3-D) mechanical design of a component. Once the CAD model of a mechanical component is complete, engineers will often need to design a control system for it. With the control design task accomplished, engineers will want to analyze how the mechanical component affects the performance of the overall vehicle and how the mechanical components work together with other vehicle systems. For example, the landing gear group for an aircraft manufacturer may develop a mechanical design of a landing gear; the controls group may develop a controller for that mechanical design; and the systems engineering group may then model how the landing gear operation affects the dynamics of the overall vehicle and how the hydraulic actuator works with the landing gear mechanical design and control system. Often, different software packages are used for each step of this process, making it difficult to move from mechanical 3-D modeling to control design and then from control design to a system level simulation. This paper introduces a streamlined workflow that enables quick and easy transition from mechanical 3-D modeling to control design and then to system level modeling and simulation. This workflow provides a compelling solution to the control design and system modeling tasks. This solution will be based on using the commercial off-the-shelf software tool, Simulink, from The MathWorks, Inc. Using the proposed approach, we will translate a CAD file into an environment where control design can be easily achieved. We will also explain how to easily model and simulate multi-domain systems, including mechanical, hydraulic, and electrical components. We will discuss how to include models of mechanical components into models of larger systems. In addition, we will show how models for environmental conditions, such as wind turbulence and changes in atmospheric pressure and temperature with altitude can be easily integrated into the model of the overall vehicle. As we discuss the overall process, we will specifically focus on two areas of this workflow. First, we will show how engineers can create Simulink models of mechanical components using CAD models as a starting point. Second, we will discuss how to create high quality 3-D animations from these models. We will present a process for exporting CAD models into Virtual Reality Modeling Language (VRML) files. VRML enables high quality online
1 2
Lead Developer, Pobrezni 20, Prague, 18600, Czech Republic. Technical Marketing Manager, 3 Apple Hill Drive, Natick, MA, 01760, AIAA member 3 Principal Application Engineer, 3 Apple Hill Drive, Natick, MA, 01760, AIAA member 1 American Institute of Aeronautics and Astronautics
3-D animation. Once the VRML file of the CAD model is available, we will show how to easily connect it to a model of a respective mechanical component and create a 3-D online animation. To illustrate our proposed approach we will use a specific example of a CAD model representing the HL-20 flight vehicles main landing gear. The end result of this workflow is a combined model of a mechanical component and a compelling 3-D online animation. With this setup we were able to easily model the dynamics of the landing gear component by itself and then include this component into a system level simulation. The 3-D animation capability provided invaluable insight into the component dynamics and improved the understanding of control system performance and the components effect on the whole vehicle.
II. Modeling Landing Gear Dynamics as Part of the HL-20 Vehicle Model
Denery, Ghidella, Mosterman, and Shenoy1 showed how a model of a mechanical component can be developed using a tool for modeling multi-body systems, such as SimMechanics2. Specifically, they showed how to develop a dynamic model of HL-20 flight vehicles landing gear using this tool. The benefit of this approach is that dynamic models of components are much easier to construct using the domain-specific building constructs that SimMechanics provides than by explicitly writing out differential equations governing component dynamics. For instance, in the considered example, a model of a landing gear was constructed using constructs called body blocks and joint blocks in SimMechanics. Through body blocks users describe the center of gravity (CG) location, mass, and inertia tensor of the links that form a mechanical assembly. In the example, landing gear is constructed of four links: a vertical strut, two bracing links, and a sprung extension (shock absorber). Joints are analogous to physical connections like hinges, slots, and ball and socket connections. For the landing gear, the links connect to the airframe and to each other through revolute joints, which are directly analogous to hinges. These revolute joints are all aligned to rotate about the axes parallel to the longitudinal axes of the airframe. Figure 1 shows a
Figure 1. Main landing gear and its four-bar linkage representation in SolidWorks. SimMechanics model of HL-20 landing gear. The same paper showed how the model of a mechanical component could be integrated into a simulation model of a larger system. Specifically, it was shown how the SimMechanics model of a landing gear could be integrated into the overall HL-20 flight simulation model. This was done by interfacing a SimMechanics model of the landing gear with the rest of the simulation model implemented in Simulink3. With this approach system engineers have a complete vehicle simulation model that they can use for trade-off studies, for example, to evaluate how the design of a landing gear component affects the performance of the overall flight vehicle. It was also shown how environment could also be modeled in the overall simulation. Using Aerospace Blockset4 authors included models of the atmosphere, Earths gravity field, and the effects of wind disturbances in the simulation. The authors then evaluated how well different designs of the landing gears hydraulic actuator were able to prevent a collapse of the landing gear after a strong wind gust immediately before the touch-down. 2 American Institute of Aeronautics and Astronautics
While it provided system engineers with useful tools for evaluating effects of mechanical component design on the performance of the overall vehicle, the approach proposed by Denery, Ghidella, Mosterman, and Shenoy did not include one important workflow improvement that is proposed and described in this paper. Mechanical design of mechanical components is typically done using a CAD tool such as SolidWorks5 or Pro/ENGINEER6. One significant improvement to the process described by Denery, Ghidella, Mosterman, and Shenoy could result from automatically creating a dynamic model of a mechanical component from its CAD file. System engineers or control engineers would then not have to build a dynamic model themselves. Instead of manually constructing a dynamic model from SimMechanics blocks, the engineer would simply initiate the conversion process of the CAD file to generate the dynamic model automatically. In addition to significantly simplifying the workflow, this enhancement would eliminate the potential errors that system engineers or control engineers could make when manually creating a dynamic model from the CAD assembly. This process improvement is possible using two translators developed by The MathWorks. One of these translators7automatically exports SolidWorks assemblies into SimMechanics models, while the other does the same for Pro/ENGINEER assemblies. The built-in SimMechanics visualization is useful for understanding the behavior of the modeled mechanisms. However, SimMechanics animation does not provide realistic rendering of the modeled component. An alternative animation method, based on the use of virtual reality graphics, makes it possible to create realistic animations for a SimMechanics model created from CAD assembly. In the rest of the paper we will use the HL-20 main landing gear component example to illustrate how a CAD assembly of a mechanical component can be used to automatically create a SimMechanics model and a realistic animation to connect to it. We will then show how this SimMechanics model and the animation can fit into the overall HL-20 flight simulation.
III. Creating SimMechanics Model of HL-20 Landing Gear from SolidWorks Assembly
As described by Denery, Ghidella, Mosterman, and Shenoy, the main landing gear represents a well-known mechanical construct, the four-bar linkage. As Fig. 1a shows, when the landing gear is deployed, the vertical strut is rotated by 90 degrees relative to the airframe. The lower bracing link (link 1) is rotated by 45 degrees relative to the vertical strut, and the upper bracing link (link 2) is collinear with the lower bracing link. Since the lengths of vertical strut, bracing link 1, and bracing link 2 were defined by Denery, Ghidella, Mosterman, and Shenoy to be 1 meter, 0.707 meters, and 0.707 meters respectively, the four-bar linkage composed of the airframe, vertical strut, and two bracing link forms an isosceles right triangle. In this triangle the airframe and the vertical strut serve as catheti, and the two bracing links form the hypotenuse. Figure 1b shows a SolidWorks assembly of a four-bar linkage corresponding to the described configuration of the HL-20 landing gear. In addition to three links corresponding to vertical strut and two bracing links, the SolidWorks assembly shown also contains four pins that are used for illustrating the rotational motion of links relative to each other and to the airframe. The top two pins represent the connection of the three links to the airframe and are fixed relative to the airframe. The lower right pin enables the rotation of bracing link 1 relative to vertical strut. Finally, the lower left pin enables the rotation of bracing link 2 relative to bracing link 1. To create a SimMechanics model from this assembly it is necessary to download and install SolidWorks-to-SimMechanics Translator. Once this free software is installed, it is possible to generate a textual description of the assembly that lists the mass properties for each body and the characteristics of each joint defined in the SolidWorks assembly. This description is saved to a SimMechanics XML file as shown in Fig. 2. Once the SolidWorks assembly has been saved as a SimMechanics XML file, it is possible to automatically create a SimMechanics model out of it. As Fig. 3a shows, this can be done with a single command in MATLAB. The resulting SimMechanics model with blocks rearranged and background colors added for easier understanding is shown in Fig. 3b. It should be noted that not all CAD assemblies can be exported into Figure 2. The SolidWorks assembly can be saved as SimMechanics models. In SolidWorks the SimMechanics XML file. 3 American Institute of Aeronautics and Astronautics
Figure 3. A SimMechanics model can be automatically created from a SolidWorks assembly. restrictions limiting the location of one body relative to another are called mates. SolidWorks-to-SimMechanics Translator attempts to find a SimMechanics joint corresponding to each mate in SolidWorks assembly. As there is no one-to-one correspondence between SolidWorks mates and SimMechanics joints, the conversion is not always possible, or it does not translate as intended. SolidWorks-to-SimMechanics Translator manual lists supported SolidWorks mates. As Fig. 1b shows, the SolidWorks assembly for the landing gear uses concentric and coincident mates (the list of mates is shown in the lower left corner of the SolidWorks screen). These types of mates are supported by SolidWorks-to-SimMechanics Translator, and therefore the SolidWorks assembly can be successfully translated into a SimMechanics model. When a SolidWorks assembly contains unsupported mates, the translation process will still proceed, but the unsupported mates will be replaced by weld joints in the resulting SimMechanics model. In this situation, even though the resulting SimMechanics model does not capture the component dynamics correctly, it is still valuable because it contains the mass and inertia properties of the bodies, automatically created from the SolidWorks assembly. A closer examination of the SimMechanics model in Fig. 3b shows that the model contains eight bodies: seven bodies representing four pins (highlighted in blue) and three links (highlighted in grey), as expected, as well as a body called RootPart that represents the airframe. The top two pins of the assembly are connected to RootPart by weld joints. This type of connection ensures that these two pins are fixed relative to RootPart. Each of the three links is connected to two pins. For example, as Fig. 3b shows, the vertical strut (represented by block LinkOsc-1) is connected by a revolute joint to upper right pin (block Pin-6) and by a revolute joint to lower right pin (block Pin-5). SolidWorks-to-SimMechanics Translator created similar connections for the other two links. As mentioned above, in addition to placing the bodies into the SimMechanics model and connecting them with appropriate joints, SolidWorks-to-SimMechanics Translator also automatically determines mass, inertia, and coordinate system properties for all bodies. Once the SimMechanics model is automatically created, it can be verified by running a simulation. Figure 4 shows a Figure 4. A visualization of four-bar linkage SimMechanics visualization for the simulation of the created motion in SimMechanics. model. The four-bar linkage moves under the influence of the gravity force in this scenario.
Figure 6. VRML exporting options have to be set properly to create realistic animation. VRML and meters as the unit. It is also necessary to keep the box Save all the components of the assembly into a single file unchecked. When all the options are selected as described, and the SolidWorks assembly of a landing gear is saved as VRML, eight VRML files are generated. These eight files contain 3-D geometries of three links and 5 American Institute of Aeronautics and Astronautics
four pins. There is also a file describing the whole mechanical component. This VRML file was called Four_bar.wrl. Since VRML files are text documents, the content of a VRML file can be viewed in any text editor. Figure 7a shows
b) A VRML file with extra spaces removed and Transform nodes added.
Figure 7. A VRML file created from SolidWorks assembly and the required modifications. the content of Four_bar.wrl in the MATLAB editor. Four_bar.wrl file contains seven Inline objects that reference four pins and three links forming the landing gear component. Some modifications to the Four_bar.wrl file are needed before it can be used with Virtual Reality Toolbox to animate the SimMechanics model automatically generated from SolidWorks assembly. First, extra spaces have to be removed between the quotation marks and the names of inlined files. Second, Transform objects have to be wrapped around inlined files. Figure 7b shows the described changes applied to file Four_bar.wrl and saved as Fourbar_mod.wrl. Virtual Reality Toolbox works with Transform objects by changing properties, such as translation and rotation, with values from Simulink models or MATLAB data. Finally, lighting, viewpoints, background, world information, and navigation information can all be added to the VRML file as needed.
Figure 8. A new coordinate system should be added to each body in SimMechanics model. system should have its origin at (0, 0, 0) and its orientation matrix should be I (3), as shown in Fig. 8a and Fig. 8b respectively. The new coordinate system is defined relative to the world coordinate system. By placing the check in the box next to this coordinate system, as shown in Fig. 8, an extra output is generated for each of the four pins and 6 American Institute of Aeronautics and Astronautics
three links. The signal connected to this output carries the information about position and rotation of the corresponding body in the world coordinate system. These positions and rotations should be measured and fed to the virtual scene. Therefore, the second step is to connect a body sensor block for each of the four pins and three links
Figure 9. A Body Sensor block is used to measure the position and rotation of each SimMechanics body. through the output created in the first step. Figure 9 shows this connection as well as the options for the Body Sensor block (highlighted in magenta). These options determine that the outputs from the Body Sensor block contain the rotation matrix and position. Step three is to convert the rotation matrix into axis-angle representation, as VRML uses that representation to define the bodys orientation. The conversion from rotation matrix to axis-angle representation is shown in Fig. 10a and is accomplished by using the appropriate blocks (highlighted in orange) from either the SimMechanics library or the
a) Connection of the SimMechanics model to the b) Simulation results can now be animated with the virtual virtual reality scene. reality scene. Figure 10. The Body Sensor block is used to measure the position and rotation of each SimMechanics body. Virtual Reality Toolbox library (blocks from the Virtual Reality Toolbox library were used in the case shown in Fig. 10). The final step is to connect SimMechanics model to Virtual Reality scene using a VR Sink block from Virtual Reality Toolbox. This is shown in Fig. 10a as well. 7 American Institute of Aeronautics and Astronautics
Once the connection has been established, the simulation can be started and the animation can be observed in the Virtual Reality window, as shown in Fig. 10b.
VI. Multi-Domain Modeling and Control Design using a SimMechanics Model of a Mechanical Component
The SimMechanics model and corresponding Virtual Reality Toolbox animation are useful in providing insight into the dynamic behavior of the mechanical component. SimMechanics model can be further used for designing a controller for the mechanical component in question and for performing multi-domain modeling. For example, a controller could be designed that would apply the appropriate amount of torque to the vertical shaft to keep it in the desired position. To accomplish that, the SimMechanics model would be linearized appropriately, and the controller would be designed for the linearized plant. Both the linearization task and the control design can be conveniently performed using Simulink Control Design. Additionally, the mechanical rigid body SimMechanics model could be interfaced with models of components of other physical domains. For example, the controller that was just discussed could be implemented with a hydraulic actuator or electric motor. The appropriate modeling tools, SimHydraulics, SimPowerSystems, and SimDriveline allow multi-domain modeling and simulation of this type in the Simulink environment. This topic was covered in detail by Denery, Ghidella, Mosterman, and Shenoy and therefore will not be discussed again here.
VII. Incorporating a Model of Landing Gear Mechanical Components into a Simulation of the HL-20 Flight Vehicle
The obtained SimMechanics model of the landing gear can be incorporated into a flight simulation model of the HL-20 flight vehicle. This was shown and explained in detail by Denery, Ghidella, Mosterman, and Shenoy. Figure 11a shows a SimMechanics model for the main landing gear developed by the aforementioned authors. Figure 11b
Figure 11. A SimMechanics model obtained from the SolidWorks assembly can be incorporated into the HL20 simulation model with minor changes. shows the same SimMechanics model as shown in Fig. 3b the SimMechanics model obtained by automatically translating the SolidWorks assembly of a four-bar linkage. Comparing SimMechanics models in Fig. 11a and Fig. 11b it can be observed that the SimMechanics model in Fig. 11b has three links (highlighted in gray) connected by four revolute joints (highlighted in green) just like the model in Fig. 11a does (the three links are shown by textboxes next to them highlighted in gray). The SimMechanics model in Fig. 11a does not model pins as the SimMechanics model in Fig. 11b does (pins are highlighted in blue in Fig. 11b), and it also includes a model of sprung extension to model wheel forces. Therefore, it can be seen that the SimMechanics model obtained from the SolidWorks assembly can be used to model a landing gear as a part of the overall flight vehicle model with only minor modifications required.
In addition to incorporating a SimMechanics model of the landing gear into the overall vehicle simulation, the animation of a four-bar linkage representing the landing gear had to be incorporated into a virtual scene showing a landing of the HL-20. The preparation of this virtual scene will be described first. One of the standard shipping Aerospace Blockset demos, aerblk_HL20_vr, was used as a starting point. This demonstration file has a virtual scene linked to it with Virtual Reality Toolbox. The virtual scene shows the landing of the HL-20 flight vehicle and is shown in Fig. 12. As can be seen from that figure, the 3-D model of the HL-20 flight vehicle used in the virtual scene is low resolution and does not include 3-D models of landing gear components. Therefore, this virtual scene was used as a starting point but was modified to include a higher resolution model of the HL-20 flight vehicle. This higher resolution Figure 12. The HL-20 landing virtual scene with a low model of the HL-20 flight vehicle was obtained resolution VRML model of the HL-20 was used as a by using a 3-D Model of HL20 created in starting point. AC3DTM software and used in a FlightGear flight simulator visualization with the asbhl20 demo from Aerospace Blockset. The AC3D model of the HL-20 was converted into VRML and incorporated into the virtual scene. Virtual scene was also updated with Figure 13. The HL-20 pitch, yaw, and roll angles as well as latitude, a more realistic terrain model. Next, a virtual scene had to be longitude and altitude had to be converted into VRML rotation and connected to the model. To do this, translation to connect to the virtual scene. latitude, longitude, and altitude were converted into X, Y, and Z VRML coordinates to define the HL-20 position in the virtual scene. Pitch, yaw, and roll were converted to axis-angle format and fed into VRML scene to define the HL-20 vehicle attitude. Figure 13 shows the connection of the HL-20 flight simulator model to the virtual scene.
a) The model of the main landing gear was modified to send link rotation angles to the virtual scene.
Figure 14. SimMechanics model obtained from SolidWorks assembly can be incorporated into HL-20 simulation model with minor changes. 9 American Institute of Aeronautics and Astronautics
With the high resolution model of the HL-20 incorporated into the virtual scene, the next step was to include a four-bar linkage 3-D model previously generated from the SolidWorks assembly into the virtual scene as well. To do that, an extra transform node was added to the virtual scene to allow proper positioning and orientation of the four-bar linkage relative to the HL-20 airframe. The HL-20 flight simulation model had to be modified as well. Figure 14a shows how the SimMechanics subsystem for modeling the main landing gear was modified. Three Joint Sensor blocks (highlighted in orange) were connected to three revolute joints to sense the three rotation angles (highlighted in red) of the landing gear links and send these signals to the virtual scene. The measured rotation angles were the rotation angle of the vertical strut relative to the airframe, the rotation angle of bracing link 1 rotation angle relative to the vertical strut, and the rotation angle of bracing link 2 relative to bracing link 1. Figure 14b shows the resulting model connection to the virtual scene. With this setup the model could be run and the deployment of landing gear could be visualized, including how individual links rotate relative to each other and relative to the airframe. To test the resulting model and the virtual reality scene, the simulation scenario described by Denery, Ghidella, Mosterman, and Shenoy was used. In this scenario, a wind gust is introduced shortly before the touch down. This wind gust caused the HL-20 to roll and touch down on only one wheel. This causes the landing gear to collapse and the flight vehicle crashes. The described scenario was run with the adjusted model, and as expected, the model provided link rotation angles describing the collapse of the landing gear. Figures 15-17 show several snapshots of
Figure 15.
Figure 16.
The HL-20 immediately after touch down. Landing gear is starting to collapse.
Figure 17.
The HL-20 after main landing gear collapses completely. 10 American Institute of Aeronautics and Astronautics
the virtual scene with a clear representation of how the landing gear collapses and the flight vehicle crashes. This simulation proved the validity of the model and the related virtual scene.
VIII. Conclusion
The paper presented a workflow for utilizing CAD assemblies of mechanical components for creation of dynamic models, control design, multi-domain modeling, and system simulation. It was shown how a realistic animation can be created and connected to the model to help understand system dynamics. Using an example of HL20 landing gear it was shown how the collapse of a main landing gear at landing can be modeled and animated using the proposed approach. The value of the proposed approach is in the simplified model development, reuse of CAD assemblies developed by mechanical engineers, and better understanding of component and system dynamics through realistic animation.
References
Denery, T., Ghidella, J. R., Mosterman, P. J., and Shenoy R., Creating Flight Simulator Landing Gear Models Using Multidomain Modeling Tools, AIAA Modeling and Simulation Technologies Conference and Exhibit, Keystone, Colorado, 2006. 2 SimMechanics, SimMechanics Users Guide, The MathWorks, Inc., Natick, MA, March 2007. 3 Simulink, Simulink Users Guide, The MathWorks, Inc., Natick, MA, March 2007. 4 Aerospace Blockset, Aerospace Blockset Users Guide, The MathWorks, Inc., Natick, MA, March 2007. 5 SolidWorks Office Premium 2007, Software Package, SolidWorks Corporation, Concord, MA, 2007. 6 Pro/ENGINEER Wildfire 3.0, Software Package, PTC, Needham, MA, 2007. 7 SolidWorks to SimMechanics Translator, Software Package, The MathWorks, Inc., Natick, MA, 2007. 8 Virtual Reality Toolbox, Virtual Reality Toolbox Users Guide, The MathWorks, Inc., Natick, MA, March 2007. 9 Marrin., C., and Campblell, B., Teach Yourself VRML 2 in 21 Days, 1st ed., Sams.net, Indianapolis, Indiana, 1997. 10 The Virtual Reality Modeling Language, International Standard ISO/IEC 14772-1:1997. 11 Carey, R., and Bell, G., The Annotated VRML 2.0 Reference Manual, Addison-Wesley Publishing, Boston, MA 1997. 12 Castillo-Effen, M., Alvis, W., Castillo, C., Valavanis, K. P., and Moreno, W. A., Modeling and Visualization of Multiple Autonomous Heterogeneous Vehicles, IEE Systems, Man and Cybernetics International Conference, Vol. 3, October 2005, pp. 2001-2007. 13 Mayhew, E. J., Creating Standalone Virtual Environments, MATLAB Digest, The MathWorks Inc., Natick, MA, March 2007
1
1994-2007 by The MathWorks, Inc., MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the Lshaped membrane logo, Embedded MATLAB, and PolySpace are trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders.