Professional Documents
Culture Documents
Using ADAMS/Controls
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.
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.
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
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
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.
Step One:
Build the
ADAMS
model.
Step Two: Step Three: Step Four:
Identify the Build the control Simulate the
ADAMS inputs and system block model.
outputs and export
diagram.
the plant 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
Controls
Controls Output 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.
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
■ Starting ADAMS/View, 13
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:
Antenna
Elevation bearings
Reduction gear
Azimuth rotor
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
3 Select the Static Equilibrium tool to equalize the applied forces and locate the
static position of the model.
5 Select the Reset to Start tool to reset the simulation back to its first frame.
6 Rerun the simulation.
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
Control
system
20 Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
1 From the Build menu, point to System Elements, point to State Variable, and then select
Modify.
3 Select control_torque.
4 Select OK.
The Modify State Variable dialog box appears.
Figure 7. Modify State Variable Dialog Box
5 Look in the F(time, ...)= text box and verify that the run-time function for the input
variable, control_torque, is 0.0.
Because the control torque 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
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 23
Introducing and Starting the Tutorials
1 From the Build menu, point to System Elements, point to State Variable, and then select
Modify.
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.
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.
5 Select OK.
26 Getting Started Using ADAMS/Controls
Introducing and Starting the Tutorials
6 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.
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.
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.
4 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:
Overview
This chapter teaches you how to use ADAMS/Controls with
MATLAB. It contains the following sections:
■ About the Tutorial, 30
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.
4 At the prompt, type who to get the list of variables defined in the files.
MATLAB echoes:
ADAMS_exec ADAMS_mode ADAMS_poutput ADAMS_sysdir
ADAMS_init ADAMS_outputs ADAMS_prefix ADAMS_uy_ids
ADAMS_inputs ADAMS_pinput ADAMS_static
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 33
Learning ADAMS/Controls with MATLAB
2 From the File menu, point to New, and then select Model.
A new palette for building your block diagram appears.
3 Drag and drop the adams_sub block from the adams_sys palette onto the new
palette.
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 35
Learning ADAMS/Controls with MATLAB
5 From the File menu, select Save As, and enter a file name for your controls block
diagram.
1 From the new Simulink palette, double-click the Mechanical Dynamics block.
The ADAMS Plant Mask dialog box appears.
Figure 14. ADAMS Plant Mask
1 From the menus on the Simulink palette, select Simulation, and then select
Parameters.
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 Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATLAB
2 Now go back to ADAMS/View. While the simulation is paused, you can change
the orientation of the model with the View Orientation tools in the Main toolbox.
These tools help you to look at the model from different vantage points.
Figure 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.
1 Display ADAMS/View in a new system window and read in the command file,
ant_test.cmd.
Page Viewports
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
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
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_mode ADAMS_poutput ADAMS_sysdir
ADAMS_init ADAMS_outputs ADAMS_prefix ADAMS_uy_ids
ADAMS_inputs ADAMS_pinput ADAMS_static
Getting Started Using ADAMS/Controls 47
Learning ADAMS/Controls with Control System Import
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
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
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 49
Learning ADAMS/Controls with Control System Import
adams : $(MODEL).obj
#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.
50 Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with Control System Import
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.
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.
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 53
Learning ADAMS/Controls with Control System Import
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 co-
simulation.
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
Overview
This chapter teaches you how to use ADAMS/Controls with
EASY5. It contains the following sections:
■ About the Tutorial, 58
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.
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 61
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
b 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 Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with EASY5
The ADAMS block is now initialized for use with the antenna model.
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 65
Learning ADAMS/Controls with EASY5
5 Connect the input blocks by clicking once on the First Order Lag block and then on
the ADAMS Nonlinear Block.
EASY5 labels this connection as S2 LA11.
6 Connect the output blocks in the diagram by clicking on the ADAMS Nonlinear Block
and then on the Summing Junction block. Be sure to connect the azimuth+position
output (Y2) to the first Summing Junction block (LA) and the rotor_velocity output (Y1)
to the second Summing Junction block (LA11).
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
1 From the toolbar at the top of the EASY5 main window, point to Analysis, point to
Nonlinear, and then select Simulation.
4 Select the variables that you want to plot for the simulation.
For this tutorial, you will select three variables: Y1, Y2, and S2 LA11.
a Click in the column next to number 1.
A box appears.
b Select Show Name List.
The Pick Dialog box appears.
c 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 69
Learning ADAMS/Controls with EASY5
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
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 71
Learning ADAMS/Controls with EASY5
3 Once you have finished reorienting the model, select Resume to continue the
simulation.
ADAMS/View closes automatically after the simulation finishes.
The EASY5 Plotter window and the Plot Selection Menu appear.
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
1 Display ADAMS/View in a new system window and read in the command file,
ant_test.cmd.
Page Viewports
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
Overview
This chapter teaches you how to use ADAMS/Controls with
MATRIXX. It contains the following sections:
■ Starting MATRIXX, 80
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.
■ Start up MATRIXX from the directory that contains the file with the antenna
example.
The Xmath main window appears.
Getting Started Using ADAMS/Controls 81
Learning ADAMS/Controls with MATRIXx
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 83
Learning ADAMS/Controls with MATRIXx
1 In the Xmath command initial window, enter the simulation time as a column
vector:
t=[0:0.001:0.25]’;
where:
■ The first parameter (0) is the start time
■ The second parameter (0.001) is the step size
■ The third parameter (0.25) is the simulation end type
2 Enter the following controller parameters as Xmath variables:
PGain = 1040
VGain = 950
Den = [1e-3,1]’;
where PGain and VGain are the numerators and Den is the denominator of the controller
transfer functions.
84 Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
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).
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
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
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.
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 89
Learning ADAMS/Controls with MATRIXx
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.
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.
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
3 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
Note: The ADAMS model is initialized to the simulation time defined in the SystemBuild
Editor.
Getting Started Using ADAMS/Controls 93
Learning ADAMS/Controls with MATRIXx
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.
94 Getting Started Using ADAMS/Controls
Learning ADAMS/Controls with MATRIXx
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 95
Learning ADAMS/Controls with MATRIXx
5 Select Block Step to execute one block at a time in the SystemBuild model.
You can monitor how the signals are updated by switching the view mode of the
blocks. To switch the view mode, point on a block and type v.
6 When the simulation is completed, close the ISIM window by selecting the File
menu, then selecting Exit.
2 To plot the other external outputs, enter: ADAMS_out(2,:) for rotor_velocity and
ADAMS_out(3,:) for azimuth_position.
Page Viewports
Menu bar
Menu toolbar
Treeview
Property editor
Status toolbar
Dashboard
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
Simulation Method
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 high-
frequency and highly nonlinear effects in the mechanical subsystem.
For more information, see Jacobian Matrix and System Refactorization, on page 108.
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
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).
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 111
Advanced Topics
Index A-B
A-B C-D
ADAMS
block, creating in EASY5 59 E-F
block, creating in MATRIXx 84
block, initializing interface in EASY5 60 G-H
ADAMS/Controls
about 3 I-J
basics 5
benefits of 6
K-L
design process with 6
four-step process, about 9
M-N
how to learn 10
initialization methods in 106 O-P
starting from UNIX or Windows 13
Q-R
using 8
ADAMS/Solver variable 108 S-T
ADAMS/View variable 108
Animation options U-V
batch 105
interactive 105 W-Z
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
114 Getting Started Using ADAMS/Controls
Index
C-D A-B
Component
data table in EASY5 60 C-D
information page in EASY5 63
Continuous simulation mode 102 E-F
Control system import 45
G-H
Controls
adding to ADAMS block using EASY5 58 I-J
adding to ADAMS block using MATLAB 31
adding to ADAMS block using MATRIXx 78 K-L
how to improve design process of 6
Create M-N
block diagram in MATLAB 33
O-P
Creating
Simulink template 47 Q-R
user libraries 110
Deactivating azimuth motion in model 17 S-T
Design process with ADAMS/Controls 6
Design variables 108
U-V
Discontinuous function expressions 109 W-Z
Discrete control systems 47
Discrete simulation mode 102
Getting Started Using ADAMS/Controls 115
Index
E-F A-B
EASY5
adding controls to ADAMS block 58 C-D
component data table in 60
component information page in 63 E-F
constructing controls system diagram in 64
creating ADAMS block in 59 G-H
executing a simulation in 66
initializing ADAMS interface block in 60 I-J
pausing and stepping simulation in 70
plotting from 71 K-L
plotting from ADAMS/View 73
simulating interactively in 69 M-N
starting 58
Error, plant communication 111 O-P
Executing Q-R
simulation in EASY5 66
simulation in MATLAB 39
S-T
simulation in MATRIXx 88
Exporting plant files 24 U-V
File types 37
Four-step process in ADAMS/Controls 9 W-Z
Functions
output 23
VARVAL 22
G-H
How you’ll learn ADAMS/Controls 12
Hybrid control systems 47
116 Getting Started Using ADAMS/Controls
Index
I-J A-B
IMPACT function 109
Importing the model 14 C-D
Initialization method E-F
automatic 106
manual 106
G-H
Initializing ADAMS block in EASY5 60
Input I-J
functions, verifying 22
identifying path for 19 K-L
verifying variables for 20
M-N
Interactive animation mode 105
Jacobian matrix 108 O-P
K-L Q-R
Learning
ADAMS/Controls 10 S-T
ADAMS/Controls with Control System Import 45
ADAMS/Controls with EASY5 45, 57 U-V
ADAMS/Controls with MATLAB 29
ADAMS/Controls with MATRIXx 77 W-Z
Libraries, user 110
Loading ADAMS/Controls 15
Getting Started Using ADAMS/Controls 117
Index
M-N A-B
Manual initialization mode 106
MATLAB 38 C-D
adding controls to ADAMS block 31
constructing controls system diagram in 35 E-F
creating block diagram in 33
executing simulation in 39 G-H
pausing simulation in 39
plotting from 40 I-J
plotting from ADAMS/View 42
setting parameters in plant mask 36 K-L
setting simulation parameters in 38
simulating interactively in 37 M-N
Simulink palette in 33
starting 31 O-P
MATRIXx Q-R
adding controls to ADAMS block 78
adding NumDen blocks to controls diagram 87
S-T
constructing controls system diagram in 86
creating ADAMS block 84
U-V
defining attributes in SuperBlock 81
executing a simulation in 88
modifying simulation parameters in 88 W-Z
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
118 Getting Started Using ADAMS/Controls
Index
O-P A-B
Output
functions, verifying 23 C-D
identifying path for 19
Parameters, setting in MATLAB plant mask 36 E-F
Pausing
G-H
simulation in EASY5 70
simulation in MATLAB 39 I-J
simulation in MATRIXx 94
Plant communication error 111 K-L
Plant files, exporting 24
M-N
Plant mask, setting parameters in MATLAB 36
Plotting O-P
EASY5 results in ADAMS/View 73
from CSI 55 Q-R
from EASY5 71
from MATLAB 40 S-T
from MATRIXx 95
MATLAB results in ADAMS/View 42 U-V
MATRIXx results in ADAMS/View 96
Plug-in, loading 15 W-Z
Q-R
Real-time workshop options 49
Refactorization, system 108
Running a trial simulation in ADAMS/View 16
Getting Started Using ADAMS/Controls 119
Index
S-T A-B
Setting
plant mask parameters in MATLAB 36 C-D
simulation parameters in ADAMS/Controls 101, 107
simulation parameters in EASY5 68 E-F
simulation parameters in MATLAB 38
simulation parameters in MATRIXx 88 G-H
Simulation
animation options for 105 I-J
choosing a method for 102
continuous, choosing 102 K-L
discrete 102
executing in EASY5 66 M-N
executing in MATLAB 39
executing in MATRIXx 88 O-P
in step 4 using EASY5 66
in step 4 using MATLAB 38 Q-R
in step four using MATRIXx 88
initialization options for 106 S-T
modifying parameters in MATRIXx 88
parameters, setting in ADAMS/Controls 101, 107 U-V
pausing and stepping in EASY5 70
pausing and stepping in MATRIXx 94 W-Z
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
120 Getting Started Using ADAMS/Controls
Index
W-Z
Ways to use ADAMS/Controls 8