adm711 coursenotes md r3

84
MSC Confi denti al Part Number: MDAM*R3*Z*Z*Z*SM-ADM711-NT1 Copyright2008 MSC.Software C orporation July 2008 MD R3 Adams/Controls ADM711 Course Notes MSC.Software Corporation Europe MSC.Soft ware G mbH Am Moosfeld 13 81829 Munich, Germany Telephone: (49) (89) 43 19 87 0 Fax: (49) (89) 43 61 71 6 Corporate MSC.Software Corporati on 2 MacArt hur Pl ace Santa Ana, CA 92707 U SA Telephone: (800) 345-2078 Fax: (714) 784- 4056 Asia Pacific MSC.Soft ware J apan Lt d. Shinjuku First West 8F 23-7 Nishi Shi njuku 1-Chome, Shi njuku-Ku Tokyo 160-0023, JAPAN Telephone: (81) (3)-6911-1200 Fax: (81) (3)-6911-1201

Upload: yogeshsingh15

Post on 27-Nov-2015

59 views

Category:

Documents


6 download

TRANSCRIPT

MSC Confidential

Part Number: MDAM*R3*Z*Z*Z*SM-ADM711-NT1 Copyright2008 MSC.Software C orporationJuly 2008

MD R3 Adams/ControlsADM711 Course Notes

MSC.Software Corporation

EuropeMSC.Software GmbH

Am Moosfeld 1381829 Munich, Germany

Telephone: (49) (89) 43 19 87 0Fax: (49) (89) 43 61 71 6

CorporateMSC.Software Corporati on

2 MacArthur Pl aceSanta Ana, CA 92707 U SATelephone: (800) 345-2078

Fax: (714) 784- 4056

Asia PacificMSC.Software Japan Ltd.

Shinjuku First West 8F23-7 Nishi Shi njuku

1-Chome, Shi njuku-KuTokyo 160-0023, JAPAN

Telephone: (81) (3)-6911-1200Fax: (81) (3)-6911-1201

MSC Confidential

Copyright2008 MSC.Software C orporation

LEGAL INFORMATION

MSC.Software Corporation reserves the right to make changes in specifications and other information contained in thisdocument without prior notice. The concepts, methods, and examples presented in this text are for illustrative andeducational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem ordesign. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirectdamages resulting from the use of any information contained herein.

Copyright © 2008 MSC.Software Corporation. All Rights Reserved. This notice shall be marked on any reproduction of thisdocumentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without the priorwritten consent of MSC.Software Corporation is prohibited.

The MSC.Software corporate logo, Adams, Dytran, Easy5, Fatigue, Laminate Modeler, Marc, Mentat, MD Nastran,MD Patran, MSC, MSC Nastran, Mvision, Patran, SimDesigner, SimEnterprise, SimManager, SimXpert and Sofy aretrademarks or registered trademarks of the MSC.Software Corporation in the United States and/or othercountries. NASTRAN is a registered trademark of NASA. All other trademarks belong to their respective owners.

MSC Confidential

Copyright2008 MSC.Software C orporation

TABLE OF CONTENTS

Section Page

0.0 Welcome to Adams/Controls TrainingA Brief History of Adams …………………….………………………………………………………………….. 0-5About MSC.Softw are ...…………………………………………………………………………………………… 0-7Getting Help …………...…………………………………………………………………………………………… 0-8A Review of Basic Adams Terminology.………………………………………………………………………… 0-12

1.0 Co-simulation ModeState variables in Adams……….......…………………………………………………………………………….. 1-3The Adams/Controls Plugin………...…………………………………………………………………………….. 1-5Plant Inputs and Outputs……………………. …..……………………………………………………………….. 1-6Control System Export……………………………… ....…...…………………………………………………….. 1-7MATLAB Setup Process ….…...…...…………………………………………………………………………….. 1-10Easy5 Setup Process……………………………………………………………………………………………....1-11Co-Simulation (Discrete Mode)……………………………………………………………….………………….. 1-12

2.0 Function Evaluation, Co-Simulation PerformanceFunction Evaluation Mode ……...………………………………….……………………………..…………….. 2-3TCP/IP Communication………………………………………………….………………………..………………. 2-5Co-Simulation Performance Settings…………………..…………..…………………………..……….……… 2-7

3.0 GSE Import MethodRTW Prerequisites… ………………………………………………………………….………………………….. 3-3RTW Build Process… ..………………………………………………………………….……………………….. 3-4Parameterize the RTW Component…………………………………………………….……………………….. 3-5GSE Import Process…………...………………………………………………………….………………………..3-6Discrete Vs. Continuous RTW Components……..…………………………………….……………………….. 3-9Prepare Simulink Model for RTW…………... ………………………………………….……………………….. 3-10

MSC Confidential

Copyright2008 MSC.Software C orporation

TABLE OF CONTENTS (Cont.)

Section Page

4.0 GSE Import SpecificsDiscrete Controllers Need External Solver……………... ……………………………….…………………….. 4-3Discrete Vs. Continuous Controllers..…………………………………………………….…………………….. 4-5Library Name, Multiple Controllers...…………………………………………………………………………….. 4-6

5.0 Co-Simulation ModifiersAdams_exec Parameter………. ……………………………………………………………………..…………. 5-3Adams_init Parameter………………………… ...…………………………………………………..…………… 5-4Adams Controls Wait Time…….. …..……………………………………………………………...……………. 5-5Co-Simulation Interpolation Order....……………………………………………………………...……………. 5-7Co-Simulation Limitations………………………………………………………………………………………... 5-9

6.0 Adams/Car and Adams/ControlsAdams/Car GUI Sequence……..………………………………………………….…………………………….. 6-3Special Files Required …………………………………………………………………………………..……….. 6-4Adams_init, Adams_exec..………………………………………………………………………………..…….. 6-6Sampling Rates… ….…………….……………………………………………………………..……………….. 6-7Persisting Data in Assemblies...…………………………………………………………………..…………….. 6-8Allow able Simulation Types……………………………………………………………………………………… 6-9

MSC Confidential

Copyright2008 MSC.Software C orporation

Copyright2008 MSC.Software C orporationINTRO-1ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

INTRODUCTION

WELCOME TO ADAMS/CONTROLS TRAINING

Copyright2008 MSC.Software C orporationINTRO-2ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

Copyright2008 MSC.Software C orporationINTRO-3ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

WELCOME TO ADAMS/CONTROLS TRAINING

● In this course, you learn how to use Adams/Controls toconnect your Adams model to block diagrams that youhave developed with control applications such as Easy5 orMATLAB.

Copyright2008 MSC.Software C orporationINTRO-4ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

WELCOME TO ADAMS/CONTROLS TRAINING

● What’s in this section:

● A Brief History of Adams

● About MSC.Software

● Getting Help

● A Review of Basic Adams Terminology

Copyright2008 MSC.Software C orporationINTRO-5ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

A BRIEF HISTORY OF ADAMS

● Adams: Automatic dynamic analysis of mechanicalsystems.

● Technology was implemented about 25 years ago.

● Mechanical Dynamics Incorporated (MDI) formed byresearchers who developed the base Adams code at theUniversity of Michigan, Ann Arbor, MI, USA. MDI has beenpart of MSC.Software Corporation since 2002.

● Large displacement code.

Copyright2008 MSC.Software C orporationINTRO-6ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

A BRIEF HISTORY OF ADAMS (Cont.)

● Systems-based analysis.

● Original product was Adams/Solver, an application thatsolves nonlinear numerical equations. You build models intext format and then submit them to Adams/Solver.

● In the early 90’s, Adams/View was released, whichallowed users to build, simulate, and examine results in asingle environment.

● Today, industry-specific products are being produced,such as Adams/Car and Adams/Driveline.

Copyright2008 MSC.Software C orporationINTRO-7ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

ABOUT MSC.SOFTWARE

● Find a list of MSC.Software products at:● http://www.mscsoftware.com/products/products.cfm

● Find a list of Adams products at:● http://www.mscsoftware.com/products/mdadams.cfm?Q=457&Z=455

● Find additional training at:● http://www.engineering-e.com/training/● Or your local support center

Copyright2008 MSC.Software C orporationINTRO-8ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

GETTING HELP

● Online help

● To access the online help, do one of the following:●From the Help menu, select Adams/Controls Help●Press F1 when a dialog box is active

● Once the online help is displayed, you can browse through thetable of contents or the index, or search for any terms.

Copyright2008 MSC.Software C orporationINTRO-9ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

GETTING HELP (Cont.)Contents ofselected tab

Index/search for entireAdams help

Table of contents

Copyright2008 MSC.Software C orporationINTRO-10ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

GETTING HELP (Cont.)

● Technical support● To find your local support center, go to:

http://www.mscsoftware.com/support/contacts/index.cfm● To read the Service Level Agreement, go to:

http://www.mscsoftware.com/support/pdf/MSC_Tech_Support_Guide_2006.pdf

● knowledge base● Go to http://support.adams.com/kb● For a quick tour of the knowledge base, go to:

http://www.adams.com/news/newsletter/vol3/kbtour.htm

● Consulting services● Go to http://support.adams.com/services/consulting.shtm

Copyright2008 MSC.Software C orporationINTRO-11ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

GETTING HELP (Cont.)

● MSC Virtual Product Development Community

● To join the community of MSC.Software users, go to:http://forums.mscsoftware.com.

● Select Adams to view the Adams discussions.

● Select MSC News to view product alerts and company news andevents.

Copyright2008 MSC.Software C orporationINTRO-12ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

● Adams/Solver● The solution engine.

● Adams/Solver dataset (*.adm)● The ASCII file submitted to Adams/Solver, which contains

statements and functions that define the model.

● Adams/Solver command (*.acf)● An ASCII file that contains commands to control how

Adams/Solver runs the model.

A REVIEW OF BASIC ADAMS TERMINOLOGY

Copyright2008 MSC.Software C orporationINTRO-13ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

● Adams/Solver output files

● Graphics (*.gra) - Information about how graphics work.● Request (*.req) - Contains output for user-specified results.● Results (*.res) - Contains state-like results for every entity.

Message (*.msg) - Information about the Adams/Solversimulations. Useful for debugging with DEBUG/EPRINT.

● Output (*.out) - Output including initial conditions and request, andcontent can depend on output specifications. It is usually tabularand human readable (for example, tables for output from LINEARcommand).

A REVIEW OF BASIC ADAMS TERMINOLOGY (Cont.)

Copyright2008 MSC.Software C orporationINTRO-14ADM711, Introduction, July 2008Copyright2008 MSC.Software Corporation

S1-1ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

SECTION 1

CO-SIMULATION MODE

S1-2ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

● Use Adams/Controls to compare a system modeled inMATLAB with a similar system built entirely within theAdams environment.

INTRODUCTION

S1-3ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

STATE VARIABLES IN ADAMS

● State Variables are essential to Adams/Controls as theyrepresent the system input/output quantities.

● Users can create State Variables to represent any quantityof interest. For example, a State Variable, that continuouslymonitors the velocity of a PART as a simulation progresses,might look like this in an Adams/Solver .adm file:VARIABLE/5, IC = 0, FUNCTION = VR(9,10)

S1-4ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

● State Variables are created in Adams/View using the menupicks.● Build > System Elements > State Variable > New

STATE VARIABLES IN ADAMS (Cont.)

S1-5ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

THE ADAMS/CONTROLS PLUGIN

● Adams/Controls is implemented as an Adams plugin. InAdams/View (or Adams/Car, Adams/Engine, etc.) you canaccess the available plugins using the menu picks:● Tools > Plugin Manager

● Loading the Adams/Controls plugin results in a new menuwithin Adams/View named ‘Controls’.

S1-6ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

PLANT INPUTS AND OUTPUTS

● Past versions of Adams/Controls (prior to v2005R2) usedthe concept of Plant Inputs and Plant Outputs to organizethe input and output State Variables that Adams/Controlsuses.

● A Plant Input is simply a grouping of State Variables.● Plant Inputs and Outputs are created using the menu

picks:● Build > Controls Toolkit > Plant Input

S1-7ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

CONTROL SYSTEM EXPORT

● The Adams model must be‘exported’ from Adams/Viewto create a plantrepresentation that MATLABor EASY5 understands. Thefollowing menu picks bringup the plant export dialogbox:● Controls > Plant Export

S1-8ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

● Given here are a few specifications of general interest in theAdams/Controls Plant Export dialog box:

Either MATLAB or EASY5Target Software

Listing of State Variables that arethe Adams inputs/outputs

Input/Output Signals

Prefix used for the resulting .cmd,.adm and .m (or .inf) files

File Prefix

CONTROL SYSTEM EXPORT (Cont.)

S1-9ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

● Exporting the plant will create the following files in theworking directory:● prefix.adm : an Adams/Solver representation of the model, used

when running Adams/Controls in batch mode.● prefix.cmd : an Adams/View representation of the model, used when

running Adams/Controls in interactive mode.● prefix.m (MATLAB only) : all the information that MATLAB needs to

start Adams, load the current model and interact with it via thedefined input/output Variables.

● prefix.inf (EASY5 only) : all the information that EASY5 needs tostart Adams, load the current model and interact with it using thedefined input/output Variables.

CONTROL SYSTEM EXPORT (Cont.)

S1-10ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

MATLAB SETUP PROCESS

● After exporting the plant representation from Adams, theenvironment must be setup in MATLAB. The generalprocess as follows:● Start MATLAB, change working directory to that of exported files

from Adams (prefix.m).● Read in prefix.m with the following command:

●prefix●This will create several variables in the MATLAB environment needed to

interact with Adams.● Execute the command on the MATLAB command line:

●adams_sys●This will create a Simulink block that represents the Adams model in

MATLAB.

● Create a Simulink model that interacts with the Adams block.

S1-11ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

EASY5 SETUP PROCESS● After exporting the plant representation from Adams, setup must be

performed in Easy5. The general process for this as follows:● Start Easy5, save current model into the directory containing files from

Adams (prefix.inf).● Ensure that the Adams extension library has been set up for the Easy5

installation (see appendix).● From the Extensions library, locate the ‘Adams Mechanism’ component, add

this to the model.● Double-click this new AD component to view the Component Data Table

(CDT).● Use the ‘Select/Configure Adams Model’ button in the CDT to select the .inf

file.

● This process creates the proper Inputs and Variables for the AD block inEasy5. Create an Easy5 model that interacts with these inputs andoutputs.

S1-12ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

CO-SIMULATION (DISCRETE MODE)

● One of the most common uses of Adams/Controls, co-simulation, does the following process:● MATLAB (or Easy5) starts the Adams ‘server’.● Adams loads the appropriate .adm or .cmd model.● MATLAB (Easy5) initializes its solution at time=0.● Adams initializes its solution at time=0.● MATLAB (Easy5) simulates for a duration of TSampling, holding the

Adams inputs constant.● Adams simulates for the same duration (TSampling), holding the

MATLAB inputs fixed.● MATLAB (Easy5) and Adams exchange updated input/output state

values.● The process repeats for another TSampling duration.

S1-13ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

CO-SIMULATION (DISCRETE MODE) (Cont.)

S1-14ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

ESSENTIAL CO-SIMULATION SETTINGS

● Co-simulation parameters can be inspected/altered byviewing the Adams block in MATLAB or EASY5.To view settings:● MATLAB: double-click the ‘adams_sub’ block, then the ‘Adams Plant’

block.● EASY5: double-click the ‘AD’ block.

S1-15ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

ESSENTIAL CO-SIMULATION SETTINGS(Cont.)

Prefix for the Adams/Solver simulat ion results files.-MATLAB: Output files prefix parameter-EASY5: The text of the 4th line in the .inf file

Simulationoutput prefix

Specifies whether Adams/View (interact ive mode) orAdams/Solver (batch mode) is used.-MATLAB: Animation mode parameter-EASY5: Adams_Animation_Mode parameterNote: Batch mode is generally much faster thaninteract ive mode.

Animation Mode

Sampling interval during which system inputs areheld fixed.-MATLAB: Communication Interval parameter-EASY5: Communication_Interval parameterNote: Sampling interval must be set to capturesystem dynamics of interest. Large intervals will misshigh-frequency content; small intervals willunnecessarily increase simulat ion time.

Co-simulationsampling rate

S1-16ADM711, Section 1, July 2008Copyright2008 MSC.Software Corporation

S2-1ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

SECTION 2

FUNCTION EVALUATION,CO-SIMULATION PERFORMANCE

S2-2ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

OVERVIEW

● Investigate Function Evaluation mode, compare resultsquality to co-simulation mode. Explore co-simulationperformance as simulation parameters are altered.

S2-3ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

FUNCTION EVALUATION MODE

● Function evaluation (or continuous) mode lets the MATLAB(or EASY5) integrators solve the entire problem made up ofthe Adams equations and the MATLAB (EASY5) equations.In this mode, Adams simply acts as a ‘function evaluator’ forthe MATLAB (EASY5) integrator.

MATLAB solves both, Simulink model andAdams model. Adams/Solver just acts asfunction evaluator for MATLAB integrator.

MATLABFunction Evaluation

MATLAB solves Simulink model,Adams/Solver solves Adams model.Data exchanged periodically.

MATLAB andAdams

Co-simulation

CommentsIntegrators usedMode

S2-4ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

● Limitations of the method:● Adams/Solver is often better at solving complicated Adams models,

especially with entities like CONTACTS. Co-simulation is therefore,often more robust.

● Function Evaluation mode does not work with most Adams/Car(Adams/Engine, Adams/Driveline, etc.) models as the CONTROL/statement is not supported in continuous mode.

FUNCTION EVALUATION MODE (Cont.)

S2-5ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

TCP/IP COMMUNICATION

● Traditional communication method for Adams/Controls:● ‘Named pipe’ files - basically, input/output file buffers.

● New alternative communication method:● TCP/IP communication - uses network infrastructure found in all

modern computer Operating Systems.

● Advantages of TCP/IP communication method:● Less hard disk activity than previous method.● Typically better performance.● MATLAB (EASY5) and Adams do not need to be on the same

machine: can be run across a network.

S2-6ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

● Additional setup required for using the TCP/IPcommunication method:● The ‘adams_daemon.py’ file must be copied from the

Adams/Controls installation directory to the working directory whereall the files (.m, .adm, .inf, etc.) exist.

● The adams_daemon must be started via the command line from theworking directory.

● The TCP/IP communications method must be chosen in the Adamsplant mask (MATLAB) or the component data table (EASY5).

TCP/IP COMMUNICATION (Cont.)

S2-7ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

CO-SIMULATION PERFORMANCE SETTINGS

● Save less data in Adams:● By default, each communication interval generates output data for

the Adams output files (*.req, *.res, *.gra) during a co-simulation.Adams/Controls can save every nth sample using the ‘Number ofcommunications per output step’ parameter in the MATLAB plantmask.

● Use ‘batch’ animation mode, avoid ‘interactive’ mode:● Interactive mode uses Adams/View, while batch mode uses

Adams/Solver. The smaller resource overhead of Adams/Solvergenerally leads to faster simulation times.

● Disable interactive charts or similar elements in Simulink (orEASY5).

● Use a coarser sampling rate:● This will speed up co-simulations, typically at the expense of

solution precision.

S2-8ADM711, Section 2, July 2008Copyright2008 MSC.Software Corporation

S3-1ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

SECTION 3

GSE IMPORT METHOD

S3-2ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

OVERVIEW

Use MATLAB’s Real Time Workshop (RTW) code to create acompiled representation of a control system that will beintegrated into an Adams/View model. Include tunableparameters for the control system and investigate systembehavior.

S3-3ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

RTW PRE-REQUISITESThe following items are needed:

1. MATLAB with a Real Time Workshop license available.2. Microsoft Visual C++ for compilation in RTW. Other C/C++ compilers

(for example gcc) will not work properly.3. An available Adams/Controls license.

S3-4ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

RTW BUILD PROCESS

MATLAB’s Real Time Workshop (RTW) package can be usedto create a compiled library (.dll) representation of theSimulink model. The RTW creation process follows thegeneral steps:● Prepare the Simulink model for RTW creation (remove

interactive/unsupported Simulink blocks)● Generate Adams-specific files for MATLAB in current directory via:

1. Read plant export .m files into MATLAB (sets up proper environment forAdams/Controls)

2. Issue command in MATLAB: (copies necessary files to workingdirectory):

>> setup_rtw_for_adams

● Build the Simulink model with RTW, creating a .dll file in the workingdirectory.

S3-5ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

PARAMETERIZE THE RTW COMPONENTVariables from the MATLAB workspace can be carried over into the RTW

component as Design Variables in Adams/View (or Adams/Car,Adams/Engine, etc.) for use in parametric studies.

The general steps are as follows:● Create variables in MATLAB workspace (ex: spring_stiffness = 8).● Modify Simulink blocks to reference the workspace variables.● In the Optimization section of the RTW options, select Configure and add the

variables of interest to the table of defined Global (Tunable) Parameters.● Build the RTW component as usual.● The variables will appear as Adams/View Design Variables that are children of

the general GSE element which is created for the RTW component.

S3-6ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

GSE IMPORT PROCESS

The Control System Import functionality of Adams/Controls isused to prepare the Adams model for use with the RTW .dllfile. From the original Adams model:1. Ensure that the Adams/Controls plugin is loaded in Adams/View and

that proper Plant Input/Output structures exist in the model.2. Import the .dll file via the Control System Import dialog box.

This creates the following modeling elements:1. A STRING specifying the .dll file name2. A GSE that contains all the states in the Simulink model3. Several ARRAY elements needed by the GSE (number of states,

references to variables, etc.).4. A SENSOR element that monitors error values in the GSE.

S3-7ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

DEPENDENCE ON HMAX

RTW code that has been imported into Adams is subject to thesame Adams/Solver error control as all of the other states inthe Adams model. This can be a problem if the importedcode has significantly different error control requirementsthan the Adams model.

Example:● An Adams/Car vehicle model created in units of millimeters might

have a relative error control value of 1e-2.● A hydraulic power steering system for this vehicle that has been

modeled in EASY5 (or MATLAB) might use the same displacementunits, but may have relative error control in the order of 1e-5 orsmaller. This is needed to capture the high-frequency behavior of thehydraulic system.

S3-8ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

Creating the hydraulic steering system as a GSE-import element islikely to yield problems for Adams/Solver; Adams/Solver will need tosolve using the finest error control value, leading to long simulationtimes and potential simulation failures due to very small step sizes.

This kind of system might best be modeled using co-simulation. In co-simulation, Adams and EASY5 (MATLAB) can have different errorcontrol settings, sharing only the sampling rate.

DEPENDENCE ON HMAX (Cont.)

S3-9ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

DISCRETE VS. CONTINUOUS RTWCOMPONENTS

Simulink allows for the creation of either discrete or continuousmodels. How these are handled within Adams/Solver isdependant on the type:1. Continuous Simulink models: the states in the RTW component

are combined with the Adams/Solver states and the larger problemis solved simultaneously. Adams/Solver therefore, solves the RTWstates explicitly. Adams/Solver handles error control and maximumstep-size for the RTW states.

2. Discrete Simulink models: Simulink builds a fixed step-sizeintegrator into the RTW .dll code. The RTW code then acts as a“function evaluator” for Adams/Solver during simulation. Errorcontrol and maximum step-size are handled by the RTW .dll itself;these values are specified when the RTW component is built.

S3-10ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

Before RTW compilation, inspect the Simulink model carefullyand consider the following:1. Some Simulink elements are not suitable for inclusion, for example:

●Blocks that interact with the GUI or the general MATLAB environment donot make sense. Examples: Scope, Display, To Workspace, To File, etc.

●Blocks that are unsupported by RTW. Example: Fcn●The Derivative block (du/dt) is unsupported. Use a Transfer Function

block like: s/(Ns+1) with a small value of N (ex: 0.001) to approximate aderivative.

PREPARE SIMULINK MODEL FOR RTW

S3-11ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

2. Disable Sample Time Inheritance: Sampling rates for blocks oftendefault to the previous or parent blocks. Sampling rates should beset to zero (“0”) to accommodate the fixed step-size algorithm usedby RTW.

3. Do not parameterize source blocks as this can also cause problemsrelated to the integration step-size.●For further details, see KB article 1-KB12498 in the MSC Knowledge

Base: http://support.mscsoftware.com/kb/

PREPARE SIMULINK MODEL FOR RTW(Cont.)

S3-12ADM711, Section 3, July 2008Copyright2008 MSC.Software Corporation

S4-1ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

SECTION 4

GSE IMPORT SPECIFICS

S4-2ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

OVERVIEW

● Consider the differences between discrete and continuouscontrollers as error settings in Adams are altered.

S4-3ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

DISCRETE CONTROLLERS NEED EXTERNALSOLVER

● RTW code libraries, built from a Simulink model containingpurely discrete states, will contain a built-in integratorprovided by Simulink to deal with the Simulink model.

● However, this .dll file will have internal ‘counter’ elementsthat deal with the integration logic. For the RTW code tofunction properly, the .dll file must be released/loadedbetween simulations. There are two ways to force thisbehavior in Adams/View (see figure on following page):1. Set ‘Hold License’ to be ‘No’.2. Or, specify ‘External’ for the Solver Library.

S4-4ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

Both methods (external Solver or not holding license) forceAdams/View to release/load libraries when a simulationreset is encountered.

DISCRETE CONTROLLERS NEED EXTERNALSOLVER (Cont.)

S4-5ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

DISCRETE VS. CONTINUOUS CONTROLLERS

Simulink allows creation of either discrete or continuousmodels. How these are handled by Adams/Solver isdependant on the type:1. Continuous Simulink models: The states in the RTW component

are combined with the Adams/Solver states and the larger problemis solved simultaneously. Adams/Solver therefore solves the RTWstates explicitly, handling all error control.

2. Discrete Simulink models: Simulink builds a fixed step-sizeintegrator into the RTW .dll code. The RTW code then acts as a“function evaluator” for Adams/Solver during simulation. Errorcontrol and maximum step-size are handled by the RTW .dll itself;these values are specified when the RTW component is built.

In general, in Simulink:●Continuous blocks are expressed in terms of “s”.●Discrete blocks are expressed in terms of “z”.

S4-6ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

LIBRARY NAME, MULTIPLE CONTROLLERS

Each GSE-Import element in an Adams model has at least thefollowing traits:● A .dll file containing the controller implementation● A GSE element in the Adams model● A STRING element in the Adams model, identifying the associated

.dll library file prefix

● The relationship between the STRING element and theactual .dll file name is very important: a .dll file name cannotbe renamed without modifying the accompanying STRINGin the Adams/model.

● Multiple controllers can exist in a single model. Eachcontroller will be associated with a unique STRING elementwhich identifies the unique library name.

S4-7ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

Example .adm file fragments:!adams_view_name='discrete_controller_name'STRING/1, STRING =discrete

!adams_view_name='other_controller_name'STRING/22, STRING =other

LIBRARY NAME, MULTIPLE CONTROLLERS(Cont.)

S4-8ADM711, Section 4, July 2008Copyright2008 MSC.Software Corporation

S5-1ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

SECTION 5

CO-SIMULATION MODIFIERS

S5-2ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

OVERVIEW

● Explore parameters that can alter the Solver library choice,issue initialization commands and modify the interpolationscheme used in co-simulation mode.

S5-3ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

ADAMS_EXEC PARAMETER

● Adams_exec parameter is required to occasionally use acustom Adams/Solver library with Adams/Controls.Adams_exec must specify either of the following:● Keyword: used to specify the special Adams Solvers, for example:

●acar_solver: use the Adams/Car-specific Solver●aengine_solver: use the Adams/Engine-specific Solver

● String: specify the name of a custom Solver library (.dll, .sl or .solibrary) to be used. This library should exist in the working directory.

● Examples:●adams_exec = ‘acar_solver’●adams_exec = ‘my_custom_solver.dll’

● Can be set in the plant export GUI, in the Adams plantmask, or simply as a command in MATLAB.

S5-4ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

ADAMS_INIT PARAMETER● Adams_init enables specification of a command before the co-simulation

is launched. This is commonly used to initialize a model prior to the co-simulation.● Examples:

● Adams_init = ‘simulate/static’● Adams_init = ‘file/command=init_commands.acf’

● The ‘init_commands.acf’ file from above might look like:● EQUILIBRIUM/STATIC, TLIMIT=10, ERROR=1● SIMULATE/STATICS● EQUILIBRIUM/STATIC, TLIMIT=1, ERROR=0.001● SIMULATE/STATICS

● This script is a classic “statics funnel” approach for finding equilibrium in amodel.

● Can be set in the plant export GUI, in the Adams plant mask, or simplyas a command in MATLAB.

S5-5ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

ADAMS CONTROLS WAIT TIME● By default, Adams/Controls waits for approximately four

seconds for Adams/Solver to launch and start interacting withAdams/Controls. Issues with acquiring licenses over a busynetwork, or similar, can delay the startup of Adams/Solver,yielding a “Plant Communication Error” from Adams/Controls.

● Setting the ADAMS_CONTROLS_WTIME environmentvariable to a larger number (8 seconds) can lead to slightlyslower startup times, but more robust co-simulationperformance.

S5-6ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

ADAMS CONTROLS WAIT TIME (Cont.)● This must be set as an environment variable in one of two

ways:● Globally: create a user-space environment variable that is always

active, setting this variable to a value greater than four seconds.● On a per-shell basis: set this environment variable only for a particular

shell instance. Then launch MATLAB (or Easy5) from this shell.● Example of setting this variable from a DOS shell on Windows, then

launching MATLAB from this same shell:●set ADAMS_CONTROLS_WTIME=8●c:\MATLAB701\bin\matlab.bat

S5-7ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

● The default co-simulation method is to sample-and-holddata on the MATLAB (or Easy5) and Adams sides of the co-simulation. Once Adams and MATLAB exchangeinput/output state information, these states are held fixed inthe respective models until the next communication interval.This is also referred to as “zero-order hold”.

● The sudden changes in the variables at the co-simulationdata exchanges can cause problems for the respectiveintegrators.

CO-SIMULATION INTERPOLATION ORDER

S5-8ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

● When the interpolation order parameter is set to “1”,Adams/Controls does the following:● MATLAB (Easy5) side: enough information is available to linearly

interpolate input data throughout the co-simulation sampling interval.● Adams side: the current data values are used with the previous time

step to linearly extrapolate over the sampling duration.

● Interpolation (or extrapolation, depending on the package)can lead to faster simulation times as the respectiveintegrators have less-severe state changes to work with.

CO-SIMULATION INTERPOLATION ORDER(Cont.)

S5-9ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

● Sampling Rate● The data exchange sampling rate must be sufficient to capture the

system interaction dynamics. In some cases, the sampling rate mustbe so small that simulations take a very long time to progress.

● SIMULATE/DYNAMICS only● SIMULATE/KINEMATICS and SIMULATE/TRANSIENT will not work

since Adams/Controls only issues SIM/DYN commands. Note thatmany suspension analysis events in Adams/Car are quasi-staticanalyses, so they are not compatible with Adams/Controls.

● Unsupported Adams/Solver Commands● SAVE and RELOAD: should not be used.

CO-SIMULATION LIMITATIONS

S5-10ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

● ACTIVATE and DEACTIVATE: should not be used with functionevaluation mode as they change the topology of the model. Workswith co-simulation mode.

● CONTROL/FUNCTION: should not be used with function evaluationmode as model topology can be changed. Works with co-simulationmode, but beware of accidentally advancing time.

CO-SIMULATION LIMITATIONS (Cont.)

S5-11ADM711, Section 5, July 2008Copyright2008 MSC.Software Corporation

S6-1ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

SECTION 6

ADAMS/CAR AND ADAMS/CONTROLS

S6-2ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

OVERVIEW

● Investigate the effect of an anti-lock braking (ABS) systemon an Adams/Car model during a dynamic event.

S6-3ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

● The Adams/Car Graphical User Interface (GUI) must beused to set up the Adams/Car model and generatespecial files needed for the co-simulation.

● Adams/Car will write out special files (.m, .inf, etc.) relatedto Adams/Controls if the following conditions are met inthe Adams/Car GUI and model:● The Adams/Controls plugin must be loaded in Adams/Car.● The current vehicle model must contain both, Plant Input and

Plant Output structures somewhere within the varioussubsystems.

● A “Files Only” simulation must be submitted for the simulationevent.

ADAMS/CAR GUI SEQUENCE

S6-4ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

SPECIAL FILES REQUIRED

● If the conditions are met, Adams/Car will write out the filesneeded to set up an Adams/Controls simulation.

● If the Adams/Controls plugin has been loaded, if modelcontains both, Plant Input and Plant Output structures, andif a ‘Files Only’ simulation has been submitted, the followingfile types will be written to the working directory:● .adm = the standard model file● .acf = the standard event simulation script● _controls.acf = special simulation script needed for

Adams/Controls model initialization● .xml = the standard event definition file● .m = information file for MATLAB● .inf = information file for Easy5

S6-5ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

● A .acf file for a standard event may look like this:! first line blankfile/model=baseline_brakeoutput/nosepcontrol/routine=abgVDM::EventInit, function=user(3,1,12,0,2,7,7,11,4,10, 19)control/routine=abgVDM::EventRunAll, function=user(0)stop

● The equivalent for an Adams/Controls simulation may look like this:output/nosepshow status=simulationcontrol/routine=abgVDM::EventInit, function=user(3,1,12,0,2,7,7,11,4,10, 19)show status=simulationsim/init

● Note that the Adams/Controls-specific .acf file simply runs the “EventInit”simulation and issues a “sim/init” command.

● Adams/Controls takes care of advancing time once the vehicle modelhas been initialized.

SPECIAL FILES REQUIRED (Cont.)

S6-6ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

ADAMS_INIT, ADAMS_EXEC

● The method for setting up the vehicle model and the customSolver library needed to run the simulation must be specifiedvia the Adams_init and Adams_exec variables.

● Initializing: the Adams_init variable must be used toinitialize the model by reading the special ‘_controls.acf’ file,for example:Adams_init=’file/command=baseline_brake_controls.acf’

● Custom Library: the Adams_exec variable must name thespecific Adams/Solver library to be used for the vehiclemodel, for example:Adams_exec=’acar_solver’

S6-7ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

SAMPLING RATES

● For co-simulation (discrete) mode, the sampling rate mustalways be the same as the one is specified in the standardevent .xml file.

● The ‘stepSize’ parameter in the .xml file must be identical tothe sampling rate for co-simulation.<DcfMini name="BRAKING" active="true" userDefined="false"smoothingTime="0.1" activeFlag="true" abortTime="4"stepSize="0.0005" hMax="0">

● If the two sampling rates differ, the MATLAB model will havea different time-basis than the Adams model and problemswill be apparent.

S6-8ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

PERSISTING DATA IN ASSEMBLIES

● By default, Adams/Car does not save any assemblychanges to file, unless the assembly is saved in the binaryformat. Model elements such as Plant Input and PlantOutput structures should therefore be created and getsaved at the template level of the model.

● Therefore, the two methods for incorporatingAdams/Controls-specific model changes are:● Make changes to the assembly, then save the assembly in the

binary format.● Incorporate changes at the template level, then re-create

subsystems and assemblies as needed.

S6-9ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation

ALLOWABLE SIMULATION TYPES

● Adams/Controls, during a co-simulation analysis, will onlyissue the “SIMULATE/DYNAMICS, ….” command. Othersimulation types, such as quasi-statics, are not possible.

● Many full-vehicle simulations in Adams/Car are dynamicsimulations; some are quasi-static events and will thereforenot work with Adams/Controls.

● Most half-vehicle (suspension) analyses in Adams/Car arequasi-static simulations, so these will not work with anAdams/Controls co-simulation.

S6-10ADM711, Section 6, July 2008Copyright2008 MSC.Software Corporation