User Tools

Site Tools


example_of_matlab_simscape_multibody

Example of Matlab Simscape Multibody

Author: Sangsin Park Email: sangsin80@gmail.com
Date: Last modified on <12/08/18>
Keywords: Matlab Simscape Multibody


The photo above depicts a LEGO pendulum model was created by Solidworks which allows you to simulate its behavior using Matlab Simscape Multibody (formerly SimMechanics). The big picture problems are how to make LEGO parts in Solidworks and how to combine a Solidworks' model with Matlab. This tutorial shows you how to begin Matlab Simscape Multibody with the pendulum model and takes approximately 1 hour to complete.

Make your model

Before starting, I used 'Solidworks 2017' to make a LEGO pendulum model. The resulting model is already shown at the top.

Here is the Solidworks assembly file which I made: lego_test_pendulum.zip .


You need to install Simscape Multibody Link to use your Solidworks model in Matlab and you can download it from the following link:

https://www.mathworks.com/campaigns/offers/download_smlink.html .


Enable the plug-in and Export a Solidworks model

Once you have installed the Simscape Multibody Link plug-in, you must enable it on your SolidWorks application.

First, at the Matlab command prompt, enter smlink_linksw.

>> smlink_linksw

Next, start SolidWorks and in the Tools menu, select Add-Ins.

Finally, in the Add-Ins dialog box, select the Simscape Multibody Link checkbox. A Simscape Multibody Link menu appears in the SolidWorks menu bar when you start or open a CAD assembly.

Now you can export your Solidworks model. In the Tools menu, select Simscape Multibody Link, Export, and Simscape Multibody.

Here is the exporting file: lego_test_pendulum.xml.zip .


Matlab Simscape Multibody

To import the file exported from Solidworks, at the Matlab command prompt, enter the following command.

>> smimport('lego_test_pendulum')

Then, the Matlab Simulink automatically makes a Simulink block diagram such as the following figure without blue boxes. The reasons why I add two blue boxes are to make the pendulum move sinusoidally and to watch joint angle.

To add actuation and sensing to a revolute joint, you can edit the parameters of it. First, set an initial position of the pendulum. Next, in Actuation section, choose “Provided by Input” at Motion field. Lastly, in Sensing section, select the Position checkbox.

Once you run the Simulink block diagrams, you can see a Mechanical Explorers window and the pendulum is moving.

Here is the Simulink file: lego_test_pendulum.slx.zip .


The Results of Matlab Simscape Multibody

A video of the pendulum motion and a joint angle graph regarding its motion are shown as follows.

example_of_matlab_simscape_multibody.txt · Last modified: 2018/12/08 21:40 by sangsinpark