OMD for Simulink

Warning: This is an earlier version than found in PyOMD, the same documentation will not apply.
OMD is a multibody dynamics tool for modeling spatial mechanical system. OMD has been embedded in Simulink to leverage the capabilities of this ubiquitous engineering tool. The models which describe the mechanism is defined in Python ( so Python must be installed).

Installation Instructions

  1. Install Simulink
  2. If you don't have a compiler download the latest free Visual C++
  3. Download Python 2.5 if you do not already have it Python Download:
  4. Download the zipped file that contains the example from here: OMD For Simulink Examples Download:
  5. Unzip the examples somewhere on your hard drive. Perhaps in you Matlab working directory, or in My Documents or wherever.
  6. Open Matlab and change the directory to the "OMD4Simulink" directory that was extracted from the zip file. Matlab command: >>cd "path"/OMD4Simulink
  7. If you have not used the "mex" command in the past, type: >>mex -setup
    Specify Visual C++, there might be something else that works, but the compiler that ships with Matlab does not (at least not for me)
  8. Enter the following command at the Matlab Prompt: >> makemex
    This will run a matlab script containing a set of "mex" commands to compile the C++ code that comprises the S-Functions in the examples. If it does not work it could be because Python 2.5 can not be found. If you open the makemex.m file you will see the absolute paths to the include and lib files from python. You should be able to find them on your hard drive is you have the software installed.
    If this step is succesful the following files should have been created:
    • getbodyposition.mexw32
    • omds.mexw32
    • revjointtorque.mexw32
  9. Open either "doublependtest.mdl" or "robottest.mdl".
  10. Start the simulation.

Users Guide

OMD is partially written in Python and definning models is done using a python script. This document describes how each element is defined and includes a set of python commands that defines a model.


Body

Description

Defines a body to be included in the simulation. Bodies have mass and inertia and move in space in response to forces and interactions with other bodies to which they are joined through joints.
The following parameters need to be defined:

Syntax

OMDPYTHONBODY = Body("name", Bool specifiying if body is fixed, mass, inertia)

Example

b1 = Body("body1",False,5,[[1,0,0],[0,1,0],[0,0,1]])
Instantiates a body b1, with the name "body1" (often the same string), which is not fixed, has a mass of 5 and the inertia isthe identity matrix.
The units are left to the user, just be consistent.


Joints

Revolute Joint

Description

Defines a kinematic connection between 2 bodies which only allows those two bodies to rotate relative to each other about a single axis.

Syntax

OMDREVJOINT = JointRev("name",Parent,Child,p2j,j2c,a,theta,omega)
where:

Example

p2j = [0.,0,0]
j2c = [1,0,0.]
a = [0,1,0]
j1rev = JointRev("j1rev",irf,b1,p2j,j2c,a,0,0)

Translational Joint

Description

Defines a kinematic connection between 2 bodies which only allows those two bodies to translate relative to each other along a single axis.

Syntax

OMDTRANSJOINT = JointTrans("name",Parent,Child,p2j,j2c,a,x,xdot)
where:

Example

p2j = [0.,0,0]
j2c = [1,0,0.]
a = [0,1,0]
j1trans = JointRev("j1trans",irf,b1,p2j,j2c,a,0,0)

6DOF Joint

Planer Joint

Spherical Joint

U Joint


Forces

1 Body Force

Description

A force and or torque on a body whose line of action and offset are both definable.

Syntax

f1 = Force1Body("f1",b1,fv,tv,coord)
where:

Example

fv = [0.0,0.0,-9.81]
tv = [0,0,0]
coord = [0,0,0]
f1 = Force1Body("f1",b1,fv,tv,coord)

Revolute Joint Force

Description

Applies torque to a revolute joint, this joint is applied by the parent on the child. The Vector defining the force is applied to a child.
An equal and opposite force is applied to the parent.

Syntax

f3 = ForceRevJnt("f3",j1rev,torque)
where: