This content is specific to Simscape™ Multibody™ First Generation software. First-generation features are slated to be deprecated and should be avoided.
In this section, you learn how to view the swinging steel rod
of the model introduced in the last section using the Simscape
window. Use your saved
spen.mdl model, or use the
mech_spen example model.
Simscape Multibody visualization displays a machine by displaying its bodies. You can display the bodies in two standard ways, by equivalent ellipsoids and by closed surfaces (convex hulls) enveloping the bodies' coordinate systems. This section explains how to visualize your pendulum using either standard body geometry.
You can view the pendulum before you start and, separately, choose to animate it during simulation as well.
The first step is to configure the Configuration Parameters dialog.
On the Simulink® menu bar, open the Simulation menu and select the Configuration Parameters entry. The Configuration Parameters dialog appears. Select the Simscape Multibody subnode, under the Simscape node, at the lower left.
To view the pendulum in its static initial state, select the Display machines after updating diagram check box.
To animate the pendulum visualization while the simulation is running, select the Show animation during simulation check box as well.
Click OK. Select Update Diagram from the Edit menu to open the visualization window.
The information that you use to specify body properties in a Simscape Multibody model is enough to display each body in a standard abstract shape. Without an external body geometry definition, Simscape Multibody visualization does not have enough information to display its full shape.
A rigid body has a unique equivalent ellipsoid, a homogeneous solid ellipsoid with the same inertia tensor.
Because the rod has an axis of symmetry, the x-axis in this case, two of its three generalized radii are equal: ay = az. The generalized radii of the equivalent ellipsoid are ax = = 0.646 m and ay = az = = 1.12 cm.
Each Body coordinate system (CS) has an origin point, and the collection of all these points, in general, defines a volume in space. The minimum outward-bending surface enclosing such a volume is the convex hull of the Body CSs.
You created the pendulum body with only two Body CSs, CG and CS1. The convex hull excludes the CG CS and thus, for the pendulum rod, is just the CS1 origin, a point.
In the Model menu of the visualization window, you can choose how the pendulum or any machine bodies are displayed. In the Body Geometries submenu, choose Convex Hulls or Ellipsoids.
You can access the Simscape Multibody visualization window from any Simscape Multibody model. To open it or to synchronize it at any time with your model, select Update Diagram in your model window's Edit menu.
The displayed figure depends on the body geometry you choose. If you chose Convex Hulls in the Model > Body Geometries menu, a convex hull appears.
Pendulum Rod Displayed as a Convex Hull
You can change the viewpoint and manipulate the image with the controls in the toolbar and menus. Experiment with the Simscape Multibody menu's settings to see various ways of displaying the pendulum.
When you start the model, the body in the graphics window moves in step with the simulation.
To display the pendulum as an equivalent ellipsoid, follow the previous steps, but change the body geometry choice:
Open the Model menu and select Body Geometries.
In the submenu, select Ellipsoids.
The display changes. The equivalent ellipsoid looks like this.
Pendulum Rod Displayed as an Equivalent Ellipsoid
The next tutorial shows how to create, run, and visualize a model for a more complex machine, a four bar mechanism. To configure Ground, Body, and Joint blocks now means repeating and expanding upon the three blocks of the first two tutorials.