# Example 17.18

## 1.1 Purpose

The purpose of this example is to show how relatively easy it is to solve a textbook example in Amesim when compared to the traditional hand-calculations.

## 1.2 Learning Outcome

After following this example, the students will be able to understand the procedure to solve many other similar textbook examples. If desired, they can use this simple procedure to validate the problems from their assignments or projects from class.

## 1.3 Introduction to the Problem

This example is from Chapter 17 – Plane Motion of Rigid Bodies: Energy and Momentum Methods. Some theoretical explanations in this tutorial assumes that the reader has an understanding of some basics of Vector Mechanics.

In this particular example, we have a rigid body – slender rod – positioned in the vertical position as shown in the above image. There is a spring with a spring constant k, one end of which is fixed at point D and the other end is attached to the lower end (C) of the rod. The rod is pivoted at a point B which is along the length of the rod. All the required parameters are provided in the question. The objective of the problem is to calculate the angular velocity of rod after it has rotated through 90 degrees.

## Sketch Mode/Step 1

Whenever we fire up Amesim, we start off in the Sketch mode by default.

Now, from the Library tree on the right side of your screen, find and double-click on the ‘Planar Mechanical’ library.

Then, the Planar Mechanical library will open up and you will be able to see all of its components.

Now, we proceed to sketch our model. To do this, we need bring all the necessary components to our sketch area. We can do this in two ways:

- Drag and drop
- Click on the component once, move your cursor onto the sketch area and place it by clicking again.

You will see a sketch similar to the following image. The numbers on the either side of the component block are its ports. More about ports later.

Follow the same procedure to bring all the necessary components into the sketch area. The following components are required to complete this example:

- 2 x end restraint
- 1 x pivot junction
- 1 x N port body (one port on the left and one port on the right)
- 1 x zero force source
- 1 x zero speed source (from Mechanical library)
- 1 x spring (from Mechanical library)

After you complete importing all the required components to your sketch it should look like this:

Now, we need to make the connections. To do this click near the port of one component to see your cursor turn to a black plus symbol. Now you should be able to see a green dot-dashed line following your cursor. Move your cursor close to the port of the component to which you want to connect your first component until you see a green square appear. Then, click again. Now, both the components are connected together. Follow the same procedure to connect all the components. At the end of it, your sketch should look like this:

You can always drag any component to rearrange your sketch. Note that you cannot rotate or flip (Ctrl + M) your components after making the connections.

Now, our sketch is ready. Using Ctrl+S, save the file to a local drive and make sure that the file name does not have any spaces, and it should also not start with a number. Before we windup our sketch, we need two more supplementary components which are not a part of our problem, but are necessary for our simulation. Those are the assembly component from the Planar mechanical library and the gravity icon from the Mechanical library.

## Sub-model Mode/ Step2

After completing the assembly of our components, the next step in building our model is the Sub-model mode.

After we switch to this mode, we will see that some components get highlighted. This means that those components have multiple sub-models from which we can select one. By selecting different sub-models, we are choosing a more complex mathematical representation of the same component.

We can see the list of sub-models of a particular component by double-clicking on the highlighted component.

Here, we can see that the pivot junction component has two sub-models. Generally, the sub-models are listed in the order of increasing complexity i.e. PLMPIV01 is more complex than PLMPIV00. If we just want all the simplest mathematical models for all the components which have multiple sub-models, we can do so by directly selecting the Premier Sub-model option.

## Parametric Mode/ Step3

Now that we have defined how each component is mathematically represented, the next step is to define the parameters of each component. We do this in the Parametric mode.

Parameters of every component can be seen on the right hand side of the screen, after clicking on the component of interest. In the following image we can see the parameters of the end restraint component. For the problem of interest, we do not change any of these parameters for the end restraint (B) as we want the end restraint to serve as the origin, relative to which we will define the positions of all the components connected to it.

Next, we set the parameters for the pivot junction. Ideally, a pivot should not have any stiffness or damping associated with it. So, to make things simple when we try to validate our simulations with hand-written solutions, it is better to set these parameters to 0. Make sure to do this for both the pivot junctions.

Then, we have to define the parameters of the PLM body-1. Whenever dealing with most of the components in the Planar mechanical library, it is important to visualize these components in a coordinate plane, and the parameters that we set will define their position in that coordinate plane. In the current problem, we have our origin at point B or the connection between the end restraint and the pivot. So, we need to define the positions of the ends A and C of the rod, and also the position of the center of gravity with respect to point B.

The following are the parameters related to the rod in our problem:

As we can see in the table above, there is no change in the x coordinate of any point. This is because the rod is in the vertical position, so all the points on the rod are on the same vertical line. Also, the y coordinate of point C is negative because it is lower than our origin point B.

Following the formula for Moment of inertia of a rod, we can set the parameter ‘moment of inertia around Gz axis'

## Simulation Mode/ Step4

At this stage, we have built our sketch, chose the mathematical representation of the components, and finally defined the parameters of all the components. Next step is to run the simulation.

As soon as we click on the simulation mode button, Amesim compiles the model that we have built and creates a simulation program

If we have built our model correctly, then we will see the ‘Completed’ message after system compilation.

We can change the parameters of our simulation, by clicking on the ‘Run parameters’ button

For the example in consideration, we need not change any of these parameters. Then, we click on the ‘Start simulation’ button to run the model. If we haven’t made any mistakes in building our model, then the simulation will run to 100% without any errors.

## Visualizing Results/ Step5

Now that we have successfully run our simulation without any errors, it is time to visualize and analyze the parameters of interest. The outputs/variables of any component can be seen on the right, bottom corner of the screen.

Because we want the angular velocity of the rod when it has rotated through 90^{o}, we need to plot angular velocity vs angular position.

To do that, first we need to plot the angular velocity and the angular position on the same figure.

In Amesim, plotting any result is as easy as a drag and drop. Click on Body-1 to display its variables. Now, click on ‘absolute angular position’ and drag it on to the sketch and release the mouse button.

Now, we will be able to see a plot of ‘absolute angular position [degree] vs Time [s]’

You can follow the same procedure to plot any variable of any component in your model. Remember that Amesim plots any variable of interest against the axis of time.

Now, follow the same procedure to plot ‘absolute angular velocity’ variable. But, this time, drag and drop on the already existing plot (Plot-1: absolute angular position).

You should get a plot similar to the one below.

At the top right corner of the figure, we have an option which will convert two curves, which are two variables each against time, into a single curve with the two curves plotted against each other. After selecting that option, click anywhere on the figure and you should see the final plot like the image below.

Using the ‘Show XY coordinates’ option, we get a cursor to visualize the Y coordinate at every X coordinate.

Because we need to calculate the angular velocity at angular position = 90^{o}, use the cursor to navigate to the point where ‘x_1’ is 90^{o}.

Then, we can see that the value of angular velocity to be around **11.53 rad/s**

The theoretical solution from the text is **11.52 rad/s**

There is one feature in Amesim which is specific to the Planar mechanical library: PLM-Assembly. In any other library, we can visualize the functioning of our system by building a 3d representation using Amesim’s Animation feature, but the PLM-Assembly block automatically builds the animation using the parameters that we set. You can open the animation by double-clicking on the PLM-Assembly component.

Here, you can see that all the components that we had used to build our model have been represented in the animation.

You can click on the play button on top of the animation window to visualize the functioning of our double pendulum system.

**Example By: Sai Krishna Sumanth Nakka**