Professional Documents
Culture Documents
2
Adams Controls User's Guide
Corporate Europe, Middle East, Africa
MSC Software Corporation MSC Software GmbH
4675 MacArthur Court, Suite 900 Am Moosfeld 13
Newport Beach, CA 92660 81829 Munich, Germany
Telephone: (714) 540-8900 Telephone: (49) 89 431 98 70
Toll Free Number: 1 855 672 7638 Email: europe@mscsoftware.com
Email: americas.contact@mscsoftware.com
Japan Asia-Pacific
MSC Software Japan Ltd. MSC Software (S) Pte. Ltd.
KANDA SQUARE 16F 100 Beach Road
2-2-1 Kanda Nishikicho, Chiyoda-ku #16-05 Shaw Tower
Tokyo 101-0054, Japan Singapore 189702
Telephone: (81)(3) 6275 0870 Telephone: 65-6272-0082
Email: MSCJ.Market@mscsoftware.com Email: APAC.Contact@mscsoftware.com
Worldwide Web
www.mscsoftware.com
Support
http://www.mscsoftware.com/Contents/Services/Technical-Support/Contact-Technical-Support.aspx
Disclaimer
This documentation, as well as the software described in it, is furnished under license and may be used only in accordance with the
terms of such license.
MSC Software Corporation reserves the right to make changes in specifications and other information contained in this document
without prior notice.
The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended
to be exhaustive or to apply to any particular engineering problem or design. MSC Software Corporation assumes no liability or
responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein.
User Documentation: Copyright © 2021 MSC Software Corporation. Printed in U.S.A. All Rights Reserved.
This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this
document, in whole or in part, without the prior written consent of MSC Software Corporation is prohibited.
This software may contain certain third-party software that is protected by copyright and licensed from MSC Software suppliers.
Additional terms and conditions and/or notices may apply for certain third party software. Such additional third party software terms
and conditions and/or notices may be set forth in documentation and/or at http://www.mscsoftware.com/thirdpartysoftware (or successor
website designated by MSC from time to time). Portions of this software are owned by Siemens Product Lifecycle Management, Inc.
© Copyright 2021
The MSC Software logo, MSC, MSC Adams, MD Adams, and Adams are trademarks or registered trademarks of MSC Software
Corporation in the United States and/or other countries. Hexagon and the Hexagon logo are trademarks or registered trademarks of
Hexagon AB and/or its subsidiaries. FLEXlm and FlexNet Publisher are trademarks or registered trademarks of Flexera Software.
Parasolid is a registered trademark of Siemens Product Lifecycle Management, Inc. All other trademarks are the property of their
respective owners.
ADAM:V2021.0.2:Z:Z:Z:DC-CNTL
Documentation Feedback
At MSC Software, we strive to produce the highest quality documentation and welcome your feedback.
If you have comments or suggestions about our documentation, write to us at: documentation-
feedback@mscsoftware.com.
Please include the following information with your feedback:
Document name
Release/Version number
Chapter/Section name
Topic title (for Online Help)
Brief description of the content (for example, incomplete/incorrect information, grammatical
errors, information that requires clarification or more details and so on).
Your suggestions for correcting/improving documentation
You may also provide your feedback about MSC Software documentation by taking a short 5-minute
survey at: http://msc-documentation.questionpro.com.
Note: The above mentioned e-mail address is only for providing documentation specific
feedback. If you have any technical problems, issues, or queries, please contact Technical
Support.
Welcome to Adams Controls 1
About 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 the control law being poorly matched to the real system is
eliminated as you can see in the figure below.
Welcome to Adams Controls 3
Ways to Use Adams Controls
Controls
Application
Controls Output Controls Input
1. 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.
2. Create the Adams Inputs and Outputs - 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 state variables. After these are defined, you export the plant system files from Adams
for use in the controls simulation software.
3. Build the Block Diagram - Build the control system block diagram with Easy5 or
MATLAB/Simulink. Include the Adams plant in your block diagram, or if using Real-Time
Workshop, export the controls system and import into Adams.
4. Simulate the Model - Simulate the combined mechanical model and control system. Several different
methods are available to run your simulation.
Adams Controls Overview 7
Loading Adams Controls
of adding controls to an Adams model. The example also includes tutorials for each of the controls
applications you can use with Adams Controls: Co-simulation, Function evaluation, and Control System
Import with both Easy5 and MATLAB. See the Examples section to find this tutorial.
Simulation Methods
Choosing a Simulation Method
Adams Controls offers you three methods with which you can simulate your integrated model and controller:
Co-simulation/Discrete mode: Specifies that Adams solve the mechanical system equations and the control
application solve the control system equations. Adams and the control application exchange inputs and
outputs at predetermined time interval also known as the communication interval or co-simulation interval.
The mode names of "co-simulation" and "discrete" are synonymous.
Function Evaluation/Continuous mode: Specifies that the control application solve both the mechanical and control
system equations. The mode names of "function evaluation" and “continuous” are synonymous.
Control System Import : Specifies that Adams solve the combined mechanical system and control system
equations by importing an External System Library (ESL) which is binary representation of a model
generated by MATLAB/Real-Time Workshop or Easy5. The ESL is used by Adams Controls to automatically
create a General State Equations (GSE) entity, along with other supporting entities. This process is also
known as External Function Evaluation (XFE), External System Import (ESI), Importing General State
Equations, or Dynamic System Import (DSI).
These methods allow you to use different methods to integrate your Adams and controls models (EASY5 or
MATLAB). See the table below for an overview of 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 Yes Yes Yes
continuous states
Discrete controller with synchronous Yes Yes Yes
sampling rates
Discrete controller with asynchronous No Yes Yes
multi-sampling rates
Logic-based controller No Yes No
Co-simulation
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
Adams Controls Overview 9
Plant Inputs and Outputs
solved in the control system would cause a large coupling effect on the Adams data. For example, you might
prefer to use the continuous mode if your analysis requires a very small time step.
To preserve the proper dynamics for a mechanical system, discrete mode should sample the mechanical
system at least five times greater than the highest frequency of interest. If the time step is too small to sample
at five times the highest frequency, then you should use continuous mode.
Note: You can find the highest frequency of your mechanical system by performing a linear analysis
with the Adams add-on module, Adams Linear.
Function Evaluation
In continuous (function evaluation) mode, the control system package solves the equations of motion for the
combined controls and mechanical dynamics system. Adams formulates the equations of motion for the
mechanical subsystem and provides information to the controls package as needed.
Typically Adams simulations involve solving a set of differential (equations of motion) and algebraic
(constraint and applied force) equations, known as a DAE system. The Adams integrators are specially tuned
for efficient solution of this type of problem. Using coordinate partitioning, Adams can also formulate the
equations of motion based on a minimum independent set of system states. This results in a compact
ordinary differential equation (ODE) formulation of the equations of motion. Typically this system of
equations is more difficult to solve numerically than the DAE method described above.
The benefit of this ODE formulation is that the state values and time derivatives can be easily communicated
to the controls package. Using this information, the controls package can form a combined ODE system
describing the controls and mechanical states. This is the problem that the controls package then solves with
its own integration techniques. When a new set of state values is found in the controls package, Adams is
called to find the time derivatives of these states, based on the ODE formulation that Adams has created for
the mechanical states. This is why it is known as “function evaluation” mode. Adams simply sets up the
equations of motion and provides time derivative information for the states in this mode.
For more information on how continuous mode works, refer to
http://simcompanion.mscsoftware.com/iKB8015801.
by the Plant Export dialog box, or created by using Plant Input/Plant Output option found in Elements Tab
→ Data Elements container → Create an ADAMS Plant Input/Plant Output.
Note that 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 Adams 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 variables (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 View 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).
Adams Controls uses state variables to specify the inputs and outputs from the Adams model, because these
variables are computed during runtime.
For more information, see the online help for Adams View Function Builder.
2. From the Controls container, click the Controls icon and then select Plant Export.
3. Complete the Adams Controls Plant Export dialog box as described in Adams Controls Plant Export.
4. Select OK.
Using Easy5
Note: Check http://simcompanion.mscsoftware.com/ to find the versions of Easy5 that are compatible
with Adams.
1. Make sure that both Easy5 and Adams have been installed.
2. Make sure you have permission (that is, root ('superuser') privilege) to add and modify files in the
Easy5 installation directory.
3. Perform the following, depending on your platform:
On Linux:
a. Open an xterm window and set your working directory to a directory outside the Easy5
installation directory tree.
b. Start Easy5. The standard command is easy5x.
c. In the Easy5 main window, from the File menu, select Open Command Shell.
d. At the prompt in the command shell, enter:
$EZHOME/install_adams_controls.ksh adamscmd
where: adamscmd = command used to invoke Adams (for example, adams1401)
On Windows:
a. From the Start menu, point to Programs, point to Easy5 - (version), point to Shell, and then
select Easy5 Command Shell.
b. At the prompt within the command shell type:
install_adams_controls.bat <Adams_topdir> <Easy5_topdir>
where: <Adams_topdir> is the top-level directory for Adams, also provided by "adams2021_0_2
-top"; <Easy5_topdir> is the top-level directory of Easy5 (for example, C:\Program
Files\MSC.Software\Adams\2021_0_2, C:\Program Files\MSC.Software\EASY5\2015,
respectively).
Note: If you are unable to identify a command line command to run Adams but you can
identify the top-level directory of the Adams installation, you can use -d "directory
path" in place of the command line command.
License Configuration
To configure your computer to run licensed exported Easy5 models within Adams:
1. Start Easy5.
2. From the File menu, select Open Command Shell.
3. At the prompt in the command shell, type easy5x -license.
Easy5 displays the licensing information, beginning with the type of license and the server name (if a
server license) or the path to the license file.
4. Write down the contents of the line that starts with Active license file(s), and the value that appears
in the line following it (for example, 1700@rainier).
5. Perform one of the following:
• If the line is Active license file(s) [EASY5_LMD_LICENSE_FILE], set the environment variable
EASY5_LMD_LICENSE_FILE to the output value displayed in Step 4 above (for example,
1700@rainier).
• If the line is Active license file(s) [MSC_LICENSE_FILE], find the value of the environment
variable MSC_LICENSE_FILE to see what license file Adams is using.
• If Easy5 and Adams are using different licenses (or license servers), set LM_LICENSE_FILE to
the value for the Easy5 license (for example 2500@bosco).
• If Easy5 and Adams are using the same license, your computer is configured properly.
6. For Windows platforms only, modify the Path environment variable to include the path to the
lib_em64t_IFORT (Win64) subdirectory of your Easy5 installation tree.
• If your Easy5 model contains components from a licensed library (for example, the Thermo-
Hydraulic, Powertrain, or Gas Dynamics libraries), you will need to make sure Adams finds your
Easy5 license. Failure to perform this step will result in the Easy5 license library not being found.
• Adams supports the Intel Visual Fortran 16 compiler. The Easy5 model import feature is not
supported with the GNU or other compilers. Check http://simcompanion.mscsoftware.com/DOC9283
for latest compiler support information.
To find the appropriate value for the variable:
a. Start Easy5.
b. Open an Easy5 command shell: from the Easy5 File menu, select Open Command Shell.
c. At the command shell prompt, enter: echo %EZHOME%.
The output is the directory in which Easy5 is installed. You will use the directory information in
Step 5 below. The usual value of EZHOME is:
C:\Program Files\MSC.Software\Easy5\(version)\
or
easy5x -AutoUpdPurge
and you want to launch the Configure dialog box to manually select the .inf and/or Execution Mode, you
can display the Adams Controls Extension Component (AD Block) by setting the following environment
variable to zero:
set EZ5_EXT_UPDATE_AD_NO_GUI=0
You can set back to the default mode of suppressing the Adams Controls Extension Component (AD Block)
by removing this environment variable or setting the following environment variable to anything non-zero:
set EZ5_EXT_UPDATE_AD_NO_GUI=1
Although it is recommended that the AD block be updated for each model, to suppress the Extension
Component Update, set the following environment variable:
set EZ5_SKIP_EXT_UPD_CHECK=true
and it will not do any checking for Extensions (this would revert to the prior behavior for Extensions – no
checking at all). For users of 8.0.7, this is recommended since an error in 8.0.7 will prevent the correct
timestamp from being updated and running simulations and Exporting Model as External System Library
will fail.
Co-Simulation and Function Evaluation 19
Animation Options
Initialization
Initialization Sequence
Adams Controls performs an Initialization Sequence, consisting of a few different steps, before commencing
with the Co-simulation or Function Evaluation run. The initialization sequence is as follows.
1. If desired, necessary Adams Solver or Adams View commands are submitted (for example,
ADAMS_init variable for MATLAB; see the Initialization Commands section for more details).
2. Following sequence is followed depending on the status of static simulation:
a. If static simulation is requested, then static analysis is performed at time = 0. (for example,
ADAMS_static='yes' for MATLAB)
b. If static simulation is requested and the simulation fails, the initial conditions analysis is
submitted.
c. If static simulation is not requested, then initial conditions analysis is submitted.
3. Dynamic co-simulation/function evaluation run begins at time = 0.
20 Adams Controls
Initialization
Thus, equivalent commands in Adams View and Adams Solver work in a similar manner. The exception is
that with Adams View, the model is not registered with the Adams Solver until after all the user commands
in Step 1. have been submitted, which means you may create modeling entities with Adams View commands.
In general, when the model is submitted to Adams Solver, you cannot create new modeling entities, so this
feature will not be available.
The Plant Export dialog box below displays the options that correspond to the steps listed above. The option
Initialization Command corresponds to Step 1. above, while Initial Static Analysis corresponds to Steps 2.a.-
c.
Initialization Commands
Initialization commands are Adams commands which are executed before the controls package starts the co-
simulation. If you run a simulation with animation in interactive mode, you must use Adams View
commands to initialize your model. If you are in batch mode, use Adams Solver commands.
Co-Simulation and Function Evaluation 21
Co-Simulation and Interpolation/Extrapolation
You can specify a command in two ways. For example, if you want to change the color of the antenna model,
for an interactive (Adams View) simulation, 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, Initialization command field reads: Adams_Init.
Alternatively, in the Initialization commands text box, 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’]
For Adams Solver, you can also place all of your initialization commands in a single file, and reference it with
the FILE command. You can do this in the Plant Export dialog box or you can manually edit your .inf or .m
files. For Easy5, your .inf file might look like this:
NUMBER OF COMMANDS
1
file/command=myfile.acf
This reads in and executes the .acf file.
In MATLAB, you would modify the following variable, either in the .m file, or in the workspace:
ADAMS_init='file/command=myfile.acf'
Interpolation/Extrapolation Options
Step 1 - Options for Adams Controls Plant Inputs
The following describe what happens to the Adams Plant inputs (that is, outputs from Easy5 or
MATLAB/Simulink) when Simulink or Easy5 leads the co-simulation.
If the Plant Input interpolation order is set to zero:
Adams Controls holds the Easy5/Simulink inputs, U, as constant values. In other words, apply a
zero-order hold to the Plant Input values of Easy5 coming into Adams. For example, specify that the
sample times occur at time = 0, 1, 2... If the current sample time is time = 2, and the last
communication interval is time = 1, the Plant Inputs are sampled at time = 2, and held
constant while Adams integrates from the last time (t1) to the current time (t2) to provide the
Plant Outputs to Easy5.
If the Plant Input interpolation order is set to one:
Adams Controls uses linear interpolation between the current and past values from Easy5 or
MATLAB/Simulink. For example, if the current sample time is time= 2 (t2), and the last sample
time is time = 1 (t2), the Plant Inputs are sampled by Adams Controls at time = 2, and
linearly interpolated from t1 (saved from the previous communication time) to t2, as shown below
while Adams integrates from the last time (t1) to the current time (t2) to provide the Plant
Outputs to Easy5.
interpolation: Plant Inputs, U (1 → 2) = U1 + (U2 - U1) /
communication_interval * (current_simulation_time - t1)
Only in Simulink, optionally, you can choose Adams to lead the co-simulation, which may be used to break
an algebraic loop with the Adams Controls S-Function. In this case, the interpolation and extrapolation
methods are exactly the same, but are reversed for the plant inputs and outputs (that is, the Plant Inputs are
extrapolated and the Plant Outputs are interpolated). This setting can be seen highlighted below:
24 Adams Controls
Co-Simulation and Interpolation/Extrapolation
Co-Simulation and Function Evaluation 25
Co-Simulation and Interpolation/Extrapolation
The communication interval is set to 1 millisecond, and the results for all interpolation settings are very close
to the result for Function Evaluation. However, upon closer inspection, the plot on the right show that for
linear extrapolation ("extrap1"), the co-simulation results (shown in the green line) are very close to the
results for Function Evaluation. The results for extrapolation off are similar (red and blue striped line), but a
little bit different than Function Evaluation. This can also be seen in the next plot of the input torque to
Adams:
The plot to the right is a close-up of the bottom of the plot on the right. You can see that the red line for
Function Evaluation is more closely matched by the plots that use extrapolation ("extrap1").
26 Adams Controls
User Libraries
Now, for comparison, look at this same example where the communication interval has been changed from
1 ms to 5 ms. In this case, the linear extrapolation is not as accurate as for 1 ms, and the results without
extrapolation appear to be closer to the Function Evaluation case.
Plot of azimuth position:
Thus, linear extrapolation can help get an accurate answer, as long as the communication interval is small
enough to provide an accurate prediction.
User Libraries
In Adams when you want to link in a user subroutine, you create a library (standard user executable) and
simply select it when you need the subroutine(s) within the library.
• On Windows: From the Start menu, point to Programs, point to Adams 2021.0.2, point to
Adams Solver, and then select Create Custom Solver. (Or, type adams2021_0_2 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 Adams Solver library, such as my_sub.dll.
4. Within Adams View, when you use the Controls Plant Export dialog box to write 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 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).
For more information, see the Running and Configuring online help.
Using TCP/IP
About TCP/IP
TCP/IP (Transmission Control Protocol/Internet Protocol) is the standard for network communications. In
addition to the default pipes-based communication protocol, you can use TCP/IP communication Adams
Controls. TCP/IP-based communication allows you to run Adams on one workstation while running
controls software, such as Easy5 or MATLAB, on a second networked machine of the same or different
architecture. In the Adams Controls communication protocol, the controls software is the client and Adams
is the server.
A python script, adams_daemon.py, is used to setup TCP/IP communication between Adams and Easy5 or
MATLAB. This script can be found in /$install_dir/controls/utils, where $install_dir is the directory in which
Adams is installed.
Once started, the default mode of Adams daemon will be available to sequentially service requests from clients
for successive Adams simulations. When a client terminates an Adams simulation, the daemon becomes
available to start another Adams simulation for the next client. In the default mode, the daemon does not
terminate until you explicitly terminate it from the operating system. To terminate the process, you can either
close the window of the process, or enter:
Windows: Ctrl + Break
Linux: Ctrl + C
Optionally, you can enter the number of runs before termination with the -n flag for adams_daemon.py.
28 Adams Controls
Using TCP/IP
Note: Although it is not required for general use, for the instructions below, copy the file
/$install_dir/controls/utils/adams_daemon.py to your local working directory, where
$install_dir is the directory in which Adams is installed
5. Start the default Adams daemon in your current working directory by entering one of the following
commands in a command shell:
• On Windows: adams2021_0_2 python adams_daemon.py
Co-Simulation and Function Evaluation 29
Using TCP/IP
Note: When your client connects to the Adams daemon, it displays information similar to the
following:
4. Start the Adams daemon on the Adams host before starting the simulation in MATLAB/Simulink
ADAMS Host
My_machine.my_domain.com
ADAMS cwd
C:\adams\antenna
4. Start the Adams daemon on the Adams host before starting the simulation in Easy5.
32 Adams Controls
Using Time Offset with Matlab
Using the time offset parameter, in the MATLAB workspace called ADAMS_time_offset, allows Adams and
MATLAB/Simulink to start its simulations at different times. If a positive value time offset T o is used then
Simulink will simulate for T o seconds prior to starting the Adams simulation. If a negative time offset is
used, then Adams will simulate for T o seconds first. If t M is the time used in MATLAB and t A is the time
used in Adams, then:
tM = tA + To
For example, time offset can be used for calibration of a Simulink control system that requires a vehicle at
stand-still, but where the Adams simulation is started at an initial speed for computation efficiencies. In such
case using To > 0s the Simulink will start its simulation prior to starting the Adams simulation.
A negative time offset can be used to bring the Adams model at a desired state before starting the controls
system.
An example model antenna_with_time_offset.mdl, is provided in the $topdir/controls/examples directory of
the Adams installation. Applying a step response at 0.05s in Simulink and using a positive time offset
To=0.05, the Adams simulation will show the response at 0s time in Adams, as shown in the following figure.
Co-Simulation and Function Evaluation 33
Using Time Offset with Matlab
Figure 1 Adams and Simulink times for a step response applied in Simulink at 0.05s and using 0.05s time offset.
The figure below shows the step response for a negative time offset of -0.05s. It can be seen that Adams already
runs for 0.05s prior to running the Simulink simulation.
34 Adams Controls
Using Time Offset with Matlab
Figure 2 Adams and Simulink times for a step response applied in Simulink at 0.05s and using -0.05s time offset.
It should be noted that when To > 0s, Adams will perform a static equilibrium at t M = 0s and then wait
until t M = To .
It is also important to note that the block containing the Adams plant can only be run when
t A = t M – T o ≥ 0s because Adams cannot simulate at negative times. This can be accomplished with
enable and merge blocks in Simulink as shown below or in the above mentioned example
antenna_with_time_offset.mdl.
Co-Simulation and Function Evaluation 35
Limitations
Limitations
Only one Adams Plant Block may be used in a model.
Name of the Adams model limited to 512 characters.
Adams and the MATLAB/Simulink or Easy5 must communicate at the same time interval.
Quasi-static co-simulations are not supported (co-simulation performs a series of simulate/dynamic
commands).
Kinematic Adams models in Function Evaluation are not supported (Workaround: add a dummy
part to get a dynamic model).
Adams Control Subroutines (CONSUB's) in Function Evaluation are not supported.
Initialization Commands: SAVE and RELOAD are not supported.
The compiler used by EASY5 must be the same as that supported by Adams; see
http://www.mscsoftware.com/ for a list of supported compilers.
36 Adams Controls
Limitations
Control System Import 37
Importing External System Library
2. From the Controls container, click the Adams Controls icon . Select Controls System →
Import.
The Adams Controls System Import dialog box appears.
3. Complete the dialog box as described in Adams Controls System Import help page.
4. Select OK.
The integrator error tolerance is compared against a local error measure that depends on the difference
between the current predicted and corrected states, the past history of the states, and the current integration
order.
The integrator's error tolerance check can effectively be written as:
2 2 2 2
e 1 + e2 + e3 + … + en < E
where e is the difference between the predicted and corrected state, and E is the integrator ERROR setting.
If, for example, e3 has an error tolerance setting from the ESL for the GSE of E3, then the formula becomes:
2 2 2 2
e 1 + e2 + ( e3 × E ⁄ E3 ) + … + en < E
which effectively tightens the error tolerance if E3 < E.
As a general guideline, this feature may be more effective when the number of continuous states from your
ESL is much larger than the number of states in the rest of the Adams model. If the opposite is true, then the
addition of the ESL error tolerance values may not have much effect, or may be too restrictive. Also, you may
find this beneficial to decrease simulation times if you are able to increase the integrator ERROR setting to
loosen error needed on the Adams parts, and so on, while maintaining the error required for the GSE/ESL.
See the INTEGRATOR statement for more details about ERROR. This feature only applies to the C++
Solver, and only Easy5 models currently report error tolerance values.
To delete a GSE:
1. Click the Plugin tab on the Adams View ribbon.
2. From the Controls container, click the Adams Controls icon . Select Controls System →
Delete.
3. Enter the name of the model and GSE you want to delete.
4. Select OK.
Software Requirements
This example requires licenses for Adams Solver, Adams View, and Adams Controls. It also requires licenses
for MATLAB/Simulink/Real-Time Workshop, and using the version(s) that are compatible with Adams. The
exact versions supported can be found under "Supported Versions of Integration Products" in the following
link:
www.mscsoftware.com/support/platform-support
Compilers supported by both Adams and MATLAB/Code Generation must also be available (for example,
Microsoft Visual Studio 2013) - again, see the link above for exact details. These products are all assumed to
be on the same machine for this tutorial.
Solver Settings
You can choose either Variable-step or Fixed-step solvers in MATLAB/Simulink, under Simulation →
Configuration Parameters → Solver → Type. The choice will affect the model code that is generated from
Code Generation, in particular to how sample times are handled. This is important to Adams since Adams
will be integrating the model, not MATLAB/Code Generation. In this regard, the Variable-step integrator is
recommended since Adams Solver uses mainly variable-step integrators, and this will ensure the outputs and
states are computed properly. If you would still like to use a Fixed-step integrator setting, the model should
have at least one continuous state to produce the code for Adams that will handle the sample times properly.
For example, if you have a discrete-only model, add a dummy continuous block (for example, integrator) to
the model.
Tip: To look for differences in sample times between Fixed-Step and Variable-step integrators
settings, look for the function ssIsSampleHit(), which handles evaluation of code at
sample times.
As a MATLAB requirement, an Code Generation S-Function must have the same type of
integrator setting as the model that will use it (that is, both Fixed-step, or both Variable-
step).
The controller for the antenna model will be used to illustrate this process. This file can be found in
install_dir/controls/example/antenna/continuous.mdl. The parameters to be changed are 1040 in Transfer
Fcn and 950 in Transfer Fcn1.
…and in continuous_rsim_cg/continuous_data.c:
Step 4 - Create Code Generation-GSE with the tunable parameters exposed in Adams View
1. Create ESL as described in Learning Adams Controls with Controls System Import.
2. Once the GSE is created, open the Database Navigator and expand the GSE to examine its children
- you should see that the design variables Kp and Kv are created. The default values are 1040.0 and
950.0 as defined in the Simulink model. Those design variables can be changed to study the effects
on ESL.
• rtw/c/libsrc
• rtw/c/src
• rtw/c/tools
• rtw/c/tlc
Note: Your make utility and compiler may be sensitive to DOS/Linux end-of-line character
differences. Therefore, we recommend that you run a dos2Linux file conversion utility to
ensure your files have a Linux end-of-line.
You may need to run a dos2Linux utility against the generated code to conform to Linux end-of-line
character standards.
Note: This procedure applies if you have Adams Controls installed on one Windows machine and
MATLAB/Simulink/RTW installed on another Windows machine.
The code generation of the Simulink model now exists on both machines.
8. On the machine where Adams Controls is installed, create the GSE with Control System Import and
run the simulation (see About Control System Import).
6. Put the S-Function block in modelname.mdl within the new Simulink model (for example,
newmodelname.mdl").
7. Build the ESL using the Adams Controls-modified RSIM target.
Limitations:
If your S-function depends on other modules, this method may fail. You may have to manually add the
dependent modules to the S-function by using the following command:
set_param('Sfunction_blockpath','SFunctionModules','file1 file2 file3')
Where:
'Sfunction_blockpath' is the path of the Sfunction block.
'file1', 'file2' and so on are the names of the dependent files.
These details can be found also written for another example here:
How do I build my model that contains an RTW generated S-function block if I do not have the
source code?
http://www.mathworks.com/matlabcentral/answers/196427
How do I build my model containing a C-MEX S-function if I don't have the S-function C source
file using Real-Time Workshop?
http://www.mathworks.com/matlabcentral/answers/196428
The overriding rules for working with MATLAB/Simulink/Real-Time Workshop must be followed in use of
S-Functions. Please consult Mathworks and their documentation for more details.
Sample Time Setting of Simulink Source Blocks for Adams Controls Target
of RTW
In Simulink, some blocks in the source library have a parameter Sample Time, which is the interval at which
those block are sampled. Setting sample time in your Simulink/RTW model can change the behavior of the
Control System Import 47
Using MATLAB/Code Generation
system, and you should take care to select this. If the Sample Time is zero, the blocks can be sampled at any
time. In real-time applications, or when the simulation is based on explicit and fixed step-size integration, a
nonzero setting of Sample Time makes sense because it controls the progression of the simulation to
guarantee accuracy. Adams Solver integrators usually maintain accuracy with variable-step integrator, error
controls, and step-size settings (for example, HMAX), which is also true when solving the Adams Controls
External System Library (ESL). Thus, the sample rate of continuous states depends on the integrator settings.
At the same time, the sample rate for the blocks in the ESL is maintained with internal calls to GSE_SAMP
to compute non-zero sample times, and GSE_UPDATE to call the sampled blocks. Therefore, you may want
to set the sample time to zero to let Adams Solver sample the block as needed (that is, continuous) instead of
at a specified sample rate. You can confirm the sample rates by looking at the RTW source code generated
for the Simulink model, for example:
Model_rsim_rtw/Model.c:
…
/* task offsets */
ssSetOffsetTime(rtS, 0, 0.0);
ssSetOffsetTime(rtS, 1, 0.0);
}
Here, there is one non-zero sample time (0.001) which will set the sample rate in GSE_SAMP. You can
confirm the blocks that use these sample times by searching for the ssIsSampleHit function in this same file.
Finally, setting the Fixed-step size for Simulink can add a sample time to your model, even if it is purely
continuous.
48 Adams Controls
Using MATLAB/Code Generation
Limitations
The models supported by Adams Controls are firstly limited by those restrictions enforced by
MATLAB/Real-Time workshop itself. Please consult the Mathworks documentation for the official
limitations, but a summary of these can be found next. In addition, Adams Controls has its own limitations
for S-Functions support for ESL creation/use which are also listed.
• Step 2: Create Adams ESL from the Simulink model that contains the S-Function block
generated in Step 1.
50 Adams Controls
Limitations
The RSim target does not support the transport delay block. However to make this work, use the
similar method mentioned in the discrete-time block.
The RSim target does not support noninlined M-file, FORTRAN, or Ada S-functions.
If an RSim build includes referenced models (by using Model blocks), these models must be set up
to use fixed-step solvers for code to be generated for them. The top model, however, can use a
variable-step solver as long as all blocks in the referenced models are discrete (variable-step solver not
supported by Adams).
In certain cases, changing block parameters can result in structural changes to your model that
change the model checksum. An example of such a change would be changing the number of delays
in a DSP simulation. In such cases, you must regenerate the code for the model.
Limitations
External System Libraries (ESL's) are not guaranteed to be compatible from release to release; you
must rebuild the ESL for each new version of Adams.
The ESL may be used only once per Control System Import. (Workaround: to use the same model
more than once, create duplicate ESL's with different names and repeat the Control System Import.
This includes copying/renaming a file already generated. Mechatronics excluded from workaround.)
Control System Import 51
Limitations
Note: Microsoft Visual Studio C compiler is required on Windows platforms (supported version:
Visual Studio 2017, MSVC toolset version 14.11) and GNU C compiler is required on
Linux platforms for FMU V1 export. Compilers are not required for FMU import and FMU
V2 export.
Exporting an FMU
Adams model could be exported as an FMU with the FMI 1.0 or 2.0 Co-Simulation Tool standard. This
could be done by using the existing Adams Controls Plant Export dialog box.
56 Adams Controls
Exporting an FMU
You need to specify the Input and Output signals, select the Target Software as FMU and then choose the
communication mode (whether to use TCP/IP, PIPE or DIRECT during the co-simulation). You can select
DIRECT to speed up communication between master and slave. It is available only if the C++ solver is
selected. It should be selected only if the FMU is intended to be imported by a master other than Adams. In
case an FMU that was exported using the DIRECT option for Communication Mode is imported into
Adams, the initialization would fail. Selecting DIRECT mode when exporting the FMU would cause the
output files (like .res, .msg and so on) to not get generated (by default) during simulation run for improving
the overall performance. If these files are required in this mode, then an environment variable called
MSC_ADAMS_REAL_TIME can be set with specified options. This would allow the user to have control
over what files to generate and what not to. The various values which the environment variable can take are
listed below.
ON - Turns on the "Real Time environment" (no results, no message file, no display, no RTI
reporting).
OFF - Turns off the "Real Time environment" (yes results, yes messages, yes display and yes timing
info).
MESSAGESON - Turns on messages/display
Functional Mock-up Interface (FMI) 57
Exporting an FMU
Note: An FMU with DIRECT option for Communication Mode would not work with Adams as
master. A limitation has also been found with Simulink as master. It has currently been
validated to work with FMU Compliance Checker (tool provided by FMI organization for
FMU validation), Easy5 and Concurrent's SIMulation Workbench® (SimWB) as masters.
To use this FMU on a different machine, the alias "adamsXXXX" (where XXXX is the version of Adams, for
example adams2021_0_2) needs to be set up. To do this, on Windows platforms, add
"Adams_installation_path\bin\" (for example, C:\Program Files\MSC.Software\Adams\2021_0_2\bin) to
the User PATH environment variable, which could be found under Control Panel → System → System
Properties → Advanced → Environment Variables.
Functional Mock-up Interface (FMI) 59
Exporting an FMU
On linux64 platform, create the alias as specified in the Adams installation guide. It is suggested that the
exporting and importing machine has the same Adams installation path. Otherwise the Adams cannot be
called during a Co-Simulation. Or the user could use TCP/IP instead of PIPE as the communication mode.
The addition of the Adams installation path to the PATH environment variable in Windows is performed
automatically by the installer. Similarly, the creation of the alias in Linux is automatically performed by the
installer when being installed as root. If the above are not done automatically due to some permission issues
on the PC, then these steps have to be taken care of manually using the above prescribed procedure.
To use TCP/IP, the Adams Host Name should be set correctly and adams_daemon.py should be running on
the host machine. The adams_daemon.py could be found under "Adams_installation_path\controls\utils\"
60 Adams Controls
Default tunable parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
pause_simulat Boolean TRUE FALSE The FMU does not step and
ion returns the old values of
FALSE outputs when this value is
True. When it is False, the
FMU process the inputs,
internally steps the model and
returns the new outputs.
Functional Mock-up Interface (FMI) 61
Default fixed parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
pause_simulat Boolean TRUE FALSE The FMU does not step and
ion returns the old values of
FALSE outputs when this value is
True. When it is False, the
FMU process the inputs,
internally steps the model and
returns the new outputs.
output_rate Integer Any value in integer range As specified in the This is the multiplier which is
plant export dialog applied to the communication
box interval between master and
slave which determines the
interval at which Adams
output files (.res) are written.
This is also dependent on
another parameter, namely
communication_scale. Output
files are updated at the period
determined by communication
interval *
communication_scale*output_
rate
solver_selectio Enumeration 1 (F77 solver) As specified in the Specifies the solver that is to be
n plant export dialog used by the Adams FMU
2 (CXX solver) box
communicatio Enumeration 1 (PIPE) As specified in the Specifies the communication
n_mode plant export dialog mode to be used between the
2 (TCP/IP) box master and slave. Note that
DIRECT mode can be used
3 (DIRECT)
only with non-Adams masters
and with CXX solver
62 Adams Controls
Default fixed parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
communicatio Integer Any value in integer range 1 This specifies the scaling factor
n_scale between the master and the
slave.
initial_static_a Boolean TRUE As specified in the This specifies whether Adams
nalysis plant export dialog should run a static analysis
FALSE box before the dynamic simulation.
initialize_inpu Boolean TRUE TRUE This specifies whether Adams
ts_to_zero should retain the initial values
FALSE of inputs as specified in the
model or they should be set to
zero. Default behavior is to
initialize them to zero.
initial_warmu Boolean TRUE TRUE if FMU is This specifies whether a short
p_analysis exported using dynamic analysis is to be
FALSE communication_mo executed before the actual
de as DIRECT. analysis. This is useful in real-
time scenarios to prime the
FALSE otherwise solver and avoid initial
overruns.
solver_thread Boolean TRUE FALSE This option works only when
_stats running Adams on
FALSE Concurrent's SimWB. It
displays the statistics of
different solver threads and is
useful for debugging to find out
where more time is being used.
Functional Mock-up Interface (FMI) 63
Default fixed parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
adams_path_f String Any string value Empty string This is used to specify the
or_fmu Adams installation path that is
to be used by the FMU
(typically used if FMU is
exported with one version of
Adams and is to be used with a
different version). This obviates
the need for setting the
environment variable
"ADAMS_PATH_FOR_FMU
". The environment variable, if
set, takes precedence over this
value and is useful for FMI
masters that do not support
strings.
thread_affinit String String values that contain Empty string Specifies the processor affinity
y_set0 numbers (indicating for set0 threads as comma
cores/processors) separated by - separated individual values or a
or , range. For example, if five
threads are to run on cores
1,2,3,5,7 this can be specified
as 1-3,5,7. See section Thread
Affinity Settings in Adams for more
information.
thread_affinit String String values that contain Empty string Specifies the processor affinity
y_set1 numbers (indicating for set1 threads as comma
cores/processors) separated by - separated individual values or a
or , range. Note that this parameter
is currently not being utilized
by Adams Solver in real time.
64 Adams Controls
Default fixed parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
msc_adams_re String String values in ON, OFF, Empty string Specifies the string settings
altime MESSAGESON, which determine if the output
MESSAGESOFF, files are generated or not and if
RESULTSON, so what output files are
CALLBACKON, generated. Individual values in
CALLBACKOFF, the specified set of values or a
LUSINGULAR, combination of values
RESULTSOFF, TIMING, separated by / can be used. This
FIRSTRTI. obviates the need for setting the
environment variable
"MSC_ADAMS_REAL_TIM
E". The environment variable,
if set, takes precedence over this
value and is useful for FMI
masters that do not support
strings.
adams_hostna String Any string value. Host name of the This is used to override the
me PC from which default host name that specifies
FMU is exported the PC where Adams would
run (typically the same PC
from where the FMU is
exported). The host name or IP
address of some other PC can
be specified which has Adams
installed.
input_interpo Enumeration FMI V1 FMI V2 1 for FMI V1 This can be used to specify the
lation_order 1 (zero order) 0 (zero order) interpolation order for Adams
0 for FMI V2 slave inputs. Accordingly, the
2 (Linear) 1 (Linear)
solver interpolates the value
3 (Quadratic) 2 (Quadratic) before using it every step.
4 (Linear least 3 (Linear least
squares) squares)
Functional Mock-up Interface (FMI) 65
Default fixed parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
output_extrap Enumeration FMI V1 FMI V2 1 for FMI V1 This can be used to specify the
olation_order 1 (zero order) 0 (zero order) extrapolation order for Adams
0 for FMI V2 slave outputs. This works only
2 (Linear) 1 (Linear)
if the communication_scale is
3 (Quadratic) 2 (Quadratic) greater than 1.
4 (Linear least 3 (Linear least
squares) squares)
animation Boolean TRUE TRUE if "Real Time This is used to enable real-time
Animation" radio animation with Adams. It is
FALSE button is set to On available only for non-Adams
in the Real Time View products (like Adams
Animation Settings Car, Adams Driveline and so
dialog before on)
performing a files
only analysis in
Adams Car, Adams
Driveline and so on,
FALSE otherwise.
rta_hostname String Any string value localhost This is used to specify the host-
name of the PC on which the
real-time animation would run.
It is available only for non-
Adams View products (like
Adams Car, Adams Driveline
and so on)
mtl_file String Any string value that points to mdids://acar_shared This is used to specify the
the material file path (in the /shell_graphics.tbl/a material file that is to be used
format required by ACar). dams_vtd_mat.mtl for real-time animation. It is
available only for non-Adams
View products (like Adams
Car, Adams Driveline and so
on)
startup_time Real Any real value 5.0 This specifies the startup time
for the real-time animation and
the units is seconds. It is
available only for non-Adams
View products (like Adams
Car, Adams Driveline and so
on)
66 Adams Controls
Exporting model specific parameters in an Adams FMU
Parameter
Name Data Type Possible Values Default Value Description
sample_time Real Any real value 0.01 This specifies the
communication frequency
between Adams and the real-
time animation component.
Units is seconds. It is available
only for non-Adams View
products (like Adams Car,
Adams Driveline and son on)
road_grid_size Real Any real value 200 This specifies the grid size of
the road for real-time
animation and units are in m. It
is available only for non-Adams
View products (like Adams
Car, Adams Driveline and so
on)
road_grid_spa Real Any real value 1 This specifies the grid spacing
cing of the road for real-time
animation and units are in mm.
It is available only for non-
Adams View products (like
Adams Car, Adams Driveline
and so on)
Solver_thread Integer Greater than 0 and preferably As specified in the This setting overrides the
_count limited to the number of cores model settings thread count specified in the
available in the PC during plant export model during plant export as
long as the newly set value is
greater than 0.
initialSpeed Real Any real value As specified in the This specifies the initial speed
event during of the vehicle. It is available
files_only analysis only for non-Adams View
before a plant export products (like Adams Car,
Adams Driveline and so on)
In AView models, the parameters that are allowed to be exported are design variables, points and mass
properties of parts. The model name is to be selected first. Subsequently, user can add individual parameters
in the respective fields by right-clicking on the field and selecting the parameters or by clicking on the Add
All button which populates all parameters in all fields. Alternately, users can also add all parameters of a
particular type (for example, all design variables, all points or all mass properties) by clicking on the buttons
at the respective fields. Design variables of type integers, real and strings are supported. Point locations (x, y
and z) are created as separate parameters of real type because the FMI can only support scalar types. Mass
properties defined by user or by density are supported. Mass properties of parts defined by material are not
supported. Individual parameters like mass, density, ixx, iyy, izz, ixy, iyz and izx are created for each selected
part.
In ACar models, the parameters that are allowed to be exported are assembly variants, analysis events, hard
points, mass properties of general parts, parameter variables, UDE design variables and property files. The
individual parameters created for general parts, parameter variables and hard points are same as for AView
based models. The design/instance design variables of UDEs and property file variables are supported
additionally for ACar.
Once this dialog box is opened, the individual tabs are visible and the subsystems for the active variant are
seen. To modify the active variant to be used, user has to first select the desired variant (if any exist) from the
drop down menu and click on the arrow ( ). Only on clicking the arrow, the subsystems for individual
68 Adams Controls
Exporting model specific parameters in an Adams FMU
categories are displayed. A subsystem is displayed in the particular tab only if it has parameters of the
corresponding type. Users can click Add All to add all parameters of a particular type. Alternately, the buttons
beside the individual subsystems can be clicked to select all parameters of that particular type in that
subsystem. Another method is to right-click on the field and manually select the parameters. For UDEs, the
design/instance design variables are not displayed in this dialog. Instead, only the UDE is displayed. The
design/instance design variables are internally found and added.
Once the user completes the selection of parameters and clicks OK or Cancel, the Plant Export dialog box is
enabled again and the saved parameters are exported as part of the FMU.
Functional Mock-up Interface (FMI) 69
Importing an FMU
Importing an FMU
An external FMU could be loaded in Adams by using the Adams Controls System Import dialog box. The
FMU should conform to FMI 1.0 or 2.0 Co-Simulation or Model Exchange standard. Currently Adams
cannot handle events during co-simulation, nor does it support interpolation/extrapolation. Adams will not
allow string inputs, outputs or parameters.
To import an FMU into Adams, simply choose the FMU in the External System Library field. The Output
and Input signals should be selected using Existing Controls Plant or from Poutput/Pinput.
The Communication Interval should be set according to the frequency of interest of the FMU model (above
the Nyquist Frequency). The Visibility specifies whether the importing FMU could be visible or not during
the Co-Simulation (needs to be supported by the importing FMU). If the imported FMU belongs to Adams,
then after the simulation, GUI of the imported FMU would not be closed automatically. It would remain
open so that users can continue perform other simulation activity by interacting with the FMU master Adams
window. The GUI of the imported FMU does not support any user interaction. It automatically gets closed
once user resets the simulation from the FMU master Adams window.
The Communication Interval and Visibility fields are automatically disabled if the imported FMU is of
Model Exchange type. If the FMU supports FMI 2.0 and supports both Model Exchange and Co-
Simulation, the user would be presented with an option to choose the kind of simulation that is to be run.
Accordingly, the corresponding simulation would be executed.
The imported FMU will be extracted in the current working directory under /fmu/<General State Equation
Name>/.
70 Adams Controls
Importing an FMU
There are two default parameters created under the GSE (general state equation) when importing a co-
simulation FMU. They are listed below.
1. adams_master_communication_interval - This allows users to dynamically modify the
communication interval between two different simulation runs without having to delete the GSE and
reimport the FMU which creates a new GSE.
2. adams_master_output_extrapolation_order - This allows users to dynamically modify the
extrapolation order between two different simulation runs without having to delete the GSE and
reimport the FMU which creates a new GSE.
In addition to the above two default parameters, any parameters exposed by the FMU are also created as
design variables underneath the GSE. Currently, the supported data types are integer, real, Boolean and
Enumeration. Strings are not supported during FMU import. If an FMU contains string parameters, they
are ignored and the corresponding variables are not created underneath the GSE. All variables are created as
real data type in the GSE irrespective of the data type in the FMU. The data type translation is handled
internally when setting/getting the parameter values.
If an Adams exported FMU is to be imported into a different version of Adams than with which it was
exported, an environment variable "ADAMS_PATH_FOR_FMU" needs to be set with a value containing a path
to the Adams installation with which it is to be imported. This feature is applicable only to FMUs exported
with Adams 2017.1 and higher. Alternately, the FMU fixed string parameter "adams_path_for_fmu" can also
be modified to point to the Adams path. This parameter is applicable only to FMUs exported with Adams
2019 and higher. The value specified in the environment variable takes precedence in case both options are
used.
For example, consider a scenario where FMU was exported with Adams 2017 and is to be imported and run
in Adams 2017.1. The installation path for Adams 2017.1 is "C:\Program
Files\MSC.Software\Adams\2017.1". Then user has to set the environment variable
"ADAMS_PATH_FOR_FMU" to the value "C:\Program Files\MSC.Software\Adams\2017.1". This would
enable the FMU exported with Adams 2017 to run with Adams 2017.1. Otherwise, it would run only with
Adams 2017 (version with which it was exported).
When the FMU is exported for FMI V1.0, then that FMU can be imported only on the platform with which
it was exported. For example, if the FMU is exported on Windows, it can only be imported on Windows and
similarly if it is exported on Linux, it can be imported only on Linux.
In case an FMU is exported for FMI V2.0, then the same FMU can be imported in both Windows and Linux
platforms. The only condition that needs to be met during import is that the same version of Adams needs
to be used and the alias needs to be set (see the Exporting an FMU section for more details on setting of the alias).
If a different Adams version is used during import, then the ADAMS_PATH_FOR_FMU environment variable
needs to be defined or the FMU fixed string parameter "adams_path_for_fmu" needs to be set as mentioned
above.
Integration with Vertical Products 63
For the latest information on integrating Adams Controls with Adams Car, refer to the Adams Technical
Articles at http://simcompanion.mscsoftware.com.
64 Adams Controls
Examples 65
Tutorials and Examples
Examples
Tutorials and Examples
The following Adams Controls examples are available:
Getting Started Using Adams Controls - Gives you an overview of the four-step process of adding controls
to an Adams model. The example also includes tutorials for each of the controls applications you can
use with Adams Controls: Co-simulation, Function evaluation, and Control System Import with
both Easy5 and MATLAB.
MSC Software Simcompanion Article KB8016239 - Various examples of Adams Controls features:
• Using Adams Solver (C++) with Adams Controls in an Easy5 co-simulation
• Performing a design study with an Adams External Systems Library (ESL) containing Easy5
parameters and requests
• Generalized communication using TCP/IP
• Improved performance of co-simulation through first-order interpolation
MSC SoftwareSimcompanion Article KB8014597 - A list of links to several articles in our Knowledge Base
dealing with Adams Controls.
install_dir/ainsight/examples/ain_tut_110_asc_mat.txt - Studies the control system of a linearized model
using the Adams Insight ASCII conduit and MATLAB.
install_dir/ainsight/examples/ain_tut_102_asc_aco.txt - Studies the control system using the Adams Insight
ASCII conduit and Adams Controls.
66 Adams Controls
Tutorials and Examples
Dialog Box - F1 Help
Adams Controls Plant Export
Controls → Plant Export
Exports the Adams plant files. Adams Controls saves the input and output information in an .m (for
MATLAB) or .inf file (for EASY5). It also generates a command file (.cmd) and a dataset file (.adm) that are
used during the simulation process. Adams could also export the model as a .fmu file (Functional Mock-up
Unit or FMU) that follows the FMI standard.
Easy5
MATLAB
FMU - Creates a Functional Mock-up Unit that follows the
FMI standard.
Analysis Type Select one of the following:
Note: The order of signals should be same during plant export and
plant import. Otherwise, simulation could fail and produce
undesired results.
Static Hold Select one of the following:
Error Scale Factor: Values > 0 will scale all of the ESL error tolerance
values in order to tighten or loosen these values, that is, Final GSE error
tolerance = Error Scale Factor * ESL error tolerance
Values <= 0 will disable using the ESL error tolerance values, and the
default computation for the local integration error will be used.
Information Check to display verbose information about the general state equation
(GSE) that the controls system import created.
Communication Interval This option is only enabled for External System Libraries of type FMU
co-simulation. For co-simulation with the FMU, you need to specify
the communication interval. Sample the FMU at least two times faster
than the highest frequency of interest (refer to Nyquist frequency). This
option is disabled for FMU of type model exchange and other ESLs
exported using MATLAB or Easy5.
Dialog Box - F1 Help 73
Adams Controls System Import
One caveat when checking this option is that, if the same PINPUT
variable is updated by multiple ESLs, then only the last imported ESL
value would be retained.
ESL Output Extrapolation This option is only enabled for External System Libraries of type FMU
Order co-simulation. When Adams is acting as master in a co-simulation, this
would allow the outputs of the FMU (inputs of Adams) to be
extrapolated and used by Adams during its integrator step. Currently
supported extrapolation orders are 0, 1, 2 and 3. (that is, zero order
hold, linear, quadratic and linear least squares)
74 Adams Controls
Select Assembly Parameters for Export to FMU
(Standard Interface) Simulate → FMI Interface → Real Time Analysis → Expose Model Parameters
For each subsystem and testrig in the assembly that contains general
parts or wheels, a toggle-button and a field will be created. In the field
any number of general parts or wheels can be entered. The button
will add all general parts from the current subsystem into the field.
Parameter Variables
Dialog Box - F1 Help 75
Select Parameters for Export to FMU
For each subsystem and testrig in the assembly that contains parameter
variables, a toggle-button and a field will be created. In the field any
number of parameter variables can be entered. The button will
add all parameter variables from the current subsystem into the field.
User Defined Elements (UDEs)
Add All Click this to auto-select all user defined elements in the entire assembly.
For each subsystem and testrig in the assembly that contains user
defined elements (UDEs), a toggle-button and a field will be created. In
the field any number of UDEs can be entered. The button will
add all UDEs from the current subsystem into the field.
For each subsystem and testrig in the assembly that contains property
file variables, a toggle-button and a field will be created. In the field any
number of property file variables can be entered. The button will
add all property file variables from the current subsystem into the field.
The property file variable may hold a list of property files. Property files
can be added or removed via the Property File field in the dialog box
(for example, Modify Bushing). Each property file in this list will be
copied into the FMU and is referenced by the enumerator value in the
model description file, as packaged in the FMU. The description field
in this file holds the name and index of each property file. Modifying
the enumerator value allows to change the property file while executing
the FMU.