Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics   

Running a Demo Model

What the Demo Represents

This demo model uses a few blocks in the library to simulate a simple machine with feedback control. You will see how SimMechanics features build upon standard Simulink features to model a mechanical system.

The demo model simulates a conveyor belt loading mechanism. A simple controller (not shown), with a sensor and an actuator, guides the mechanism with a saturation limit and anti-windup logic for the applied torque. The controller is user-adjustable and sets the stopping point for the pusher.

Conveyor Loader Mechanism

Viewing a Mechanical Drawing of the Conveyor

Click here to open a detailed mechanical drawing of the conveyor.

What the Demo Illustrates

The conveyor mechanism demo illustrates some important SimMechanics features:

Opening the Model

To get started quickly with the conveyor demo model, follow either of these steps:

Opening General SimMechanics Demos

You can open the complete SimMechanics demos list by:

  1. Clicking the Start button on the lower left of the MATLAB desktop.

  2. In the pop-up menu, selecting Simulink, then SimMechanics, and then Demos.

    This opens the SimMechanics demos list in the MATLAB Help browser.

You can locate and select any specific demo entry from the list of models.

Alternatively, you can open the same SimMechanics demos list by entering demo simulink simmechanics or demo('simulink','simmechanics') at the MATLAB command line.

The Block Diagram Model

The block diagram model opens in a model window.

What the Model Contains

Here are some critical features of the model:

Running the Model

You can now run the model as it is when you first open it:

  1. In the Simulation menu, select Configuration Parameters. The Configuration Parameters dialog box appears. Select the Solver node:

    1. The preset Stop time is inf, so the simulation keeps running once you start it. You should leave it at inf and stop the simulation manually the first few times you run it.

      Later you can apply a finite stop time (in seconds) if you want.

    2. Leave the Solver options entries at default values and close the box.

  2. From the Simulation menu, select Start. In Microsoft Windows®, you can also click the Start button in the model window toolbar.

    The measured position of the pusher and the torque applied to maintain that position start and remain essentially constant in the Scope plots. The applied torque is adjusted to maintain the initial pusher position.

  3. To see greater detail at the simulation start, stop the simulation before the time passes 20 seconds and zoom in on the Scope plots.

Modifying the Model

Here is a modification of the demo you can try. It illustrates the simple user-driven controller you can adjust to change the motion of the pusher.

To make these modifications, it is best to close and restart the demo.

Changing the Pusher Reference Position

The Reference Position block is actually a Simulink Slider Gain block (from the Simulink Math Library) and controls where the pusher comes to rest.

You can adjust the Reference Position block to change where the pusher stops:

  1. Open the Reference Position block. You see an adjustable slider to set the position of the pusher's rest point.

  2. Enter values in the Low and High fields to set the lower and upper limits of the allowed slider range. The defaults in this demo are 0 and 0.2, with implied units of meters (m).

  3. Enter a value in the central field to set the pusher stopping point, which you can also adjust by clicking and dragging the slider between the lower and upper limits. The default is 0 (meters).

You can apply changes to the reference position to the simulation in two ways:

Visualizing and Animating the Model

Another modification you can make illustrates a powerful SimMechanics feature, visualization of a mechanism and animation of its simulated motion.

You can visualize and animate the conveyor mechanism by opening the SimMechanics visualization window. This window lets you display the bodies in two standard abstract forms:

Convex Hulls

First try visualizing the conveyor with bodies displayed as convex hulls:

  1. From the Simulation menu, select Configuration Parameters. The Configuration Parameters dialog box appears.

  2. Select the SimMechanics node. In the Visualization area, select the Display machines after updating diagram and Show animation during simulation check boxes.

  3. Leave the other defaults as they are and close the dialog. From the Edit menu, select Update Diagram.

    A SimMechanics visualization window appears, displaying the conveyor at rest in its initial state.

    The bodies are displayed in the default geometry, as convex hulls. The bodies and Body coordinate system axis triads are also displayed as defaults.

  4. Change Reference Position to a nonzero value such as 0.1 or 0.2.

  5. Restart the simulation. The window animates the conveyor in motion. You can compare this motion to the plots in the scope.

  6. Click a body in the visualization window. In the model window, the corresponding Body block is highlighted in red. The block name appears at the lower left of the visualization window.

  7. Examine the visualization window menus and tool bar.

    Here, you can reconfigure the display properties: bodies, Body CS axis triads, colored fill-in body surface patches connecting Body CSs on the same body, and user viewpoint orientation.

  8. Leave the visualization window open for the next set of steps.

Equivalent ellipsoids

Now visualize the conveyor with bodies displayed as ellipsoids:

  1. From the Model menu in the menu bar, select Body Geometries > Ellipsoids, so that a check mark appears beside the menu entry.

    The display in the visualization window changes. The conveyor appears at rest in its initial state but with the bodies displayed as equivalent ellipsoids.

  2. Restart the simulation. The viewer now animates the conveyor in motion.

  3. Use the menus to experiment with the visualization settings. The toolbar contains most of these functions as well.

  4. While the animation is running, open the Reference Position block and move the slider up and down. In addition to what you can see in the Scope plots, the window directly animates the pusher trajectory in space as the mechanism responds to your adjustment.

Viewing a Conveyor Animation

If you are connected to the Internet, have an AVI-compatible media streaming application installed on your system, and want to play a recorded animation of this system:

  1. Click the following link. When the download dialog opens, choose Save to file and specify a file name and location on your system.

  2. Click OK to save the AVI file to your system.

  3. Once the downloading is complete, start the AVI animation on your system.

If you do not have an AVI-compatible application, consider using the MATLAB aviread and movie commands instead.

This is a compressed AVI recording, which requires that you have the Indeo 5 video codec installed to decompress and play.

Download animation

The animation shows the conveyor mechanism pulled back and forth by the motion of the slider control. The animation steps through the predefined viewpoints to show different perspectives on the mechanism.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS