当前位置:文档之家› amesim simulink联合仿真

amesim simulink联合仿真

amesim simulink联合仿真
amesim simulink联合仿真

MATLAB/Simulink interface?

Version 4.0 - March 2002

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Copyright ? IMAGINE S.A. 1995-2002

AMESim? is the registered trademark of IMAGINE S.A.

AMESet? is the registered trademark of IMAGINE S.A.

ADAMS? is a registered United States trademark of Mechanical Dynamics, Incorporated.

ADAMS/Solver? and ADAMS/View? are trademarks of Mechanical Dynamics, Incorpo-

rated.

MATLAB and SIMULINK are registered trademarks of the Math Works, Inc.

Netscape and Netscape Navigator are registered trademarks of Netscape Communications

Corporation in the United States and other countries. Netscape’s logos and Netscape product

and service names are also trademarks of Netscape Communications Corporation, which may

be registered in other countries.

PostScript is a trademark of Adobe Systems Inc.

UNIX is a registered trademark in the United States and other countries exclusively licensed

by X / Open Company Ltd.

Windows, Windows NT, Windows 2000 and Windows XP are registered trademarks of the

Microsoft Corporation.

X windows is a trademark of the Massachusetts Institute of Technology.

All other product names are trademarks or registered trademarks of their respective compa-

nies.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

AMESim 4.0

User Manual

i

Table of contents

Using the AMESim MATLAB/Simulink Interface. . . . . . . . . . . . . . . . . . . . . . .11.

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12.

Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22.1.

C compiler requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22.2.

Supported versions of Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22.3.

Setting up the environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33.

Constructing the model in AMESim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64.

Importing the model into Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115.

Co-simulation interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165.1.

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175.2.

Usage of the co-simulation interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186.Concluding remarks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Table of contents

ii

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

1

Using the AMESim MATLAB/Simulink Interface

1.Introduction

The AMESim M ATLAB /Simulink interface enables you to construct a model of a sub-system in AMESim and to convert it to a Simulink S-Function. The S-Function can then be imported into Simulink and used within a Simulink system just like any other S-Func-tion.

The interface is designed so that you can continue to use many of the AMESim facilities while the model is running in Simulink . In particular you can change the parameters of the AMESim model within AMESim in the normal way, examine the results within

AMESim by creating plots just as if they were produced in a regular AMESim run.Normally you will have AMESim and Simulink running simultaneously so that you can use the full facilities of both packages. The process is illustrated below:

When the process is done, the AMESim model parameters may be changed within

AMESim , as well as the Simulink parameters within Simulink. A series of runs can be performed. Typically, a controller can be designed for the system.

Organization of this manual

This manual describes both the standard interface and the co-simulation interface. The main part of the manual deals with the standard interface and section 5 looks at the differ-ences between the standard and the co-simulation interface.Modify the AMESim submodel parameters

Construct the AMESim model as a S-Function

Complete the Simulink system

Run the simulation

Examine the AMESim

submodel results in AMESim Examine the Simulink control system results in Simulink

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

2The structure of this manual is the following:

?

Section 2 describes how you must set your working environment so that you can use the interface.?

Section 3 describes with a simple example how the AMESim submodel is cre-ated and converted to an S-Function.?

Section 4 describes how the AMESim model is imported into and run within Simulink .?

Section 5 describes the differences between the co-simulation interface and the standard interface.?

Section 6 gives a summary of the most important things to remember.?Sometimes a section of text is only applicable to a UNIX or Linux environment.

For such text the following presentation is used:

?Sometimes a section of text is only applicable to a Windows environment. For

such text the following presentation is used:

Note that a collection of utilities also exists for M ATLAB so as to import/export data to and from AMESim . These are documented in chapter 7 of the main AMESim manual. It is assumed that the reader of this manual is already familiar with AMESim , M ATLAB and Simulink .

2.

Preliminaries 2.1. C compiler requirements

If you work on a UNIX or Linux platform, you will need an ANSI C Compiler that is sup-ported by MATLAB/Simulink for creating S-functions.

If you work on a PC with Windows NT, Windows 2000 or Windows XP, you must use Microsoft Visual C++ whether you use the Simulink interface or not.

2.2.Supported versions of Simulink

This manual is written for Simulink 4.1.1 (distributed with M ATLAB 6.1), but the AMESim/Simulink interface was originally developed using Simulink 1.3c (M ATLAB

4.2c) and has thus been tested using this version. It has also been tested with M ATLAB

5.3. Note that the performance of the interface is higher with the newer version of Simulink . If you are using a different version of Simulink , some of the pictures of this manual will be different from the ones on your https://www.doczj.com/doc/3817140278.html,ing Unix:

Description for Unix/Linux https://www.doczj.com/doc/3817140278.html,ing Windows:

Description for Windows environments.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

3

2.3.Setting up the environment

In order to use the AMESim M ATLAB /Simulink interface it is necessary to set an envi-ronment variable that points out the M ATLAB installation directory. If this is not set, AMESim will not be able to find the files necessary to create S-functions.

To find out if this environment variable is set, type the following line in a terminal win-dow:Using Unix:

echo $MATLAB_ROOT

This should result in something like:

/opt/matlabr12.1

being printed on screen. If nothing is printed, or the message "MATLAB_ROOT: Undefined variable " is displayed, you must set this variable. To do this you need to know where M ATLAB is installed. If your working environment is set up properly to run M ATLAB , type either

which matlab

(if you are using Cshell) or whence matlab

(if you are using Korn shell (ksh) or Bourne shell (sh)) or type matlab (for some versions of Bourne shells).

This will tell you the location of your version of M ATLAB e.g.

/opt/matlabr12.1/bin/matlab

Remove the last two parts from this pathname to get the value to set for

MATLAB_ROOT, in this case /opt/matlabr12.1. If you are using the Unix C shell, you can then set the environment variable as follows:

setenv MATLAB_ROOT /opt/matlabr12.1

This statement can also be added to your .cshrc file so that the environment variable is set every time you login.

For Bourne or Korn shells the corresponding would be:

MATLAB_ROOT=/opt/matlabr12.1 ; export MATLAB_ROOT

Add these statements to your .profile file so that the environment variable is set ev-ery time you login.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

42. 4. Configuration files

The configuration files for the AMESim/Simulink interface 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. These changes can as all AMESim configurations be performed in two ways: glo-bally for all users, or locally for the current directory (for a particular project).

The files that can be customized are simulink.conf and simulink.make. They normally exist in the $AME/lib or (%AME%/lib) directory. For global customization, they should be ed-ited there. Your system administrator should normally handle this. For local configuration, copy these files to your project directory and make the necessary changes to these files. AMESim looks in the current directory before looking in the standard area ($AME/lib or %AME%/lib), any changes made to the local files will therefore override the global con-figuration. The file simulink.conf contains instructions on which files are to be used to cre-ate the S-function for Simulink. This means that if you decide to make any local configurations this file must be edited, otherwise the global configuration will be used. The Using Windows:

echo %MATLAB%

This should result in something like:

C:\MATLAB6p1

being printed on screen. If the environment variable is not set, %MATLAB% is printed and you need to set the MATLAB environment variable to point to the MATLAB installation directory. This can be done from the Windows Control Panel.

Another important point is that you path must contain the directory:

%windir%\System32

where %windir% is the Windows installation directory (a typical value for %wind-

ir% is C:\WINNT). You can check the content of your path by typing the command below and you can change it from the Windows Control Panel:

echo %Path%

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

5

standard simulink.conf is shown below.

The lines beginning with # are comments. The line that all local configurations needs to change is the 3rd non-comment line (currently reading "$AME/lib/simulink.make"). This is the name of a file with instructions on how to create the Simulink S-function. If you want AMESim to use your local configuration, change this line to "./simulink.make" for instance .

In the standard distribution, this file ($AME/lib/simulink.make ) contains two lines, as in:

The first line is the command for compiling the AMESim generated C file. This system is dependent and may therefore be different on your installation.

The second line specifies the command used for creating the Simulink mex S-function. This is a small shell script (amemex ) that runs the M ATLAB utility mex . All arguments are passed on to mex . By modifying amemex more advanced customizations can be made than are possible using lines 1 and 3 in simulink.make .#########################################################

# #

# This file specifies the AMESim export facility to #

# Simulink. 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/imulink.etemp

NULL

$AME/lib/simulink.make

Simulink\nInterface

$AME/lib/https://www.doczj.com/doc/3817140278.html,unch

Using Unix:

${AME}/lib/amemex -c -g -I${AME}/lib

${AME}/lib/amemex

Using Windows:

$(CC) -c -g -DWIN32 -I${MATLAB}/extern/include -I${MATLAB}/

simulink/include

${AME}/lib/amemex

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

6This is for advanced users only.

Each AMESim model ‘remembers’ which simulink.config was specified when it was cre-ated. This means that for any new simulation, the corresponding simulink.make will be used. Hence, it is necessary to rebuild the special icon created for the AMESim/Simulink interface, if you wish your model to use a different simulink.make.

Using Unix:

If your model includes Fortran code simulink.make probably needs to be altered by adding a 3rd line specifying the additional libraries needed. An example on such a

line is:

-L/opt/SUNWspro/SC3.0.1/lib -lF77 -lsunmath

This is highly system dependent and you probably need to ask your system admin-istrator 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 simulink.make in

the standard area ($AME/lib/simulink.make).

Another reason to add a 3rd line is if your submodels use user written utilities or oth-

er non-standard files or libraries; this would typically be a change that you would

do locally. For instance, if you would like to include a library called libmyfuncs.a which is stored in /home/my_name/library add the following line:

-L/home/my_name/library –lmyfuncs

If there already is a 3rd line in simulink.make, for instance for using Fortran, add

your files at the beginning of the line as in:

-L/home/my_name/library -lmyfuncs -L/opt/SUNWspro/SC3.0.1/

lib -lF77 -lsunmath

Using Windows:

A reason to add a 3rd line is if your submodels use user written utilities or other non-standard files or libraries; this would typically be a change that you would do local-ly. For instance, if you would like to include a library called myfuncs.lib which is stored in C:\home\my_name\library add the following line:

-link -libpath:C:\home\my_name\library myfuncs.lib

or

C:\home\my_name\library\myfuncs.lib

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

7

3.Constructing the model in AMESim

Figure 1

The process of constructing the AMESim model is described with the help of a simple ex-ample. You will understand the process better if you create and run the system yourself. The exercise can be completed within about an hour.

Create the system shown in Figure 1 calling it skyhook . It consists of two masses connected with a spring which represent a quarter car suspension.

Note. :

?

two transducers determine the positions of the wheel and the car body;?

connected to the wheel is a spring to which the road profile is applied;?

the system is incomplete with three ports unconnected.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

8

Figure 2

The force representing the damping in the suspension will be provided by Simulink and the output from the velocity transducers will be sent to Simulink. To complete the system it is necessary to add a special interface icon. Figure 2 shows this block added to the sys-tem.

Figure 3

To create the interface blocks, click on the Interface pulldown menu shown in Figure 3. This menu is designed to be used with the Simulink interface and other interfaces but in our case it will be Simulink. Select the item labeled Create export icon. This is used to define the variables which are provided and received by the companion software. From AMESim these variables are seen as inputs and outputs respectively. The dialog box

shown in Figure 4 is produced.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

9

Figure 4

Notice that in this figure there is a field with the label SimulCosim in it. This must be changed by clicking on the arrow in the right of the field and by selecting Simulink as in Figure 5. There is currently no input and output variable. By selecting the arrow buttons in the top corners, the number of input or output variables can be adjusted. You can have any number including 0 but a reasonable upper limit is 10. If you want more than this, it is bet-ter to use more than one interface block. In our example, we require two input variables and three output variables, so ensure that the fields have the values 2 and 3 respectively.The next stage is to get AMESim to create a specific icon for the interface. The number of ports is now specified but it is also necessary to add a label to each port. Hence, we will add text to give a name to the variables. In addition, we will give a general name for the whole interface block. Figure 5 shows text added in this way. Select each field and type an

appropriate text string.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

10

Figure 5

Note the three buttons labeled Clear all text, OK and Cancel.

?Click on Cancel to abandon the process.

?Click on Clear all text to remove any text you have entered.

?Click on OK to obtain the icon produced by AMESim.

An icon similar to that shown in Figure 6 will appear. Note the port position is denoted by >.

Figure 6

The pointer will take on the appearance of the icon and can be treated like a normal AMESim component icon. Thus it can be mirrored, rotated, deleted or added to system sketch. All AMESim interface blocks have signal type ports.

Connect the block inputs and output to the other components of the model as shown in Fig-ure 2.

It is worth mentioning 2 important points:

?You can have more than one interface block but if you do, they must all be of the same type (all Simulink standard interface blocks in the current example);

?the AMESim model must be explicit i.e. there cannot be any implicit variables, unless the co-simulation interface is used.

Change now to Submodel mode. The interface block will automatically be associated with a special submodel and you are not allowed to change these. For the other submodels select Premier submodel

so as to get the simplest submodels.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

11

Figure 7

Next, change to Parameter mode. Normally AMESim would create an executable pro-gram that you would start in Run mode. However, because the system contains Simulink interface blocks, an S-Function is created. The normal System Compilation window should appear (as in Figure 7) and the Parameter mode should be entered. If any error occurs, it is likely that the MATLAB environment variable is not properly set. In this case save the system, exit from AMESim and carry out the instruction for setting this variable as de-scribed in section 2.

Enter new parameters for the components to values shown in the table below, leave all oth-

er parameters at their default values:Submodel Name on

sketch if

any

Title Value MAS002Body mass mass [kg]

400SPR00current spring length [m]

0.2spring rate [N/m]

15000free length of spring [m]

0.2MAS002Wheel mass mass [kg]

40SPR00Tire stiffness current spring length [m]

0.05spring rate [N/m]

200000free length of spring [m]

0.05UD00duration of step 1 [s]

0.1output at start of stage 2 [null]

0.1output at end of stage 2 [null]

0.1duration of step 2 [s]3

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

12When you change from Parameter mode to Run mode, special data files containing the parameters are written. When you run the S-Function within Simulink, these files will be read. Hence, when you change any parameters, ensure you enter the Run mode. If not, your changes will not be seen by Simulink.

At this point, you are ready to run the AMESim model within Simulink . Start Simulink in the normal way from a suitable shell window (Unix) or by double-clicking on its asso-ciated icon (Windows).

4.Importing the model into Simulink

The AMESim model at this stage exists as an S-Function. It must be imported into Sim-ulink . Remember that when you quit AMESim , the files defining your system are com-pressed into a single file. This means that Simulink would not have access to the S-Function. For this reason, it is normal to have AMESim and Simulink running simulta-neously when using the interface. This way, you can change the parameters in the AMESim model and restart the simulation very rapidly. You can also examine the results in AMESim .

Another mode of working is to quit AMESim but then to type in a terminal (Unix) or DOS (Windows) window:

AMEload skyhook

to expand the single file into its constituent parts. Simulink will then have access to all the files it needs.

For the rest of this exercise it will be assumed you employ the first mode of working.

Figure 8

From within Simulink select the S-Function block (Figure 8) and add it to the display area, then set the parameters as shown in Figure 9. The name of the S-Function is skyhook _ i.e. the name of the system with an ‘_’ added. This name must be entered in the first box. In the input box below this, two parameters must be entered. These are used to specify the characteristics of the AMESim

result files.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

13

Figure 9

With a normal AMESim run, a print interval is specified whereby the size of the results file can be controlled. Simulink runs in a somewhat different way and consequently the AMESim result files can become unacceptably large. To prevent this from occurring a special AMESim print interval is specified in the S-Function. The data added to the AMESim results file will be spaced with a time interval not less than this value .?

The first parameter indicates whether an AMESim results file is to be created. A value of 1 indicates it is to be created and any other number indicates it is not to be created.?The second parameter indicates the special print interval. If a zero or negative value is

entered, Simulink will add to the AMESim results file whenever it adds to its own re-sults.

Add the values shown in Figure 9 so that there will be an AMESim results file but with a print interval restriction of 0.01 s.

Complete the system as shown in Figure 10. Note that there are gain blocks, as well as summing junctions. The outputs from the S-Function are passed through the Demux block to form two kind of signals:

?

The outputs from the AMESim model, labeled Bspeed and Wspeed . ?The signal which is passed to the Hit Crossing block.

If there are N outputs from the AMESim model, there will be N+1 outputs from the S-Function. The last output will always be connected to the Hit Crossing

block.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

14

Figure 10

Why is the extra output required? To understand why it is needed it is necessary to remem-ber that the AMESim model probably contains discontinuities. AMESim has its method to deal with discontinuities and Simulink has, a different method that uses the Hit Cross-ing block. Since the model is run within Simulink, it must employ the Simulink method. The last output from the S-Function is a variable, which is normally positive but becomes negative near a discontinuity. When this happens the Hit Crossing block slows down the simulation greatly reducing the integration step. When the value goes positive again, the simulation can speed up.

It is possible to omit the Hit Crossing block but simulation runs are likely to be less reliable

and may take longer.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

MATLAB/Simulink interface 4.0

User Manual

15

Important note:

If your AMESim model has more than one input coming from Simulink , the input sig-nals to AMESim have their order reversed when compared to what is sent from Sim-ulink . This is due to the fact that AMESim numbers the ports in counter-clockwise order while the Mux block in Simulink numbers them starting at the top. The output side of the interface block is not affected by this, since in that case the variables are numbered from the top in both softwares. This can be seen by comparing the model in AMESim and Simulink as shown in the figures below:

Next, set the simulation parameters to the values shown in Figure 11. Remember that AMESim systems can be numerically stiff, this is particularly true for hydraulic and HCD systems. This means that some of the time constants are very small and there can be very fast dynamics. For this reason, the only integration methods likely to succeed are the ones that are specially designed for this.

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

Chapter 1

Using the AMESim MATLAB/Simulink Interface

16

Figure 11

In Simulink it seems that both solvers for stiff systems are possible to use for AMESim models. In this particular case, use the ode15s (stiff/NDF) method (in older versions, Gear and Adams/Gear were the ones most suitable). Set the stop time to 5 seconds, this will be quite enough to produce some interesting results.

Initiate the Simulink run and watch the output from the Scope block. This will give the input force supplied to the car suspension as shown in Figure 12.

Figure 12

https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html,

The document is for study only,if tort to your rights,please inform us,we will delete

CarSim与Simulink联合仿真

CarSim与Simulink联合仿真 1 软件介绍 在MATLAB中,Simulink是用来建模、仿真和分析动态多维系统的交互工具。可以使用Simulink提供的标准模型库或者自行创建模型库,描述、模拟、评价和精化系统行为,同时,Simulink和MATLAB之间的联系十分便捷,可以使用一个灵活的操作系和应用广泛的分析和设计工具。最后,除了可以使用Simulink建模和仿真之外,还可以通过其他软件联合来完成更多的分析任务,如CarSim、ADAMS、AMEsim等许多软件。 CarSim是专门针对车辆动力学的仿真软件,CarSim模型在计算机上运行的速度比实时快3-6倍,可以仿真车辆对驾驶员,路面及空气动力学输入的响应,主要用来预测和仿真汽车整车的操纵稳定性、制动性、平顺性、动力性和经济性,同时被广泛地应用于现代汽车控制系统的开发。CarSim可以方便灵活的定义试验环境和试验过程,详细的定义整车各系统的特性参数和特性文件。CarSim软件的主要功能如下: ●适用于以下车型的建模仿真:轿车、轻型货车、轻型多用途运输车及SUV; ●可分析车辆的动力性、燃油经济性、操纵稳定性、制动性及平顺性; ●可以通过软件如MA TLAB,Excel等进行绘图和分析; ●可以图形曲线及三维动画形式观察仿真的结果; ●包括图形化数据管理界面,车辆模型求解器,绘图工具,三维动画回放工具,功率 谱分析模块; ●程序稳定可靠; ●软件可以实时的速度运行,支持硬件在环,CarSim软件可以扩展为CarSim RT, CarSim RT 是实时车辆模型,提供与一些硬件实时系统的接口,可联合进行HIL 仿真; ●先进的事件处理技术,实现复杂工况的仿真; ●友好的图形用户界面,可快速方便实现建模仿真; ●提供多种车型的建模数据库; ●可实现用户自定义变量的仿真结果输出; ●可实现与simulink的相互调用; ●多种仿真工况的批运行功能; 2 CarSim与Simulink联合仿真 2.1 Simulink接口 1) 变量由Simulink导入CarSim(导入变量) 可由Simulink导入到CarSim中的变量可达160多个,主要分为以下几部分: ?控制输入

AMEsim联合仿真配置

本教程主要解决AMEsim R13联合仿真过程中SimuCosim生成失败问题。 VS2010(C:\Program Files (x86)\Microsoft Visual Studio 10.0) AMEsimR13(C:\AMESim) 注:先安装VS。

编辑还是新建记不清了,有就编辑,没有就新建。 用户变量(注,根据自己软件的安装路径对应修改) PACH C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files

(x86)\Microsoft Visual Studio 10.0\VC\bin; MSSDK C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK;C:\Program Files (x86)\Microsoft Visual Studio 10.0\DIA SDK; 系统变量 PACH %AME%;%AME%\win32;%AME%\win64;%AME%\sys\mingw32\bin;%AME%\sys\mpich\mpd\bin ;%AME%\sys\cgns;%AME%\sys\python\win32;%SystemRoot%\system32;%SystemRoot%;%Syste mRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; AMEsim设置

参数模式

SIMULINK仿真方法简介

SIMULINK仿真方法简介 SIMULINK是一个进行动态系统的建模、仿真和综合分析的集成软件包。它可以处理的系统包括:线性、非线性系统;离散、连续及混合系统;单任务、多任务离散事件系统。 在SIMULINK提供的图形用户界面GUI上,只要进行鼠标的简单拖拉操作就可以构造出复杂的仿真模型。它的外表以方框图形式呈现,且采用分层结构。从建模角度,SIMULINK 既适用于自上而下的设计流程,又适用于自下而上的逆程设计。从分析研究角度,这种SIMULINK模型不仅让用户知道具体环节的动态细节,而且能够让用户清晰的了解各器件、各子系统、各系统间的信息交换,掌握各部分的交互影响。 1. 应用SIMULINK的基本操作 1)在MATLAB的命令窗运行指令simulink或点击命令窗口中的图标,便可以打开如图B1-2所示的SIMULINK模块库浏览器(Simulink Library Browser)。 图B1-2 SIMULINK库浏览器 2)点击Source字库前的“+”号(或双击字库名),便可以得到各种信源模块,如图B1-3。 图B1-3 信源子库的模块 3)点击“新建”图标,打开一个名为untitled的空白模型窗口,如图B1-4。

图B1-4 SIMULINK的新建模型窗口 4)用鼠标指向所需的信号源(如阶跃信号Step),按下鼠标左键,把它拖至untitled窗,就生成一个阶跃信号的复制品。,如图B1-5。 图B1-5模型创建中的模型窗口 5)采用上述方法,将信宿库Sink中的示波器scope拷贝到模型窗口,把鼠标指向信源右侧的输出端,当光标变成十字符时,按住鼠标任意键,移向示波器的输入端,就完成了两个模块间的信号连接,如图B1-6。 图B1-6 创建模型完毕中的模型窗口 6)进行仿真,双击示波器,打开示波器显示屏,如图1-7。点击模型窗口中的“仿真启动” 图标或点击simulink菜单下的start,仿真就开始了,就可以观测到阶跃信号的波形了,如图B1-7。

amesim、MatlaB联合仿真(最全面)接口设置

1、我们先要确定所使用的电脑上已经安装版本匹配的软件,必要的软件是visual stdio也就是vc++,我使用的vs版本是2010;MatlaB,我使用的是2011b; amesim,我使用的是amesim 12.0版本。PS:这几个版本的匹配情况请参阅LMS那边提供的帮助文档。 2、在默认版本安装成功的情况下,我们来设置一下环境变量: (1)我们要是设置用户变量:1)变量名:MatlaB,值为:D:\Program Files\MATLAB\R2011b,如图所示 2)设置第二个用户变量,变量名:Path,值为:D:\Program Files\MATLAB\R2011b\bin\win64,如图所示 那么,我们默认以上两个用户变量已经设置完毕。 (2)我们设置系统变量,我们找到系统变量的Path变量,点击编辑

这里我建议把系统变量的Path复制出来检查一下几个变量是否已经添加 C:\Program Files\Microsoft HPC Pack 2008 R2\Bin\; %AME%; %AME%\win32; %AME%\win64; %AME%\sys\mingw32\bin; %AME%\sys\mpich\mpd\bin; %AME%\sys\cgns; %AME%\sys\python\win32; C:\Program Files (x86)\Intel\iCLS Client\; C:\Program Files\Intel\iCLS Client\; %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem; %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; C:\Program Files\Intel\Intel(R) Management Engine Components\DAL; C:\Program Files\Intel\Intel(R) Management Engine Components\IPT; C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL; C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT; d:\Program Files\MATLAB\R2011b\runtime\win64; d:\Program Files\MATLAB\R2011b\bin; D:\abaqus6134\Commands;D:\Program Files\MATLAB\R2011b\bin\win64; D:\Program Files (x86)\Microsoft Visual Studio 10.0这个可能需要动手自己添加

Matlab中的Simulink和SimMechanics做仿真

这里我们利用Matlab中的Simulink和SimMechanics做仿真,那么先来看看相关的资料。 SimMechanics ——机械系统建模和仿真 SimMechanics 扩展Simscape? 在三维机械系统建模的能力。用户可以不进行方程编程,而是借助该多刚体仿真工具搭建模型,这个模型可以由刚体、铰链、约束以及外力组成。自动化3-D动画生成工具可做到仿真的可视化。用户也可通过从CAD系统中直接导入模型的质量、惯量、约束以及三维几何结构。Real-Time Workshop可以对SimMchanics模型进行自动化C代码生成,并在硬件在回路仿真过程中可以使用生成的代码而不是硬件原型测试嵌入式控制器。 SimMechanics可以用于开发悬架、机器手臂、外科医疗设备、起落架和大量的其它机械系统。用户也可以在SimMechanics环境下集成其它的MathWorks物理建模工具,这样做可以实现更加复杂跨领域的物理建模。 特点: ?提供了三维刚体机械系统的建模环境 ?包含了一系列分析机械运动和设计机械元件尺寸的仿真技术 ?三维刚体可视化仿真 ?SimMechanics Link utility,提供Pro/ENGINEER 和SolidWorks CAD平台的接口并且也提供了API函数和其它CAD平台的接口

?能够把模型转化为C代码(使用Real-Time Workshop) ?由于集成在Simulink环境中,因此可以建立高精度、非线性的模型以支持控制系统的开发和测试。 强大功能: 搭建机械系统模型 使用SimMechanics用户仅需要收集物理系统信息即可建立三维机械系统模型。使用刚体、坐标系、铰链和作用力元素定义和其它Simulink模型直接相连的部分。这个过程可以重用Simulink模型以及扩展了SimMechanics工具的能力。用户还可把Simulink模型和SimMechnics模型集成为一个模块,并可封装成可在其它模型中复用的子系统。 机械系统建模仿真和分析 SimMechanics包含如下子系统: ?使用Simulink查表模块和SimMechanics传感器和作动器定义的非线性的弹性单元 ?用来定义航空器件压力分布的空气动力学拖曳模块,例如副翼和方向舵 ?车辆悬架系统,例如防侧翻机械装置和控制器 ?轮胎模型

amesim与matlab联合仿真参数设置(精)

Amesim 与 matlab 联合仿真参数设置 实验软件平台 Matlab2009a , amesimR8a , VC6.0企业版 步骤: 1 将 VC++中的 "vcvar32.bat" 文件从 Microsoft Visual C++目录(通常 是 .\Microsoft Visual Studio\VC98\Bin中拷贝至 AMESim 目录下。 2 设置环境变量:我的电脑 -〉属性 -〉高级 -〉环境变量。设置 AMESim 环境变量:变量名 AME , 值为其安装路径如安装在 C 盘中则值为 C:\。设置 Matlab 环境变量:变量名MATLAB 值为 D:\MATLAB701。确认在系统变量 PATH 中包含系统安装目录C:\WINNT\System32 3 在 Matlab 的目录列表里加上 AMESim 与 Matlab 接口文件所在的目 录 %AME%\matlab\amesim。 File-〉 Set Path-〉 Add Folder 加上 C:\AMEsim\matlab\amesim。 (注意 amesimR8A 是 将 %AME%\scripting\matlab\amesim设置到 MATLAB 路径中 4 将联合仿真的许可证文件 licnese.dat 拷贝到 AMESim 安装目录下的 licnesing 文件夹中 5 确认是否在 AMESim 中选择 VC 作为编译器。具体操作在AMESim-〉 Opions-> AMESim Preferences->Compilation/Parameters中。 . 在MATLAB 命令窗口中输入命令 Mex -setup , 选择 VC 作为编译器。 如果上面设置成功下面不用看 下面给出 amesim4.0版本设置方法 为了实现二者的联合仿真,需要在 Windows2000或更高级操作系统下安装Visual C++ 6.0,AMESim4.2以上版本与 MATLAB6.1上版本 (含 Simulink

AMESim和ADAMS联合仿真设置

AMESim和ADAMS 依托AMESim7.0与adams2007或2005联合仿真过程,除要用到这两中软件外还要安装完整版的vc++(注意不能要绿色版,要完整破解版)。 设置环境变量: 右键点击我的电脑>属性>高级>环境变量,在administration 用户变量栏下点“新建”,设置:变量名 AME_ADAMS_HOME 变量值填写你安装adams的安装路径(例如:D:\adams2005) 然后确定。在开始>运行栏中打cmd进入dos环境,输入 echo %AME_ADAMS_HOME% 注意echo后有空格,然后回车,显示你的adams安装路径(例如:D:\adams2005)说明正确。 下面总体说一下联合仿真过程,简单的说,是两种软件量与量的交换过程。首先在adams中会建立一个接受AMESim传来的量(f)驱动模型,然后从adams中输出一个模型量(w)传到AMESim。 建立adams模型: 首先建立一个工作文件夹,adams和AMESim的工作目录全部指向它,注意这个文件夹的名字和路径全部为英文不能有其他符号和字符,视频教程中建在c盘根目录下,命名aa。为了说明清楚,在这里仅建立了一个绕固定点旋转的杆件模型,在它和ground直接加入铰接关系,就是那个合页的连接关系,给它加入空间力矩。然后在build下选system elements>stable variable>new建立新的变量f(AMESim 输入扭矩),用同样的方法建立变量w(adam s输出角速度),并且设置w的值,从build下选system elem ents>stable variable>modify选择model中的w,设定f=值,点击三个小点的按钮进入function build,在下拉框中选择velocity,单击anglar velocity about Z,点击assist,在to marker 栏右键单击,选择marker>browse,选择part2 cm(杆中心点),OK,Ok,删掉原有的0,然后确定, 然后选择build>contral toolit>plant input在弹出对话框中,双击variable nam e栏,Database Navigator中选择f,OK;同样在build>contral toolit>plant output的Database Navigator中选择w为输出变量,OK! 将前面设定的扭矩值设定为f,就是在那个fuction窗口中选data element>plant input. 从tool>plung manage>中选择control,调出control,在control下选择plant explorer,在plant input选择pinput1,在plant output选择poutput1,点确定。这时在aa文件夹下会出现三个文件*.inf, *.adm, *.cmd,其中*.inf文件包含了进行联合仿真时AMESim软件所需要的一些基本信息,如工作路径、文件名、输入输出变量的特征、状态变量数。*.cmd, *.adm分别是仿真运行时计算方式为交互式和批处理式所必须的数据文件,包含ADAMS求解器可读的信息,这些信息在运行仿真时,将输入到求解器。

adams和simulink联合仿真的案例分析

相信大家在联合仿真ADAMS和SIMULINK时都会遇到很多的问题:ADAMS/contro中的例子ball_beam通过联合仿真,更容易理解adams和simulink的联合仿真精髓。小球在一脉冲力的作用下沿着横梁滚动,此时梁的两端受力不平衡,梁的一段倾斜,为了使得小球不掉下横梁,在横梁上施加一个绕Z轴的力矩,横梁达到一定的角度之后逆向转动,然后小球就在这个作用力矩的控制下来回滚动而不掉下横梁!其中控制力矩在整个过程中是个动态变化的,力矩Torque_In是通过位移Position 和横梁转角Beam_Angle确定,这个是在simulink中通过框图完成的。 首先我申明一下我用的是adams2003和matlab6.5 以下我说明一下我的操作步骤: 1、把control中的ball_beam文件copy到另外一个文件夹下,同时设置adams和matlab的默认路径即为ball_beam文件夹,这样可以省略很多不必要的麻烦! 2、用aview打开ball_beam.cmd文件,先试试仿真一下,可以看到小球会在脉冲的作用下滚动,仿真时间最好大于8s 3、载入control模块,点击tools|plugin manager在control框选定。 4、点击control|plant export在file prefix下输入你的文件名,这个可以随便的,我输入的是myball,在plant input点击右键点

击guess选定tmp_MDI_PINPUT,在tmp_MDI_PINPUT中就是输入力矩Torque_In,只有一个输入参数;同样在plant output 中点击右键guess选定tmp_MDI_POUTPUT,这是模型的输出变量横梁转角Beam_Angle和小球与横梁中心轴的距离position。control package选择matlab,type是non_linear,初始化分析选择no,然后按ok!此时m文件已经生成了! 5、打开matalb,设置你的工作路径在ball_beam文件夹上,键入myball,马上有 %%% INFO : ADAMS plant actuators names : 1 Torque_In %%% INFO : ADAMS plant sensors names : 1 Beam_Angle 2 Position 出现 6、再键入adams_sys,弹出一个控制框图,这时可以新建一个mdl文件,将adams_sub拖入你新建的mdl框图中,其实再这里有一个偷懒的办法,就是在matlab中打开ball_beam.mdl文件,然后把他的那个adams_sub用你的刚产生的这个代替,然后另存为my_ball.mdl!

amesim与matlab联合仿真步骤(自己总结)

Amesim与matlab 联合仿真参数设置 实验软件平台 Matlab2009a,amesimR8a ,VC6.0 企业版(英文版) 步骤: 1 将VC++中的"vcvar32.bat" 文件从Microsoft Visual C++目录(通常是.\Microsoft Visual Studio\VC98\Bin 中)拷贝至AMESim 目录下。 2 设置环境变量:我的电脑- 〉属性-〉高级- 〉环境变量。设置AMESim环境变量:变量名AME,值为其安装路径如安装在 C 盘中则值为C:\+amesim 安装路径。设置Matlab 环境变量:变量名MATLAB值为D:\MATLAB,此处我安装的matlab 在D 盘根目录下。确认在系统环境变量PATH 中包含系统安装目录C:\WINDOWS\system32 3 在Matlab 的目录列表里加上AMESim 与Matlab 接口文件所在的目录%AME%\matlab\amesim。File- 〉Set Path- 〉Add Folder 加上需要联合仿真的amesim文件目录和C:\AMEsim\matlab\amesim(注意R8A版本是将%AME%\scripting\matlab\amesim 设置到MATLAB路径中)加入matlab 默认路径中 4 将联合仿真的许可证文件licnese.dat 拷贝到AMESim 安装目录下的licnesing 文件夹中 5 确认是否在AMESim 中选择VC 作为编译器。具体操作

在AMESim-〉Opions-> AMESim Preferences->Compilation/Parameters中。. 在MATLAB命令窗口中输入命令Mex -setup,选择VC 作为编译器 注意点: 1,Vc建议安装企业版而且是英文的,其第一次打开安装文件安装并不完全,重启动以后再次点安装文件,会出现于第一次安装文件不同的界面,就说明没有安装完全 2,Matlab 的安装目录和amesim的安装目录都不能在中文路径下,而去文件夹的名称不能有空格 3,联合仿真设置成功的标志: 可以运行amesim- 〉HELP- 〉GET AMESIM DEMO-〉interface- 〉amesimsimulink 下的范例 4,如果运行的现实找不到matlab bin 则说明系统环境变量中没有设置matlab 路径,设置方法见上面,再重启电脑,再次用amesim打开范例并到参数模式下,运行TOOLS-〉Start matlab,系统会调用matlab 程序,再在打开的matlab 中找到与amesim中打开的文件同目录且同名的.mdl 文件,在matlab 中运行仿真,如果没有错误则在amesim 中进入仿真模式打开相应的元件就可 以看到曲线(注意在amesim中不用运行仿真)

AMESim与ADAMS联合仿真

AMESim与ADAMS联合仿真 1.引言 AMESim(Advanced Modeling Environment for Simulation of engineering systems)软件是由法国IMAGINE公司于1995年推出的多学科复杂领域系统工程高级建模和仿真平台,该软件不要求用户具备完备的仿真专业知识,采用面向系统原理图建模的方法,便于工程技术人员掌握和使用。机构动力学分析软件ADAMS (automatic dynamic of mechanical system)集建模、求解和可视化技术于一体,能有效分析和比较多种参数方案。运用AMESim与ADAMS的联合仿真,可以有效的对设备的动态过程进行分析,根据交互分析产生的结果来评价设备的性能,为了更加真实的符合实际情况,理论分析用来完成检验产生的数值结果。这种虚拟产品开发方法与得出的结论将对设计人员提供一定帮助。 通过AMESim/ADAMS之间的接口,有两种方式实现联合仿真: 1)将模型从一个平台中输入到另一个平台中,采用单一的积分器进行计算。 2)各个平台分别利用自己的积分器计算自己的模型,通过预先统一的通讯间隔进行信息交换。 2.软件环境要求: 首先AMESim软件需要4.2级以上版本; ADAMS需要2003级以上版本(含A/Control模块)。其次必须要有Microsoft Visual C++ 编译器。如果需要从ADAMS环境中使用接口,那么还强烈推荐Fortran编译器,这样可以将AMESim的模型编译成为ADAMS的子函数(Subroutine)。该接口支持的操作系统包括Windows、Sun、SGI和IBM。

matlab的Simulink简介

Simulink是MATLAB最重要的组件之一,它提供一个动态系统建模、仿真和综合分析的集成环境。在该环境中,无需大量书写程序,而只需要通过简单直观的鼠标操作,就可构造出复杂的系统。Simulink具有适应面广、结构和流程清晰及仿真精细、贴近实际、效率高、灵活等优点,并基于以上优点Simulink已被广泛应用于控制理论和数字信号处理的复杂仿真和设计。同时有大量的第三方软件和硬件可应用于或被要求应用于Simulink。 Simulink是MATLAB中的一种可视化仿真工具,是一种基于MATLAB的框图设计环境,是实现动态系统建模、仿真和分析的一个软件包,被广泛应用于线性系统、非线性系统、数字控制及数字信号处理的建模和仿真中。Simulink可以用连续采样时间、离散采样时间或两种混合的采样时间进行建模,它也支持多速率系统,也就是系统中的不同部分具有不同的采样速率。为了创建动态系统模型,Simulink提供了一个建立模型方块图的图形用户接口(GUI) ,这个创建过程只需单击和拖动鼠标操作就能完成,它提供了一种更快捷、直接明了的方式,而且用户可以立即看到系统的仿真结果。 Simulink;是用于动态系统和嵌入式系统的多领域仿真和基于模型的设计工具。对各种时变系统,包括通讯、控制、信号处理、视频处理和图像处理系统,Simulink提供了交互式图形化环境和可定制模块库来对其进行设计、仿真、执行和测试。. 构架在Simulink基础之上的其他产品扩展了Simulink多领域建模功能,也提供了用于设计、执行、验证和确认任务的相应工具。Simulink与MATLAB® 紧密集成,可以直接访问MATLAB大量的工具来进行算法研发、仿真的分析和可视化、批处理脚本的创建、建模环境的定制以及信号参数和测试数据的定义。 丰富的可扩充的预定义模块库 交互式的图形编辑器来组合和管理直观的模块图 以设计功能的层次性来分割模型,实现对复杂设计的管理 通过Model Explorer 导航、创建、配置、搜索模型中的任意信号、参数、属性,生成模型代码 提供API用于与其他仿真程序的连接或与手写代码集成 使用Embedded MATLAB?模块在Simulink和嵌入式系统执行中调用MATLAB算法 使用定步长或变步长运行仿真,根据仿真模式(Normal,Accelerator,Rapid Accelerator)来决定以解释性的方式运行或以编译C代码的形式来运行模型 图形化的调试器和剖析器来检查仿真结果,诊断设计的性能和异常行为 可访问MATLAB从而对结果进行分析与可视化,定制建模环境,定义信号参数和测试数据 模型分析和诊断工具来保证模型的一致性,确定模型中的错误 平面连杆机构 英文名称: planar linkage mechanism

AMESim与ADAMS联合仿真操作说明

AMESim与ADAMS联合仿真操作说明 1.引言 AMESim(Advanced Modeling Environment for Simulation of engineering systems)软件是由法国IMAGINE公司于1995年推出的多学科复杂领域系统工程高级建模和仿真平台,该软件不要求用户具备完备的仿真专业知识,采用面向系统原理图建模的方法,便于工程技术人员掌握和使用。机构动力学分析软件ADAMS (automatic dynamic of mechanical system)集建模、求解和可视化技术于一体,能有效分析和比较多种参数方案。运用AMESim与ADAMS的联合仿真,可以有效的对设备的动态过程进行分析,根据交互分析产生的结果来评价设备的性能,为了更加真实的符合实际情况,理论分析用来完成检验产生的数值结果。这种虚拟产品开发方法与得出的结论将对设计人员提供一定帮助。 通过AMESim/ADAMS之间的接口,有两种方式实现联合仿真: (1)将模型从一个平台中输入到另一个平台中,采用单一的积分器进行计算。 (2)各个平台分别利用自己的积分器计算自己的模型,通过预先统一的通讯间隔进行信息交换。 2.软件环境要求 首先AMESim软件需要4.2级以上版本;ADAMS需要2003级以上版本(含A/Control模块)。其次必须要有Microsoft Visual C++ 编译器。 如果需要从ADAMS环境中使用接口,那么还强烈推荐Fortran编译器, 这样可以将AMESim 的模型编译成为ADAMS的子函数(Subroutine)。该接口支持的操作系统包括Windows、Sun、SGI和IBM。 3.AMESim与ADAMS接口操作 要成功使用接口, 必须在Windows中设置环境变量%AME_ADAMS_HOME%, 该环境变量的值为ADAMS的安装路径(例如C :\ADAMS2003。注意在ADAMS的安装路径中不能出现空格)。 如果需要从ADAMS环境中使用接口,那么还需要将dfvars.bat文件拷贝至AMESim的安装路径下。 3.1.在ADAMS中设置用于输入到AMESim的模型 在这种情况下,AMESim是主控软件,用户需要在AMESim中运行并控制ADAMS的仿真进程。从ADAMS输出到AMESim有两种方式: 1.共同仿真模式,AMESim通知ADAMS在给定的时间间隔提供它的输出。由ADAMS 自己来求解它的模型。 2.连续模式,AMESim从ADAMS输入完整的系统模型并将所有的方程集成起来在AMESim中求解,此时ADAMS只起到函数评估器的作用。 不管上述哪种模式,在ADAMS中的设置过程是一样的。 用户只需要在AMESim中选择是共同仿真方式或是连续模式输出方式。 3.1.1:创建/检查需要交换的变量。 在这个步骤中,用户需要检查一些状态变量的定义,使用这些状态变量作为两个软件间的交换变量。例如, 如果用在AMESim建立的液压作动器模型来驱动ADAMS中建立的机构模型, 那么这些变量就应该是力、位移以及速度等。事实上, AMESim需要根据位移和速度计算得到力。 ADAMS中的输出变量, 通常是速度和位移, 主要是使用ADAMS内部函数来定义;如AZ()用于角度测量,WZ()用于转速,DM()用于位移。

ADAMS与Matlab联合仿真

7.1机械夹紧机构建模使用实例 机械系统建模实例将创建一种机械夹紧机构模型,是阿波罗登月计划中用于夹紧登月舱和宇宙飞船的十二个夹紧机构之一。夹紧机构包括:摇臂(Pivot)、手柄(Handle)、锁钩(Hook)、连杆(Slider)和固定块(ground Block)等物体。 夹紧机构的工作原理是:如图7-1所示,在夹紧机构手柄(Handle)处施加一个作用力,驱动机构运动,使其锁钩(Hook)处产生十倍于作用力的夹紧力,用于夹紧登月舱和宇宙飞船。 夹紧机构的设计要求是:至少产生800N的夹紧力;施加在手柄上的力应不大于80N;释放手柄的力应最小;在振动环境中夹紧机构应安全可靠。 手柄Handle 锁钩Hook 图7-1 夹紧机构三维模型图 以下将从创建几何构件、添加约束、添加载荷及结果后处理等几个方面详细介绍机械夹紧机构模型的建立。通过本实例的学习,能够详细了解ADAMS软件设计流程及使用方法。 7.1.1创建几何构件 1、创建新模型 本实例将使用ADAMS/View的零件库、约束库和力库创建夹紧机构模型。 首先打开ADAMS/View,选择“Create a new model”,模型名称(Model Name):Latch,点击OK,创建新模型完毕。其它设置如图7-2所示:

图7-2 创建新模型 2、设置工作环境 选择菜单栏【Settings】→【Units】命令,设置模型物理量单位,如图7-3所示: 图7-3设置模型物理量单位 选择菜单栏【Settings】→【Working Grid】命令,设置工作网格,如图7-4所示:

图7-4设置工作网格 3、创建设计点 设计点是几何构件形状设计和位置定位的参考点。本实例将通过设计点列表编辑器创建几何构件模型所需要的全部设计点。 选择并点击几何模型库(Geometric Modeling)中的点(Point),下拉菜单选择(Add to Ground)、(Don’t Attach),并单击Point Table列表编辑器,创建并生成Point_1、Point_2等六个设计点,如图7-5、图7-6所示: 图7-5设计点列表编辑器

AMESim-MATLAB联合仿真详细设置+部分问题解决步骤

AMESim-Matlab 的联合仿真设置 1. 联合仿真的前期准备 1.1. AMESim 与Matlab 的版本匹配问题 AMESim 与Matlab 的联合仿真有两类接口: 接口(将AMESim 模型导入到Simulink 中) 接口(将Simulink 模型导入到AMESim 中) 两种不同的接口,对应的AMESim-Matlab 联合仿真的软件兼容列表,分别如图 1 和 2 所示。图中,"Probable"表示未经AMESim 官方测试,但仍然可以正常使用。"Yes"表示经AMESim 官方测试,确定可以正常使用。"No"表示该组合不能实现联合仿真。 如图 1 所示,"AMESim to Simulink" 接口对软件的版本要求较低,基本上AMESim Rev7(或者更高的版本)与Mablab R2007b (或者更高的版本)可以自由组合进行联合仿真。如果想使用"Simulink to AMESim" 接口,建议安装AMESim Rev11 以上的版本,Malab 只要求R2007b 以上即可。 图 1 "AMESim to Simulink" 接口 图 2 "Simulink to AMESim" 接口

1.2. Microsoft Visual C++编译器(VC++)的版本选择? AMESim 支持的VC++版本分别如图1(32 位编译器),图2(64 位编译器)所示。 图 1 和图 2 中,"Probable","Yes","No"表示的意思同上。经测试,AMESim Rev9 可以正常调用VS2010 版的VC++(32 位)。另外,从图 1 中,可以看到,VC++ 6.0 不能支持AMESim Rev11 以上的版本。建议安装英文版的VC++编译器,便于联合仿真出错时,查看编译信息,寻找问题所在。中文版的VC++编译器,在联合仿真出错时,部分编译信息会显示为乱码。 1.3. AMESim、Matlab、VC++的安装顺序需要注意吗? 建议的安装顺序为:先装VC++,Malab 和AMESim 的安装顺序任意,这样就能省去一些手动操作。AMESim 调用VC++编译器,需要事先将VC++编译器里的文件vcvars32.bat (32 位操作系统)或vcvars64.bat(64 位操作系统)拷贝到AMESim 的安装目录。如果先装VC++,后装AMESim,正常情况下,vcvars32.bat 文件会自动导入到AMESim 安装目录中。

amesim simulink联合仿真

MATLAB/Simulink interface? Version 4.0 - March 2002 https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html, The document is for study only,if tort to your rights,please inform us,we will delete

Copyright ? IMAGINE S.A. 1995-2002 AMESim? is the registered trademark of IMAGINE S.A. AMESet? is the registered trademark of IMAGINE S.A. ADAMS? is a registered United States trademark of Mechanical Dynamics, Incorporated. ADAMS/Solver? and ADAMS/View? are trademarks of Mechanical Dynamics, Incorpo- rated. MATLAB and SIMULINK are registered trademarks of the Math Works, Inc. Netscape and Netscape Navigator are registered trademarks of Netscape Communications Corporation in the United States and other countries. Netscape’s logos and Netscape product and service names are also trademarks of Netscape Communications Corporation, which may be registered in other countries. PostScript is a trademark of Adobe Systems Inc. UNIX is a registered trademark in the United States and other countries exclusively licensed by X / Open Company Ltd. Windows, Windows NT, Windows 2000 and Windows XP are registered trademarks of the Microsoft Corporation. X windows is a trademark of the Massachusetts Institute of Technology. All other product names are trademarks or registered trademarks of their respective compa- nies. https://www.doczj.com/doc/3817140278.html, EMail:cadserv21@https://www.doczj.com/doc/3817140278.html, The document is for study only,if tort to your rights,please inform us,we will delete

(完整word版)CarSim、Simulink联合仿真

CarSim 与Simulink 联合仿真 1 软件介绍 在MATLAB 中,Simulink 是用来建模、仿真和分析动态多维系统的交互工具。可以使用Simulink 提供的标准模型库或者自行创建模型库,描述、模拟、评价和精化系统行为,同时,Simulink 和MATLAB 之间的联系十分便捷,可以使用一个灵活的操作系和应用广泛的分析和设计工具。最后,除了可以使用Simulink 建模和仿真之外,还可以通过其他软件联合来完成更多的分析任务,如CarSim 、ADAMS 、AMEsim 等许多软件。 CarSim 是专门针对车辆动力学的仿真软件,CarSim 模型在计算机上运行的速度比实时快3-6 倍,可以仿真车辆对驾驶员,路面及空气动力学输入的响应,主要用来预测和仿真汽车整车的操纵稳定性、制动性、平顺性、动力性和经济性,同时被广泛地应用于现代汽车控制系统的开发。CarSim 可以方便灵活的定义试验环境和试验过程,详细的定义整车各系统的特性参数和特性文件。CarSim 软件的主要功能如下:适用于以下车型的建模仿真:轿车、轻型货车、轻型多用途运输车及SUV ;可分析车辆的动力性、燃油经济性、操纵稳定性、制动性及平顺性;可以通过软件如MA TLAB ,Excel 等进行绘图和分析;可以图形曲线及三维动画形式观察仿真的结果;包括图形化数据管理界面,车辆模型求解器,绘图工具,三维动画回放工具,功率谱分析模块;程序稳定可靠;软件可以实时的速度运行,支持硬件在环,CarSim 软件可以扩展为CarSim RT, CarSim RT 是实时车辆模型,提供与一些硬件实时系统的接口,可联合进行HIL 仿真;先进的事件处理技术,实现复杂工况的仿真;友好的图形用户界面,可快速方便实现建模仿真;提供多种车型的建模数据库;可实现用户自定义变量的仿真结果输出;可实现与simulink 的相互调用;多种仿真工况的批运行功能; 2 CarSim 与Simulink 联合仿真 2.1 Simulink 接口 1)变量由Simulink 导入CarSim (导入变量) 可由Simulink 导入到CarSim 中的变量可达160 多个,主要分为以下几部分:控制输入

simulink仿真说明

Simulink是Simulation和link仿真链接。是一个附加组件,为用户提供了一个建模与仿真的工作平台,由于许多功能是基于MATLAB平台的。必须在MATLAB环境中运行,也把他称为一个MATLAB的工具箱。 以前MATLAB仿真编程是在文本窗口中进行的。输入函数是命令和MATLAB 函数,在simulink 中与用户的交互接口是基于windows的模型化图形输入,用户可以通过单击拖动鼠标的方式绘制和组织系统,并完成对系统的仿真。因此对于我们来说只需知道这些功能模块的输入输出、功能以及图形界面的使用方法。就可以用鼠标和键盘进行仿真。 三种方法进入Simulink 1、在MATLAB菜单栏中单击FILE,在下拉菜单的NEW选项中单击MODEL. 2、在MATLAB工具栏中单击彩色图标,然后在打开的模型库浏览器窗口中单击 ‘新建文件‘ 3、在MATLAB命令窗口中输入Simulink,然后在打开的模型库浏览器窗口中单 击‘新建文件‘。 一、模块的提取 左键拖曳 右键add to 二、模块的移动放大和缩小 移动:左键拖曳选中后用方向键脱离线移动按住shift 然后拖曳 缩放 : 点击模块四个角拖曳 三、复制粘贴和删除和windows一样删除选择clear 四、模块的旋转:右键点击然后选择Flip block 顺时针转180度 rotate block 顺时针90度。 五、模块名的修改移动:单击该模块名出现一个小框可以像文本一样修改移动 还可以右键单击然后Hide name 六、模块参数设置:双击 七、模块连接:光标的箭头对准模块的输出端变成+后按下左键拖曳到另一个 输入端松开左键。 八、连线的弯折开始画线时,在需要弯折的地方松开鼠标停顿一下,然后继续 按下鼠标左键改变方向即可。 移动光标指向要移动的线段,然后拖动鼠标即可 删除选中要删除的部分,然后delete 直流电动机的直接启动 新建一个simulink 仿真平台打开simulink然后点击新建 打开simpowersystems的加号在electrical source中选择D C Voltage Source拖曳到仿真平台 Elements里面选Breaker Connectors 里面选择Ground output把电源正端接到断路器的1端,电源负端接

相关主题
文本预览
相关文档 最新文档