Getting Started Using ADAMS/Controls

About this Guide 3
Learning the Basics 5 Introducing and Starting the Tutorials 11 Learning ADAMS/Controls with EASY5 27 Learning ADAMS/Controls with MATLAB 47 Learning ADAMS/Controls with MATRIXx 63 Setting Simulation Parameters 85

2

Getting Started Using ADAMS/Controls Copyright

U.S. Government Restricted Rights: If the Software and Documentation are provided in connection with a government contract, then they are provided with RESTRICTED RIGHTS. Use, duplication or disclosure is subject to restrictions stated in paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at 252.227-7013. Mechanical Dynamics, Incorporated, 2301 Commonwealth Blvd., Ann Arbor, Michigan 48105. The information in this document is furnished for informational use only, may be revised from time to time, and should not be construed as a commitment by Mechanical Dynamics, Incorporated. Mechanical Dynamics, Incorporated, assumes no responsibility or liability for any errors or inaccuracies that may appear in this document. This document contains proprietary and copyrighted information. Mechanical Dynamics, Incorporated permits licensees of ADAMS® software products to print out or copy this document or portions thereof solely for internal use in connection with the licensed software. No part of this document may be copied for any other purpose or distributed or translated into any other language without the prior written permission of Mechanical Dynamics, Incorporated. ©2000 by Mechanical Dynamics, Incorporated. All rights reserved. Printed in the United States of America. ADAMS ® is a registered United States trademark of Mechanical Dynamics, Incorporated. All other product names are trademarks of their respective companies.

Part number: 110CTRLGS-01

Getting Started Using ADAMS/Controls About this Guide

3

About this Guide
Welcome to ADAMS/Controls
ADAMS/Controls™ is an add-on module to MDI’s ADAMS/View or ADAMS/Solver that helps you add sophisticated controls to your ADAMS model. ADAMS/Controls lets you connect your ADAMS model to block diagrams that you’ve developed with control applications such as EASY5, MATLAB, or MATRIXX. ADAMS/Controls offers you the option of simulating your combined mechanical system and controller through the control application environment or through ADAMS/Solver. ADAMS/Controls also lets you interactively view the simulation results in ADAMS/View.

What You Need to Know
This guide assumes that you know how to run ADAMS/View or ADAMS/Solver. It also assumes that you have a moderate level of proficiency with one of the controls packages with which ADAMS has an interface. These include: EASY5, MATLAB, or MATRIXX. To use ADAMS/Controls, you need access to one of these controls packages so that you can prepare a controls block diagram, add it to your mechanical model, and simulate the combined system. For information on ADAMS/View or ADAMS/Solver, or for information on other MDI products, see the online Documentation Roadmap.

4

Getting Started Using ADAMS/Controls About this Guide

1

Learning the Basics

Overview
ADAMS/Controls helps you connect your ADAMS mechanical system models to block diagrams developed with EASY5, MATLAB, or MATRIXX. This chapter introduces you to ADAMS/Controls and the basics of its interface features. It contains the following sections:
s s

How You Benefit from Using ADAMS/Controls, 6 How to Improve the Design Process with ADAMS/Controls, 6 Ways in Which You Can Use ADAMS/Controls, 8 About the ADAMS/Controls Four-Step Process, 9 How to Learn ADAMS/Controls, 10

s s s

6

Getting Started Using ADAMS/Controls Learning the Basics

How You Benefit from Using ADAMS/Controls
By combining mechanical system simulation tools and controls design tools, you can:
s

Add sophisticated controls to an ADAMS model and simulate the combined system. Generate mechanical system simulation models directly from your ADAMS data without having to write equations. Analyze the results of your simulation in the ADAMS environment or the control application environment.

s

s

How to Improve the Design Process with ADAMS/Controls
In the typical design process of a mechanical system with controls, the mechanical designer and the controls designer work from the same concept, but use different sets of software tools. The result is that each designer produces a model for the same problem. Each design is then subject to verification and testing, and the first time the two designs are brought together is during physical prototype testing. If a problem occurs during the interaction between the controls design and the mechanical design, the engineers must refine the control design, the mechanical design, or both, and then go through the entire verification process again as shown in Figure 1 on page 7.

Getting Started Using ADAMS/Controls Learning the Basics

7

Figure 1. Design Process Before ADAMS/Controls

With ADAMS/Controls, the two designers can share the same mechanical model. They can also verify from one database the combined effects of a control system on a nonlinear, non-rigid model. The physical testing process is greatly simplified, and the risk of having a control law that is developed for the wrong mechanical model is eliminated as you can see in Figure 2 on page 8.

8

Getting Started Using ADAMS/Controls Learning the Basics

Figure 2. Improved Design Process with ADAMS/Controls

Ways in Which You Can Use ADAMS/Controls
You can use ADAMS/Controls with either ADAMS/View or ADAMS/Solver. The simulation method you choose, interactive or batch, determines which application you use.
s

ADAMS/View - By using ADAMS/Controls with ADAMS/View, you can animate your model and view the effects of the control system and any structural modifications you make. This is the application you use if you are running an interactive simulation. ADAMS/Solver - For faster simulation results, you can run ADAMS/Controls directly with ADAMS/Solver, MDI’s powerful analysis engine. This is the application you use if you are running a simulation in batch mode.

s

Getting Started Using ADAMS/Controls Learning the Basics

9

About the ADAMS/Controls Four-Step Process
The diagram in Figure 3 describes the four-step process of combining controls with a mechanical system. The tutorials in this guide walk you through the detailed procedures for each step.
Figure 3. ADAMS/Controls Four-Step Process

Step One:
Build the ADAMS model.

Step Two:
Identify the ADAMS inputs and outputs.

Step Three:
Build the control system block diagram.

Step Four:
Simulate the model.

s

Step One: Build the Model - The first step in working with ADAMS/Controls is to build or import an ADAMS model. The model should be complete and include all necessary geometry, constraints, forces, and measures.
s

Step Two: Identify the ADAMS Inputs and Outputs - Define the inputs and outputs through the information or startup file in ADAMS/View or ADAMS/Solver. The outputs describe the variables that go through the controls application (the output from ADAMS/Controls is the input to the controls application). The inputs describe the variables that come back into ADAMS (the output of the controls application) and, therefore, complete a closed loop between ADAMS and the controls application. All inputs and outputs must be set up as variables.

10

Getting Started Using ADAMS/Controls Learning the Basics

ADAMS Input

ADAMS/View ADAMS Output or ADAMS/Solver Controls Application

Controls Output

Controls Input

s

Step Three: Build the Block Diagram - Build the control system block diagram with one of the following applications: EASY5, MATLAB, or MATRIXX. Include the ADAMS plant block in your diagram. Step Four: Simulate the Model - Simulate the combined mechanical model and control system. Several different methods are available to run your simulation.

s

How to Learn ADAMS/Controls
This guide introduces you to the most basic concepts of Using ADAMS/Controls through a series of tutorials. You begin learning ADAMS/Controls with Chapter 2, Introducing and Starting the Tutorials. This material explains the basics of the ADAMS side of the ADAMS/Controls interface. After you complete Chapter 2, you continue with the tutorial that is associated with the specific controls application you are using, including EASY5, MATLAB, or MATRIXX.

2

Introducing and Starting the Tutorials

Overview
This chapter starts you off on the process of adding controls to your ADAMS model. Following this chapter are three different tutorials, one for each of the controls applications you can use with ADAMS/Controls: EASY5, MATLAB, or MATRIXX. After you finish this chapter, continue with the tutorial that is specific to the controls application you are using. This chapter contains the following sections:
s s s s s

About the Tutorial, 12 How You’ll Learn ADAMS/Controls, 12 Starting ADAMS/Controls, 13 Step One - Importing the ADAMS Model, 14 Step Two - Identifying the ADAMS Inputs and Outputs, 17

Note: Before doing these tutorials, you should be familiar with

the basic features of the ADAMS/View interface. See the Learning ADAMS/View Basics guide, for information about the ADAMS/View interface.

12

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

About the Tutorial
The tutorials in this guide give you an overview of the four-step process of adding controls to an ADAMS model. This chapter covers Steps One and Two of the process in depth. You’ll learn how to:
s s

Import an ADAMS model and run a trial simulation with ADAMS/View. Use the ADAMS/Controls interface features to identify forces, motions, and sensors on your mechanical model.

Steps Three and Four are covered in the chapters that follow for each controls application.

How You’ll Learn ADAMS/Controls
By following the tutorials in this guide, you’ll apply the four-step process of using ADAMS/Controls on a simple antenna-pointing problem. The objective of the problem is to add a control system to the antenna that will move the antenna along a defined path to track a satellite signal. For this tutorial, you will supply the torque that pivots the antenna in the azimuthal (horizontal) direction. The torque level will be computed by a control system, based on the error between the actual antenna position and the desired antenna position. This is more realistic than attaching an ADAMS motion to the pivot and driving the motion directly. By applying a torque, you can look at issues related to motor size in an actual mechanical system.

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

13

Starting ADAMS/Controls
You’ll start the tutorial by launching ADAMS/Controls through ADAMS/View. In UNIX, you’ll launch ADAMS/Controls from the ADAMS Toolbar. From Windows, you’ll start ADAMS/Controls from the Start menu.
To start ADAMS/Controls and create your database in UNIX: 1

At the command prompt, enter the command to start the ADAMS Toolbar, and then press Enter. The standard command that MDI provides is adamsxxx, where xxx is the version number, for example adams11.0. The ADAMS Toolbar appears.

2

Select the ADAMS/Controls tool

.

The ADAMS/Controls main window appears. You are now ready to begin the ADAMS/Controls tutorial. For more information on the ADAMS Toolbar, see the guide, Running and Configuring ADAMS on UNIX.
To start ADAMS/Controls and create your database in Windows:
s

From the Start menu, point to Programs, point to ADAMS 11.0, point to AControls, and then select ADAMS - Controls. The ADAMS/Controls main window appears. Do not close this window. You are now ready to begin the ADAMS/Controls tutorial. For more information on running ADAMS products from the Start menu, see the guide, Running ADAMS on Windows.

14

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

Step One - Importing the ADAMS Model
Now you’ll import an ADAMS model and familiarize yourself with its construction by following the next three sections:
s s s

Importing the ADAMS Model, 14 Familiarizing Yourself with the Model, 15 Running a Trial Simulation, 16

Importing the ADAMS Model
In this section, you’ll import install_dir/controls/examples/antenna/antenna.cmd, where install_dir is the directory in which ADAMS is installed. The file antenna.cmd contains the completed model of the antenna.
To import the ADAMS model: 1 2

Copy all of the files in install_dir/controls/examples/antenna to a new directory. In the Start In text box on the ADAMS/Controls welcome screen, enter the name of your new directory (the one created in Step 1). This sets your new directory as your working directory.

3 4 5

Select Close to close the ADAMS/Controls welcome screen and open ADAMS/View. In ADAMS/View, from the File menu, select Import. Right-click the File to Read text box, and then select Browse. The File Selection dialog box appears.

6 7

Select the file antenna.cmd. Select OK. This file contains a model called main_olt. An antenna model like the one shown in Figure 4 on page 15 appears.

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

15

8

Wait for the model to load and then select Render from the Main Toolbox to change the display of the antenna from a line drawing into a shaded, threedimensional image.
Figure 4. Shaded Model of Antenna

Elevation bearings

Antenna

Antenna support

Plate

Azimuth rotor

Reduction gear

Familiarizing Yourself with the Model
This model is designed so that its base turns in the azimuthal (horizontal) direction and its antenna moves in the vertical direction.
To familiarize yourself with the model, locate the following components:
s s s s s s

Azimuth rotor (peach) tied by revolute joint to ground. Azimuth reduction gear (sky blue) tied by revolute joint to ground. Azimuth plate (magenta) tied by revolute joint to ground. Antenna support (silver) tied by fixed joint to plate. Elevation bearings (peach) tied by fixed joint to support. Antenna (sky blue) tied by revolute joint to bearings.

16

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

Running a Trial Simulation
To run a trial simulation with ADAMS/View: 1 2

From the Main toolbox, select the Simulate tool

.

Enter the following in the Simulation container of the Main toolbox:
x x

In the End Time text box, enter 0.5 seconds. In the Steps text box, enter 250.

3

Select the Static Equilibrium tool static position of the model. Select the Simulation Start tool .

to equalize the applied forces and locate the

4

The base of the mechanism turns counterclockwise as the antenna moves up and down. If the base doesn’t turn in the current configuration, see Deactivating the Motion.
Deactivating the Motion

Now that you know the model is working properly, you can begin the process of adding a control system to it. The first step is to deactivate the azimuthal motion on the model. When the model is deactivated, the joint .main_olt.azimuth_actuator applies a torque based on values that the the Controls system package predetermines.
To deactivate the motion: 1

From the Edit menu, select Deactivate. The Database Navigator appears.

2

Double-click the model main_olt. A list of parts and motions appears.

3 4

Scroll down the list and select azimuth_motion_csd. Select OK. ADAMS/View deactivates the motion.

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

17

5 6

Select the Reset to Start tool Rerun the simulation.

to reset the simulation back to its first frame.

Now that you’ve deactivated the azimuthal motion, the antenna moves laterally, but it does not move horizontally as it did during the last simulation.
Note: You might detect some small movement in the azimuthal direction because the

model has no constraints or restoring forces to control its natural movement. You should also notice that the flex to the antenna support beam increases when the azimuthal motion is deactivated. The flexing illustrates that a certain amount of coupling takes place between the elevation and azimuthal movements.

Step Two - Identifying the ADAMS Inputs and Outputs
Now you’ll identify the inputs and outputs on the ADAMS model by:
s s s s s s

Identifying the Path of ADAMS Inputs and Outputs, 18 Verifying Input Variables, 19 Verifying Input Functions, 21 Verifying Output Functions, 22 Defining Input Variables, 23 Defining Output Variables, 24

18

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

Identifying the Path of ADAMS Inputs and Outputs
Figure 5 indicates the path of the input and output variables to and from the antenna model

and its control system. This diagram shows that when you supply an input control torque to the antenna model, you receive controller outputs of azimuth_position and rotor_velocity. The circular path allows you to:
s s

Define the input and output variables in ADAMS/View. Read in the variables with EASY5, MATLAB, or MATRIXX and run a simulation. Animate and plot the simulation results in ADAMS/View. Modify the variables and repeat this process as necessary.
Figure 5. Terminology for ADAMS Inputs and Outputs

s s

Input = control _torque

ADAMS model Control system

Output = azimuth_position and rotor_velocity

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

19

Verifying Input Variables
ADAMS/Controls and controls applications such as EASY5, MATLAB, and MATRIXX communicate by passing state variables back and forth. Therefore, you must connect your model’s input and output variables (and the functions that those inputs and outputs reference) to a set of state variables. This step has already been done for you in the antenna model that you imported. When you create your own model, you will have to define the state variables and their corresponding input or output variables. For this tutorial, you will verify that the state variables on the antenna model and control system correspond to the correct input and output variables.
To verify the input variables: 1

From the Build menu, point to System Elements, point to State Variable, and then select Modify. The Database Navigator appears.

2

Double-click the model main_olt. The list of ADAMS variables appears.
Figure 6. List of ADAMS Variables

3

Select control_torque.

20

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

4

Select OK. The Modify State Variable dialog box appears.
Figure 7. Modify State Variable Dialog Box

5

Look in the F(time, ...)= text box and verify that the run-time function for the input variable, control_torque, is 0.0. Because the control torque is defined to get its value from the control application, the 0.0 will be overwritten during each step of the simulation.

6

Select Cancel to close the Modify State Variable dialog box. selection of the model.

Note: After you close the box, click in the background of the screen to clear the

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

21

Verifying Input Functions
Now you’ll verify the function that is referenced to the input variable.
To verify the function that is referenced to the input variable, control_torque: 1

From the Edit menu, select Modify. The Database Navigator appears.

2

Double-click main_olt, and then double-click azimuth_actuator (azimuth_actuator is the name of the control torque). The Modify a Torque dialog box appears.
Figure 8. Modify a Torque Dialog Box

3

Look in the F(time, ...)= text box and verify that the run-time function for the input variable reads: VARVAL(.main_olt.control_torque). of the given variable. Notice that the function is defined as the value of the control_torque variable. In other words, the input control torque (azimuth_actuator) gets its value from the input variable.

Note: VARVAL (short for variable value) is the ADAMS function that returns the value

22

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

Verifying Output Functions
Now you’ll verify the output functions just as you verified the input functions in the previous section.
To verify the output functions: 1

From the Build menu, point to System Elements, point to State Variable, and then select Modify. The Variable Selection dialog box appears.

2

Double-click the model main_olt. The list of ADAMS variables appears.

3 4

Select azimuth_position. Select OK. The Modify State Variable dialog box appears.
Figure 9. Modify State Variable Dialog Box

5

Look in the F(time, ...)= text box to verify that the run-time function for the output variable is AZ(.main_olt.bearings.MAR70, .main_olt.ground.MAR.26). This function returns the angle about the z-axis, the axis about which the given object moves. Therefore, the function assigns the rotating position of the antenna to the output state variable.

6

Select Cancel to close the Modify State Variable dialog box.

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

23

7

From the Build menu, point to System Elements, point to State Variable, and then select Modify. The Variable Selection dialog box appears.

8

Double-click the model main_olt. The list of ADAMS variables appears.

9 10

Select rotor_velocity. Select OK. The Modify State Variable dialog box appears.

11

Look at the F(time, ...)= text box and verify the run-time function for the output variable is WZ(.main_olt.rotor.MAR21, .main_olt.ground.MAR22, .main_olt.ground.MAR22).

This function measures the rotational velocity of the given object.

Defining Input Variables
To define the input variables: 1

From the Controls menu, select Plant Export. The ADAMS/Controls Plant Export dialog box appears.
Figure 10. ADAMS/Controls Plant Export Dialog Box

24

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

2

Right-click the Input Variables text box, point to ADAMS_Variable, and then select Browse. The Database Navigator appears.

3 4

Select control_torque. Select OK.

Defining Output Variables
To define the output variables: 1

Right-click the Output_Variables text box, point to ADAMS_Variable, and then select Browse. The Database Navigator appears.

2 3 4 5 6

Select rotor_velocity and azimuth_position, holding down the Ctrl key as you click the mouse. Select OK. In the File Prefix text box, type ant_test for the filename. Right-click the Csd Package text box, and then select the controls application you are using during this session: Matlab or MATRIXx_and_EASY5. Select OK. ADAMS/Controls saves the input and output information in a .m or .inf file (.m for MATLAB or .inf for MATRIXX and EASY5). It also generates a command file (.cmd) and a dataset file (.adm) that are used during the simulation process. ADAMS/Controls setup is complete after the plant has been exported. Now you will go to the specific Controls application (EASY5, MATLAB, or MATRIXX) and complete the link between the Controls and mechanical systems.

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

25

Note: You have now finished the introduction to the ADAMS/Controls tutorials. To

continue learning the ADAMS/Controls interface, go to the tutorials that follow this section. If you are using:
s s s

EASY5, go to Chapter 3, Learning ADAMS/Controls with EASY5. MATLAB, go to Chapter 4, Learning ADAMS/Controls with MATLAB. MATRIXx, go to Chapter 5, Learning ADAMS/Controls with MATRIXx.

26

Getting Started Using ADAMS/Controls Introducing and Starting the Tutorials

3

Learning ADAMS/Controls with EASY5

Overview
This chapter teaches you how to use ADAMS/Controls with EASY5. It contains the following sections:
s s

About the Tutorial, 28 Step Three - Adding Controls to the ADAMS Block Diagram, 28 Step Four - Simulating the Model, 36

s

Note: Before beginning this tutorial, you should have finished Chapter 2, Introducing and Starting the Tutorials.

28

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

About the Tutorial
This chapter provides you with procedures for using ADAMS/Controls with EASY5. It teaches you Steps Three and Four of the four-step process of adding controls to an ADAMS model. You’ll learn how to:
s s s

Specify the control algorithms in your system using EASY5. Simulate an ADAMS model with a complex control system. Plot simulation results.

Step Three - Adding Controls to the ADAMS Block Diagram
You will add controls to the ADAMS block diagrams by:
s s s

Starting EASY5, 28 Creating the ADAMS Interface Block, 29 Constructing the Controls System Block Diagram, 34

Starting EASY5
To start EASY5:
s

Start EASY5 on your system from the directory that contains the file with the antenna example. This is the working directory that you created in Step One Importing the ADAMS Model on page 14. The EASY5 main window appears.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

29

Creating the ADAMS Interface Block
You create the ADAMS interface block by defining its component parts in the Add Components dialog box. After you define the component parts, you place the block in the work space area of the EASY5 main window.
To create the ADAMS interface block: 1

From the EASY5 toolbar, select Add or type Ctrl+A. The Add Components window appears.
Figure 11. Add Components Window

30

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

2

Select a category for each of the component fields in the window.
s s s

Under Opened libraries, select Extensions. Under Extension Groups, select ADAMS/Controls Extension. Under ADAMS/Controls Extension, select ADAMS Nonlinear Block. The information you supply in these fields becomes part of the ADAMS interface block.

3

Move the cursor to the center of the EASY5 main window and click. The ADAMS interface block appears. You build the controls block diagram by adding elements to this block.
ADAMS Nonlinear Block

Initializing the ADAMS Interface Block
To initialize the ADAMS interface block: 1

Use the middle mouse button to click the ADAMS interface block (for a two-button mouse, click the right and left buttons simultaneously). The Component Data Table appears.
Figure 12. Component Data Table

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

31

2

Select Spawn ADAMS Interface on the lower right corner of the Component Data Table. The ADAMS Interface dialog box appears (see Figure 13 on page 31).

3

At the prompt, enter the following information:
s

For information file name, enter ant_test.inf, which is the name of the file generated during the Plant Export from ADAMS/Controls, and press Enter. For number of independent states, enter 14, and press Enter. This number initializes the EASY5 integrator to accommodate space for 14 ADAMS states in continuous mode. The ADAMS Interface dialog box appears.
Figure 13. ADAMS Interface Dialog Box

s

Three simulation methods are available:
s s s

Option 1: Function evaluation mode with no feed-through Option 2: Function evaluation mode with feed-through Option 3: Co-simulation mode discrete simulation method. For information on choosing a simulation method, see Choosing a Simulation Method on page 86. If you’ve linearized a nonlinear ADAMS model and represented it as A, B, C, and D matrices and the matrix D is zero at all times, then there is no feed-through from the input variables to the output variables. If the matrix D is not zero at all times, then there is feed-through from the input variables to the output variables.

Note: Options 1 and 2 are continuous simulation methods and option 3 is a

32

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

4

For this example, enter option 3 to select the co-simulation method. The ADAMS Interface dialog box closes, and the Component Data Table now looks like Figure 14:
Figure 14. Component Data Table

5

In the Component Data Table, do the following:
a

Enter a value for the following input modes:
s

For ANI_MOD, enter 1 to define interactive mode as the animation mode. For more details about animation modes, see the section, Choosing an Animation Option on page 87. For OUT_RAT (output rate interval), enter .001. conditions of the ADAMS model.
If the USE_ICS flag is set to 1, the model uses the ADAMS initial conditions, which is the default. If the flag is set to 0, the model relies on EASY5 to provide the initial conditions. For example, if you need to start a simulation from the end of the last run simulation, which is stored on EASY5, set the USE_ICS flag to 0.

s

Note: Do not change the USE_ICS flag. This flag determines how to set the initial

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

33

b

Select Info from the lower left corner of the Component Data Table.
The Component Information Page appears as shown in Figure 15. This page displays an overview of the ADAMS nonlinear block extension components.

c

Review the information on this page to ensure that you entered the correct values in the Component Data Table. Select Close to close the Component Information Page.
Figure 15. Component Information Page

34

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

6

Return to the Component Data Table and do the following:
a

Place the cursor on the input name U1 and click the middle mouse button.
The information line at the bottom of the EASY5 main window displays the input name as control_torque.

b

Click on the other output names, Y1 and Y2, and see that the output names read rotor_velocity and azimuth_position, respectively, and then select OK. The ADAMS block is now initialized for use with the antenna model.

Constructing the Controls System Block Diagram
The completed block diagram is in the file, antenna.mf.0, in the examples directory. To save time, you can read in this diagram instead of building it.
To construct the controls system block diagram: 1 2 3

Review the controls block diagram in Figure 16. Begin recreating the diagram with the blocks from the Add Components menu. Place the Step Function Generator block in the diagram first. Click on the Step Function Generator block using the middle mouse button. The Component Data Table appears.

4

Set the step time (TO) to .01 and the step value (STP) to 0.3, and then select OK.
Figure 16. Controls Block Diagram

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

35

5

Connect the input blocks by clicking once on the First Order Lag block and then on the ADAMS Nonlinear Block. EASY5 labels this connection as S2 LA11.

6

Connect the output blocks in the diagram by clicking on the ADAMS Nonlinear Block and then on the Summing Junction block. Be sure to connect the azimuth+position output (Y2) to the first Summing Junction block (LA) and the rotor_velocity output (Y1) to the second Summing Junction block (LA11). Connect the Strip Chart to the ADAMS Nonlinear Block. Be sure to connect only the Y1 output to the Strip Chart. The Y1 output corresponds to the rotor-velocity signal from the ADAMS Nonlinear Block.

7

8

Click the Strip Chart using the middle mouse button to display the Component Data Table. Set the sample period TAU to .001, and then select OK.
Note: You must edit the connection from the ADAMS Nonlinear Block to the Strip Chart because EASY5 automatically connects the state vector from the ADAMS block to the display variable on the Strip Chart.

9

From the File menu, select Save As, and then enter a file name for your controls block diagram. You have now created the controls block diagram.

36

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

Step Four - Simulating the Model
You’ll simulate your mechanical model and controls system by:
s s s s s

Building the Executable, 36 Executing the Simulation, 36 Pausing and Stepping Through the Simulation, 40 Plotting from EASY5, 41 Plotting from ADAMS/View, 43

Building the Executable
You must build an executable for your model before you execute a simulation in EASY5.
To build the executable:
s

In EASY5, from the Build menu, select Create Executable. After a few moments, EASY5 displays the message, Executable has been
created, at the bottom of the main window.

You are now ready to execute the simulation.

Executing the Simulation
To execute the simulation from EASY5: 1

From the toolbar at the top of the EASY5 main window, point to Analysis, point to Nonlinear, and then select Simulation. The Simulation Data Form window appears.

2

For the Plot Results option, select Yes. The Show-Edit Plot Variables button appears.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

37

3

Select Show-Edit Plot Variables. A Plot Specification Form appears where you define the variables that you want to plot after the simulation.
Note: If you are using the completed block diagram from the file, antenna.mf.0, that was provided for you in the examples directory, you may find that the

Plot Specification Form opens with information that is unnecessary for this tutorial. To remove the information, select Select All on the bottom of the Plot Specification Form, and then select Delete. The Plot Specification Form should look like the one shown in Figure 17.
Figure 17. Plot Specification Form

38

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

4

Select the variables that you want to plot for the simulation. For this tutorial, you will select three variables: Y1, Y2, and S2 LA11.
a

Click in the column next to number 1.
A box appears.

b

Select Show Name List.
The Pick Dialog box appears.

c d

Select the variable Y1. Repeat this procedure for a second and third variable. For the second variable, select Y2, and for the third, select S2 LA11 (the input to the ADAMS block as indicated in Figure 16).

The finished Plot Specification Form should look like the one in Figure 18.
Figure 18. Plot Specification Form

s

Select OK.

The Plot Specification Form closes.
5

Return to the Simulation Data Form window and specify the following simulation parameters:
s s s s

For Start Time, enter 0.0. For Stop Time, enter .25. For Time Increment, enter .001. For Integration Method, enter BCS Gear.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

39

6

Select Execute and Close to begin the simulation. For more information about the simulation settings, see the EASY5 manual. A new ADAMS/View window appears and the analysis begins on the model specified in the ADAMS block. ADAMS/View displays the analysis for you.

To run an interactive simulation: 1

As the simulation begins, arrange the windows so that you have a good vantage point to view the antenna model.
Note: The ADAMS model is initialized to the current simulation time in EASY5.

2

Start and pause the simulation by selecting Continue and Break on the interactive plot window. ADAMS/View accepts the control inputs from EASY5 and the model moves in response to them. ADAMS/View then provides the azimuthal position and rotor velocity information to EASY5. The simulation process creates a closed loop in which the control inputs from EASY5 affect the ADAMS simulation, and the ADAMS outputs affect the control input levels. See Figure 5 on page 18 for an illustration of the closed loop simulation process.

40

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

Pausing and Stepping Through the Simulation
The interactive capabilities of ADAMS/Controls let you pause the simulation in EASY5 and monitor the graphic results in ADAMS/View. You can plot simulation results during pause mode.
To pause the simulation: 1

Select Break to pause the simulation at the next sample step. You can use the interactive plot window (Figure 19) to pause the simulation, or you can single-step through the simulation. If you select Step, the simulation steps through one sample step (.001 seconds) of the interactive Strip Chart.
Figure 19. Interactive Plot Window

2

Now go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model with the View Orientation tools in the Main toolbox. These tools help you to observe the model from different vantage points.
Figure 20. View Orientation Tools

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

41

3

Once you have finished reorienting the model, select Resume to continue the simulation. ADAMS/View closes automatically after the simulation finishes. The EASY5 Plotter window and the Plot Selection Menu appear.

Plotting from EASY5
EASY5 automatically displays the Plot window after running a simulation. By default, EASY5 displays the plot of the first variable you defined in the Plot Specification Form (see Figure 18 on page 38). You can plot any data generated in EASY5 by selecting a variable from the Plot Selection Menu. In this tutorial, you’ll plot the curve for control torque.
To plot from EASY5:
s

From the Plot Selection menu, point to Displays, and then select the variable, S2 LA11, which is the control torque input to the ADAMS block from EASY5. The EASY5 Plotter window displays the plot for control torque.
Figure 21 on page 42 shows how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also zero.

42

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

To add labels to the plot: 1

At the bottom of the Plot Selection Menu, select Edit Display. The Display Specification Form appears.

2

Enter the following labels:
s

In the Plot Title text box, enter ADAMS/Controls Torque Input from EASY5 to ADAMS. In the x-axis text box, enter time in seconds. In the y-axis text box, enter Control Torque, N-m.

s s

The labels you entered appear on the plot as shown in Figure 21.
Figure 21. Plot of Control Torque Input

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

43

Plotting from ADAMS/View
To plot from ADAMS/View: 1 2

Display ADAMS/View in a new system window and read in the command file, ant_test.cmd. From the File menu, select Import. The File Selection dialog box appears.

3

Select the following:
s s s

For File Type, select ADAMS Results File. For Files to Read, select antenna.res. For Model, select main_olt. When you read in results files, be sure to include the model name because ADAMS/View needs to associate the results data with a specific model.

Note: You can plot any data from the simulation and rerun the animation from

ADAMS/View.
4

From the Review menu, select Postprocessing. ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed. Take a minute to familiarize yourself with ADAMS/PostProcessor.
Figure 22 on page 44 shows a conceptual sketch of the ADAMS/PostProcessor

window.

44

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

Figure 22. ADAMS/PostProcessor Window
Menu bar Main Toolbar Page Treeview Viewport Viewport

Viewport

Viewport

Property Editor Status bar

Dashboard

5 6 7 8 9 10 11

From the dashboard, set Source to Objects. From the Model list, select .main_olt. From the Filter list, select constraint. From the Object list, select antenna_joint. From the Characteristic list, select Element Torque. From the Component list, select Y. Select Add Curves. ADAMS/PostProcessor generates the curve.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

45

To add labels to the plot: 1 2

In the treeview, navigate to the plot and select it. In the Property Editor, in the Title text box, enter the name: Antenna Joint Peak Torque,
Controlled.

The plot title appears above the plot.
Figure 23 illustrates how the curve should look. The curve shows the stress in the antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.
Figure 23. ADAMS Antenna Joint Peak Torque, Controlled

46

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with EASY5

4

Learning ADAMS/Controls with MATLAB

Overview
This chapter teaches you how to use ADAMS/Controls with MATLAB. It contains the following sections:
s s

About the Tutorial, 47 Step Three - Adding Controls to the ADAMS Block Diagram, 48 Step Four - Simulating the Model, 55

s

Note: Before beginning this tutorial, you should have finished

2, Introducing and Starting the Tutorials.

About the Tutorial
This chapter provides procedures for using ADAMS/Controls with MATLAB. It teaches you Steps 3 and 4 of the four-step process of adding controls to an ADAMS model. You will learn how to:
s

Specify the control algorithms in your system using MATLAB. Simulate an ADAMS model with a complex control system. Plot simulation results.

s

s

48

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Step Three - Adding Controls to the ADAMS Block Diagram
You will add controls to the ADAMS block diagrams by:
s s s s

Starting MATLAB, 48 Importing the ADAMS Block Diagram, 50 Setting Simulation Parameters in the Plant Mask, 52 Constructing the Controls System Block Diagram, 54

Starting MATLAB
Running an ADAMS/Controls cosimulation will check out an ADAMS/Solver license and possibly an ADAMS/View license (for interactive simulations only). To ensure that you are able to run these products, close your current ADAMS/Controls session.
To start using MATLAB: 1 2

Start MATLAB on your system. Change directories to the one in which your ant_test.m file resides (the working directory you specified during your ADAMS/Controls session). You can do this by entering cd c:\new_dir, where new_dir is the name of your working directory.

3

At the prompt (>>), type ant_test. MATLAB echoes:
%%%INFO:ADAMS plant actuators names: 1 control_torque %%%INFO:ADAMS plant sensors names: 1 rotor_velocity 2 azimuth_position.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

49

4

At the prompt, type who to get the list of variables defined in the files. MATLAB echoes:
ADAMS_forces ADAMS_inputs ADAMS_joints ADAMS_outputs ADAMS_prefix ADAMS_sysdir ADAMS_uy_ids ADAMS_mode ADAMS_utidir

You can check any of the above variables by entering them in at the MATLAB prompt. For example, if you enter ADAMS_outputs, MATLAB displays all of the outputs defined for your mechanism: ADAMS_outputs= rotor_velocity!azimuth_position.

50

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Importing the ADAMS Block Diagram
To import the ADAMS block diagram: 1

At the MATLAB prompt, enter adams_sys. This builds a new model in Simulink named adams_sys.mdl. This model contains the adams_sub block representing your mechanical system. A palette containing the ADAMS blocks appears. These are the blocks that you will include in the Simulink block diagram.
Figure 24. Simulink Palette

2

From the File menu, point to New, and then select Model. A new palette for building your block diagram appears.

3

Drag and drop the adams_sub block from the adams_sys palette onto the new palette.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

51

4

Double-click the adams_sub block. All of the elements in the subsystem appear.
Figure 25. ADAMS Sub-Block

Note: The inputs and outputs you defined for the model appear in the sub_block. The

input and output names automatically match up with the information read in from the ant_test.m file.

52

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Setting Simulation Parameters in the Plant Mask
To set the simulation parameters: 1

From the new Simulink palette, double-click the Mechanical Dynamics block. The ADAMS Plant Mask dialog box appears.
Figure 26. ADAMS Plant Mask

2

In the Output Files Prefix text box, enter ‘mytest’. Be sure to enclose the name with single quotation marks. ADAMS/Controls saves your simulation results under this name in the three file types listed in Table 1 on page 53.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

53

Table 1. File Types File name:
mytest.res

File type:

What the file contains:

Results Requests Graphics

ADAMS/Solver analysis data and ADAMS/View graphics data ADAMS/Solver analysis data ADAMS/View graphics data

mytest.req mytest.gra

3

Select a simulation parameter for each text box.
x

Select discrete for Simulation mode.

This mode specifies that ADAMS solve the mechanical system equations and that the controls application solve the control system equations. See the section, Choosing a Simulation Method, on page 86, for more details about simulation modes.
x

Select interactive for Animation mode.

Animation mode allows you to graphically monitor your simulation results in ADAMS/View. See the section, Choosing an Initialization Method, on page 88, for more details about animation modes.
x

Select automatic for initialization mode. See the section, Choosing an Initialization Method, on page 88, for more details about initialization modes.

4 5

Select Apply. Select Close to close the plant mask.

54

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Constructing the Controls System Block Diagram
The completed block diagram is in the file, antenna.mdl, in the examples directory. To save time, you can read in our diagram instead of building it. Remember to update the settings in the plant mask if you decide to use this file.
To construct the controls system block diagram: 1

At the MATLAB prompt, type simulink. The Simulink library palettes appear. Use the block icons from the palettes to complete your controls block diagram. Each icon contains a submenu.

2 3 4

Double-click each icon to reveal its submenu. Look at the controls block diagram in Figure 27. Drag and drop the appropriate blocks from the Simulink library to complete your block diagram as shown below.
Figure 27. Controls Block Diagram

5

From the File menu, select Save As, and enter a file name for your controls block diagram.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

55

Step Four - Simulating the Model
You will simulate your mechanical model and control system by:
s s s s s

Setting the Simulation Parameters, 55 Executing the Simulation, 56 Pausing the Simulation, 56 Plotting from MATLAB, 57 Plotting from ADAMS/View, 59

Setting the Simulation Parameters
To set the simulation parameters: 1

From the menus on the Simulink palette, select Simulation, and then select Parameters. The Simulation Parameters dialog box appears.

2

Enter the following simulation parameters:
x x

For Start Time, enter 0.0 seconds. For End Time, enter 0.25 seconds.

3

Select the Type text box for the Solver options:
x x x

Set the first text box to variable step mode. Set the second text box to ode15s. Accept the default values in the remaining text boxes.

4

Select OK to close the Simulation Parameters dialog box.

56

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Executing the Simulation
To start the simulation:
s

Select Start. A new ADAMS/View window opens and graphically displays the simulation. If you’re using Windows NT, a dialog box appears with the current simulation data. If you’re using UNIX, the current simulation data scrolls across the MATLAB window. ADAMS accepts the control inputs from MATLAB and the model moves in response to them. ADAMS then provides the azimuthal position and rotor velocity information to MATLAB. This simulation process creates a closed loop in which the control inputs from MATLAB affect the ADAMS simulation, and the ADAMS outputs affect the control input levels. See Figure 5 on page 18 for an illustration of the closed loop simulation process.

Pausing the Simulation
The interactive capabilities of ADAMS/Controls let you pause the simulation in MATLAB and monitor the graphic results in ADAMS/View. You can plot simulation results during pause mode.
To pause the simulation: 1

A time display in the upper left corner of the ADAMS screen tracks the seconds of the simulation. As soon as the time elapsed reaches .1 seconds, move your cursor to the Simulink palette, point to Simulation, and then select Pause. MATLAB suspends the simulation.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

57

2

Now go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model with the View Orientation tools in the Main toolbox. These tools help you to look at the model from different vantage points.
Figure 28. View Orientation Tools

3

Once you have finished reorienting the model, resume the simulation by selecting Simulation, and then Start, from the toolbar on the Simulink palette. ADAMS/View closes automatically after the simulation finishes.

Plotting from MATLAB
You can plot any of the data generated in MATLAB. In this tutorial, you will plot the ADAMS_uout data that is saved in the ADAMS sub_block. The ADAMS sub_block is shaded in the figure below.
Figure 29. ADAMS Sub-Block

58

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

To plot from MATLAB:
s

At the MATLAB prompt, type in the following command:
>>plot (ADAMS_tout, ADAMS_uout)

The plot window opens and shows the time history of input from MATLAB to ADAMS. Figure 30 shows you how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also at zero.
To add labels to your plot:
s

At the MATLAB prompt, enter:
>>xlabel(‘time in seconds’) >>ylabel(‘Control Torque Input, N-m’) >>title(‘ADAMS/Controls Torque Input from MATLAB to ADAMS’)

The labels appear on the plot.
Figure 30. Control Torque Input from MATLAB to ADAMS

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

59

Plotting from ADAMS/View
To plot from ADAMS/View: 1 2

Display ADAMS/View in a new system window and read in the command file, ant_test.cmd. From the File menu, select Import. The File Selection dialog box appears.

3

In the File Selection dialog box, select the following:
s s s

For the File Type, select ADAMS Results File.

For Files to Read, select Read mytest.res. For Model, select main_olt. Be sure to include the model name when you read in results files. ADAMS/View needs to associate the results data with a specific model. ADAMS/View.

Note: You can plot any data from the simulation and rerun the animation from 4

From the Review menu, select Postprocessing. ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed. Take a minute to familiarize yourself with ADAMS/PostProcessor.
Figure 31 on page 60 shows a conceptual sketch of the ADAMS/PostProcessor

window.

60

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

Figure 31. ADAMS/PostProcessor Window
Menu bar Main Toolbar Page Treeview Viewport Viewport

Viewport

Viewport

Property Editor Status bar

Dashboard

5 6 7 8 9 10 11

From the dashboard, set Source to Objects. From the Model list, select .main_olt. From the Filter list, select constraint. From the Object list, select antenna_joint. From the Characteristic list, select Element Torque. From the Component list, select Y. Select Add Curves. ADAMS/PostProcessor generates the curve.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

61

To add labels to your plot: 1 2

In the treeview, navigate to the plot and select it. In the Property Editor that appears, in the Title text box, enter the name: Antenna
Joint Peak Torque, Controlled.

The plot title appears above the plot.
Figure 32 illustrates how the curve should look. The curve shows the stress in the antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.
Figure 32. ADAMS Antenna Joint Peak Torque, Controlled

62

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATLAB

5

Learning ADAMS/Controls with MATRIXx

Overview
This chapter teaches you how to use ADAMS/Controls with MATRIXX. It contains the following sections:
s s

About the Tutorial, 64 Step Three - Adding Controls to the ADAMS Block Diagram, 64 Step Four - Simulating the Model, 74

s

Note: Before beginning this tutorial, you should have finished Introducing and Starting the Tutorials on page 11.

This tutorial is designed for MATRIXX version 62.2. You can use it with other versions of MATRIXX, but, the interface might be different.

64

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

About the Tutorial
This chapter provides procedures for using ADAMS/Controls with MATRIXX. It teaches you Steps Three and Four of the four-step process of adding controls to an ADAMS model. You will learn how to:
s s s

Specify the control algorithms in your system using MATRIXX. Simulate an ADAMS model with a complex control system. Plot simulation results.

Step Three - Adding Controls to the ADAMS Block Diagram
You will add controls to the ADAMS block diagram by:
s s s s s s

Setting up the MATRIXX Interface, 65 Starting MATRIXX, 66 Defining SuperBlock Attributes, 67 Defining ADAMS Block Parameters, 69 Creating the ADAMS Block, 70 Constructing the Controls System Block Diagram, 72

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

65

Setting up the MATRIXX Interface
In this section you will set up the ADAMS/Controls MATRIXX interface. You must perform these steps before starting MATRIXX. Be sure to visit the MDI knowledge base at http://support.adams.com/kb/ for the latest information.
To run the ADAMS/Controls MATRIXX interface: 1

Copy the following two files from the /install_dir/controls/matrixx/ directory to your local directory, where install_dir is the directory where ADAMS/Controls is installed:
makefile.{system_type} to ./makefile adams_matrixx.c

For example, if you are running on a Sun Ultra with ADAMS/Controls installed in /usr/local/adams11, you enter:
cp /usr/local/adams11/controls/matrixx/makefile.ultra ./makefile cp /usr/local/adams11/controls/matrixx/adams_matrixx.c .

2

Do one of the following:
s

Copy the following three files from the /install_dir/controls/matrixx/ directory to your local directory:
build_adams.msc update_adams.msf Build_adams

s

In your startup.ms file, add the line:
path “/install_dir/controls/matrixx/”

For example, on a Sun system, you include:
path “/usr/local/adams11/controls/matrixx/”

3

Set the environment variable SYSBLD_ADAMS to /install_dir/controls/. For example, on a Sun system, enter:
setenv SYSBLD_ADAMS /usr/local/adams11/controls/

You can add the above to your .cshrc file.

66

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Starting MATRIXX
Ensure that you’ve set up MATRIXX so that you can run cosimulations from the directory containing the antenna example. See Setting up the MATRIXX Interface on page 65.
To start using MATRIXX:
s

Start up MATRIXX from the directory that contains the file with the antenna example. The Xmath main window appears.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

67

Defining SuperBlock Attributes
In this section, you will create a file called SuperBlock in MATRIXX that contains the controls block diagram for the antenna model.
To define the SuperBlock attributes: 1

In the command window, enter Build. The command window is the blank area attached to the bottom of the main window. The SystemBuild Editor appears.

2

In the SystemBuild Editor, from the File menu, select New, and then select SuperBlock. The SuperBlock Properties dialog box appears.

68

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Figure 33. SystemBuild Editor Window

3 4 5 6

In the SuperBlock Properties dialog box, in the Name text box, enter antenna_system as the block name. In the Outputs text box, enter 3 to define the number of outputs required for the combined antenna model and controls system. Set Type to Continuous to define the simulation type. Select OK to exit the SuperBlock Properties dialog box.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

69

Defining ADAMS Block Parameters
In this section, you will supply the control system parameters for the ADAMS block.
To define the parameters for the ADAMS block: 1

In the Xmath command initial window, enter the simulation time as a column vector:
t=[0:0.001:0.25]’;

where:
s s s

The first parameter (0) is the start time The second parameter (0.001) is the step size The third parameter (0.25) is the simulation end type

2

Enter the following controller parameters as Xmath variables:
PGain = 1040 VGain = 950 Den = [1e-3,1]’;

where PGain and VGain are the numerators and Den is the denominator of the controller transfer functions.

70

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Creating the ADAMS Block
To create the ADAMS block: 1

Ensure that you’ve either copied the two build_adams* files to your working directory, or have added a proper path line to your startup.ms file (see Setting up the MATRIXX Interface on page 65 for more information). In the Xmath command window, enter build_adams. The Build_adams Input dialog box appears.

2

3

Select ADAMS Information File. A file browser appears.

4 5 6

Select ant_test.inf, and then select OK. In the ADAMS block name text box, enter a name for the SuperBlock you are creating, such as antenna, and press Enter. Select Interactive for the ADAMS Animation Mode option. Animation mode lets you graphically monitor your simulation results in ADAMS/View. See the section, Choosing an Initialization Method on page 88, for more details about animation modes.

7

Select Discrete as the Simulation Mode option. For more details about simulation options, see Choosing a Simulation Method on page 86.

8 9

In the Sample/Output Interval text box, enter 0.001 as the sample interval, and then press Enter. Select Build ADAMS Block. The Build_adams Input dialog box should now look like the one in Figure 34.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

71

Figure 34. Completed Build_adams Input Dialog Box

10

Select OK. The ADAMS block, antenna_system, is now created in the Superblock. The ADAMS block appears in the SystemBuild Editor as shown in Figure 35 on page 72. You can reposition the block by dragging and dropping it to a new location on the screen.

Note: The ADAMS block, antenna_system, automatically receives the correct number of

inputs and outputs as well as the names specified in the ADAMS antenna model.

72

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Figure 35. ADAMS SuperBlock

Constructing the Controls System Block Diagram
The completed block diagram is in the file, antenna.xmd, in the examples directory. To save time, you can read in that diagram instead of building it.
To construct the controls system block diagram: 1

Double-click a blank area of the SystemBuild Editor. The Palette Browser appears. Navigate the control categories using the treeview; click and drag components on to the SystemBuild editor window with the middle mouse button. To set parameters, select the block in the SystemBuild editor window, select Edit, and then select Block Properties.

2

Select the appropriate submenu, then click on the block you want to place in your diagram. A Step Block dialog box appears for you to modify parameters on the block.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

73

3 4

Modify the parameters, and then select Done to place the block in the SystemBuild Editor. Review the completed controls block diagram shown in Figure 36. Recreate the same diagram for your antenna model using the procedures in the following section.
Figure 36. Controls System Block Diagram

To add and connect blocks in the controls system block diagram: 1

Start building the diagram by placing a reference slider in the SystemBuild Editor.
Note: The reference slider is limited to generating a position between -0.3 and

0.3.
2

Place two dynamic NumDen blocks in the diagram, and then define a numerator and denominator for each block as follows:
x x

At the Numerator prompt of the blocks, enter %PGain and %VGain, respectively. At the Denominator prompt of each block, enter the variable name, Den.

The NumDen blocks should look like the ones in Figure 37.
Figure 37. Completed NumDen blocks

74

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

3

Connect the blocks in your controls system diagram. Make sure that both the input and outputs of the ADAMS block are connected as external outputs in the SystemBuild model. From the File menu in the Xmath window, select Save All, and then enter a file name for your completed controls block diagram. Xmath saves the file with the extension .xmd. The file includes both the SystemBuild models and Xmath variables used in the current session.

4

Step Four - Simulating the Model
You will simulate your mechanical model and control system by:
s s s s s

Modifying Simulation Parameters, 74 Executing the Simulation, 76 Pausing and Stepping the Simulation, 80 Plotting from MATRIXX, 81 Plotting from ADAMS/View, 82

Modifying Simulation Parameters
You can modify the simulation parameters for your model through the Build_adams dialog box that you invoke using the build_adams script, or you can modify them directly from the command window using the update_adams script. The next two procedures explain how to modify the parameters using the two scripts. Follow either procedure depending on how you want to modify the parameters.
Note: You can get additional help on build_adams and update_adams scripts by entering help <script name> in the Xmath command window.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

75

To modify the simulation parameters using the build_adams script: 1

In the Xmath command window, enter build_adams. The Build_adams input dialog box appears. The name, antenna, appears in the ADAMS block name text box.

2 3

To modify the block name, click the text box, enter Telescope in place of antenna, and then press Enter. Select the Update ADAMS block option, and select OK. The ADAMS SuperBlock is now named Telescope.

Note: You can use the build_adams script to modify all of the simulation settings in the

Build_adams Input dialog box. The current settings are stored in the Xmath variables.
To view the variables: 1

From the Xmath main window, select Windows, and then select Variables. The Xmath Variables window appears.

2

Select Partition, and then select ADAMS. You should modify these variables only through the build_adams or update_adams scripts.

To modify the simulation parameters using the update_adams script: 1

In the Xmath command window, enter update_adams (“Telescope”,{NewSampleP=0.005}) to change the sample interval in the SuperBlock, and then press Enter. The sample interval in the ADAMS SuperBlock changes from 0.001s to .005s.

2

Using the build_adams script once more, change the sample interval back to its original value.

76

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Executing the Simulation
This section shows you how to execute an interactive simulation from MATRIXX.
To execute the simulation: 1

From the SystemBuild Editor menu, select Tools, and then select Simulate. The SystemBuild Simulation Parameters dialog box appears.
Figure 38. SystemBuild Simulation Parameters Dialog Box

2

Set the following parameters:
x

Select Outputs, and select the Use Extended Time Vector option. When this option is used with the discrete simulation mode, ADAMS/Controls saves two values for each simulation step. Select Parameters, and enter the variable name ADAMS_out in the Output Variable text box. In Time Vector/Variable text box, enter t to define the simulation time vector. The t references the time vector [0:0.001:0.25]’ that you defined in Step Four of Starting MATRIXX on page 66. Select the Interactive option.

x

x

x

The SystemBuild simulation mode is set to interactive.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

77

3

Select OK. The Interactive Simulator window appears.
Figure 39. Interactive Simulator Window

4

Use the control buttons to pause and resume the simulation and to modify the Xmath variables. After you select OK, MATRIXX begins to initialize the simulation data. A new ADAMS/View window opens and the simulation initialization begins. The simulation data appears in the terminal window where you launched MATRIXX, and the ISIM (interactive simulator) appears.

5

After initialization, review the information in the terminal window. If it is correct, go to the ISIM and select Resume to execute the simulation. The model simulates in the ADAMS/View window. If the simulation does not begin, press Rerun.

78

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Running a Simulation from the Xmath Command Window

You can also execute the simulation from the Xmath command window, where you can create scripts that run a number of simulations with varied settings.
To run the simulation from the Xmath command window: 1

In the Xmath command window, enter the following command:
ADAMS_out=sim(“antenna_system”,t,{extend, interact});

2

Press Enter to start the simulation. A new ADAMS/View window opens and the simulation begins.

Note: The ADAMS model is initialized to the simulation time defined in the SystemBuild

Editor.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

79

Running the Simulation Interactively
You can interrupt the simulation to modify the controller variables or to change the visual aspect of the model.
To run the simulation interactively: 1 2

Arrange the windows so that you have a good view of the model. Close the SystemBuild Editor to help unclutter the screen. When a new ADAMS/View window opens and the simulation begins, start and pause the simulation by selecting Resume and Pause respectively. While in pause mode, experiment with making modifications to the control system:
x

Modify the reference signal for azimuthal position by moving the slider in the Interactive ISIM window. Modify the control variables, PGain and VGain, by selecting RVE, selecting each variable, and then selecting Open.

x

The Matrix Editor appears.
x

Modify the selected variable and close the window.

ADAMS/View accepts the control inputs from MATRIXX and the model moves in response to them. ADAMS/View then provides the azimuthal position and rotor velocity information to MATRIXX. This simulation process creates a closed loop in which the control inputs from MATRIXX affect the ADAMS/View simulation, and the ADAMS/View outputs affect the control input levels. For an illustration of the closed loop simulation process, see Figure 5 on page 18.

80

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

Pausing and Stepping the Simulation
The interactive capabilities of ADAMS/Controls let you pause the simulation and perform time and block steps in MATRIXX while monitoring the graphic results in ADAMS/View. You can also plot simulation results during pause mode.
To pause the simulation: 1

Select Pause in the ISIM Control Panel. MATRIXX suspends the simulation. Pause changes to Resume after you select it so you can toggle between Simulation and Pause mode.

2

Go back to ADAMS/View. While the simulation is paused, you can change the orientation of the model using the View Orientation tools in the Main Toolbox. These tools help you to observe the model from different vantage points.
Figure 40. View Orientation Tools

3

Once you have finished reorienting the model, you can continue the simulation by selecting Resume. ADAMS/View closes automatically after the simulation finishes.

4

Advance the SystemBuild model one sample interval at a time by selecting TimeStep. Notice how the ADAMS model is updated during each time step.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

81

5

Select Block Step to execute one block at a time in the SystemBuild model. You can monitor how the signals are updated by switching the view mode of the blocks. To switch the view mode, point on a block and type v.

6

When the simulation is completed, close the ISIM window by selecting the File menu, then selecting Exit.

Plotting from MATRIXX
You can plot any of the data generated in MATRIXX. In this tutorial, you will plot the ADAMS_out data that is saved in the Xmath environment.
To plot from MATRIXX: 1

In the Xmath command window, enter:
plot (ADAMS_out(1,:), {title=”ADAMS/Controls Torque Input from MATRIXx to ADAMS”, xlab=”time in seconds”, ylab=”Control Torque input, N-m”})

The plot window opens and shows the time history of input from MATRIXX to ADAMS/View and includes the specified plot labels. Figure 41 on page 82 shows you how the plot should look. Notice that the control torque reaches a peak, and then settles down as the antenna accelerates. As the antenna gets close to its final position, the torque reverses direction to slow down the antenna. The antenna moves past its desired position, and then settles down to the point of zero error. At this point, the torque value is also at zero.

82

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

2

To plot the other external outputs, enter: ADAMS_out(2,:) for rotor_velocity and ADAMS_out(3,:) for azimuth_position.
Figure 41. Controls Torque Input from MATRIXX to ADAMS

Plotting from ADAMS/View
1 2

Display ADAMS/View in a new system window and read in the command file, ant_test.cmd. From the File menu, select Import. The File Selection dialog box appears.

3

Select the following:
x x x

For File Type, select ADAMS Results File. For Files to Read, select antenna.res. For Model, select main_olt.

Be sure to include the model name when you read in results files. ADAMS/View needs to associate the results data with a specific model.
Note: You can plot any data from the simulation and rerun the animation from

ADAMS/View.

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

83

4

From the Review menu, select Postprocessing. ADAMS/View launches ADAMS/PostProcessor, a post-processing tool that lets you view the results of the simulations you performed. Take a minute to familiarize yourself with ADAMS/PostProcessor.
Figure 42 on page 83 shows a conceptual sketch of the ADAMS/PostProcessor

window.
Figure 42. ADAMS/PostProcessor Window
Menu bar Main Toolbar Page Treeview Viewport Viewport

Viewport

Viewport

Property Editor Status bar

Dashboard

5 6 7 8 9 10 11

From the dashboard, set Source to Objects. From the Model list, select .main_olt. From the Filter list, select constraint. From the Object list, select antenna_joint. From the Characteristic list, select Element Torque. From the Component list, select Y. Select Add Curves. ADAMS/PostProcessor generates the curve.

84

Getting Started Using ADAMS/Controls Learning ADAMS/Controls with MATRIXx

To add labels to your plot: 1 2

In the treeview, navigate to the plot and select it. In the Property Editor, in the Title text box, enter the name: Antenna Joint Peak Torque,
Controlled.

The plot title appears above the plot.
Figure 43 illustrates how the curve should look. The curve shows the stress in the

antenna joint from the azimuth control loop. You can use the information on the plot to help you determine how to modify the control system of the antenna model. For example, you can reduce the load in the antenna joint by decreasing the velocity gain of the azimuth controller at the expense of slowing the overall response of the controller. This is the type of trade-off between the mechanism design and the control design that you can analyze using ADAMS/Controls.
Figure 43. ADAMS Antenna Joint Peak Torque, Controlled

6

Setting Simulation Parameters

Overview
ADAMS/Controls provides a variety of options for simulating and animating your integrated model and controller. This chapter introduces you to these options and the advantages they offer. This chapter contains the following sections:
s s s

Choosing a Simulation Method, 86 Choosing an Animation Option, 87 Choosing an Initialization Method, 88

86

Getting Started Using ADAMS/Controls Setting Simulation Parameters

Choosing a Simulation Method
ADAMS/Controls offers you two methods with which you can simulate your integrated model and controller: discrete or continuous. These methods allow you to analyze your model with ADAMS or the control application (EASY5, MATLAB, or MATRIXX).
Table 2. Simulation Methods Method: Its Purpose:

Discrete mode Continuous mode

Specifies that ADAMS solve the mechanical system equations and the control application solve the control system equations. Specifies that the control application solve both the mechanical and control system equations.

For most analyses, the discrete mode is generally the more efficient simulation method. It is faster and can handle complex models better than continuous mode. You should use continuous mode when equations solved in the control system would cause a large coupling effect on the ADAMS data. For example, you might prefer to use the continuous mode if your analysis requires a very small time step. To preserve the proper dynamics for a mechanical system, discrete mode should sample the mechanical system at least five times greater than the highest frequency of interest. If the time step is too small to sample at five times the highest frequency, then you should use continuous mode.
Note: You can find the highest frequency of your mechanical system by performing a

linear analysis with the ADAMS add-on module, ADAMS/Linear. For information about ADAMS/Linear, see the guide, Using ADAMS/Solver.

Getting Started Using ADAMS/Controls Setting Simulation Parameters

87

Choosing an Animation Option
ADAMS/Controls lets you choose one of two animation modes: interactive or batch. Both methods allow you to save results to ADAMS files for review at a later date.
Table 3. Animation Options Method: Its purpose:
s s

Interactive mode

Specifies the simulation to run in ADAMS/View. Provides a dynamic, graphic display of the simulation results. Allows you to pause during a simulation to review any animation or plotting results. Allows you to verify the initial design of your control law for proper signal phase and magnitude.

s

s

Batch mode

Specifies that the simulation run in ADAMS/Solver. This is the preferred method if a graphic display of the analysis results is unnecessary.

88

Getting Started Using ADAMS/Controls Setting Simulation Parameters

Choosing an Initialization Method
ADAMS/Controls lets you choose one of two initialization modes: automatic or manual. Both methods allow you to issue ADAMS/View or ADAMS/Solver commands before simulating your combined model and controller.
Table 4. Initialization Options Method: Its purpose:

Automatic mode

Allows you to issue any command in the Initialization command field of the ADAMS plant mask before running a simulation. You can specify a command in two ways. For example, if you want to change the color of the antenna model, you can issue one of the following commands: x At the MATLAB prompt, enter:
ADAMS_Init=‘geometry attributes geometry_name= .main_olt.antenna.REV15 color=RED’

x

Within the ADAMS mask, the Initialization command field reads: ADAMS_Init. Alternatively, inside the Initialization command field, you can enter the complete command string enclosed in single quotes and square brackets as follows:
[‘geometry attributes geometry_name=.main_olt.antenna.REV15 color=RED’]

Manual mode

Allows you to issue ADAMS commands directly from MATLAB.
s

After you enter a command at the MATLAB prompt, MATLAB sends it to ADAMS for immediate execution. After ADAMS executes the command, MATLAB prompts you for an additional command or direction to continue.

s

Getting Started Using ADAMS/Controls Index

89

Index
A-B
ADAMS block, creating in EASY5 29 block, creating in MATRIXx 70 block, initializing interface in EASY5 30 ADAMS/Controls about 3 basics 5 benefits of 6 design process with 6 four-step process, about 9 how to learn 10 initialization methods in 88 starting from UNIX or Windows 13 using 8 Animation options batch 87 interactive 87 Antenna model components of 15 importing 14 Automatic initialization mode 88 Batch animation mode 87 Block diagram ADAMS, creating in EASY5 29 ADAMS, creating in MATRIXx 70 controls system, constructing in EASY5 34 controls system, constructing in MATLAB 54 controls system, constructing in MATRIXx 72 importing ADAMS in MATLAB 50 sub-block of ADAMS in MATLAB 51

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

90

Getting Started Using ADAMS/Controls Index

C-D
Component data table in EASY5 30 information page in EASY5 33 Continuous simulation mode 86 Controls adding to ADAMS block using EASY5 28 adding to ADAMS block using MATLAB 48 adding to ADAMS block using MATRIXx 64 how to improve design process of 6 Deactivating azimuth motion in model 16 Design process with ADAMS/Controls 6 Discrete simulation mode 86

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

E-F
EASY5 adding controls to ADAMS block 28 component data table in 30 component information page in 33 constructing controls system diagram in 34 creating ADAMS block in 29 executing a simulation in 36 initializing ADAMS interface block in 30 pausing and stepping simulation in 40 plotting from 41 plotting from ADAMS/View 43 simulating interactively in 39 starting 28 Executing simulation in EASY5 36 simulation in MATLAB 56 simulation in MATRIXx 74 File types 53

Getting Started Using ADAMS/Controls Index

91

Four-step process in ADAMS/Controls 9 Functions output 22 VARVAL 21

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

G-H
How you’ll learn ADAMS/Controls 12

I-J
Identifying inputs and outputs 17 Import ADAMS antenna model 14 block diagram in MATLAB 50 Initialization method automatic 88 manual 88 Initializing ADAMS block in EASY5 30 Input defining variables for 23 functions, verifying 21 identifying path for 18 verifying variables for 19 Interactive animation mode 87

K-L
Learning ADAMS/Controls 10 ADAMS/Controls with EASY5 27 ADAMS/Controls with MATLAB 47 ADAMS/Controls with MATRIXx 63

92

Getting Started Using ADAMS/Controls Index

M-N
Manual initialization mode 88 MATLAB 55 adding controls to ADAMS block 48 constructing controls system diagram in 54 executing simulation in 56 importing block diagram in 50 pausing simulation in 56 plotting from 57 plotting from ADAMS/View 59 setting parameters in plant mask 52 setting simulation parameters in 55 simulating interactively in 53 Simulink palette in 50 starting 48 MATRIXx adding controls to ADAMS block 64 adding NumDen blocks to controls diagram 73 constructing controls system diagram in 72 creating ADAMS block 70 defining attributes in SuperBlock 67 executing a simulation in 74 modifying simulation parameters in 74 pausing and stepping simulation in 80 plotting from 81 plotting from ADAMS/View 82 simulating interactively in 79 starting 66 Motion, deactivating in ADAMS/View 16 NumDen blocks, using in MATRIXx 73

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

Getting Started Using ADAMS/Controls Index

93

O-P
Output defining variables for 24 functions, verifying 22 identifying path for 18 Parameters, setting in MATLAB plant mask 52 Pausing simulation in EASY5 40 simulation in MATLAB 56 simulation in MATRIXx 80 Plant mask, setting parameters in MATLAB 52 Plotting EASY5 results in ADAMS/View 43 from EASY5 41 from MATLAB 57 from MATRIXx 81 MATLAB results in ADAMS/View 59 MATRIXx results in ADAMS/View 82

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

Q-R
Running a trial simulation in ADAMS/View 16

S-T
Setting plant mask parameters in MATLAB 52 simulation parameters in ADAMS/Controls 85 simulation parameters in EASY5 38 simulation parameters in MATLAB 55 simulation parameters in MATRIXx 74 Simulation animation options for 87 choosing a method for 86 continuous, choosing 86 discrete 86

94

Getting Started Using ADAMS/Controls Index

executing in EASY5 36 executing in MATLAB 56 executing in MATRIXx 74 in step 4 using EASY5 36 in step 4 using MATLAB 55 in step four using MATRIXx 74 initialization options for 88 modifying parameters in MATRIXx 74 parameters, setting in ADAMS/Controls 85 pausing and stepping in EASY5 40 pausing and stepping in MATRIXx 80 pausing in MATLAB 56 running a trial without controls 16 running interactively in EASY5 39 running interactively in MATRIXx 79 Simulink palette in MATLAB 50 Starting EASY5 28 MATLAB 48 MATRIXx 66 Steps step 1 - importing model 14 step 2 - inputs and outputs 17 step 3 - adding controls using EASY5 28 step 3 - adding controls using MATLAB 48 step 3 - adding controls using MATRIXx 64 step 4 - simulation in EASY5 36 step 4 - simulation in MATLAB 55 step 4 - simulation in MATRIXx 74 SuperBlock defining attributes in MATRIXx 67 file in MATRIXx 67

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

Getting Started Using ADAMS/Controls Index

95

Tutorial about 12 for ADAMS/Controls with EASY5 27 for ADAMS/Controls with MATLAB 47 for ADAMS/Controls with MATRIXx 63 introducing and starting the 12

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

U-V
Variables defining input for 23 defining output for 24 output function for 22 verifying input for 19 VARVAL function 21 Verifying input variables 19 output functions 22

W-Z
Ways to use ADAMS/Controls 8

96

Getting Started Using ADAMS/Controls Index

A-B C-D E-F G-H I-J K-L M-N O-P Q-R S-T U-V W-Z

Sign up to vote on this title
UsefulNot useful