|On this page…|
In this section, you learn how to view the swinging steel rod of the model introduced in the last section using the SimMechanics™ visualization window. Use your saved spen.mdl model, or use the mech_spen example model. If you are using online Help, you can click herehere to open the model.
SimMechanics 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 SimMechanics subnode, under the Simscape node, at the lower left.
To animate the pendulum visualization while the simulation is running, select the Show animation during simulation check box as well.
The information that you use to specify body properties in a SimMechanics model is enough to display each body in a standard abstract shape. Without an external body geometry definition, SimMechanics 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 SimMechanics visualization window from any SimMechanics 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 SimMechanics 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: