# Matlab Simmechanics Manual

Download (English) |

*Download*and complete offer, you will get access to list of direct links to websites where you can download this manual.

### About

**About Matlab Simmechanics**

Here you can find all about Matlab Simmechanics like tutorial and other informations. For example: .

Matlab Simmechanics manual (user guide) is ready to download for free.

On the bottom of page users can write a review. If you own a Matlab Simmechanics please write about it to help other people. [

**Report abuse**or wrong photo | Share your Matlab Simmechanics photo ]

# Video review

## Double Pendulum: Comparison between MapleSim, SimMechanics, & MATLAB ODE (with error ...

### User reviews and opinions

No opinions have been provided. Be the first and add a new opinion/review.

### Documents

Multibody System Simulation with SimMechanics

Michael Schlotter May 2003

Abstract This paper describes, how to simulate the dynamics of multibody systems with SimMechanics, a toolbox for the Matlab/ Simulink environment. The novel Physical Modeling method is compared with traditional ways to represent mechanical systems in Matlab, and some interesting mathematical aspects of the implementation of SimMechanics are examined.

#### 1 Introduction

Simulating the dynamics of multibody systems is a common problem in engineering and science. Various programs are available for that task which are either symbolical computation programs to derive and solve the dynamical equations of motion, or numerical programs which compute the dynamics on the basis of a 3D-CAD model or by means of a more abstract representation, e.g. a block diagram. As an add-on for the GUI-based simulation environment Simulink, SimMechanics falls into the last category. Mechanical systems are represented by connected block diagrams. Unlike normal Simulink blocks, which represent mathematical operations, or operate on signals, Physical Modeling blocks represent physical components, and geometric and kinematic relationships directly. This is not only more intuitive, it also saves the time and eort to derive the equations of motion. SimMechanics models, however, can be interfaced seamlessly with ordinary Simulink block diagrams. This enables the user to design e.g. the mechanical and the control system in one common environment. Various analysis modes

and advanced visualization tools make the simulation of complex dynamical systems possible even for users with a limited background in mechanics.

2 Functionality of the Toolbox

This section provides an overview about SimMechanics. The block set is described briey, as well as the dierent analysis modes and visualization options. More details about these topics can be found in [Mat02].

2.1 Physical Modeling Blocks

As already mentioned, the SimMechanics blocks do not directly model mathematical functions but have a denite physical (here: mechanical) meaning. The block set consists of block libraries for bodies, joints, sensors and actuators, constraints and drivers, and force elements. Besides simple standard blocks there are some blocks with advanced functionality available, which facilitate the modeling of complex systems enormously. An example is the Joint Stiction Actuator with event handling for locking and unlocking of the joint. Modeling such a component in traditional ways can become quite dicult. Another feature are Disassembled Joints for closed loop systems. If a machine with a closed topology is modeled with such joints, the user does not need to calculate valid initial states of the system by solving systems of nonlinear equations. The machine is assembled automatically at the beginning of the simulation. All blocks are congurable by the user via graphical user interfaces as known from Simulink. The option to generate or change models from Matlab programs with certain commands is not implemented yet. It might be added in future releases. It is possible to extend the block library with custom blocks, if a problem is not solvable with the provided blocks. These custom blocks can contain other precongured blocks or standard Simulink S-functions. Standard Simulink blocks have distinct input and output ports. The connections between those blocks are called signal lines, and represent inputs to and outputs from the mathematical functions. Due to Newtons third law of actio and reactio, this concept is not sensible for mechanical systems. If a body A acts on a body B with a force F, B also acts on A with a force F, so that there is no denite direction of the signal ow. Special connection lines, anchored at both ends to a connector port have been introduced with this toolbox. Unlike signal lines, they cannot be branched, nor can they be connected to standard blocks. To do the latter, SimMechanics provides Sensor and Actuator blocks. They are the interface to standard Simulink models.

Actuator blocks transform input signals in motions, forces or torques. Sensor blocks do the opposite, they transform mechanical variables into signals.

#### 2.2 Types of Analysis

SimMechanics provides four modes for analyzing mechanical systems: Forward Dynamics calculates the motion of the mechanism resulting from the applied forces/ torques and constraints. Inverse Dynamics nds the forces/ torques necessary to produce a specied motion for open loop systems. Kinematics does the same for closed loop systems by including the extra internal invisible constraints arising from those structures. Trimming searches for steady or equilibrium states of a systems motion with the Simulink trim command. It is mostly used to nd a starting point for linearization analysis. Generally it is necessary to build a separate model for each type of analysis, because of the dierent mechanical variables which need to be specied. In Forward Dynamics mode, the initial conditions for positions, velocities, and accelerations, as well as all forces acting on the system are required to nd the solution. To use the Inverse Dynamics or the Kinematics mode, the model must specify completely the positions, velocities, and accelerations of the systems independent degrees of freedom.

#### 2.3 Visualization Tools

SimMechanics oers two ways to visualize and animate machines. One is the build-in Handle Graphics tool, which uses the standard Handle Graphics facilities known from Matlab with some special features unique to SimMechanics. It can be used while building the model as a guide in the assembly process. If a body is added or changed in the block diagram, it is also automatically added or changed in the gure window. This gives immediate feedback and is especially helpful for new users or for complex systems. The visualization tool can also be used to animate the motion of the system during simulation. This can be much more expressive than ordinary plots of motion variables over time. The drawback is a considerably increased computation time if the animation functionality is used. The bodies of the machine can be represented as convex hulls. These are surfaces of minimum area with convex curvature that pass through or surrounds

all of the points xed on a body. The visualization of an entire machine is the set of the convex hulls of all its bodies. A second option is to represent the bodies as equivalent ellipsoids. These are unique ellipsoids centered at the bodys center of gravity, with the same principal moments of inertia and principal axes as the body. More realistic renderings of bodies are possible, if the Virtual Reality Toolbox for Matlab is installed. Arbitrary virtual worlds can be designed with the Virtual Reality Modeling Language (VRML) and interfaced to the SimMechanics model.

#### 3 An example problem

Some of the features of SimMechanics will now be shown on an example. The forward dynamics problem is solved with Matlab/ Simulink without the Physical Modeling environment as well as with SimMechanics. This allows a comparison of the results and the eort taken to get the desired solution. It is also shown briey, how to compute the inverse dynamics and how to trim and linearize the model with SimMechanics. Finally, the problem of controlling an inverted pendulum is addressed as an example for the integrated design of mechanical and control systems.

#### 3.1 The Mechanism

Figure 1 shows the mechanical system of interest. It consists of a uniform cubical rod B attached to a uniform cubical cart A which slides on a smooth horizontal plane in reference frame E. E can be oriented arbitrarily in the Newtonian reference frame N. A and B are connected by means of a frictionless revolute joint with the axis of rotation in A3 direction. A is attached to E with a linear spring/ damper system with the spring stiness kSD and the damping coecient bSD. The dimensions of the cart in A1 , A2 , A3 direction are aA , bA , cA , respectively, and the dimensions of the rod are similarly dened in reference frame B as aB , bB , cB. The masses and central inertia dyadics of bodies A and B are assumed to be mA , IA , mB , and IB. The gravity force acts in N3 direction. Two spatial forces, FA and FP1 act on the mechanism as shown. The system has one translational degree of freedom, q1 and one rotational degree of freedom q2. The equations of motion for that mechanism can be derived by hand. They

Figure 1: Pendulum on cart. are given by (mA + mB )1 + mB bB cos(q2 )2 + bSD q1 mB bB sin(q2 )q2 + q q 2 P A kSD q1 EF1 EF= 0 (1) and 1 B B m bB cos(q2 )1 + (mB b2 + 4 I33 )2 + mB g bB sin(q2 ) q q b 2 P E P1 bB F1 cos(q2 ) bB EFsin(q2 ) = 0 (2)

#### 3.2 Forward Dynamics

As mentioned above, the forward dynamics have been computed with and without SimMechanics. The techniques to solve such problems in Matlab/ Simulink are not explained here explicitly, because the reader is assumed to be familiar with them. For the forward dynamics problem, the external forces are set to FA = FP1 = 0. The initial conditions are given by q2 = 0.1 rad, and q1 = q1 = q2 = q1 = q2 = 0. Figure 2 shows a m-le suitable to nd the numerical solution. A Simulink block diagram for the same task is depicted in Figure 3. Both possibilities are implemented pretty easily once the equations (1) and (2) are

function [] = pocn_fdyn_ml(poc) % POCN_FDYN_ML computes the forward dynamics of a pendulum o a cart. % Input parameter is a structure poc, which is defined in the % m-script poc_mdlvar.m. % % written by: Michael Schlotter % -------------------------------------------------------------------% methods tspan = [0:0.1:10]; y0 = [0 0.0]; % timespan % initial conditions

% ******************************************************************** function ydot = odesystem(t,y,poc) % This subfunction presents the ode- system to the solver % The mass matrix is state-dependent and is calculated in calc_m. ydot = [y(3); y(4); -poc.SD.b*y(3)+poc.B.m*0.5*poc.B.b*sin(y(2))*y(4)^2-poc.SD.k*y(1); -poc.B.m*poc.g*0.5*poc.B.b*sin(y(2))]; % ******************************************************************** function massmat = calc_m(t,y,poc) % This subfunction calculates the state-dependent mass matrix. massmat = eye(4); massmat(3,3) = poc.A.m+poc.B.m; massmat(3,4) = poc.B.m*0.5*poc.B.b*cos(y(2)); massmat(4,3) = poc.B.m*0.5*poc.B.b*cos(y(2)); massmat(4,4) = poc.B.m*(0.25*poc.B.b^2)+poc.B.I(3,3);

options = odeset(Mass,@calc_m); [t,y] = ode45(@odesystem,tspan,y0,options,poc); output.time = t; output.signals.dimensions = size(y,2); output.signals.values = y; assignin(base,yout_pocn_fkin_ml,output);

Figure 2: Matlab code for forward dynamics.

#### %&

' () +

#### &.

"

Figure 3: Simulink block diagram for forward dynamics.

Figure 4: Simple SimMechanics block diagram for forward dynamics. derived. This however has to be done by hand and is quite cumbersome and error prone. The Physical Modeling environment SimMechanics makes the task much easier. The very simple block diagram of Figure 4 solves the problem without the need to derive any equations. Let us have a closer look at the diagram. Obviously, every block corresponds to one mechanical component. The properties of the blocks can be entered by double-clicking on them. These are for example mass properties, dimensions and orientations for the bodies, the axis of rotation for the rotational joint and the spring/ damper coecients for the Spring & Damper block. The initial conditions are given directly by specifying the initial position and orientations of the rigid bodies. With this model and the visualization facilities of SimMechanics it is possible to animate the motion of the pendulum and the cart. As this model is so simple, it lacks some important features, though. It is not possible to specify nonzero initial conditions for velocities and accelerations, and no data is output to the workspace for further processing. This can be done by adding Sensor blocks and Joint Initial Condition blocks. With their help, a model which is functionally completely equivalent to the one in Figure 3 can be build. It is shown in Figure 5. The Joint Initial Condition blocks let the user dene arbitrary initial conditions, and the Joint Sensor blocks measure the position, velocity, and acceleration of the two independent motion variables. If desired, the forces and torques transmitted by the joints can be sensed, too. Remarkable are the dierent types of connectors between the blocks. It is clearly visible that the input of the Sensor blocks are the special SimMechanics connection lines, while the output are normal Simulink signals which can be multiplexed and transfered to the Matlab workspace.

Figure 5: Complete SimMechanics block diagram for forward dynamics. The results of all models are of course identical. Only the numerical errors dier slightly. The dierences in the computation time are more obvious. As expected, the Matlab code is the fastest, followed by the Simulink model. The simulation with SimMechanics takes longer, because the mathematical model has to be derived by the software before the integration of the ODE system can begin. For such small models, however, computation time is mostly not an issue. More important is the time required to build the model, and in this discipline SimMechanics is unbeaten.

#### 3.3 Visualization

SimMechanics is based on Simulink, and as that, all common options for exporting and plotting data are available. However, graphs like Figure 6 where the response of the system is shown by plotting q1 and q2 over the time t are rather abstract. If only the qualitative motion of a mechanism is of interest, the animation facilities of SimMechanics come into play. Figures 7 and 8 show the automatically generated animation windows if the options equivalent ellipsoids or convex hulls are chosen, respectively. The representation with equivalent ellipses is only sensible, if all bodies have similar inertia dyadics. If one body is exceptionally big, it can be that it covers all others. An example is shown in Figure 9, where the inertia dyadic of the cart IA is multiplied by 100. Unfortunately it is not yet possible to exclude such bodies from visualization.

#### q1 (m), q2 (rad)

q 1 q2

Figure 6: Response of the pendulum.

Figure 7: Animation display with option equivalent ellipsoids.

Figure 8: Animation display with option convex hulls.

Figure 9: Equivalent ellipsoids view with a big body.

Figure 10: Enhanced convex hulls view.

The convex hulls option allows to improve the display by specifying additional xed points on rigid bodies1. Figure 10 shows the result, if several points are added to the example model.

#### 3.4 Inverse Dynamics

In Inverse Dynamics problems, the forces and torques required to let the system move as specied are the unknowns. Mostly, the results can be obtained by solving systems of nonlinear algebraic equations. In this discipline, SimMechanics underlies certain limitations, which becomes clear when looking at the following question. Considered kSD = bSD = 0, and FA = FA A1 , FP1 = FB B1. What are FA (t) and FB (t), if the motion of the mechanism is given by q1 = 1 m/s = const. and q2 = 1 rad/s = const. with the initial conditions q1 (t = 0) = q2 (t = 0) = 0 ? Although the solution can be obtained easily by hand with equations (1) and (2), there is no direct way to compute the forces directly with SimMechanics. To get a model suitable for inverse dynamics, the translational motion of the cart and the rotational motion of the pendulum have to be specied. This can be done with Joint Driver Actuator blocks. With this model, only the forces/ torques transmitted by the joints can be computed a a function of time. That is a force FP which acts on A by the prismatic joint, and a torque TR from A on B, transmitted by the revolute joint. The physically B/A = 0) and that circumstance, that the revolute joint is frictionless (thus E T3 P1 only a force F = FB B1 drives the rotational degree of freedom can not be represented properly2. Mathematically it is not a problem, as the calculated forces and torques can be easily transformed to nally get the desired functions FA (t) and FB (t), as shown in Figure 11. Nevertheless certain limitations of the Physical Modeling approach become obvious.

3.5 Linearization, Trimming

The linearization and trimming functionalities for SimMechanics models are equivalent to traditional Simulink systems. The linmod command derives a

Actually it is not possible to specify points. A workaround is to add coordinate systems xed on the body, whose origins are considered as xed points. 2 It is not stated that it is not possible at all. By designing a closed loop system with additional (massless) bodies, joints, constraints, the problem can probably be solved. From the physical point of view this is even worse than the current solution.

Figure 11: SimMechanics block diagram for inverse dynamics. LTI state space model in the form x(t) = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (3) (4)

where x is the models state vector, y is its outputs, and u is its inputs. The trim command nds solutions for the model that satisfy specied conditions on its inputs, outputs, and states, e.g. equilibrium positions where the system does not move, or steady state solutions where the derivatives of the systems states are zero. In order to use both commands, the initial states of the system have to be specied. The new command mech_stateVectorMgr is of great help, as it can be used to displays the layout of the systems state vector, and the units in which the physical quantities have to be specied. For the forward kinematics model of Figure 5, for example, one gets for the state vector >> v = mech_stateVectorMgr(pocn_fdyn_sm/Ground); >> v.StateNames ans = pocn_fdyn_sm/Revolute:R1:Position pocn_fdyn_sm/Prismatic:P1:Position pocn_fdyn_sm/Revolute:R1:Velocity pocn_fdyn_sm/Prismatic:P1:Velocity

which implies that x = (q2 , q1 , q2 , q1 )T. All models designed for forward dynamics can be linearized. For trimming, to the contrary, one has to enter the Trimming mode. This causes SimMechanics to insert a subsystem into the model in order to deal with the position and motion constraints. Everybody who is familiar with the Simulink linmod and trim commands will have no problems to use them with SimMechanics models. That is why they are not described here further, as this paper concentrates on the novelties introduced with SimMechanics.

#### 3.6 Inverted pendulum

Starting from the forward dynamics model, it is straightforward to implement a classical control problem: the inverted pendulum on a cart. This study completes the example problem, because it shows how mechanical systems can be interfaced with control system models. As in the inverse dynamics problem, it is again assumed that kSD = bSD = 0, and FA = FA A1. On the tip of the rod acts a perturbation force FP1 = FB B1. The block diagram of Figure 12 reveals that the changes which have to be made on the forward dynamics model are minimal. Basically the Spring & Damper block is removed by a Joint Actuator block, and the initial position of the rod is of course changed so that it points upwards. The controllers are simple PD cascade controllers R P P R which implement the control law FA = Kp q1 + Kd q1 + Kp q2 + Kd q2. The linearization facilities in connection with the Control Design Toolbox are a P great help to nd appropriate values for the controller constants. For Kp = 25, R R P Kd = 50, Kp = 500, Kd = 75, where q1 and q1 are measured in meters, and meters per second, and q2 and q2 in radians, and radians per second, respectively, the following commands show that the system is stable for small perturbations, because the eigenvalues of the system matrix are all in the left half plane. >> [A B C D] = linmod(poci_fdyn_pd); >> eig(A) ans = 1.0e+002 * -2.0456 -0.0831 -0.0054 + 0.0053i -0.0054 - 0.0053i This can be veried by plotting the time response of the system for an impulse force FP1 = FB B1 , as shown in Figure 13.

#### ( ! # $

% & !"# "$ % & % '

Figure 12: Interfacing SimMechanics systems with control system models.

1 F1 (N), q1 (m), q210 (rad) 0.8 0.6 0.4 0.4 t (s) 6 8

#### FB q1 q210

Figure 13: Response of the inverted pendulum to a impulse force.

#### 4 Mathematical Aspects

In this section it is examined how SimMechanics works. Some interesting mathematical aspects are addressed, but the underlying algorithms are not described. The interested reader should refer to [Woo03] and the numerous references.

4.1 Equations of Motion for Multibody Systems

Although there are various derivations and formulations of the equations of motion for multibody systems, they can always be written as q = H(q)v M(q)v = f (t, q, v) + HT (q)GT (q, t) g(q, t) = 0 (5) (6) (7)

Equation (5) expresses the kinematic relationship between the derivatives of the conguration variables q and the velocity variables v. In the most sim ple cases H is the identity matrix. The second equation (6) is the motion equation with the positive denite mass matrix M, the acceleration v, the contribution of the centrifugal, Coriolis, and external forces f , and the contribution of reaction forces due to kinematical constraints which is expressed by the last term on the right side. Finally, equation (7) represents kinematical constraints between the conguration variables q. The main problem arising from equations (5)(7) is that they form an index3 dierential algebraic equation3 (DAE) because of the constraints in equation (7). Currently, Simulink is designed to simulate systems described by ODEs and a restricted class of index-1 DAEs, so the multibody dynamics problem is not solvable directly. The structure of the equations of motion depends largely on the choice of coordinates. Many commercial software packages for multibody dynamics use the formulation in absolute coordinates. In this approach, each body is assigned 6 degrees of freedom rst. Then, depending on the interaction of bodies due to joints, etc. suitable constraint equations are formed. This results in a large number of conguration variables and relatively simple constraint equations, but also in a sparse mass matrix M. This sparseness and the uniformity in which the equations of motions are derived is exploited by the software. However, due to the large number of constraint equations, this strategy is not suitable for SimMechanics. It uses relative coordinates. In this approach,

The approach taken by SimMechanics is to dierentiate the constraint equation (7) twice and solve for the Lagrange multiplier. Near singularities of the mechanism, i.e. near points where the number of independent constraint equations in decreased and the solution for is no longer unique, numerical diculties arise. To deal with this problem, the user the choose between two solvers. One, based on Cholesky decomposition (the default), which is generally faster, and one based on QR decomposition, which is more robust in the presence of singularities [Sha94]. The main implication when turning DAEs into ODEs by dierentiating the constraint equations is the numerical drift. Although the acceleration constraints will be fullled, the accumulation of roundo and truncation errors may cause a violation of the position and velocity constraints. Common schemes which address this problem are coordinate partitioning [Dam02], coordinate projection [BT99], and stabilization [ACR94], [ACPR94]. In the coordinate partitioning approach, the Lagrange multiplier is eliminated from analysis, and the variables are split into a independent set which corresponds to the degrees of freedom of the system, and a dependent set, which correspond to the number of kinematic constraints. The minimal set of independent coordinates can be integrated with the ODE solvers, and the dependent coordinates can be found by solving the constraint equations. In practice, it is hard to select the independent coordinates, and the sparsity of the mass matrix is destroyed. These are the reasons, why SimMechanics does not oer this option. Coordinate Projection is used after each time step. The computed solution qn of time-step tn is projected on the invariant manifold qn , given by g(qn , tn ) = 0. This prevents the solution from drifting away. Finally, stabilization is based on adding stabilization parameters to the reduced ODE, which makes it more attractive to the manifold. A major diculty is the selection of the parameters; for many stabilization methods there is no general solution for this problem. Nevertheless, several approaches methods are available which are a good compromise between numerical cost and accuracy. The SimMechanics user has the choice between the last two options. Coordinate projection is more exact, while the stabilization algorithms are faster and suitable for real-time applications. Another aspects which is relevant for cyclic systems is the check for redundant constraints. It is performed once before simulation start. If redundant constraints occur, e.g. because of inconsistent motion drivers, SimMechanics can detect that by examining the numerical rank of the Jacobian G via QR decomposition (basically the same method as the one to detect and handle singularities). If the motion drivers are brought sequentially into analysis, it is even possible to detect the motion drivers which cause inconsistency. If the initial conguration is singular, however, redundant constraints may not be

detected before simulation start. Also at simulation start, the initial conditions are checked for consistency. If a machine with a cyclic topology has to be simulated, the user can either build model with fully dened (possibly inconsistent) initial conditions, or he can use Disassembled Joint blocks which are assembled automatically by SimMechanics. In both ways, the software must be able to compute consistent initial conditions by solving systems of nonlinear equations. This is done with modied robust Gauss-Newton solvers and homotropy continuation solvers. The assembly tolerances can be specied by the user. As already mentioned in Section 2.1, SimMechanics provides a Joint Stiction Actuator block. This block can cause joint locking and therefore discrete topology (or mode) changes. A special feature of mechanical systems is that multiple joints can lock at one instant of time, or that the locking of one joint causes another one to unlock. The detection of such events is done by mode iteration. In this approach, the topology change is introduced, and the system analyzed if the mode change causes any inconsistencies. If that is the case, an iteration is started to nd a mode which is consistent with the applied torques and forces. After the right mode is found, cyclic systems are checked for constraint redundancies (without sequential addition of motion drivers to save computation time), and the integration resumes. Since version 2, SimMechanics can be used for real-time Hardware in the loop (HIL) simulations. A major demand on such models is that they are deterministic, in the sense that the time to integrate one (xed-size) time step must be predictable. Therefore, iterations which can take arbitrary time must be avoided. The consequence is that only the less accurate stabilization methods can be used to avoid numerical drift, and that the mode iteration is not carried out before the simulation resumes, but is spread over multiple time-steps.

4.3 Mathematics of Inverse Dynamics

Most of the aspects discussed in Section 4.2 also apply for inverse dynamics calculations. The dierence is, that in this mode the equations of motion need not be integrated, but solved for the unknown reaction torques and forces, and the torques and forces generated by the constraint drivers. In general, this computation takes less time, as it is only an algebraic problem. Unfortunately, no detailed information about the inverse dynamics solvers used by SimMechanics could be found. It can be assumed, however, that recursive methods similar to CRBM and ABM are used.

4.4 Major Steps of the Dynamical Analysis

This section summarizes the steps carried out by SimMechanics during machine simulation. It is base on Chapter 5 of [Mat02]. 1. Model Validation

Check of data entries in dialog boxes. Validation of body, joint, constraint, driver geometry, and model topology.

2. Machine Initialization

Check of assembly tolerances. Cutting of closed loops, formulation of constraint equations, and check for consistency and redundancy of constraints. Examination of Joint Initial Condition blocks (if any), assembly of disassembled joints, and again check of assembly tolerances. Mode iteration for sticky joints.

#### 3. Analysis

Forward Dynamics/ Trimming modes: Application of external torques and forces. Formulation and integration of the equations of motion and solution for machine motion. Inverse Dynamics/ Kinematics modes: Application of motion constraints, drivers, actuators. Formulation of equations of motion and solution for machine motion and actuator torques and forces. After each time step in all analysis modes: Check of assembly, constraint, and solver tolerances, constraint and driver consistency and joint axis singularities. If stiction is present: Stiction mode iteration, and check for constraint redundancy.

#### 5 Conclusion

In this paper, the Matlab toolbox SimMechanics was introduced, it basic functionalities were shown on an example, and some mathematical aspect were addressed. The nal judgment is very satisfactory. SimMechanics is an interesting and important add-on to the simulation environment Simulink. It allows

to easily include mechanical subsystems into Simulink models, without the need to derive the equations of motion. Especially non-experts will benet from the visualization tools, as they facilitate the modeling and the interpretation of results. SimMechanics is certainly not a replacement for specialized multibody dynamics software packages due to the limitations of the physical modeling approach and the restrictions of the Simulink environment. It is, however, well suited for many practical problems in education and industry, where Matlab became the standard language of technical computing.

#### References

[ACPR94] Uri M. Ascher, Hongsheng Chin, Linda R. Petzold, and Sebastian Reich. Stabilization of constrained mechanical systems with DAEs and invariant manifolds. Technical report, Department of Computer Science, University of British Columbia, Vancouver, Canada, October 1994. ftp://ftp.cs.ubc.ca/ftp/local/ ascher/papers/acpr.ps.gz. [ACR94] Uri M. Ascher, Hongsheng Chin, and Sebastian Reich. Stabilization of DAEs and invariant manifolds. Technical report, Department of Computer Science, University of British Columbia, Vancouver, Canada, November 1994. ftp://ftp.cs.ubc.ca/ftp/local/ ascher/papers/acr.ps.gz. Uri M. Ascher, Dinesh K. Pai, and Benoit P. Cloutier. Forward dynamics, Elimination Methods, and Formulation Stiness in Robot Simulation. Technical report, Department of Computer Science, University of British Columbia, Vancouver, Canada, May 1996. ftp://ftp.cs.ubc.ca/ftp/local/ascher/papers/apc.ps.gz. Claus Bendtsen and Per Grove Thomsen. Numerical Solution of Dierential Algebraic Equations. Technical Report IMM-REP1999-8, Department of Mathematical Modelling, Technical University of Denmark, Lyngby, Denmark, 1999. www.imm.dtu.dk/ documents/ftp/tr99/tr08_99.pdf. Michael Damsgaard. An Introduction to Dynamics of Rigid-Body Systems Draft Version, chapter 4. Institute of Mechanical Engineering, Aalborg University, October 2002. http://www.ime.auc. dk/people/employees/md/LectureNotes.htm.

#### [APC96]

[BT99]

#### [Dam02]

[Mat02] [PAK00]

The MathWorks, Inc. SimMechanics Users Guide, November 2002. http://www.mathworks.com. Dinesh K. Pai, Uri M. Ascher, and Paul G. Kry. Forward Dynamics Algorithms for Multibody Chains and Contact. In Proceedings of the IEEE Conference on Robotics and Automation, 2000. http: //www.cs.ubc.ca/~pai/papers/PaAsKr00.pdf. Michael Schlotter. Dynamical Modeling and Analysis of the Canterbury Satellite Tracker. Project report, University of Canterbury, November 2002. Ahmed A. Shabana. Computational Dynamics. Wiley-Interscience, 1994. Giles D. Wood. Simulating Mechanical Systems in Simulink with SimMechanics. Technical report, The MathWorks, Inc, 2003. http: //www.mathworks.com.

#### [Sch02]

[Sha94] [Woo03]

#### Appendix

A SimMechanics Model of the Canterbury Satellite Tracker

In order to check how good SimMechanics performs with models of real mechanisms, a simplied model of the Canterbury Satellite Tracker has been build. Details about this robot, shown in Figure 14, can be found in [Sch02].

Figure 14: The Canterbury Satellite Tracker. It was impressive to realize, how fast and easy the tracker mechanism could be implemented. Building the original Autolev model required good knowledge about the virtual force method (also known as Kanes method ), and the formulation of conguration and motion constraints was quite dicult. Furthermore the generated calculation routines have often been unstable, and they still have some numerical diculties at certain congurations of the mechanism. In SimMechanics the user does not need to bother about special dynamical methods or the formulation of constraint equations. The software does the job. Even the unsymmetric case4 for which no analytic solution was found yet, was solved by SimMechanics without problems. Another nice feature is that reaction torques and forces in the joints can be sensed easily, which allows to use more advanced friction models, or to optimize the design of the joints. As mentioned in section 3, the physical modeling approach of SimMechanics has some limitations, which require special attention. In this model, the op4

Unsymmetric means that the six clevis arms which connect the lower circle with the upper dish holder may have dierent lengths.

tions to actuate disassembled and spherical joints were missed. Due to this limitation, modeling friction in such joints becomes tricky. However, this toolbox is very new and some features will certainly be added in future releases. Even now, SimMechanics proved to be a very suitable tool for multibody dynamics which allows the design of complex models in a fraction of time compared to other programs. Excerpts of the block diagram for the tracker are shown in Figures 15, 16, and 17.

#### % % %*

& &

#### % &

%* %%. %/

#### ! % &

" #

#### $ '( % )

Figure 15: Top level of the block diagram.

#### ! " " # # $

&'

Figure 16: Implementation of the moving base. Sometimes one has to be a bit exible when selecting joint blocks. The base is certainly not a Bushing, but this block contains all needed functionality.

#### ! " "

Figure 17: One of the three clevis arms. Note that the disassembled joint in the middle cannot be sensed or actuated.

Applied and Computational Mechanics 2 (2008) 235242

NI LabView Matlab SimMechanics Stewart platform design

L. Bezinaa,, O. Andr a, T. Bezinaa r s r

a Faculty of Mechanical Engineering, Brno University of Technology, Technick 2, Brno, Czech Republic a Received 29 August 2008; received in revised form 22 October 2008

Abstract The article deals with approach of using NI Labview and Matlab SimMechanics for the designing of Stewart platform model of dynamics and its control. Matlab SimMechanics was used as a tool for the multi body dynamics modeling of the mechanism. The advantage of working within this computational environment is the possibility of the model linearization at a specied operating point and receiving linear state space model. Another benet is the option of designing of the machine control and also the control simulations may be performed in the same environment. On the other hand NI LabView seems to be better for the real-time control implementation because of the possibility of real-time computer communication and possibility of FPGA chipset direct conguration. NI LabView has also ability to work with Matlab commands, thus possibility of Matlab models importing. Advantages of using both of environments are presented on the example of Stewart platform. The presented approach is quite complex and seems to be suitable for a dynamics modeling and a control designing of mechatronic systems. c 2008 University of West Bohemia in Pilsen. All rights reserved. Keywords: Stewart platform, dynamics, linearization, control

1. Introduction Simulation of dynamics and control design of mechatronic systems are often very complicated tasks. The main problem is to build a model of system dynamics fast enough to be suitable for designing of the control. This is even more challenging in case of parallel kinematic machines where the kinematic structure consists of closed loop kinematic chains. The representative example of parallel kinematic machine is a Stewart (also known as Gough) platform originally designed in the middle fties for testing of tires against wear [5]. Fig. 1 presents an example of a Stewart platform mechanism consisting of a movable platform and six linearly actuated links. In our case the linear actuator consists of a DC motor with a planetary gearbox (part 1), a spur gearing (part 4), actuated screw nut (part 3) and a ball screw (part 2), g. 2. Commonly used methods for the machine dynamics modeling, e.g. [3, 4], are consuming a lot of computational time. Models created by using such methods are inappropriate for the machine control design. Thus models with approximate dynamics [6] or simplied models [7] are often used for that reason. On the other hand control based on simplied mechanism model usually needs some kind of compensation [6]. One of possibilities how to create a model describing a machine dynamics and at the same time model suitable for the control design is the use of linear state space representation of the model. This may be obtained by using multi-body dynamics modeling of the machine in Matlab SimMechanics followed by linearization at a specied operating point.

Corresponding author. Tel.: +143 375, e-mail: ybrezi00@stud.fme.vutbr.cz.

L. Bezina et al. / Applied and Computational Mechanics 2 (2008) 235242 r

#### Fig. 1. Stewart platform

Fig. 2. Single linear actuator

For real-time control implementation seems to be suitable NI LabView with possibility of graphical programming and many other advantages. Among others it is an option of importing Matlab data, thus possibility of importing Matlab linear state space model of the machine. The general approach of using Matlab SimMechanics and NI LabView for the designing of Stewart platform model of dynamics and its control is described in the article. 2. Modeling of the Stewart platform dynamics in Matlab SimMechanics Stewart platform dynamics model was built in Matlab SimMechanics environment which works on the principle of multi body dynamics and it is directly intended for modeling of kinematics and dynamics of various machines. The environment works with block schemes which represent kinematical structure of a machine. The routine is able to work in dynamic mode by assigning of inertia moments and masses to the each body of the modeled machine. It was protable to use information about body inertia moments and body masses from previous engineering design in CAD software [1] in case of the Stewart platform, g. 3.

Fig. 3. Example of body inertia moments and body masses value transfer (from Inventor (right) to Matlab SimMechanics (left))

The model is ready for the simulation of dynamics after creating of a single link subsystem with all joints, bodies, planetary gear and spur gearing, and completing whole Stewart platform model. Inputs of the model are dened as shaft torques of the each motor and outputs are angular position and angular velocity of the each screw nut, g. 4.

Fig. 4. Stewart platform SimMechanics model with six single link subsystems and input/output denition

3. Linearization of the SimMechanics model The model itself is nonlinear and consuming quite lot of computational time thus it is not appropriate for the controller designing. This may be solved by the model linearization which is also possible to implement in Matlab SimMechanics. SimMechanics works with linearization at a specied operating point. There are generally two linearization approaches in SimMechanics block-by-block linearization and linearization by numerical perturbation. Block-by-block linearization works on principle when are linearized single blocks and results are combined to the linearization of the whole system. The advantage is that many blocks contain analytical information for precise linearization. Thus the method is useful in cases when blocks also contain some discontinuities and results obtained by numerical perturbation are not precise. On the other hand linearization by the numerical perturbation linearizes whole system. 237

The method is simple and fast but the disadvantage is that even blocks containing analytical information for the precise linearization are numerically perturbed. From this reason was in our case chosen block-by-block linearization. The operating point for the linearization is chosen as an initial point in which is the platform situated (for the platform radius 0.125 m is the initial distance between base and platform 0.06 m). The point is dened by shaft torques of the each actuator, needed for holding the platform nonmoving in the initial state. The torque value was from the model measured as 0.Nm. The linear state space model of the Stewart platform dened by matrices A, B, C, D is obtained after the linearization. The meaning of these matrices, well known from the state space representation theory, is following: A is the state matrix, B is the input matrix, C is the output matrix and nally D is the feedforward matrix. The received linear model is of the twelve order. It has twelve states automatically chosen by SimMechanics. Nonlinear and linear model comparison proved that the difference in reaction on the same constant input is in the worst case lower than 3 % (in extreme testing conguration, cant be reached with the real device), g. 58. The comparison was performed by simulation where both models were for 5 seconds actuated by constant shaft torques of 0.03 Nm. The state space representation of the model is advantageous because of small requirements on the computational time.

Fig. 5. Output angle of the single screw nut linear and nonlinear model

Fig. 6. Output angular velocity of the single screw nut linear and nonlinear model

Fig. 7. Difference between output (angle) of the linear and nonlinear model

Fig. 8. Difference between output (angular velocity) of the linear and nonlinear model

4. Control design Now the obtained linear model is prepared for the design of the control, which is in detail described in [2]. For the control purposes the nonlinear SimMechanics model had to be completed with six DC motor Simulink models providing single link actuating. Basically the control itself is designed of two layers. Fig. 9 presents higher control layer which synchronizes all six actuators to reach the desired screw nuts angular orientations by specifying shaft torques. The lower control layer presents isolated torque control of each actuator, g. 10. The actuator input is a voltage.

Fig. 9. Higher control layer structure

Fig. 10. Lower control layer structure

The control was designed in Matlab Simulink with use of the linear model. Control preciseness testing simulations were performed with the original nonlinear model. The Stewart platform model was moving with platform gravity center orientation and position according to the desired values during the simulation. Desired time courses of platform gravity center orientation and position are presented in g. 11 and g. 12. During the simulation were mea-

Fig. 11. Desired position of the platform gravity center

Fig. 12. Desired orientation of the platform gravity center

sured errors in orientation and position as well as desired shaft torques and driving voltages, g. 1316. The overall positioning error is for the referential trajectory in the worst case 4.2 %. Measuring of shaft torques and motor driving voltages is necessary for the future examination of the chosen actuator suitability.

Fig. 13. Position errors (X, Y axis left, Z axis right)

Fig. 14. Orientation errors (X, Y, Z axis)

Fig. 15. Shaft torque (single actuator)

Fig. 16. Driving voltage (single actuator)

5. NI LabView implementation The presented control design was remade in NI LabView where is guaranteed communication with a real-time machine for the linear actuator motion control. The real-time machine contains FPGA chipset which can be congured directly from the NI LabView environment. The main advantage of the device is saving of computational time and reliable timing. The linear model for the control design was exported from Matlab to NI LabView. Experiments with real linear actuator for the model verication and feedback correction of the SimMechanics model of dynamics are planned to the near future. 6. Conclusion The presented approach may be used for the designing of dynamic models of complicated mechatronic systems and for designing of their control. The approach was applied on the example of the Stewart platform which is a six degrees of freedom parallel mechanism. Simulation results proved that control designed with use of the linear state space machine model is able to work with better than 4.2 % positioning error. Now the verication on the real machine is planned. Matlab SimMechanics and NI LabView were used for the different phases of the design and also some general advantages of working with these environments were mentioned. Acknowledgements This work is supported from research plan MSM 0021630518 Simulation modelling of mechatronic systems and by the grant project 2E13800123 Stewart platform computational and experimental control verication. References

[1] T. Bezina, Simulation modelling of mechatronics systems II, Brno University of Technology, r Brno, 2006. [2] T. Bezina, L. Bezina, The device for implants testing: The control, Proceedings of the Engineerr r ing mechanics 2008, Svratka, Institute of Thermomechanics, Academy of Sciences of the Czech Republic, 2008, pp. 8489.

L. Bezina et al. / Applied and Computational Mechanics 2 (2008) 235242 r [3] B. Dasgupta, T. S. Mruthyunjaya, Closed form dynamic equations of the general Stewart platform through the Newton-Euler approach, Mechanism and machine theory 34 (7) (1998) 9931 012. [4] J. Gallardo, J. M. Rico, A. Frisoli, D. Checcacci, M. Bergamasco, Dynamics of parallel manipulators by means of screw theory, Mechanism and machine theory 38 (11) (2003) 131. [5] V. E. Gough, S. G. Whitehall, Universal tire test machine, Proceedings of the 9th International Technical Congress of International Federation of Automotive Engineering Societes, London, Institution of Mechanical Engineers, 1962, pp. 117135. [6] S. H. Lee, J. B. Choi, Song, D. W. Ch. Hong, Position control of a Stewart platform using inverse dynamics control with approximate dynamics, Mechatronics 13 (6) (2003) 605619. [7] J. Wang, J. Wu, L. Wang, T. Li, Simplied strategy of the dynamic model of a 6-UPS parallel kinematic machine for real time control, Mechanism and machine theory 42 (9) (2007) 140.

### Tags

1220P KX-TC1801B GT-S8300T M4201C-BAF RW13ebbb BSY600 GR-50 Mobile Cube Nikon F70D DMR-EX95vebs GC-131CW AG-H300 Mk3 DSP-AZ2 CH18-750 Siemens C30 RSA1dhpe Lifebook A530 L-758cine TO PCB WMP54GX CD-RW2000 DSP-AX420 Wixl12 BDP-S360HP UX-60 84 Single Bravo Machine NN-K602 LE-32R86BD Photosmart 385 LHD45ELY6 Desktop MX Motorola V188 EMP-821 Kawai CA5 Prima ABM6 Forerunner 101 Touring ES-TG55G CA-R-pi 182 CDX-GT232 WTD1071K STR-DE935 Mitsubishi M320 TLU-01511C 81920 KR22A E2409HDS WF203ANS CXT90C Hotpoint-ariston LD44 SR224G AFC9002X JS400ATV-2 XL-2004 Juno-D DCD-1440 Sony PS-P Sp-MP366a-1028 Asus N80 SD-200 STR-V333ES PDP-R06FE UF-6300 E 1000 Compaq 800 CD-BA2010H KDL-26V4500 AOM703 HDR-XR350E Singer 66 DTH 8550 Inspiration 4210 Express 3 - 50 Shield M2N-e-SLI UN40C7000 MW872 42PG60D Movie Cube EHD68200P 21P Souls UX-V10 MM-ZB9 Microtower PC HD710 KW-32HDF9 DCT748-4 PS42A416c1D 6900 Zoom 8386 PC MD-MT15H Poulan 2250 GH750 Highlander Vestax Splendid Maxima-2007

manuel d'instructions, Guide de l'utilisateur | Manual de instrucciones, Instrucciones de uso | Bedienungsanleitung, Bedienungsanleitung | Manual de Instruções, guia do usuário | инструкция | návod na použitie, Užívateľská príručka, návod k použití | bruksanvisningen | instrukcja, podręcznik użytkownika | kullanım kılavuzu, Kullanım | kézikönyv, használati útmutató | manuale di istruzioni, istruzioni d'uso | handleiding, gebruikershandleiding

#### Sitemap

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101