Software for Fluid Power Technology


From Editor

The purpose of the Software Review section of the Journal is to present information to the reader about engineering software, including simulation programs, to highlight their specific features and their "fitness to purpose" in the unique field of fluid power and motion control. It is, of course, impossible to establish evaluation criteria matching the needs of all readers, therefore readers should not look for absolute ratings but more or less "fuzzy" opinions of the reviewer. A software program is like a wrench, just a tool to solve problems. It is good to solve some problems and not so good for others and this depends on both the nature of the problem and the users' attitude - and generally when we review software we do not know either. A software tool can be highly specialised and great for a some applications but not so well suited for others, on the other hand another software tool can be more flexible and generally applicable but without outstanding features. It is impossible, and even misleading, to say which one is better. What we hope to accomplish is to give the reader information necessary to take his/her own decision.

Simulation of Hydro-Mechanical Systems
Using MATLAB/Simulink® and MATLAB/SimMechanics®


Introduction

The Mathworks, Inc. introduced the ability to simulate mechanical systems within a Simulink environment in the Release 12.1 of their MATLAB program suite for technical computing as an additional toolbox called SimMechanics. Before this release there was no software available on the market to provide all tools within a toolbox necessary to build up and simulate systems consisting both of hydraulic components and mechanical elements. Up to this point the simulation of the hydraulic components could be done by using the Simulink toolbox in MATLAB, but for the block oriented simulation of a connected mechanic multibody model a different program was necessary. This led to developments according to co-simulation interfaces using MATLAB/Simulink for the hydraulic model and tools like MSC.Adams or others for the mechanical system. However, the setup and running of a co-simulation is a challenging and time consuming act.
This document will give an inside into system simulation using SimMechanics and compare the model generation and simulation process for a hydro-mechanical system for both approaches, barely utilizing MATLAB and a co-simulation, respectively. The advantages and disadvantages of each way will be pointed out and a practical example will be shown to illustrate the task.

MATLAB - Toolboxes and References

As reported in "Modelling and Simulation of Fluid Power Systems with MATLAB/Simulink®" (Vol. 2, No. 3, pp. 55-58) MATLAB is a very powerful software solution for the simulation of hydraulic systems - especially when control systems have to be simulated and tested as well. The Simulink toolbox provides block elements representing mathematical functions, tools to handle data streams and the full range of functions for discrete and continuous control systems - to name just a few. Within the block diagrams representing a system the dataflow from function to function or block to block is established by simply connecting the inputs and outputs of the mathematical operators and additional functions. The dataflow represents numeric vectors and matrixes. Additional toolboxes provide more specialised block elements for specific applications like aerodynamics or the simulation of complex power systems as well as the control system toolbox. These toolboxes are in most cases like the Simulink toolbox not part of the standard MATLAB program and only available at an additional charge.

SimMechanics

One of these toolsets is SimMechanics. In the current MATLAB release R14 the SimMechanics toolbox has the version number 2.2, before in the release R13 (SP1) SimMechanics was released with version number 2.1.1. The definition of SimMechanics by The Mathworks, Inc. is: "SimMechanics is a block diagram modelling environment for the engineering design and simulation of rigid body machines and their motions, using the standard Newtonian dynamics of forces and torques."
  • bodies
  • joints (prismatic, revolute, spherical and weld joint as standard joints)
  • actuators
  • sensors

  • and additional blocks for the definition of
  • constrains and
  • drivers

  • The connection between these basic elements is established by connecting the ports of the block elements like in Simulink. The difference lies in the fact that the connection ports of mechanical blocks to each other are not inputs or outputs but simply connection points. Forces and moments can be introduced into the system at the joints connecting two bodies or at defined coordinate positions directly at the bodies. Fig. 1 shows the SimMechanics library browser and Fig. 2 the basic elements of the SimMechanics toolbox. The bodies can only be connected to the circle shaped connection ports of joints or body actuators. I.e., SimMechanics blocks contain the new mechanical ports which cannot be connected to the standard Simulink numeric ports except an actuator or sensor block is used.


    Fig. 1: SimMechanics library window



    Fig. 2: Basic SimMechanics block elements

    The number of ports can be defined for bodies by defining additional coordinate systems (CS) - connection point on the body. The joints provide two basic connection points, one for the base (B) and one for the follower (F). Additional ports can be activated to allow the connection of joint actuators or sensors. How information like angular position or velocity of a revolute joint for example is measured by the joint sensor is defined through the selection of the base and the follower body. For a joint, additional to a sensor and an actuator an initial condition (IC) can be defined by connecting the appropriate block. The connection of a mechanical system to a common Simulink system is established though the sensor and actuator blocks. These blocks provide besides the circular shaped connection ports standard Simulink output and input ports. Fig. 4 displays a simple example, consisting of two bodies (Body, Body1), two joints (Revolute, Prismatic), two sensors for a joint and a body (Joint Sensor, Body Sensor) and two actuators for a joint a body (Joint Actuator, Body Actuator) and connections to a Simulink model (inputs:In1 and In, outputs: Out1, Out2). Furthermore, the model is connected to a ground point (Ground). In Fig. 4 the obvious difference between mechanical SimMechanics connections (with circle) and the standard Simulink connections (with arrow) can be clearly seen.
    Note, that each model requires a ground point. The co-ordinates e.g. of a body can be specified within the WORLD co-ordinate system or within the local body co-ordinate system (CS). Figure 3 explains the definition of the co-ordinate systems in SimMechanics.



    Fig. 3: WORLD and ground co-ordinate system



    Fig. 4: Typical SimMechanics model with connections to and from Simulink

    Hydro-Mechanical Co-Simulation

    As mentioned above, before a complete simulation toolset for mechanical systems became available in MATLAB, it was necessary to build a co-simulation model using MATLAB/Simulink and mechanical multi-body simulation tools (like MSC.ADAMS). In ADAMS a multi-body system is defined though a CAD interface and the combination of 3D elements with specified densities and joints connecting the bodies. Measurements at specified coordinate positions can be carried out and forces and moments can be introduced into the system. These outputs and inputs can be connected to a simulation model in Simulink.
    The disadvantages of a co-simulation are the facts that two programs have to run parallel, both using computing resources, and that both programs have to be synchronised - meaning the data exchange - to provide stable execution of the simulation task. This synchronisation can work very fluently. Should problems occur at this point the process of debugging both models and their connection becomes much more difficult compared to one model containing all system components.
    Apart from this it should be taken into account that a software solution like MSC.ADAMS provides more tools than just the algorithms to calculate the equations of motion. These tools are not necessary for most hydro-mechanical models and therefore only slow down the execution of the program.
    The implementation of a co-simulation using MATLAB and ADAMS has been explained in "Co-simulation Method for a Hydro-Mechanical System Using Adams and MATLAB/Simulink" (Vol. 3 (2002) No. 3 pp. 55-58). The hypothesis stated in the article, that "simulating a dynamical system in only one simulation program is usually extremely demanding or even impossible" is no longer true - it is possible using the new toolbox in MATLAB - providing an even higher simulation speed.

    Generation of a SimMechanics Model

    Is a model of a mechanical system already available and a co-simulation should be avoided, the generation of a new mechanical model with the SimMechanics toolbox using information extracted from the co-simulation model becomes interesting.
    Figure 5 shows the ADAMS model of the lift frame of a wheel loader working hydraulics as an example for a mechanical model which has been used as part of a co-simulation together with a Simulink model for a hydraulic system including actuators and control system.


    Fig. 5: ADAMS lifting frame model

    To rebuild a new mechanical model using the SimMechanics toolbox, the following data is necessary for each component:

  • mass
  • inertia matrix
  • centre of gravity (coordinate position and orientation)
  • coordinates of linking points
  • definitions of linking points according to joints (degrees of freedom)

  • For this demonstration these information have been extracted from the ADAMS model manually. Due to the limited number of components an automatic approach was not pursued. However, these information are available also by CAD programs like ProE®, Auto-CAD®, SolidWorks®, etc. so that the data input for SimMechanics is simple in case a CAD is model is available. Fig. 6 describes the process of the data transfer graphically.
    The extracted information is used to define the properties of the body objects in SimMechanics and the selection of necessary joints connecting the bodies. The information defining the body objects is entered in the properties dialog box of each body block. These information are the mass (m, dimension: 1 1), the inertia matrix (J, dimension: 3 3), the centre of gravity (CG, dimension: 1 3 for the positions and 1 3 for the orientation) and the individual connection points of the bodies (CS, dimension: 1 3 for the position and 1x3 for the orientation). The information can be defined directly by numerical values or indirectly by variables which can be provided for example in a separate M-File (a standard MATLAB script file).


    Fig. 6: Information transfer from ADAMS to SimMechanics

    In ADAMS the moments of inertia for each component are defined according to the co-ordinate system of the centre of gravity of the component (centre marker) or - if available - the inertia marker (for objects with variable density). The orientation of these co-ordinate systems are defined through axis rotations taking the origin coordinate system as basis. Here lies a major difference between ADAMS and SimMechanics: in ADAMS these rotations are defined as Z-X-Z EULER angles. In SimMechanics the standard definition uses X-Y-Z EULER angles (see also Wood and Kennedy, 2002). Accordingly, the co-ordinate definition for the CG orientation has to be changed in the properties dialog for each SimMechanics component; otherwise the moments of inertia will be calculated incorrectly.
    An automatic conversion of a CAD model into a SimMechanics model is at the moment only available if the CAD model has been generated using Solid-Works. In this case the stand-alone CAD translator which comes with MATLAB can be used to convert the CAD model to a Physical Modelling XML file. The XML file can then be imported into SimMechanics, the CAD software is not necessary to do this. Because the model of lifting frame was not available in SolidWorks and an additional CAD translator was not available for ADAMS models, this conversion process has not been tested by the authors.
    Defined through the co-ordinate positions of the bodies, SimMechanics provides a basic graphical representation of the mechanical system. The user can choose between the representations as so called convex hulls as in Fig. 7 or as half-transparent ellipsoids displaying the inertia of the model components as in Fig. 8.



    Fig. 7: Mechanical model representation (convex hulls) in MATLAB/SimMechanics

    The inertia of each component is defined according to the CG coordinate systems. Using the display method of equivalent ellipsoids (Fig. 8) provides a useful method to check the correct definition of the inertia matrix and the orientation of the centre of gravity coordinate systems for each component. Fig. 8 displays the components of the lifting frame as equivalent ellipsoids.



    Fig. 8: Mechanical model representation (equivalent ellipsoids) in MATLAB/SimMechanics


    Using convex hulls the similarity to the original ADAMS model in Fig. 5 can be easily observed. In this display mode the graphic representation of the bodies is created through planes between the defined connection points (CS) and symbols for the centres of gravity of the individual bodies ( ).
    Fig. 9 displays the consistence of the model generated in SimMechanics and the lifting frame structure shown as a blue outline.
    Additionally, a more realistic representation of the mechanical model can be created by using the Virtual Reality toolbox. Basically this means the generation of a virtual environment using VRML (Virtual Reality Modelling Language) and interfacing the environment with an existing SimMechanics model. For most applications this equals a high amount of additional programming efforts and might be only useful when graphic representation has a high priority. However, this graphic representation is already included e.g. in ADAMS and therefore, here, the limitation of Sim-Mechanics can be seen.



    Fig. 9: Consistency of lifting frame structure and Sim-Mechanics model




    Fig. 10: Simulation setting of the mechanical environment in SimMechanics


    In Fig. 10 the dialogue box for the simulation settings in SimMechanics can be found. Next to gravity, the linear and angular assembly tolerance can be specified. Under analysis type the "forward dynamics" are chosen in case forces are acting on the system and the positions and velocity should be calculated. In case the forces should be determined for an open loop system then the "inverse dynamics" mode should be taken and for a closed loop system the "kinematics mode". The numeric integration solver settings are specified in the standard Simulink block as for normal MATLAB models.

    Comparison

    Following aspects could be observed during modelling this hydraulic-mechanical system on he one hand with SimMechanics and Simulink and on the other hand with a co-simulation between ADAMS and Simulink. The modelling in SimMechanics was done very quickly due to the fact that the all data could be taken out of the ADAMS (but other CAD programs offer the required data, too) model. The effort for creation of an ADAMS model depends upon the available CAD model of the mechanical system, but normally, this can be done also quickly. The initialization of both simulations was much easier using barely MATLAB, and by this only one integration method. The co-simulation is sensitive according to this topic and different kind of integration technique and data exchange between the two simulation programs can be chosen. However, the most interesting pro for SimMechanics is the simulation time. Whereas the co-simulation took about 30 min time for a special lifting manoeuvre (on a Intel Pentium 4 platform with 2.8 GHz), the pure MATLAB model could perform the same simulation within 10 min - at nearly same integration step size meaning accuracy. For both approaches, the graphical display of the system behaviour slows down the simulation enormously and should be normally switched off during simulation.

    Summary

    Compared to the traditional co-simulation of systems containing hydraulic components and a control system on the one hand and mechanical components of a multi-body structure on the other hand, the simulation using the new toolbox SimMechanics in MAT-LAB has the following advantages:

    References



    Wood, G. D. and Kennedy, D. C. 2002. Simulating Mechanical Systems in Simulink with SimMechanics.
    The Mathworks, Inc.,www.mathworks.com/matlabcentral/fileexchange/(PDF file), MA, USA.

    Modelling and Simulation of Fluid Power Systems with MATLAB/Simulink® 2001.
    Int. Journal of Fluid Power, Vol. 2, No. 3, pp. 55-58.

    Co-simulation Method for a Hydro-Mechanical System Using Adams and MATLAB/Simulink 2002.
    Int. Journal of Fluid Power, Vol. 3, No. 3 pp. 55-58.


    BE RR
     

    BACK



    ©2004 Fluid Power Net All rights reserved. Disclaimer