当前位置:首页 >> 机械/仪表 >>

AMESim和adams联合仿真使用说明


ADAMS interface?
Rev 9 – November 2009

Copyright ? LMS IMAGINE S.A. 1995-2009 AMESim? is the registered trademark of LMS IMAGINE S.A. AMESet? is the registered trademark of L

MS IMAGINE S.A. AMERun? is the registered trademark of LMS IMAGINE S.A. AMECustom? is the registered trademark of LMS IMAGINE S.A. LMS Imagine.Lab is a registered trademark of LMS International N.V. LMS Virtual.Lab Motion is a registered trademark of LMS International N.V. ADAMS? is a registered United States trademark of MSC.Software Corporation. MATLAB and SIMULINK are registered trademarks of the Math Works, Inc. Modelica is a registered trademark of the Modelica Association. UNIX is a registered trademark in the United States and other countries exclusively licensed by X / Open Company Ltd. Windows is the registered trademark of the Microsoft Corporation. All other product names are trademarks or registered trademarks of their respective companies.

TABLE OF CONTENTS
1. Introduction ............................................................................................................................1? 1.1. Organization of this manual 2?

2. Preliminaries...........................................................................................................................3? 2.1. License requirements 2.2. Compiler requirements 2.2.1. Requirements to import ADAMS model into AMESim 2.2.2. Requirements to export AMESim models into ADAMS 2.3. Versions of ADAMS supported 2.4. Platforms supported 2.5. Setting up the environment 3? 3? 3? 3? 4? 4? 4?

3. Importing AMESim into ADAMS............................................................................................7? 3.1. Preliminary 3.2. Import AMESim models into ADAMS 3.2.1. Preparing an AMESim model for export to ADAMS 3.2.2. Importing the model in ADAMS 7? 9? 9? 11?

4. Importing Adams into AMESim...........................................................................................20? 4.1. Introduction 4.2. Preparing an ADAMS model for export to AMESim 4.2.1. Step 1: Check exchanged variables 4.2.2. Step 2: Create the Interface 4.2.3. Step 3: Export the system from ADAMS into AMESim 4.3. Importing the model into AMESim 4.3.1. Step 1: Import file generated by ADAMS 4.3.2. Step 2: Configuration of the interface block 4.3.3. Step 3: Running a simulation 4.4. Analyzing results in both software 20? 22? 22? 25? 26? 27? 27? 29? 30? 32?

5. Co-simulation or full export? ..............................................................................................32? 6. Tips on using the interface..................................................................................................35? 6.1. How to stop a simulation 6.2. How do you execute ADAMS commands before a co-simulation? 35? 36?

7. Advanced use of the interface ............................................................................................36? 7.1. How to setup interface with template-based ADAMS products 7.1.1. Using more than one interface 7.2. Advanced configuration of the interface 7.2.1. Configuration file 36? 37? 37? 37?

November 2009

Table of Contents

1/1

Using the AMESim / ADAMS Interface
1. Introduction
The AMESim ADAMS interface enables you to link an AMESim model with an ADAMS multibody model of a mechanical structure. By coupling motion simulation and system simulation, this interface improves the accuracy of your full system simulation. This interface is useful when hydraulic or pneumatic fluid power systems or other AMESim systems interact with complex mechanical structures. The interface is designed so that you can continue to use many of the AMESim facilities while the model is running in ADAMS. In particular, you can change the parameters of the AMESim model within AMESim in the normal way and monitor the results by creating plots just as if you were producing a regular run. Normally you will have AMESim and ADAMS running simultaneously so that you can use the full facilities of both packages. An illustration of this process follows: Construct the AMESim model with import/export icon from/to MSC.ADAMS

Modify AMESim submodel parameters

Complete the MSC.ADAMS model and link with AMESim part

Run the simulation

Examine AMESim submodel results in AMESim

Examine MSC.ADAMS system results in MSC.ADAMS

When the process is finished, the user can change the AMESim model parameters within AMESim, as well as the ADAMS parameters within ADAMS.

November 2009

Using the ADAMS Interface

1/39

1.1. Organization of this manual
This manual describes both the two-way full export interface (using ADAMS or AMESim integrator exclusively for the full system) and the two-way co-simulation interface (where both solvers are used, one of them being called by the other). The main part of the manual deals with the standard interface and section 5 looks at the differences between export and co-simulation. The structure of this manual is the following: ? Section 1 is the current section. ? Section 2: Preliminaries, describes how you must set your working environment so that you can use the interface. ? Section 3:Error! Reference source not found. describes how ADAMS imports the AMESim model.

2. Section 4: Importing Adams into AMESim
? , uses a simple example to describe how to create an AMESim model and configure it to run in cooperation with ADAMS. ? Section 5: This section describes the differences between co-simulation interface and the export facility. ? Section 6: Tips on using the interface, gives some advice on efficient use of the interface. ? Section 7: Advanced use of the interface and Section 8: Advanced configuration of the interface, are useful for customized use of the interface (advanced users). Sometimes a section of text is only valid for a UNIX or Linux environment, for such text, the following presentation is used: Using UNIX: Description for Unix/Linux based environments. Similarly, sometimes a section of text is only valid for a Windows environment, for such text, the following presentation is used: Using Windows: Description for Windows based environments. We assume that either the reader of this manual is already familiar with using AMESim and ADAMS or an AMESim user and an ADAMS user will collaborate in performing the task. We recommend that new AMESim users at least do the tutorial examples in the AMESim manual before attempting a combined simulation. Similarly, a new ADAMS user should become familiar with using ADAMS before attempting a combined simulation.

November 2009

Using the ADAMS Interface

2/39

3. Preliminaries
3.1. License requirements
When the user is running a coupled simulation from the AMESim environment, an Adams interface license is required in AMESim in combination with a standard AMESim runtime license. On the ADAMS side the module Adams/Controls (A/Controls) is needed. When running simulations from ADAMS the user only needs Adams interface and AMESim runtime licenses, A/Controls is unused.

3.2. Compiler requirements

3.2.1. Requirements to import ADAMS model into AMESim
Using Unix: You will need an ANSI C compiler. Using Windows: You must have at least Microsoft Visual C/C++ 6.0, .NET 2003, 2005.

3.2.2. Requirements to export AMESim models into ADAMS
AMESim follows the requirements given for ADAMS 2005 Software specifications are: Hardware Vendor Intel and Intelcompatible PCs Hewlett Packard SGI IBM Sun Microsystems Operating System Windows 2000, Windows XP Professional HP-UX 11, 11i IRIX 6.5.14m AIX 4.3.3, 5.1* Solaris 7, 8, 9 Fortran Compaq Visual Fortran 6.6B f90 2.4.13 7.3.1.2m XL Fortran 7.1 6 Update 1 C/C++ MS Visual C/C++ 6.0 (SP5) or Visual Studio C++.NET 2003 c89 11.01.20 aC++ 03.27 7.3.1.2m Visual Age C/C++ 5.0.2 6 Update 1

* ADAMS Service Pack APN-130-257 is required to run on this operating system.

November 2009

Using the ADAMS Interface

3/39

3.3. Versions of ADAMS supported
This manual applies to ADAMS 2005. The interface was developed using this version and when using a mode that requires A/Controls (i.e. importing into AMESim) we suggest that you use that version with following patches: A/View 2003 Service Pack 1 APN-130-240 A/Solver 2003 Service Pack APN-130-252 A/Controls 2003 Service Pack APN-130-256 This manual was also revisited to add some particular aspects for using this interface with the Adams 2008 release

3.4. Platforms supported
Windows (2000, XP), HP, Sun and IBM.

3.5. Setting up the environment
In order to use the AMESim / ADAMS interface it is necessary to set an environment variable that points to the ADAMS installation directory. If this is not set, AMESim will not be able to find the files necessary to compile the system. To find out if this environment variable is set, type the following line in a terminal window: Using Unix: echo $AME_ADAMS_HOME The result should be something like: /opt/Adams2005 being printed on screen. If nothing is printed, or the message “AME_ADAMS_HOME: Undefined variable” is displayed, you must set this variable. To do this you need to know where ADAMS is installed. If your working environment is set up properly to run ADAMS, type either: which adams05 (if you are using C shell) or, whence adams05 (for Korn shell - ksh or Bourne shell - sh) or, type adams05 (for some versions of Bourne shells). This will tell you the location of the command to start ADAMS e.g. /opt/bin/adams05 Then type: ls –l /opt/bin/adams05 This finds the link to the ADAMS directory, it may give something like: /opt/bin/adams05 /opt/Adams2005/mdi* Remove the last part from this pathname to get the value to set for AME_ADAMS_HOME, in this case /opt/Adams2005. If you are using Unix C shell, you can then set the environment variable as follows: setenv AME_ADAMS_HOME /opt/Adams2005 This statement can also be added to your .cshrc file so that the environment variable is set every time you log in. For Bourne or Korn shells the corresponding would be: AME_ADAMS_HOME=/opt/Adams2005; export AME_ADAMS_HOME November 2009 Using the ADAMS Interface 4/39

Add these statements to your .profile file so that the environment variable is set every time you log in or add it to a script that launches AMESim. Using Windows: echo %AME_ADAMS_HOME% The result should be something like: C:\ADAMS2005 being printed on screen. If the environment variable is not set, %AME_ADAMS_HOME% is printed and you need to set the environment variable to point to the ADAMS installation directory. This can be done from the Windows Control Panel.

If you want to use this interface from ADAMS side, you will need a Fortran compiler as stated in section 2.2. Using Windows: In this case the file dfvars.bat must be copied into $AME. This file sets up the environment to use Fortran libraries. For Compaq Visual Fortran this file can be found here: C:\Program Files\Microsoft Visual Studio\DF98\BIN Copy this file into the AMESim installation directory. Using Unix: You need access to a Fortran compiler. To be certain that the compiler is installed, type one of the following commands in a terminal window. For IBM type: xlf, for SGI type f77 and for Sun type f77. If the command issues an error message, please contact your system administrator.

In AMESim the $AME/libadams directory must be in the current path list. You must set the environment variable ADAMS_CONTROLS_WTIME to 20. Generally, this waiting time is enough to initialize connections between AMESim and ADAMS. The AME_ADAMS_HOME environment variable must be defined with a DOStype path (that can be found in the .inf file generated by ADAMS), for example: D:\PROGRA~1\MSC~1.ADA\ To use this interface using the Visual C compiler, the make file called amesim_adams_gsec.make located in $AME/interfaces/adams/ should not contain the library dform.lib which is reserved for Fortran compilers. The library for ADAMS must be replaced in the AMESim installation depending on the ADAMS version used. The library files are located in $AME/libadams/lib as shown below.

November 2009

Using the ADAMS Interface

5/39

Replace AMEADAMS.lib with the correct library file

November 2009

Using the ADAMS Interface

6/39

4. Importing AMESim into ADAMS
4.1. Preliminary
The recommended way of working is to first create independent sub-system models in AMESim and ADAMS, each of which has a very simple model of the other domain subsystem. Thus if the end result of a simulation study is to investigate how a hydraulic actuator system will work in a mechanical system it is often best to first model the hydraulic system separately with a simplified model of the mechanical system using the mechanical submodels available in AMESim. This would probably be a prescribed velocity and displacement. In parallel a separate model of the mechanical system would be built in ADAMS with a simplified hydraulic system. This would probably be a prescribed force instead of an actuator. The two sub-system models should then be verified thoroughly. As much independent tuning of the sub-systems as possible should be done at this stage. When the two separate models work properly, they can be integrated. A good general rule is that the ports where the hydraulic and multi-body sub-systems are connected will correspond to hydraulic linear actuator rods or the shafts of hydraulic pumps, motors or rotary actuators. It is not too difficult to think of exceptions but the overwhelming majority of applications will satisfy this rule. You will look at one simple system that uses this way of interfacing. The tutorial case is the ADAMS tutorial example of the antenna. It is strongly recommended that you reproduce this system. When using the interface, there are four important points to treat carefully ? ? ? ? units, sign conventions, implicit variables (when using AMESim from ADAMS), numerical aspects.

With reasonable care these points can be solved without any problem. The problem of different units in ADAMS and AMESim often leads to the need for the interfacing variables to be adjusted with some unit conversion factor. What we mean by a sign convention is the significance of the signs of forces, displacements and velocities in both AMESim and ADAMS. It is almost always necessary to reverse the sign of displacements and velocities when they are imported into AMESim if hydraulic jacks or hydraulic pumps, motors or rotary actuators are used. Since the sign convention depends on the interfacing of components and variables it is necessary to use caution regarding the sign. This is another good reason for creating two separate subsystem models. The single software simulation results will give good insight into the system behavior and make any sign errors in the combined simulation apparent. As explained in the AMESim manual, AMESim can solve two kinds of systems of differential equations: ordinary differential equations (ODEs) and differential algebraic equations (DAEs). The latter uses implicit variables. The interface between AMESim and the General State Equation in ADAMS supports only ODEs. It is therefore impossible to use any submodel in AMESim that uses implicit variables when exporting the model into ADAMS. It may also be necessary to modify the AMESim model to eliminate any implicit variables that may be created to resolve algebraic loops.

November 2009

Using the ADAMS Interface

7/39

When working from ADAMS, numerical problems arise due to the fact that the interface uses the ADAMS integrator, which is tuned to work well with the equations governing multibody systems. The numerical characteristics of a fluid power system are different. Another source of numerical problems is that an AMESim model when run with the AMESim integrators can employ some special tricks to deal with discontinuities. This is not possible when using the ADAMS integrator. In fact, the documentation of the ADAMS GSE facility, states that the imported system of ODEs must be continuous. It is therefore recommended to avoid hard discontinuities completely in the AMESim model. By a hard discontinuity we mean that there are jump changes in the values of state variables. Fortunately very few AMESim submodels employ hard discontinuities. Avoid the following hydraulic actuator icons that have an integral mass as the corresponding submodels employ hard discontinuities. It is not impossible to use these submodels but if you do, make sure that the jack never hits its end-stops. However, submodels associated with alternative icons employ elastic endstops, which do not have hard discontinuities. Hence it is preferable to use these. USE THESE ICONS

NOT THESE

Similarly if you use the mechanical icons,

, use MAS21 not MAS005.

Looking at the input and output requirements of these preferred submodels and at the requirements of hydraulic pumps and motors, a second general rule becomes apparent. The ADAMS model normally calculates position and velocity, (or angle and angular velocity) and passes them to the AMESim model, which calculates the corresponding force (or torque). Again it is possible to think of exceptions but this rule is very useful. In the same way when working from AMESim, numerical problems can arise when importing a large ADAMS system. The AMESim integrator is not designed to solve such problems, and simulation times may rise significantly. In these cases the co-simulation interface can be a solution if no workaround is found to make the full import facility efficient.

November 2009

Using the ADAMS Interface

8/39

4.2. Import AMESim models into ADAMS
In this section you will focus on the interface method to import the AMESim model into ADAMS. We designed the facility for multiple reasons: An ADAMS user needs to integrate a validated AMESim component into a mechanical system; he can still work with ADAMS facilities while taking advantage of AMESim’s ability to design multi-disciplinary control systems. ? AMESim may sometimes encounter difficulties in solving a complex ADAMS mechanical structure; in this case, we suggest that user tries the other method for coupling the systems, especially if the AMESim system is simple. ? This methodology requires no supplementary license for A/controls product. In this case, you will use AMESim subsystem in ADAMS as a general state equation (GSE) block. ADAMS executable will communicate with AMESim using a library. In fact, AMESim will not generate an executable as usual but rather a dynamic link library (dll) on Windows platforms or a library (so) on UNIX platforms. One advantage of this methodology is that you do not need to have AMESim installed on the ADAMS machine; you will just need an AMESim runtime license.

4.2.1. Preparing an AMESim model for export to ADAMS
In this section, you will see how to export an AMESim system into ADAMS. In Sketch mode, construct your AMESim system with non-connected ports corresponding to ADAMS inputs and outputs. Then, select Modeling Interface block Create interface icon…, as shown in the screen capture below: Figure 1: Creating export icon in AMESim

It opens a dialog box window named Interface Icon Creation, you select there a Type of interface it should be Adams or AdamsCosim depending whether you want to run discrete coupling or continuous export. Set the number of input variables to ADAMS and output variables from ADAMS and give them a name. November 2009 Using the ADAMS Interface 9/39

In the antenna case it should be one input and two outputs and the created icon looks like this: Figure 2: AMESim subsystem containing ADAMS block

It is also possible to change the interface status without having to re-do the export, just go to the menu and use Modeling Interface block Display interface status. Then you can switch from Adams to AdamsCosim.

Now switch to Submodel mode and Parameter mode. After the compilation of the system AMESim creates the library. Switch to Simulation mode to generate all necessary files or by using File Write auxiliary files.

November 2009

Using the ADAMS Interface

10/39

The model cannot have implicit variables otherwise the interface does not work. During the compilation process, the following information is presented:

You are now ready to work under ADAMS and import the AMESim system; this is the subject of the next section.

4.2.2. Importing the model in ADAMS
As an example, you will use the ADAMS tutorial of the antenna controlled within AMESim. This example comes from A/Controls tutorials; copy the A/View command file antenna.cmd from {ADAMS_DIR}/controls/examples/antenna into a working directory.

In ADAMS, do not forget to select the working directory where the AMESim model is located. Use the menu item File Select Directory… By default, the working directory is set to $HOME. This interface also uses libraries located in the $AME/$MACHDIR where $MACHDIR is the machine directory, for example win32 for Windows. This variable must be in the patch directory. Import the file within A/view environment. The ADAMS model contains an input on the azimuth_motion_csd. variable to force the rotation during the simulation. This input must be deactivated because it is managed in the controller (AMESim model). If we do not deactivate this variable, there will be a conflict between the AMESim control and ADAMS control. To do this, select the Edit Deactivate entry. This action displays the Database Navigator to access the data tree. In the window Database Navigator select azimuth_motion_csd.

November 2009

Using the ADAMS Interface

11/39

Figure 3: Deactivate a motion in A/View

Apply by clicking OK If we reopen the Database Navigator, the variable appears as OFF

November 2009

Using the ADAMS Interface

12/39

4.2.2.1. Step 1: Create the arrays for inputs, outputs and states
Adams 2005: In A/View go to the Build Adams 2008: In A/View go to the Build Controls Toolkit menu. Data Elements Array menu.

First, choose the U input array. There you create inputs to the AMESim subsystem, so it will be a 2-dimensional array containing ADAMS variables for velocity and position.

Adams 2005

Adams 2008 Next choose X states array. discrete export:X state array size = 1 (a dummy state variable) continuous export: size of the array = AMESim number of states (*) (if = 0 put 1)

(*) this number is displayed in the build dialog box.

The model cannot have implicit variables otherwise the interface does not work.

Adams 2005

November 2009

Using the ADAMS Interface

13/39

Adams 2008 Finally, choose Y output array. It represents the outputs from AMESim so in our case it will be a 1-dimension array for the control torque.

Adams 2005

Adams 2008

4.2.2.2. Step 2: Association of array output value to the model
The control torque computed by AMESim needs to be associated with the ADAMS model. You do it in the single component torque using ARYVAL ADAMS function. This one permits you to get an array value. Note that, as a first argument to this function you use the array of outputs and the second argument is the position of the required value; 1 in our case. From the Database Navigator, select the azimuth_actuator and we have access to the following dialog box to modify the function Figure 4: Associate AMESim output to the ADAMS model

November 2009

Using the ADAMS Interface

14/39

4.2.2.3. Step 3: Creating the GSE and linking with the AMESim library
In the Build System Elements General State Equation menu, choose New… this opens the dialog box window below. Fill in the window as shown in the following figures. The States line corresponds to the coupling method you chose previously under AMESim; choose discrete for a co-simulation and continuous for an export. The User Function Parameters field always needs three parameters and corresponds respectively to the ID of U Array, Y Array and X Array. AMESim will need them to be able to get correct values from ADAMS during simulation.

Figure 5: Creating a GSE in ADAMS; discrete mode

November 2009

Using the ADAMS Interface

15/39

Figure 6: Creating a GSE in ADAMS; continuous mode

Once completed, you have to indicate to A/Solver to use the AMESim library. Go to the Settings Solver Executable… menu, in the dialog box window for Solver Library supply the AMESim library path as shown in the figure below: Figure 7: A/Solver settings when using AMESim library

In AMESim, select the appropriate settings for the simulation

November 2009

Using the ADAMS Interface

16/39

4.2.2.4. Step 4: Running a simulation
Create a command script. Here is an example of a Solver command script: simulate/dynamics, end=0.250000, dtout=0.001 Select Simulate Simulation Script … New

Since A/Solver will use an external library only scripted simulations are available. Select Simulate Scripted Controls …

November 2009

Using the ADAMS Interface

17/39

Run the simulation within ADAMS, at the same time the AMESim library writes a result file. The AMESim model is executed in the background. The communication with ADAMS takes place at the library level (dll on Windows and so on Unix platforms). In the aside figure you can notice that AMESim outputs some messages during the simulation.

4.2.2.5. Step 5: Checking the results
If you have AMESim installed on the same machine, you can look at the results within AMESim. Otherwise, you can focus on ADAMS results only. Results of common variables are as follows under AMESim.

November 2009

Using the ADAMS Interface

18/39

In Adams we can also see the variable curves.

November 2009

Using the ADAMS Interface

19/39

5. Importing Adams into AMESim
5.1. Introduction
As an example, you will use the same ADAMS tutorial of the antenna controlled within AMESim. The final sketch in AMESim will look like: Figure 8: Antenna sketch in AMESim

The example comes from A/Controls tutorials; copy the A/View command file antenna.cmd from {ADAMS_DIR}/controls/examples/antenna into a working directory. In ADAMS, do not forget to select the working directory where the AMESim model is located. Use the menu item File Select Directory… By default, the working directory is set to $HOME Import the file within the A/view environment. The ADAMS model contains an input on azimuth_motion_csd variable to force the rotation during the simulation. This input must be deactivated because it is managed in the controller (AMESim model). If we do not deactivate this variable, there will be a conflict between AMESim control and ADAMS control. To do this, select the Edit Deactivate entry. This action displays the Database Navigator to access to data tree. November 2009 Using the ADAMS Interface 20/39

In the window Database Navigator select azimuth_motion_csd. Figure 9: Deactivate a motion in A/View

Apply by clicking OK. If we reopen the Database Navigator, the variable appears as OFF

November 2009

Using the ADAMS Interface

21/39

5.2. Preparing an ADAMS model for export to AMESim
In this case, AMESim is the master software, you will launch simulations from AMESim and AMESim controls ADAMS simulation. There are two ways to export ADAMS into AMESim: ? Discrete export, or co-simulation mode, AMESim tells ADAMS to supply its outputs at fixed intervals, ADAMS solves its system, ? Continuous mode, AMESim gets the complete system from ADAMS and tries to integrate all equations, ADAMS acts then as a function evaluator. These modes require that you have a valid license for A/Controls. The ADAMS side of the procedure is unchanged whichever mode you use. It is only in AMESim that you make your choice.

5.2.1. Step 1: Check exchanged variables
In this step, you will check the definition of some ADAMS state variables 1 . You will use them as exchanged variables between the two software packages, for example for a hydraulic actuator modeled in AMESim and acting on an ADAMS mechanical structure, these variables should be a force, a position and a velocity. AMESim needs position and velocity and computes a force. Outputs from ADAMS, often velocity and position, are defined with ADAMS intrinsic functions; AZ( ) for an angle measurement, WZ( ) for a rotational velocity, DM( ) for a displacement magnitude.

Be careful, the meaning of state variables is not the same in AMESim and in MSC.ADAMS. For the latter these are simple variables defined by an algebraic equation whereas in AMESim these are the variables integrated by the solver.

1

November 2009

Using the ADAMS Interface

22/39

Figure 10: Check outputs in ADAMS Select the variables in the Database Navigator

November 2009

Using the ADAMS Interface

23/39

Be careful with units (accessible from Settings/Units… menu in A/View). They should be compatible with what AMESim expects, if you do not want to change them in ADAMS, do not forget to place a gain (conversion factor) on the AMESim sketch before inputting the signals into AMESim submodels. Inputs to ADAMS, mainly forces/torques, are used in standard elements like single component force/torque or general force (6 components). At creation, these variables are set to zero value because the other software (AMESim) will compute their values. In our example, the unique input variable is referenced in a torque single component using the function VARVAL. The element azimuth_actuator can be accessed from the Tools Database Navigator… menu in A/View. The control_torque state variable is accessible from Build System Elements State Variables Modify… menu. Figure 11: Creating input variable in ADAMS

Once you have created input and output variables, in the next section you will learn how to define the interface in ADAMS.

November 2009

Using the ADAMS Interface

24/39

5.2.2. Step 2: Create the Interface
Using the variables you created in the previous step, use the existing Plant Input and Plant Output. Plant Input: {control_torque}, where the torque is used in a single component torque as VARVAL(control_torque) and, Plant Output: {rotor_velocity, azimuth_position}, where these variables are computed with ADAMS functions. Look at the figure below, you can access these windows by using the Database Navigator… from the Tools menu and by selecting the existing plants.

Figure 12: Creating Interface component in ADAMS

The ADAMS model is now ready for export; in the next section, you will see how to generate the files necessary to AMESim.

November 2009

Using the ADAMS Interface

25/39

5.2.3. Step 3: Export the system from ADAMS into AMESim
You will export the coupled system; if A/Controls plugin is loaded (refer to ADAMS documentation to do so), you have access to the Controls menu. There you can do a Plant Export: Figure 13: Exporting the coupled system from ADAMS

In this dialog box, you have to fill in: ? the name (File prefix) that ADAMS will use to store results files, ? if you want ADAMS to compute an initial static analysis before running the coupled system choose yes, otherwise choose no, ? plant input and plant output created in step two, BE CAREFUL: remove blank lines before control_torque and rotor_velocity after usage of From PInput or FromPoutput ? Target Software: choose MSC.EASY5, ? Analysis type, choose between linear and non_linear, ? if needed a user-defined library name. This operation creates three files in your working directory, adams2amesim.inf ...adm and …cmd. You will only focus on the adams2amesim.inf file, but here is a brief description of the three files:

November 2009

Using the ADAMS Interface

26/39

? The inf file contains generic information for coupling with other software: the path of ADAMS, names of files that ADAMS will write to, some information needed by the solver, identities of exchanged variables, and number of states 2 . ? The adm file contains the ADAMS system readable by the ADAMS/Solver, this one will be input to the solver when running the simulation. ? The cmd file also contains all the relevant system information but suitable for ADAMS/View. The ADAMS part of the process is now finished, in the next part you will focus on AMESim.

5.3. Importing the model into AMESim
In AMESim construct the simple sketch that will control the antenna model. The information necessary is given on the sketch below. Save this system in the directory where you have exported ADAMS files (inf adm and cmd).

5.3.1. Step 1: Import file generated by ADAMS
Before importing the model from ADAMS, create the AMESim system:

Once you have created the main part of the AMESim system, use the Interface menu to import the ADAMS model:

The inf file also contains information that is not directly accessible under MSC.ADAMS: interactive or batch simulation, discrete or continuous interface, step time for discrete mode, solver commands, initial conditions analysis. These are defined by default in MSC.ADAMS settings (easily accessible under UNIX), most of them will be accessible under AMESim but if you are an experienced user you can always edit this file.

2

November 2009

Using the ADAMS Interface

27/39

Figure 14: Importing ADAMS model in AMESim

This opens a dialog box window in which you select the inf file generated during ADAMS export. Then the inf file is analyzed and you get following tabbed window: Figure 15: ADAMS model import window in AMESim

The tabs are used as follows: ? In the Common tab, the number and names of inputs and outputs are automatically set up according to the content of ADAMS file. Check the names of variables and give a title to the icon. ? In the ADAMS tab, several settings are available: o Output prefix name: this is the name of output files of ADAMS, o User executable: optionally, here you can add your user defined library path needed by ADAMS models, it usually contains some subroutines, o Simulation mode: Continuous stands for complete import of an ADAMS system into AMESim and Discrete for co-simulation mode, o Animation mode: here you can specify if you want to launch A/View while you run a simulation; namely the Interactive mode that is much slower than the Batch one. In the latter, you can always view the animation of your model at the end of simulation, November 2009 Using the ADAMS Interface 28/39

o ADAMS output step size: here you set the period at which ADAMS writes its results, o Initialization mode: an ADAMS option to say that you will do an initial condition analysis if needed, this option is disabled, o Static analysis: the same as the previous option, but for an equilibrium analysis before dynamic run, o Initialization commands: this contains ADAMS/Solver commands that are in the inf file and should work only in Batch mode (Interactive mode requires A/View commands) this field is not customizable, if needed, modify the inf file directly.

Upon completion of the sketch, you switch to Submodel mode and then Parameter mode. AMESim compiles the system and you can now focus on parameters available for the interface submodel.

5.3.2. Step 2: Configuration of the interface block
Depending on the mode you selected in previous step, you have two possibilities. For the discrete mode you get following parameters: Figure 16: AMESim parameters for discrete ADAMS block

November 2009

Using the ADAMS Interface

29/39

You have access to the communication interval; indeed, it is useful to test several values for this parameter. We will return to this parameter in a later section concerning problems with co-simulation. If the block is a continuous one, you get the following parameters: Figure 17: AMESim parameters for continuous ADAMS block

In this case, since AMESim imports the complete ADAMS system, it integrates all states 3 variables coming from ADAMS . All these states become AMESim states variables. Unlike with other standard submodels you do not have access to the initial values of these states since ADAMS will compute them.

5.3.3. Step 3: Running a simulation
Change to Simulation mode. Set the parameters of the simulation as usual, bearing in mind that if you are using a discrete block and have a sample time step you should use at most this value for the AMESim communication step. When you run the simulation depending on the platform you are using, you will notice that A/Solver is running: Using Windows: ADAMS opens a Command DOS Prompt and you see messages coming from A/Solver. All the messages are saved in a text file (msg).

In fact, MSC.ADAMS converts its algebraic/differential system into a purely differential one and sends the derivatives of its states to AMESim whenever we ask for it. The conversion methodology introduces supplementary states and as a result, the states have no physical meaning.

3

November 2009

Using the ADAMS Interface

30/39

Figure 18: ADAMS command window

…. Using UNIX: The output messages from A/Solver appear on the AMESim message window. When running a co-simulation in discrete mode in AMESim the simulation gives an error message concerning the standard output in Warning/Error tab. On Sun stations: dofio: [-1] end of file logical unit 6, named ‘stdout’ lately: writing sequential formatted external IO On IBM stations: 1525-013: The sequential or stream WRITE statement cannot be completed because an errno value of 11 (Resource temporarily unavailable) was received while writing the file (standard output). The program will stop This is because ADAMS sends many messages to the standard output while AMESim does some processing on it and it seems that there is no way to avoid all these messages. The workaround is to launch the simulation from a terminal window, e.g. if your model is called model.ame in /home/usr/ametest do the following: cd /home/usr/ametest ./model_ This will execute the model; output messages will appear in the terminal window.

November 2009

Using the ADAMS Interface

31/39

5.4. Analyzing results in both software
Upon completion of the simulation, you can analyze the results in both packages. In AMESim, you can get the variable values exchanged with ADAMS by clicking the ADAMS block. You get the following results: Figure 19: Results from the co-simulation in AMESim

In ADAMS, you have to load the results files into the model. To do so, in the File menu, choose Import and select ADAMS/Solver Analysis (req, gra, res), select one on the three files created during the simulation and do not forget to fill in the model name so as to associate results with the model you are working with. You can then look at the animation or plot any variables as usual within the A/Postprocessor.

6. Co-simulation or full export?
When a full export is feasible it is always better than a co-simulation. Indeed having the entire system integrated by one solver makes the analysis of the system easier. For example using the linear analysis facility in AMESim is more accurate if AMESim knows all states of the system. During a full export to ADAMS, AMESim is used as a function evaluator by ADAMS. All derivatives and outputs are passed to ADAMS whenever it asks for them. The AMESim solver is not used and values in ADAMS may be discontinuous and may make the solver fail. In the opposite case, during export to AMESim, ADAMS is used as a function evaluator. MCS.ADAMS passes derivatives and outputs whenever AMESim needs them. The precision of ADAMS values is essential for the success of AMESim integrator. That is why it is necessary to set a special ADAMS parameter. In the inf file you will have to add a command: NUMBER OF COMMANDS November 2009 Using the ADAMS Interface 32/39

1 CPAPAR/ALA=1e-10, ALR=1e-10 If necessary you can raise these values to 1e-8. This controls the coordinate partitioning algorithm for the ABAM (Adams-Bashforth and Adams-Moulton) integrator. Coordinate partitioning is the action carried out in order to remove the constraints of ADAMS system; from a set of DAEs it gets a set of ODEs that AMESim can integrate. A co-simulation can be easier to set-up, especially if the models are complex. During a co-simulation both solvers exchange information at a fixed interval. When ADAMS receives a signal, this will stay constant during the whole sample interval, until a new value is received. The same thing happens in AMESim. You will have to set this communication interval with care since different values can lead to different results. We want to use as large an interval as possible to get a quick run and as small as possible for accurate values! Sampled environments are a difficult subject and there are books written on the stability of them. How do we efficiently set up a communication interval for discrete mode? Keeping in mind that introducing a communication interval is more or less equivalent to introducing a delay in the system, the following study can be done. We consider a linear actuator modeled within AMESim and coupled with an ADAMS model. In the figure you will notice that some variables are exchanged. The torque is here always zero.

November 2009

Using the ADAMS Interface

33/39

Figure 20: AMESim sketch of a linear actuator coupled with ADAMS

An equivalent system is given above. A simple calculation will give the global inertia which must be the one of the ADAMS structures on which the AMESim force acts. You can also include some friction if there is any in the ADAMS model. In order to test the validity of a chosen communication interval we want to construct a similar system in AMESim only. Figure 21: AMESim sketch with a delay loop.

The sample period of the discrete delay blocks is set to the communication interval we are testing.

November 2009

Using the ADAMS Interface

34/39

In addition you must also construct the same system in the same sketch without the discrete blocks. With this sketch you can then compare results for both systems, with and without discrete blocks depending on the delay=communication interval you have chosen. Figure 22: AMESim sketch without discrete blocks.

Run simulations with different delays (communication interval) and check that results on both systems are equivalent. Choose the highest communication interval that preserves the quality of the results. With this methodology you are able to establish an optimal communication interval.

7. Tips on using the interface
7.1. How to stop a simulation
Using Windows: If you use AMESim to run the simulation and stop it for any reason, ADAMS continues to run in the command window. To stop the ADAMS simulation, click on this command window and type: Ctrl C

November 2009

Using the ADAMS Interface

35/39

7.2. How do you execute ADAMS commands before a co-simulation?
You can edit the inf file and change the following lines: NUMBER OF COMMANDS 0 Add any A/Solver command at this location, all these commands are executed in ADAMS before launching the co-simulation, it can look like: NUMBER OF COMMANDS 2 SIMULATE/STATICS SIMULATE/INITIAL_CONDITIONS

8. Advanced use of the interface
8.1. How to setup interface with template-based ADAMS products
Your ADAMS model may use functionalities of an ADAMS template-based product. These products are: ? ADAMS/Aircraft, ADAMS/Car, ADAMS/Car Ride, ADAMS/Driveline, ADAMS/Engine and ADAMS/Rail.

If your model does use one of these libraries, the import into AMESim requires an additional step: editing the .inf file. You always need A/Controls to set up the export in Adams (cf. Figure 13: Exporting the coupled system from ADAMS, page 20). Once you have selected OK in the Plant export dialog box, this will create the inf file. Then submit the analysis in a normal way, but make sure that you choose files_only. When you set Mode of Simulation to files_only, your template-based product only outputs the analysis files, .adm and .acf, but it does not perform an analysis. In A/Car, you can use this option to prepare files for use with A/Controls. If you have loaded A/Controls (Tools Plugins Controls Load), and your model has a plant input and a plant output, A/Car will prepare a special _controls.acf file. It supports a single plant input and output. If you have more than one plant input and output, A/Car prompts you to select which one you want to see. The next step to run a co-simulation is to edit the inf file, and make the following changes: NUMBER OF COMMANDS 1 FILE/COMMAND= _controls.acf Then ADAMS will execute the commands that are in the _controls.acf file before running the co-simulation with AMESim.

November 2009

Using the ADAMS Interface

36/39

8.1.1. Using more than one interface
If your AMESim model and your ADAMS model are coupled at different locations, unify all exchange variables and use only one Plant Input and one Plant Output in ADAMS and one interface block in AMESim.

8.2. Advanced configuration of the interface

This section is useful only for advanced users; it shows you how to customize the interface.

8.2.1. Configuration file
This section applies only when exporting AMESim systems to ADAMS. It should be possible to do the tutorial example without any further changes to the configuration of the interface. The configuration files for the AMESim export to ADAMS supplied with a standard AMESim installation assumes that all functions are written in C and that no extra libraries with user-written functions are needed. If you write your submodels in Fortran or you use non-standard libraries in your model, some changes to the standard distribution files are needed. Refer to the standard AMESim manual for these changes. Similarly, it is possible to customize the AMESim-ADAMS interface. The files involved are adams.conf and amesim_adams_gsec.make. They are stored in the $AME/lib directory. For global customization, they should be edited there. If you do this, the new configuration becomes the default for all users of the interface. Your system administrator should normally do this. It is also possible to alter the configuration locally so that changes apply only to you work in a particular directory. To do this, copy the files (adams.conf and amesim_adams_gsec.make) to your project directory and make the necessary. AMESim looks in the current directory before looking in the standard area ($AME/lib), any changes made to the local files will therefore override the global configuration. The file adams.conf contains instructions specifying which files are to be used when creating the AMESim part of the simulation model. This means that if you decide to make any local configurations this file must be edited, otherwise the global configuration will be used. Below the standard adams.conf is shown. ######################################################### # This file specifies the AMESim export facility to # # ADAMS. The entries are as follows: # # # # 1. the template to use for an explicit system. # # 2. the template to use for an implicit system. # # 3. the makefile to use. # # 4. the button title. # # 5. the script file to launch the companion software. # ######################################################### $AME/lib/adams_cont.etemp NULL $AME/lib/amesim_adams_gsec.make November 2009 Using the ADAMS Interface 37/39

Adams NULL hp:so,ibm:so,lnx:so,sgi:so,sun:so,win32:dll The lines beginning with # are comments. The line that all local configurations need to change is the 3rd non-commented line (currently $AME/lib/amesim_adams_gsec.make). This is the name of a file with instructions on how to create the AMESim simulation model. If you want AMESim to use a local configuration the line should point to this. For example you would change this line to: ./adams.make. In the standard distribution the file $AME/lib/amesim_adams_gsec.make contains the following lines: Using Windows: $(CC) -c -I$(AME)/lib -DAMEADAMS $(CC) -LD dformd.lib asutility_imp.lib Using Unix: $(CC) -c -I$(AME)/lib -DAMEADAMS $(AME)/lib/makeadamsso.sh -L$(AME_ADAMS_HOME)/ADAMS_NOT_DEFINED_FOR_THIS_COMPUTER_TYPE – lAsUtility sun:-L$(AME_ADAMS_HOME)/ultra –lAsUtility sgi:-L$(AME_ADAMS_HOME)/irix32 –lAsUtility ibm:-L$(AME_ADAMS_HOME)/ibmrs –lAsUtility The first line is the command for doing some pre-processing of the AMESim-generated C file and to compile it. If your compiler needs any special flags this is where to add them. For further customization it is possible, under Unix to modify the makeadamsso.sh file or under Windows to add a specific library. This is for advanced users only. Using Windows: The 2nd line specifies the command used for linking the AMESim simulation executable; this is normally the C compiler. Using Unix: The 2nd line specifies the path to the script (makeadams.sh) that will effectively command the compilation depending on the platform used. Using Windows: The 3rd line specifies the required libraries to compile the system. In our case we need the Fortran library dformd.lib and an ADAMS library asutility_imp.lib. Here, you can add specific libraries if needed, but these ones must be accessible to the system. To do so, you will have to append your library path to an environment variable called %lib%. This can be done in a command file (bat), either when you start AMESim or in a local copy of the file %AME%/AMEcompile42.bat. The line should be: set lib=%lib%;path_to_your_library Using Unix: The 3rd line should never be used. It is only used if the platform is not recognized. The following lines (4th, 5th and 6th lines) are platform-dependant. If your model includes Fortran code, amesim_adams_gsec.make probably needs to be altered by modifying the 4th line (if working with Sun) specifying the additional libraries needed. An example on such a line is:

November 2009

Using the ADAMS Interface

38/39

sun:-L$(AME_ADAMS_HOME)/ultra –lAsUtility L/opt/SUNWspro/SC3.0.1/lib -lF77 –lsunmath This is highly system-dependent and you probably need to ask your system administrator for the libraries used on your computer. If many users are using Fortran it is probably a good idea to let your system administrator change the amesim_adams_gsec.make in the standard area ($AME/lib/amesim_adams_gsec.make). Another possibility is to use the Fortran compiler for the link step, that is change the 2nd line to $(F77). Another reason to modify the 3rd and subsequent lines is if your submodels use userwritten utilities or other non-standard files or libraries; this would typically be a change that you would make locally. For instance, if you would like to include a library called libmyfuncs.a which is stored in /home/usr/library, modify the 4th line: sun:-L$(AME_ADAMS_HOME)/ultra –lAsUtility -L/home/usr/library lmyfuncs -L/opt/SUNWspro/SC3.0.1/lib -lF77 –lsunmath Note that for a particular simulation, the state of adams.conf when the system is created and the corresponding amesim_adams_gsec.make are remembered. It will be necessary to recreate the interface blocks if you wish to change to a different amesim_adams_gsec.make. Note that to use the AMESim export facility without a Fortran compiler you should modify amesim_adams_gsec.make as follows. Using Windows: $(CC) -c -I$(AME)/lib -DAMEADAMS $(CC) -LD ws2_32.lib kernel32.lib asutility_imp.lib

November 2009

Using the ADAMS Interface

39/39

Support and contact information
Support General information on our products is available on our Solutions http://www.lmsintl.com/imagine-amesim-1-d-multi-domain-system-simulation. webpage:

Please refer to our Support webpage: http://www.lmsintl.com/support for information on current and upcoming releases, FAQs and a bug reporting form. You can also contact the Support desk of your local LMS Imagine Office directly. The corresponding e-mail address and phone number are indicated on our Support contact webpage: http://www.lmsintl.com/support/contact. For problems with a specific model, please send us a test case and a test procedure if possible. If result data is not needed, please purge the system concerned (using the AMESim Purge tool) and compress it before sending it. Please note that the scope of our Software Maintenance Service is limited as defined in your Software License Agreement. Contact information For more information on your local LMS Imagine Office (mail address for example), please refer to our Contact webpage: http://www.lmsintl.com/lmsworldwide.

IMAGINE Web Site http://www.lmsintl.com/imagine

Subsidiaries
CHINA LMS Imagine China Tel: + 86 21 58 88 61 82/83 E-mail: info.imagine.cn@lmsintl.com FRANCE - BENELUX LMS Imagine Paris Tel: +33 1 39 43 08 12 E-mail: info.imagine@lmsintl.com FRANCE – SPAIN - Portugal LMS Imagine Toulouse Tel: +33 5 34 50 14 90 E-mail: info.imagine@lmsintl.com GERMANY – CENTRAL AND NORTHERN EUROPE LMS Imagine Germany Tel: +49 89 54 84 95 0 E-mail: info.imagine.de@lmsintl.com ITALY LMS Imagine Italy Tel: +39 03 21 44 50 11 E-mail: info.imagine.it@lmsintl.com JAPAN LMS Imagine Japan Tel: +81 45 47 84 82 0 E-mail: info.imagine.japan@lmsintl.com NORTH AMERICA LMS Imagine North America Tel: +1 24 89 52 56 64 E-mail: info.imagine.us@lmsintl.com SWEDEN LMS Imagine Sweden Tel: +46 31 79 90 11 8 E-mail: info.imagine.uk@lmsintl.com UK LMS Imagine U.K. Tel: +44 24 76 40 81 20 E-mail: info.imagine.uk@lmsintl.com

Distributors
AUSTRALIA Concentric Asia Pacific Pty. Ltd. Tel: +61 29 54 29 55 5 E-mail: mark.brindley@concentric.com.au CHINA Global Crown Engineering Ltd. Tel: (86) 10 65 53 90 72 (3)(5)(6) E-mail: support.china-bj@globalcrown.com.cn INDIA MAXSOFT Tel: +91 80 25 43 06 76 E-mail: sales@maxsoft-india.com ROMANIA S.C. Property Development SRL Tel: +40 24 15 15 15 2 E-mail: corneliu.dica@rokura.ro SOUTH KOREA SHINHO Systems Co., Ltd. Tel: +82 31 60 80 43 4 E-mail: support@shinho-systems.co.kr TURKEY DTA Ltd Sti Tel: +90 22 42 25 37 41 E-mail: akif.goksu@dta.com.tr


相关文章:
AMESim与ADAMS联合仿真步骤及相关注意事项
AMESim 与 ADAMS 联合仿真 1、安装软件 最好的安装顺序:VS , Adams,Amesim 安装路径不要有中文和空格及特殊字符 2、环境变量设置 AME_ADAMS_HOME,指向Adams安装...
Adams与AMESim联合仿真实例
ADAMS AMESim 联合仿真AMESim 作为主软件进行联合仿真。在 ADAMS 中建立曲柄滑块 机构,将建立的模型导入 AMESim 中,用 AMESim 中的液压系统驱动曲 柄转动,...
ADAMS与AMESim联合仿真
ADAMS与AMESim联合仿真_工学_高等教育_教育专区。ADAMS与AMESim联合仿真首页>> 科技资讯 >> 实用宝典 AMESim 与 ADAMS 联合仿真操作说明 摘要:物理系统可能由各种元...
AMESim和ADAMS联合仿真设置
AMESim和ADAMS联合仿真设置_机械/仪表_工程科技_专业资料。Amesim AMESim 和ADAMS依托 AMESim7.0 与 adams2007 或 2005 联合仿真过程,除要用到这两中软件外还要...
ANSYS与ADAMS联合仿真的关键
ANSYS与ADAMS联合仿真的关键_机械/仪表_工程科技_专业资料。通过有限元方法得到 ...外部节点使用,如果在联接处柔性体为空洞,则需在此处 创建一节点,并使用刚性区域...
一个简单的Adams—MATLAB联合仿真实例
一个简单的 Adams——MATLAB 联合放置实例新浪微博@robpark_罗/luozhuhui@126.com 目的:建立一个简单的 Adams—MATLAB 联合仿真程序,对联合仿真有一个直观的了解,...
我的Adams和matlab联合仿真接口设置
Adams/matlab 联合仿真软件接口设置 1、安装 adams 2010 2、安装 matlab r2009a 3、因 matlab 默认工作目录为其安装路径的 work 目录,因此将 adams 默认目录修改...
ADAMS与ANSYS联合仿真方法
ADAMS与ANSYS联合仿真方法_机械/仪表_工程科技_专业资料。adams ansys 软件联合仿真 曲柄连杆机构的模态分析 1.在 solidworks 里创建连杆的几何模型,保存为 ...
adams和matlab的联合仿真心得
adams和matlab的联合仿真心得_计算机软件及应用_IT/计算机_专业资料 暂无评价|0人阅读|0次下载|举报文档 adams和matlab的联合仿真心得_计算机软件及应用_IT/计算机_...
ADAMS与ISIGHT联合仿真流程介绍
ADAMS ISIGHT 联合仿真流程介绍 一、软件介绍 MSC.ADAMS 软件由于其领先的“功能化数字样机”技术, 迅速发展成为 CAE 领域中使用范 围最广、应用行业最多的...
更多相关标签:
amesim adams联合仿真 | amesim联合仿真 | adams matlab联合仿真 | adams和ansys联合仿真 | adams与ansys联合仿真 | ansys adams联合仿真 | adams联合仿真 | abaqus adams联合仿真 |