Getting Started
Using ADAMS/Controls
About this Guide 3
Learning the Basics 5
Introducing and Starting the Tutorials 11
Learning ADAMS/Controls with MATLAB 29
Learning ADAMS/Controls with Control System Import 45
Learning ADAMS/Controls with EASY5 57
Learning ADAMS/Controls with MATRIXx
Setting Simulation Parameters 101
Advanced Topics 107
77
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, 2300 Traverwood Drive, 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.
©2002 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: 120CTGS-01
Getting Started Using ADAMS/Controls
About this Guide
3
About this Guide
Welcome to ADAMS/Controls
ADAMS/Controls is a plug-in to MDI’s ADAMS/Car, ADAMS/Chassis, ADAMS/Rail,
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 the combined mechanical system and controller entirely within the
controls application,
■
Simulating entirely within ADAMS, or
■
Solving the controls equations with the control package and solving the
mechanical system equations with ADAMS.
ADAMS/Controls also lets you interactively view the simulation results in ADAMS/Car,
ADAMS/Chassis, ADAMS/Rail, and 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 other MDI products, see the online Road Map to ADAMS
Documentation.
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:
■
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
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:
■
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
controls application environment.
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 in the ways listed below. The simulation method you
choose, interactive or batch, determines which application you use.
■
ADAMS/Car, ADAMS/Chassis, ADAMS/Rail and ADAMS/View - By using
ADAMS/Controls with one of these products, 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.
9
Getting Started Using ADAMS/Controls
Learning the Basics
Note: You also have the option with ADAMS/Controls to export either a linear or
nonlinear version of your ADAMS plant to the controls application, or to import
the controls system definition into ADAMS. Importing the control system
requires Mathwork’s Real-Time Workshop.
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:
Step Three:
Step Four:
Identify the
ADAMS inputs and
outputs and export
the plant model.
Build the control
system block
diagram.
Simulate the
model.
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.
■
Step Two: Identify the ADAMS Inputs and Outputs - Define the inputs
and outputs through the information or startup file in your ADAMS
product. The outputs describe the variables that go to the controls
application (the output from the ADAMS model is the input to the controls
system). 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. Optionally, export the plant system files from
ADAMS for use in the controls simulation software.
10
Getting Started Using ADAMS/Controls
Learning the Basics
ADAMS Input
Controls Output
ADAMS/Car,
ADAMS Output
Chassis, Rail, or View
or ADAMS/Solver
Controls
Application
Controls Input
■
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 in your block diagram, or if using
Real-Time Workshop, export the controls system and import into ADAMS.
■
Step Four: Simulate the Model - Simulate the combined mechanical
model and control system. Several different methods are available to run
your simulation.
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,
Control System Import, 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 four different
tutorials, one for each of the controls applications you can use
with ADAMS/Controls: EASY5, Control System Import,
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:
■
About the Tutorial, 12
■
How You’ll Learn ADAMS/Controls, 12
■
Starting ADAMS/View, 13
■
Step One - Importing the ADAMS Model, 14
■
Step Two - Creating the ADAMS Plant Inputs and
Outputs, 18
Note: Before doing these tutorials, you should be familiar with
the basic features of the ADAMS/View interface. See
the guide, Learning ADAMS/View Basics, for
information about the ADAMS/View interface.
This tutorial takes about two hours to complete.
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:
■
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.
13
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
Starting ADAMS/View
In this section, you learn how to create a new directory and start ADAM/Controls from
within ADAMS/View in the UNIX and Windows environments.
In the UNIX environment, you start ADAMS/View from the ADAMS Toolbar, and then,
from within ADAMS/View, you load the ADAMS/Controls plug-in. For information on
the ADAMS Toolbar, see the guide, Running and Configuring ADAMS on UNIX.
In the Windows environment, you start ADAMS/View from the Start menu, and then load
the ADAMS/Controls plug-in. For more information, see the guide, Running ADAMS on
Windows.
To start ADAMS/View:
1
Copy all of the files in install_dir/controls/examples/antenna to a new directory.
2
Do either of the following depending on the platform on which you are running
ADAMS/View:
■
In UNIX, type the command to start the ADAMS Toolbar at the command
prompt, and then press Enter. Select the ADAMS/View tool
■
.
In Windows, from the Start menu, point to Programs, point to ADAMS 12.0,
point to AView, and then select ADAMS - View.
The Welcome dialog box appears, in the ADAMS/View main window.
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 four sections:
■
Importing the ADAMS Model, 14
■
Loading ADAMS/Controls, 15
■
Running a Trial Simulation, 16
■
Running a Trial Simulation, 16
Importing the ADAMS Model
1
In the Start In text box on the ADAMS/View welcome screen, enter the name of
your new directory (the one created in Step 1 on page 13).
This sets your new directory as your working directory.
2
Select Close to close the ADAMS/View welcome screen and open ADAMS/View.
3
In ADAMS/View, from the File menu, select Import.
4
Right-click the File to Read text box, and then select Browse.
The File Selection dialog box appears.
5
Select the file antenna.cmd.
6
Select OK.
This file contains a model called main_olt. An antenna model like the one shown in
Figure 4 on page 15 appears.
7
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.
15
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
Figure 4. Shaded Model of Antenna
Elevation bearings
Antenna support
Azimuth rotor
Antenna
Plate
Reduction gear
Loading ADAMS/Controls
Because ADAMS/Controls is a plug-in for ADAMS/View, you need to load
ADAMS/Controls when you use it with ADAMS/View.
To load ADAMS/Controls:
■
From the Tools menu, point to Plugins, point to Controls, and then select Load.
ADAMS/View loads the ADAMS/Controls plug-in.
16
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
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:
■
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.
Running a Trial Simulation
To run a trial simulation with ADAMS/View:
1
From the Main toolbox, select the Simulate tool
2
Enter the following in the Simulation container of the Main toolbox:
◆
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.
4
Select the Simulation Start tool
.
to equalize the applied forces and locate the
.
The base of the mechanism turns counterclockwise as the antenna moves up and
down.
17
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
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 Controls system package provides.
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
Scroll down the list and select azimuth_motion_csd.
4
Select OK.
ADAMS/View deactivates the motion.
5
Select the Reset to Start tool
6
Rerun the simulation.
to reset the simulation back to its first frame.
Now that you’ve deactivated the azimuthal motion, the antenna moves up and
down, 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.
18
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
Step Two - Creating the ADAMS Plant Inputs and Outputs
Now you’ll identify the inputs and outputs on the ADAMS model by:
■
Identifying the ADAMS Plant Inputs and Outputs, 19
■
Verifying Input Variables, 20
■
Verifying Input Functions, 22
■
Verifying Output Functions, 23
■
Exporting the ADAMS Plant Files for the Controls Application, 24
19
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
Identifying the ADAMS Plant 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 outputs to the controller of azimuth_position and
rotor_velocity.
The circular path allows you to:
■
Define the input and output variables in ADAMS/View.
■
Read in the plant and the input/output variables with EASY5, MATLAB, or
MATRIXX, create an ADAMS plant, 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
Input = control _torque
ADAMS
model
Control
system
Output = azimuth_position
and rotor_velocity
20
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
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 define your
model’s input and output variables (and the functions that those inputs and outputs
reference) with a set of state variables.
This step has already been done for you in the antenna model that you imported. When you
create a new model, you will have to define the state variables for your input and output
variables to the ADAMS model.
For this tutorial, you will only verify that the state variables on the antenna model and
control system correspond to the correct input and output variables. For a description of
state variables, see Design Variables versus State Variables on page 108.
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
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
3
Select control_torque.
4
Select OK.
21
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 will 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.
Note: After you close the box, click in the background of the screen to clear the
selection of the model.
22
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
Verifying Input Functions
Now you’ll verify the function that references 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 Torque dialog box appears.
Figure 8. Modify 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).
Note: VARVAL (short for variable value) is the ADAMS function that returns the
value 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.
4
Select Cancel to close the Modify Torque dialog box.
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
23
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
Select azimuth_position.
4
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.MAR26).
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.
24
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
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
Select rotor_velocity.
10
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.
Exporting the ADAMS Plant Files for the Controls Application
In this section, you will export the ADAMS linear and nonlinear plant files.
To export the nonlinear plant files:
1
From the Controls menu, select Plant Export.
The ADAMS/Controls Plant Export dialog box appears.
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
25
Figure 10. ADAMS/Controls Plant Export Dialog Box
2
In the File Prefix text box, type ant_test for the filename.
This defines the prefix for the .adm, .cmd, .acf, .m, and .inf files created by the Plant
Export dialog box.
3
Right-click the Plant Input text box, point to Plant Input, and then select Create.
The Data Element Create Plant Input dialog box appears.
Note: If you want to use an existing plant input, right-click the Plant Input text box, point
to Plant Input, and then select Browse. Then, you can select your plant input from
the Database Navigator.
4
Complete the dialog box as shown below:
5
Select OK.
26
6
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
In the ADAMS/Controls Plant Export dialog box, right-click the Plant Output text
box, point to Plant Output, and then select Create.
The Data Element Create Plant Output dialog box appears.
Note: If you want to use an existing plant output, right-click the Plant Output text box,
point to Plant Output, and then select Browse. Then, you can select your plant output
from the Database Navigator.
7
Complete the dialog box as shown below:
8
Select OK.
9
Right-click the Control Package text box, and then select the controls application
you are using during this session: Matlab or MATRIXx_and_EASY5.
10
Select Apply.
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.
To export the linear plant files:
1
Run the static equilibrium again as described in Running a Trial Simulation on page
16.
2
From the Controls menu, select Plant Export.
In the ADAMS/Controls Plant Export dialog box, change the file prefix from
ant_test to ant_test_l.
3
Set Type to Linear.
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
4
27
Select OK.
ADAMS/Controls generates the linear model of the ADAMS model in four
matrices: ADAMS_a, ADAMS_b, ADAMS_c, and ADAMS_d.
ADAMS/Controls setup is complete after the plant files have 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.
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:
■
■
MATLAB, go to Chapter 3, Learning ADAMS/Controls with MATLAB.
Control System Import, go to Chapter 4, Learning ADAMS/Controls with
Control System Import.
■
EASY5, go to Chapter 5, Learning ADAMS/Controls with EASY5.
■
MATRIXx, go to Chapter 6, Learning ADAMS/Controls with MATRIXx.
28
Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
3
Learning ADAMS/Controls with
MATLAB
Overview
This chapter teaches you how to use ADAMS/Controls with
MATLAB. It contains the following sections:
■
About the Tutorial, 30
■
Step Three - Adding Controls to the ADAMS Block
Diagram, 31
■
Step Four - Simulating the Model, 38
Note: Before beginning this tutorial, you should have finished
2, Introducing and Starting the Tutorials.
30
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
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:
■
Add an ADAMS plant to your block diagram in MATLAB simulation.
■
Simulate an ADAMS model with a complex control system.
■
Plot simulation results.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
31
Step Three - Adding Controls to the ADAMS Block Diagram
You will add controls to the ADAMS block diagrams by:
■
Starting MATLAB, 31
■
Creating the ADAMS Block Diagram, 33
■
Setting Simulation Parameters in the Plant Mask, 36
■
Constructing the Controls System Block Diagram, 35
Starting MATLAB
A note about your ADAMS license(s): 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
Start MATLAB on your system.
2
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 the following:
3
■
On Windows: cd c:\new_dir, where new_dir is the name of your working
directory.
■
On UNIX, cd /new_dir, where new_dir is the name of your working directory.
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.
32
4
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
At the prompt, type who to get the list of variables defined in the files.
MATLAB echoes:
ADAMS_exec
ADAMS_init
ADAMS_inputs
ADAMS_mode ADAMS_poutput
ADAMS_outputs ADAMS_prefix
ADAMS_pinput ADAMS_static
ADAMS_sysdir
ADAMS_uy_ids
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.
Note: If you want to import the linearized ADAMS model, use ant_test_l.m instead of
ant_test.m. The difference is in the ADAMS_mode variable:
■
In ant_test.m, ADAMS_mode=non_linear.
■
In ant_test_l.m, ADAMS_mode=linear.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
33
Creating the ADAMS Block Diagram
To create 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 Mechanical Dynamics S-Function block representing your mechanical system.
A palette containing the ADAMS blocks appears. These blocks represent your
ADAMS model in different ways:
■
The S-Function represents the nonlinear ADAMS model.
■
The adams_sub contains the S-Function, but also creates several useful
MATLAB variables.
■
The State-Space block represents a linearized ADAMS model.
The adams_sub block is created based on the information from the .m file (either
from ant_test.m or ant_test_l.m). If the ADAMS_mode is nonlinear, the S-Function
block is used in the adams_sub subsystem. Otherwise, the State_Space block is
copied into adams_sub.
Figure 11. Simulink Palette
34
2
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
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.
4
Double-click the adams_sub block.
All of the elements in the subsystem appear.
Figure 12. 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.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
35
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 (see Setting Simulation Parameters in the
Plant Mask, on page 36).
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
Double-click each icon to reveal its submenu.
Note: Be sure to set the step input block parameters as follows:
❖
Step time: 0.001
❖
Initial value: 0
❖
Final value: .3
❖
Sample time: .001
3
Look at the controls block diagram in Figure 13.
4
Drag and drop the appropriate blocks from the Simulink library to complete your
block diagram as shown below.
Figure 13. Controls Block Diagram
36
5
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
From the File menu, select Save As, and enter a file name for your controls block
diagram.
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 14. 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 37.
37
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
Table 1. File Types
3
File name:
File type:
What the file contains:
mytest.res
Results
ADAMS/Solver analysis data and
ADAMS/View graphics data
mytest.req
Requests
ADAMS/Solver analysis data
mytest.gra
Graphics
ADAMS/View graphics data
Select a simulation parameter for each text box.
◆
Set Simulation mode to discrete.
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 102, for more details about simulation
modes.
◆
Set Animation mode to interactive.
Animation mode allows you to graphically monitor your simulation results in
ADAMS/View. See the section, Choosing an Animation Option, on page 105, for
more details about animation modes.
◆
Select automatic for initialization mode. See the section, Choosing an Initialization
Method, on page 106, for more details about initialization modes.
4
Select Apply.
5
Select Close to close the plant mask.
38
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
Step Four - Simulating the Model
You will simulate your mechanical model and control system by:
■
Setting the Simulation Parameters, 38
■
Executing the Simulation, 39
■
Pausing the Simulation, 39
■
Plotting from MATLAB, 40
■
Plotting from ADAMS/View, 42
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
3
4
Enter the following simulation parameters:
◆
For Start Time, enter 0.0 seconds.
◆
For End Time, enter 0.25 seconds.
Select the Type text box for the Solver options:
◆
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.
Select OK to close the Simulation Parameters dialog box.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
39
Executing the Simulation
To start the simulation:
■
Select Start.
A new ADAMS/View window opens and graphically displays the simulation.
If you’re using Windows, a DOS window 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 integrates the ADAMS
model in response to them. At the same time, ADAMS provides the azimuthal
position and rotor velocity information for MATLAB to integrate the Simulink
model. 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 19 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. Since MATLAB controls
the simulation, you must pause the simulation from within MATLAB. 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. To pause the simulation, move your cursor to the Simulink palette,
point to Simulation, and then select Pause.
MATLAB suspends the simulation.
40
2
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
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 15. 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. This block is shaded in the figure
below.
Figure 16. adams_sub Block
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
41
To plot from MATLAB:
■
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 17 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:
■
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 17. Control Torque Input from MATLAB to ADAMS
42
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
Plotting from ADAMS/View
To plot from ADAMS/View:
1
Display ADAMS/View in a new system window and read in the command file,
ant_test.cmd.
2
From the File menu, select Import.
The File Selection dialog box appears.
3
In the File Selection dialog box, select the following:
■
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.
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 (see Figure 18 on page 43).
ADAMS/PostProcessor has two modes: plotting (default) and animation, as shown
in the first option menu on the menu toolbar. Note that the page in the
plot/animation viewing area can contain up to six viewports to let you compare
plots and animations.
43
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
Figure 18. ADAMS/PostProcessor Window
Viewports
Page
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
5
From the dashboard, set Source to Objects.
6
From the Model list, select .main_olt.
7
From the Filter list, select constraint.
8
From the Object list, select antenna_joint.
9
From the Characteristic list, select Element Torque.
10
From the Component list, select Y.
11
Select Add Curves.
ADAMS/PostProcessor generates the curve.
44
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
To add labels to your plot:
1
In the treeview, navigate to the plot and select it.
2
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 19 illustrates how the curve should look. The curve shows the torque 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 19. ADAMS Antenna Joint Peak Torque, Controlled
4
Learning ADAMS/Controls with
Control System Import
Overview
This chapter teaches you how to import the C-code of control
systems designed in control programs into ADAMS in terms of
GSE (General State Equations). It contains the following
sections:
■
Step One – Create Control System for Code
Generation, 46
■
Step Two – Code Generation of Control System, 48
■
Step Three – Create GSE for the Simulink Model, 53
46
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
About the Tutorial
This chapter provides the procedures to import control systems designed in
MATLAB/Simulink into ADAMS. It depends on MATLAB/Real-Time Workshop to
convert the control model to C-code. This tutorial is based on the files output from
ADAMS/View in the previous chapter.
The antenna model is still used in this chapter. The controller used in last chapter will be
modified to represent three different types of controllers: continuous, discrete, and hybrid
(continuous/discrete). Those three simulink files (continuous.mdl, discrete.mdl, and
hybrid.mdl) are in the example directory. Copy them to the local directory.
Step One – Create Control System for Code Generation
First you will start MATLAB, and then you will create simulink template for control
system design. You will use the antenna model files from the last section, plus several
additional files.
To start MATLAB:
1
Start MATLAB in the same directory as the one the model and Simulink files
reside.
2
At the prompt (>>), type ant_test.
MATLAB displays:
%%%INFO:ADAMS plant actuators names:
1 control_torque
%%%INFO:ADAMS plant sensors names:
1 rotor_velocity
2 azimuth_position.
3
At the prompt, type who to get the list of variables defined in the files.
MATLAB displays:
ADAMS_exec
ADAMS_init
ADAMS_inputs
ADAMS_mode ADAMS_poutput
ADAMS_outputs ADAMS_prefix
ADAMS_pinput ADAMS_static
ADAMS_sysdir
ADAMS_uy_ids
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
47
You can check any of the above variables by entering them at the MATLAB prompt. For
example, if you enter ADAMS_outputs, MATLAB displays all of the outputs defined for
your mechanism. For example,
ADAMS_outputs= rotor_velocity!azimuth_position
To create the Simulink template for the control system:
■
Enter setio at the MATLAB prompt.
MATLAB creates a template model with the inport(s) and outport(s) defined, as
shown in the following figure:
Figure 20. Simulink Template
Based on this template, you can design the continuous, discrete, and hybrid control
systems. These are the files you already copied into the local directory.
In the following context, the hybrid control system will be used as the main example to
illustrate the process, whereas the continuous and discrete control systems will be used to
a lessor extent. Figure 21 on page 48 shows the hybrid system which can be opened from
the hybrid.mdl file.
You can also display the Simulink model of continuous and discrete control systems.
48
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
Figure 21. Hybrid Control System
Step Two – Code Generation of Control System
First you will create code from the Simulink model and then you will create the Simulink
model object file.
Given a controller designed with the appropriately designated inports and outports, the
following steps are required to export the model using RTW.
To create code from the Simulink model:
1
Copy the RTW template files from the MATLAB installation into the current
working directory as follows:
■
From $(MATLAB_ROOT)/rtw/c/grt, copy the makefile template to the
directory where the Simulink model resides. On UNIX, the makefile
template is grt_unix.tmf. On Windows, the makefile template is grt_vc.tmf.
■
From $(MATLAB_ROOT)/rtw/c/tlc, copy the source code template srtbody.tlc
to the directory where the Simulink model resides.
For more information on these template files, refer to the Real-Time Workshop
User’s Guide from Mathworks.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
2
Modify the makefile template as follows:
■
On UNIX, insert the contents of the file
<adams_installation_dir>/controls/matlab/unix_make, into grt_unix.tmf,
immediately after the following line:
#--------------------------------- Rules -------------------------------------■
On Windows, insert the line
adams : $(MODEL).obj
into the grt_vc.tmf file, immediately after the following line:
#--------------------------------- Rules --------------------------------------
3
Modify the source code template as follows:
In srtbody.tlc, insert the following two lines:
#include "rt_nonfinite.c"
#include "wrapper"
immediately after the line
#include "%<Name>_reg.h"
4
From the Tools menu, point to Real-Time Workshop, and then select Options. The
Simulation Parameters dialog box appears as shown in Figure 22.
49
50
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
Figure 22. Simulation Parameters - Real-Time Workshop
On UNIX
On Windows
5
On UNIX, make sure that Generate code only is selected. On Windows, deselect it.
6
On UNIX, enter grt_unix.tmf in the Template makefile text box. On Windows, enter
grt_vc.tmf.
7
Accept all remaining default settings.
8
Select Solver tab.
9
The dialog box displays the Solver options as shown in Figure 23 on page 51.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
51
Figure 23. Simulation Parameters - Solver Options
10
Set Solver options Type to Fixed-Step
11
Set Mode to SingleTasking.
12
Select a continuous integrator (because the control system has continuous states).
For the control system discrete.mdl, you would select a Discrete integrator.
13
Select the Real-Time Workshop tab.
14
On UNIX, select the Generate code button to begin code generation. On Windows,
select Build to proceed.
Messages will appear in the MATLAB command window indicating:
■
Successful code generation.
■
Creation of Makefile from the template in the working directory.
For MATLAB 6 and later, all the generated files are created in a subdirectory of the
working directory, called $(MODEL)_grt_rtw. Otherwise, the code is generated in
the working directory.
52
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
On Windows, a message panel appears indicating a failed build. Since we are only
interested in code generation, build failure really does not matter. Instead, the build
process will generate a batch file for our use later. Delete all .obj files in
$(MODEL)_grt_rtw.
To create the Simulink model object:
In the directory $(MODEL)_grt_rtw, several files are created. In addition to several *.c and
*.h file, there is also a makefile $(MODEL).mk. Next, you will create the object file (and
shared library on UNIX) of the Simulink model.
■
Select the proper make command. Refer to Table 2.
In this case, $(MODEL) stands for hybrid.
Table 2. RTW Make Commands
Controller
with
discrete
states:
UNIX
make -f hybrid.mk USER_INCLUDES="-DDGSE
-I<adams_installation_dir>/controls/matlab"
Windows
nmake -f hybrid.mk USER_INCLUDES="-DDGSE
-I<adams_installation_dir>/controls/matlab"
Controller
without
discrete
states:
UNIX
make -f hybrid.mk USER_INCLUDES=
"-I<adams_installation_dir>/controls/matlab"
Windows
nmake -f hybrid.mk USER_INCLUDES=
"-I<adams_installation_dir>/controls/matlab"
UNIX
$(MODEL).o $(MODEL).dll
Windows
$(MODEL).o
File(s)
created:
Note: On UNIX, be sure that the make command is the Gnu Make. On Windows, if the
nmake utility does not work, you can use the batch file hybrid.bat. Modify this file
and run it.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
53
Step Three – Create GSE for the Simulink Model
First you will start ADAMS/View and import the command file, and then simulate your
ADAMS model containing the GSE for the control system.
To start ADAMS/View and load the command file:
1
Launch ADAMS/View and import the file ant_test.cmd.
2
Load the ADAMS/Controls plug-in.
3
From the Controls menu, point to Control System, and then select Control System
Import.
The ADAMS/Controls System Import dialog box displays as shown in
Figure 24 on page 53.
Figure 24. ADAMS/Controls System Import Dialog Box
4
Complete the dialog box and select OK.
As shown in the Database Navigator below, ADAMS/Controls creates a GSE and
its associated arrays.
54
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
Figure 25. Database Navigator
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
55
To simulate your model:
1
From the Settings menu, point to Solver, and then select Dynamics.
The Solver Setting dialog box displays.
2
Change Formulation to SI2, if necessary.
3
Run a simulation with a step size of .001s and duration of .25s.
During the simulation, the antenna motion behaves the same as the one in the cosimulation.
4
Press F8 to open ADAMS/PostProcessor.
5
ADAMS/PostProcessor displays the plot of azimuth position versus time, as
shown in the figure below.
Figure 26. Plot of Azimuth Position vs. Time
A comparison among the results of the above simulation, discrete simulation, and
continuous simulation is conducted. In all cases, the output step (sampling time in discrete
simulation) is set to .001 second. The control torque versus time from three simulations is
plotted in Figure 27 on page 56. As shown, the result from the simulation with imported
GSE is almost the same as that from continuous simulation. The control torque from the
discrete simulation is slightly larger in magnitude because the one-step delay results in a
control-mechanical system with less damping.
56
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
Figure 27. Control Torque vs. Time
5
Learning ADAMS/Controls with
EASY5
Overview
This chapter teaches you how to use ADAMS/Controls with
EASY5. It contains the following sections:
■
About the Tutorial, 58
■
Step Three - Adding Controls to the ADAMS Block
Diagram, 58
■
Step Four - Simulating the Model, 66
Note: Before beginning this tutorial, you should have finished
Chapter 2, Introducing and Starting the Tutorials.
58
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:
■
Add an ADAMS plant to your block diagram in the EASY5 simulation.
■
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:
■
Starting EASY5, 58
■
Creating the ADAMS Interface Block, 59
■
Constructing the Controls System Block Diagram, 64
Starting EASY5
To start EASY5:
■
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
59
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 28. Add Components Window
60
2
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
Select a category for each of the component fields in the window.
■
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 29. Component Data Table
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
2
Select Spawn ADAMS Interface on the lower right corner of the Component Data
Table.
The ADAMS Interface dialog box appears (see Figure 30 on page 61).
3
At the prompt, enter the following information:
■
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 30. ADAMS Interface Dialog Box
Three simulation methods are available:
■
Option 1: Function evaluation mode with no feed-through
■
Option 2: Function evaluation mode with feed-through
■
Option 3: Co-simulation mode
Note: Options 1 and 2 are continuous simulation methods and option 3 is a
discrete simulation method. For information on choosing a simulation
method, see Choosing a Simulation Method on page 102.
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.
61
62
4
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
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 31:
Figure 31. Component Data Table
5
In the Component Data Table, do the following:
a
Enter a value for the following input modes:
■
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 105.
■
For OUT_RAT (output rate interval), enter .001.
Note: Do not change the USE_ICS flag. This flag determines how to set the initial
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.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
b
63
Select Info from the lower left corner of the Component Data Table.
The Component Information Page appears as shown in Figure 32. 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 32. Component Information Page
64
6
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
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
Review the controls block diagram in Figure 33. Begin recreating the diagram with
the blocks from the Add Components menu.
2
Place the Step Function Generator block in the diagram first.
3
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 33. Controls Block Diagram
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
5
65
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).
7
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.
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.
66
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:
■
Building the Executable, 66
■
Executing the Simulation, 66
■
Pausing and Stepping Through the Simulation, 70
■
Plotting from EASY5, 71
■
Plotting from ADAMS/View, 73
Building the Executable
You must build an executable for your model before you execute a simulation in EASY5.
To build the executable:
■
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
3
67
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 34.
Figure 34. Plot Specification Form
68
4
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
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
Select the variable Y1.
d
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 33).
The finished Plot Specification Form should look like the one in Figure 35.
Figure 35. Plot Specification Form
■
Select OK.
The Plot Specification Form closes.
5
Return to the Simulation Data Form window and specify the following simulation
parameters:
■
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
6
69
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 integrates the ADAMS
model in response to them. At the same time, ADAMS provides the azimuthal
position and rotor velocity information for EASY5 to integrate the Simulink model.
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 19 for an illustration of the closed loop
simulation process.
70
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 36) 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 36. 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 37. View Orientation Tools
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
71
Once you have finished reorienting the model, select Resume to continue the
simulation.
3
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 35 on page 68). 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:
■
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 38 on page 72 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.
72
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:
■
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.
The labels you entered appear on the plot as shown in Figure 38.
Figure 38. Plot of Control Torque Input
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
73
Plotting from ADAMS/View
To plot from ADAMS/View:
1
Display ADAMS/View in a new system window and read in the command file,
ant_test.cmd.
2
From the File menu, select Import.
The File Selection dialog box appears.
3
Select the following:
■
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 39 on page 74 shows the ADAMS/PostProcessor window.
74
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
Figure 39. ADAMS/PostProcessor Window
Viewports
Page
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
5
From the dashboard, set Source to Objects.
6
From the Model list, select .main_olt.
7
From the Filter list, select constraint.
8
From the Object list, select antenna_joint.
9
From the Characteristic list, select Element Torque.
10
From the Component list, select Y.
11
Select Add Curves.
ADAMS/PostProcessor generates the curve.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
75
To add labels to the plot:
1
In the treeview, navigate to the plot and select it.
2
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 40 illustrates how the curve should look. The curve shows the torque 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 40. ADAMS Antenna Joint Peak Torque, Controlled
76
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
6
Learning ADAMS/Controls with
MATRIXx
Overview
This chapter teaches you how to use ADAMS/Controls with
MATRIXX. It contains the following sections:
■
About the Tutorial, 78
■
Step Three - Adding Controls to the ADAMS Block
Diagram, 78
■
Step Four - Simulating the Model, 88
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.
78
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:
■
Add an ADAMS plant to your block diagram in the MATRIXX simulation.
■
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:
■
Setting up the MATRIXX Interface, 79
■
Starting MATRIXX, 80
■
Defining SuperBlock Attributes, 81
■
Defining ADAMS Block Parameters, 83
■
Creating the ADAMS Block, 84
■
Constructing the Controls System Block Diagram, 86
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
79
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/adams, you enter:
cp /usr/local/adams/controls/matrixx/makefile.ultra ./makefile
cp /usr/local/adams/controls/matrixx/adams_matrixx.c .
2
Do one of the following:
■
Copy the following three files from the /install_dir/controls/matrixx/
directory to your local directory:
build_adams.msc
update_adams.msf
Build_adams
■
In your startup.ms file, add the line:
path “/install_dir/controls/matrixx/”
For example, on a Sun system, you include:
path “/usr/local/adams/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/adams/controls/
You can add the above to your .cshrc file.
80
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 79.
To start using MATRIXX:
■
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
81
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.
82
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
Figure 41. SystemBuild Editor Window
3
In the SuperBlock Properties dialog box, in the Name text box, enter antenna_system
as the block name.
4
In the Outputs text box, enter 3 to define the number of outputs required for the
combined antenna model and controls system.
5
Set Type to Continuous to define the simulation type.
6
Select OK to exit the SuperBlock Properties dialog box.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
83
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:
2
■
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
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.
84
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 79 for more information).
2
In the Xmath command window, enter build_adams.
The Build_adams Input dialog box appears.
3
Select ADAMS Information File.
A file browser appears.
4
Select ant_test.inf, and then select OK.
5
In the ADAMS block name text box, enter a name for the SuperBlock you are
creating, such as antenna, and press Enter.
6
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 106, 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 102.
8
In the Sample/Output Interval text box, enter 0.001 as the sample interval, and then
press Enter.
9
Select Build ADAMS Block.
The Build_adams Input dialog box should now look like the one in Figure 42.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
85
Figure 42. 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 43 on
page 86. 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.
86
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
Figure 43. 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
87
3
Modify the parameters, and then select Done to place the block in the SystemBuild
Editor.
4
Review the completed controls block diagram shown in Figure 44. Recreate the
same diagram for your antenna model using the procedures in the following
section.
Figure 44. 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:
◆
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 45.
Figure 45. Completed NumDen blocks
88
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.
4
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.
Step Four - Simulating the Model
You will simulate your mechanical model and control system by:
■
Modifying Simulation Parameters, 88
■
Executing the Simulation, 90
■
Pausing and Stepping the Simulation, 94
■
Plotting from MATRIXX, 95
■
Plotting from ADAMS/View, 96
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
89
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
To modify the block name, click the text box, enter Telescope in place of antenna,
and then press Enter.
3
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.
90
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 46. SystemBuild Simulation Parameters Dialog Box
2
Set the following parameters:
◆
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 80.
◆
Select the Interactive option.
The SystemBuild simulation mode is set to interactive.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
3
91
Select OK.
The Interactive Simulator window appears.
Figure 47. 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.
92
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
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
Arrange the windows so that you have a good view of the model. Close the
SystemBuild Editor to help unclutter the screen.
2
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:
◆
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.
The Matrix Editor appears.
◆
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 19.
93
94
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 48. 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
5
95
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 49 on page 96 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.
96
2
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
To plot the other external outputs, enter: ADAMS_out(2,:) for rotor_velocity and
ADAMS_out(3,:) for azimuth_position.
Figure 49. Controls Torque Input from MATRIXX to ADAMS
Plotting from ADAMS/View
1
Display ADAMS/View in a new system window and read in the command file,
ant_test.cmd.
2
From the File menu, select Import.
The File Selection dialog box appears.
3
Select the following:
◆
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.
97
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
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 50 on page 97 shows the ADAMS/PostProcessor window.
Figure 50. ADAMS/PostProcessor Window
Page
Viewports
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
5
From the dashboard, set Source to Objects.
98
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
6
From the Model list, select .main_olt.
7
From the Filter list, select constraint.
8
From the Object list, select antenna_joint.
9
From the Characteristic list, select Element Torque.
10
From the Component list, select Y.
11
Select Add Curves.
ADAMS/PostProcessor generates the curve.
To add labels to your plot:
1
In the treeview, navigate to the plot and select it.
2
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 51 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.
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
Figure 51. ADAMS Antenna Joint Peak Torque, Controlled
99
100
Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
7
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:
■
Choosing a Simulation Method, 102
■
Choosing an Animation Option, 105
■
Choosing an Initialization Method, 106
102
Getting Started Using ADAMS/Controls
Setting Simulation Parameters
Choosing a Simulation Method
ADAMS/Controls offers you three methods with which you can simulate your integrated
model and controller:
■
Discrete mode: Specifies that ADAMS solve the mechanical system equations
and the control application solve the control system equations.
■
Continuous mode: Specifies that the control application solve both the
mechanical and control system equations.
■
C-code import into ADAMS: Specifies that ADAMS solve the mechanical
system and control system equations (only available with MATLAB).
These methods allow you to use different methods to integrate your ADAMS and controls
models (EASY5, MATLAB, or MATRIXX). See Table 3 on page 103 for an overview of
suitable controller/simulation method options.
103
Getting Started Using ADAMS/Controls
Setting Simulation Parameters
Table 3. Suitable Controller/Simulation Method Options
Simulation Method
Controller type:
Discrete
mode:
Continuous
mode:
C-code
import:
Continuous
Yes
Yes
Yes
Continuous sampled controller
Yes
Yes
Yes
Controller with discrete and
continuous states
Yes
Yes
Yes
Discrete controller with
synchronous sampling rates
Yes
Yes
Yes
Discrete controller with
asynchronous multi-sampling
rates
No
Yes
Yes
Logic-based controller
No
Yes
No
Discrete Mode
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.
104
Getting Started Using ADAMS/Controls
Setting Simulation Parameters
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.
Continuous mode
Continuous mode lets MATLAB integrate a system of equations that includes the
mechanical and controls subsystem equation. ADAMS acts as a function evaluator.
ADAMS evaluates differential equations describing the mechanical system, and the
values are sent to the controls package to populate the equations integrated solely by the
controls package. Viewed from the control side, ADAMS is no different from a nonlinear
block. At each integration step, ADAMS provides the necessary information, such as
inputs and time derivatives of states, to the controls packages.
Because the function-evaluation mode creates a system of equations presenting both the
control scheme and the mechanical system at once, any integrator dealing with this sees
an effectively continuous system. While the combined system representation is accurate,
the control software integrator may not be robust enough to effectively handle highfrequency and highly nonlinear effects in the mechanical subsystem.
For more information, see Jacobian Matrix and System Refactorization, on page 108.
C-Code import into ADAMS (MATLAB only)
In this mode, you can import into ADAMS a C-code representation of the control system
build in MATLAB. To do this, you have to first export a C language representation of the
control system using Real-Time Workshop. ADAMS/Controls then allows you to create,
in an automated manner, a general state equation (GSE) element in your ADAMS model
and an object library from this C code. After this is done, you can simulate your combined
model in ADAMS.
Getting Started Using ADAMS/Controls
Setting Simulation Parameters
105
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 4. Animation Options
Method:
Interactive
mode
Batch
mode
Its purpose:
■
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.
Specifies that the simulation run in ADAMS/Solver. This is
the preferred method if a graphic display of the analysis
results is unnecessary, since it provides a much faster solve
time.
106
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. Initialization commands are ADAMS
commands which are executed before the controls package starts the co-simulation. If you
run an animation in interactive mode, you must use ADAMS/View commands to initialize
your model. If you’re in batch mode, use ADAMS/Solver commands.
Table 5. 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:
◆ At the MATLAB prompt, enter:
ADAMS_Init=‘geometry attributes geometry_name=
.main_olt.antenna.REV15 color=RED’
◆
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.
■
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.
8
Advanced Topics
Overview
This chapter contains important information that will be
helpful to you when using ADAMS/Controls. It includes the
following sections:
■
Design Variables versus State Variables, 108
■
Jacobian Matrix and System Refactorization, 108
■
User Libraries, 110
■
Plant Communication Error, 111
■
Integration with Vertical Products, 111
108
Getting Started Using ADAMS/Controls
Advanced Topics
Design Variables versus State Variables
In ADAMS/Controls you can use two types of variables: design variables and state
variables.
A design variable is only a preprocessing entity. It is a placeholder for element parameter
values. When writing an .adm file, these entities are evaluated and entered in the Solver
dataset as numerical values. The design variable value can be any expression created in
the ADAMS Expression Builder. Design variables are also known as ADAMS/View
variables and simply as variable (in the ADAMS/View Database Navigator).
A state variable is a variable whose value is calculated at every simulation step. The value
can be any function created in the ADAMS Function Builder. State variables are also
known as ADAMS/Solver variables, ADAMS/Variable (in ADAMS/View database
navigator), and VARIABLE (statement in ADAMS/Solver dataset).
For more information, see the guide, Using the ADAMS/View Function Builder.
Jacobian Matrix and System Refactorization
A continuous mode simulation in ADAMS/Controls may cause erroneous results due to a
changing Jacobian.
At the start of every simulation, ADAMS creates a Jacobian matrix and factorizes it. The
elements of this special matrix represent the partial differentials of each equation of
motion with respect to each state variable in your system. Some elements could be very
large, others could be very small, and many are typically zero.
To solve the equations of motion, ADAMS must invert the Jacobian matrix. It inverts the
matrix using LU decomposition, Gaussian elimination, and backward substitution
methods, among others. To make these solution techniques more efficient, ADAMS
performs symbolic factorization in an attempt to position the largest values on the
diagonals to act as better pivots during the matrix inversion process. (The factorization
process rearranges rows and columns of the matrix and is said to be symbolic because it
uses pointers to particular matrix elements, rather than actually moving their computer
addresses.)
Getting Started Using ADAMS/Controls
Advanced Topics
109
Unfortunately, it is quite common that as parts move and forces change during the course
of a mechanical system’s natural movement, some of the matrix pivots (that is, elements
on the diagonal) radically change in magnitude. To avoid zero or near-zero pivots in the
resulting Jacobian matrix, at certain points in time, ADAMS will attempt to re-factorize
the matrix to again place the largest values on the diagonal. A common example of a
situation that requires refactorization is when intermittent contact is modeled using a force
element with the IMPACT function in ADAMS and a derivative of this force equation is
used as a pivot. When the bodies are in contact, the force is typically very large and thus
the pivot works well. But when the bodies are not in contact, the force goes to zero and the
zero pivot will cause a singularity during the matrix-inversion process, so refactorization
is required.
Discontinuous function expressions for user-defined equations, such as with forces or
motions, can also cause matrix singularities. This is why we recommend the use of the
continuous STEP, STEP5, or TANH functions in ADAMS, instead of the possibly
discontinuous IF function.
So, you could receive a message that ADAMS is symbolically refactorizing the Jacobian
matrix for various reasons:
■
A new analysis type has been initiated (for example, assembly or initial
conditions, statics, dynamics, and so on). ADAMS must always perform an
initial factorization of the Jacobian matrix at the start of a new simulation.
■
Pivot has become sufficiently close to zero so as to make the Jacobian matrix
nearly singular and non-invertible. This is usually due to abrupt changes
occurring in your system.
A refactorization message is a sign that something has changed in your system at a
particular point in time. Although it is not necessarily a sign of problems in the definition
of your system or in the solution, it could be, and so is worth investigating. Fortunately,
ADAMS automatically refactorizes when necessary. However, you can also use your
animation and plotting tools or your debugging tools to check what happens immediately
before and after these times to search for causes.
110
Getting Started Using ADAMS/Controls
Advanced Topics
User Libraries
Unlike previous versions of ADAMS, with ADAMS 12.0, you no longer need to create an
entire executable for ADAMS when you want to link in a user subroutine. Instead, you
create a library and simply select it when you need the subroutine(s) within the library. For
more information on this change, see http://support.adams.com/kb/faq.asp?ID=
kb9317.html.
Therefore, instead of creating a controls executable (for example,
adams12 controls cr-uscontrols), you simply create a standard user executable (for
example, adams12 cr-user).
To create a user library:
1
Perform one of the following:
❖
On UNIX: enter mdi -c cr-user
❖
On Windows: From the Start menu, point to Programs, point to ADAMS 12.0,
point to ASolver, and then select Create Custom Solver. (Or, type mdi cr-user in
the DOS prompt.)
2
Specify if you want to link in debug mode, and provide the list of your user
subroutines.
3
Provide a name for the library, such as my_sub.dll.
4
Within ADAMS/View, when you use the Controls Plant Export dialog box to save
out your input and output data, include the name of the user library you just
created in the appropriate text box.
The user executable name is now automatically written out to the MATLAB .m file
or the MATRIXx/EASY5 information file and automatically picked up by the
controls program as the proper executable. Alternatively, you can enter this
explicitly in the file. For example, in MATLAB, enter ADAMS_exec =
’$my_path/my_sub.dll’; (where $my_path is the path to your library).
Note that there is no longer a difference between a custom ADAMS/Solver library and a
custom ADAMS/View library if the library is used by ADAMS/Solver. In other words,
you create a library for ADAMS/Solver, which can be used by either the ADAMS/View
Getting Started Using ADAMS/Controls
Advanced Topics
111
interface or ADAMS/Solver when simulating. An ADAMS/View library can only be in
ADAMS/View as in design-time; it makes no sense to use this with ADAMS/Solver, and
obviously cannot be used in ADAMS/Solver.
For more information, see the guides, Running and Configuring ADAMS on UNIX and
Running ADAMS on Windows.
Plant Communication Error
The ADAMS plant communication error is a generic message that could unfortunately
mean anything from you don’t have a license available, to you’ve referenced a variable
incorrectly in MATLAB. If you’re trying to make your own model work and haven’t tried
one of the example problems found in your ADAMS installation at
/ADAMS_install/controls/examples/, then run an example. It’s important to ensure that you
can run an example, as your own model can potentially have incorrect feedback values,
crossed lines, and so on. You should verify that you can run an example model, which has
been setup to work properly, before you start with your own model.
If you generate an ADAMS plant communication error at some point in an
ADAMS/Controls cosimulation (due to too rapid feedback, improper variable
specification in MATLAB, and so on), fix the source of your error, but now get the plant
communication error as soon as you select Simulate, you may need to clean up your
workspace.
To clear things in the MATLAB environment, use the clear mex command on the command
line in MATLAB. This removes extraneous items from past failures and will allow you to
perform subsequent simulations.
Integration with Vertical Products
For the latest information on integrating ADAMS/Controls with ADAMS/Car,
ADAMS/Chassis, and ADAMS/Rail, refer to the MDI Knowledge Base at
http://support.adams.com/kb.
112
Getting Started Using ADAMS/Controls
Advanced Topics
113
Getting Started Using ADAMS/Controls
Index
Index
A-B
ADAMS
block, creating in EASY5 59
block, creating in MATRIXx 84
block, initializing interface in EASY5 60
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 106
starting from UNIX or Windows 13
using 8
ADAMS/Solver variable 108
A-B
C-D
E-F
G-H
I-J
K-L
M-N
O-P
Q-R
S-T
ADAMS/View variable 108
Animation options
batch 105
interactive 105
Antenna model, components of 16
Automatic initialization mode 106
Batch animation mode 105
Block diagram
ADAMS, creating in EASY5 59
ADAMS, creating in MATRIXx 84
controls system, constructing in EASY5 64
controls system, constructing in MATLAB 35
controls system, constructing in MATRIXx 86
creating ADAMS in MATLAB 33
sub-block of ADAMS in MATLAB 34
U-V
W-Z
114
Getting Started Using ADAMS/Controls
Index
C-D
A-B
Component
data table in EASY5 60
information page in EASY5 63
C-D
Continuous simulation mode 102
E-F
Control system import 45
G-H
Controls
adding to ADAMS block using EASY5 58
adding to ADAMS block using MATLAB 31
adding to ADAMS block using MATRIXx 78
how to improve design process of 6
Create
block diagram in MATLAB 33
Creating
Simulink template 47
user libraries 110
Deactivating azimuth motion in model 17
I-J
K-L
M-N
O-P
Q-R
S-T
Design process with ADAMS/Controls 6
Design variables 108
Discontinuous function expressions 109
Discrete control systems 47
Discrete simulation mode 102
U-V
W-Z
Getting Started Using ADAMS/Controls
Index
E-F
EASY5
adding controls to ADAMS block 58
component data table in 60
component information page in 63
constructing controls system diagram in 64
creating ADAMS block in 59
executing a simulation in 66
initializing ADAMS interface block in 60
pausing and stepping simulation in 70
plotting from 71
plotting from ADAMS/View 73
simulating interactively in 69
starting 58
115
A-B
C-D
E-F
G-H
I-J
K-L
M-N
Error, plant communication 111
O-P
Executing
simulation in EASY5 66
simulation in MATLAB 39
simulation in MATRIXx 88
Q-R
Exporting plant files 24
U-V
S-T
File types 37
Four-step process in ADAMS/Controls 9
Functions
output 23
VARVAL 22
G-H
How you’ll learn ADAMS/Controls 12
Hybrid control systems 47
W-Z
116
Getting Started Using ADAMS/Controls
Index
I-J
A-B
IMPACT function 109
Importing the model 14
Initialization method
automatic 106
manual 106
C-D
E-F
G-H
Initializing ADAMS block in EASY5 60
Input
functions, verifying 22
identifying path for 19
verifying variables for 20
Interactive animation mode 105
I-J
K-L
M-N
Jacobian matrix 108
O-P
K-L
Q-R
Learning
ADAMS/Controls 10
ADAMS/Controls with Control System Import 45
ADAMS/Controls with EASY5 45, 57
ADAMS/Controls with MATLAB 29
ADAMS/Controls with MATRIXx 77
Libraries, user 110
Loading ADAMS/Controls 15
S-T
U-V
W-Z
Getting Started Using ADAMS/Controls
Index
M-N
117
A-B
Manual initialization mode 106
MATLAB 38
adding controls to ADAMS block 31
constructing controls system diagram in 35
creating block diagram in 33
executing simulation in 39
pausing simulation in 39
plotting from 40
plotting from ADAMS/View 42
setting parameters in plant mask 36
setting simulation parameters in 38
simulating interactively in 37
Simulink palette in 33
starting 31
MATRIXx
adding controls to ADAMS block 78
adding NumDen blocks to controls diagram 87
constructing controls system diagram in 86
creating ADAMS block 84
defining attributes in SuperBlock 81
executing a simulation in 88
modifying simulation parameters in 88
pausing and stepping simulation in 94
plotting from 95
plotting from ADAMS/View 96
simulating interactively in 93
starting 80
Model, importing 14
Motion, deactivating in ADAMS/View 17
NumDen blocks, using in MATRIXx 87
C-D
E-F
G-H
I-J
K-L
M-N
O-P
Q-R
S-T
U-V
W-Z
118
Getting Started Using ADAMS/Controls
Index
O-P
A-B
Output
functions, verifying 23
identifying path for 19
C-D
Parameters, setting in MATLAB plant mask 36
E-F
Pausing
simulation in EASY5 70
simulation in MATLAB 39
simulation in MATRIXx 94
G-H
Plant communication error 111
K-L
Plant files, exporting 24
Plant mask, setting parameters in MATLAB 36
I-J
M-N
Plotting
EASY5 results in ADAMS/View 73
from CSI 55
from EASY5 71
from MATLAB 40
from MATRIXx 95
MATLAB results in ADAMS/View 42
MATRIXx results in ADAMS/View 96
O-P
Plug-in, loading 15
W-Z
Q-R
Real-time workshop options 49
Refactorization, system 108
Running a trial simulation in ADAMS/View 16
Q-R
S-T
U-V
Getting Started Using ADAMS/Controls
Index
S-T
Setting
plant mask parameters in MATLAB 36
simulation parameters in ADAMS/Controls 101, 107
simulation parameters in EASY5 68
simulation parameters in MATLAB 38
simulation parameters in MATRIXx 88
Simulation
animation options for 105
choosing a method for 102
continuous, choosing 102
discrete 102
executing in EASY5 66
executing in MATLAB 39
executing in MATRIXx 88
in step 4 using EASY5 66
in step 4 using MATLAB 38
in step four using MATRIXx 88
initialization options for 106
modifying parameters in MATRIXx 88
parameters, setting in ADAMS/Controls 101, 107
pausing and stepping in EASY5 70
pausing and stepping in MATRIXx 94
pausing in MATLAB 39
running a trial without controls 16
running interactively in EASY5 69
running interactively in MATRIXx 93
Simulink palette in MATLAB 33
Simulink, creating template 47
Solver options 51
Starting
EASY5 58
MATLAB 31
MATRIXx 80
119
A-B
C-D
E-F
G-H
I-J
K-L
M-N
O-P
Q-R
S-T
U-V
W-Z
120
Getting Started Using ADAMS/Controls
Index
State variables 108
A-B
SuperBlock
defining attributes in MATRIXx 81
file in MATRIXx 81
C-D
System refactorization 108
E-F
Tutorial
about 12
for ADAMS/Controls with CSI 46
for ADAMS/Controls with EASY5 45, 57
for ADAMS/Controls with MATLAB 29
for ADAMS/Controls with MATRIXx 77
introducing and starting the 12
U-V
User libraries 110
Variables
design 108
output function for 23
state 108
verifying input for 20
G-H
I-J
K-L
M-N
O-P
Q-R
S-T
U-V
VARVAL function 22
Verifying
input variables 20
output functions 23
W-Z
Ways to use ADAMS/Controls 8
W-Z