好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

AMESim与Simulink联合仿真操作指南.doc

7页
  • 卖家[上传人]:s9****2
  • 文档编号:485349120
  • 上传时间:2023-10-20
  • 文档格式:DOC
  • 文档大小:254.50KB
  • / 7 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • Amesim8以上,matlab7以上(必须是 32位),vs2005或2008 (2010不可以)AMESim 与Simulink联合仿真操作指南 (2008-04-29 12:08:07)注意这是co-simu模式为了实现二者的联合仿真,需要在 Windows2000或更高级操作系统下安装 Visual C++6.0,AMESim4.2 以上版本与 MATLAB6.1 上版本(含 Simulink)1. 将 VC++ 中的"vcvar32.bat"文件从 Microsoft Visual C++ 目录(通常是.'Microsoft Visual Studio\VC98\Bin 中)拷贝至 AMESim 目录下2. 环境变量确认:1) ,选择 控制面板-系统”或者在 我的电脑”图标上点右键,选择 属性”2) ,在弹出的 系统属性”窗口中选择 高级”页,选择 环境变量”;3) ,在弹出的 环境变量”窗口中找到环境变量 “ AM巳它的值就是你所安装 AMESim的路径,选中改环境变量;4) ,点击 确认”按键,该变量就会加到系统中;5) ,如上法确认环境变量 “ MATLAB",该值为你所安装的 MATLAB的路径,这个路径不能有空格的,女口 C:\MA TLAB\R2007b , matlab2007 是安装在 Programe files 下的就不可以。

      6) ,新建环境变量 LM_LICENSE_FILE=C:\AMESim4.2.0\lice nsi ng'lice nse.dat 3. 确认是否在 AMESim 中选择 VC作为编译器具体操作在 AMESim- > Opions-> AMESimPreferences->Compilation/Parameters 中如果是后安装 VC 的话,会需要把 VCVARS32.BAT文件copy到AMESim的安装目录下4. 在MATLAB命令窗口中使用 Mex -setup,选择VC作为编译器有时候如果matlab不能把安装的vc编译器列出来,可以选择n,然后自己选择vc编译器和 安装路径5. 在 Matlab 的 目 录列表里加上 AMESim 与 Matlab 接 口文件所在的 目 录%AME%\matlab\amesim,其中%AME%是AMESim 的安装目录,如果安装在 C:\AMEsim ,则 就加上 C:\AMEsim\v800\interface\simulink 在file菜单下的set path选项6.S函数名是所设计的系统名加上 ,—?得到的7. AMESim与Simulink交互的模型具有相反的输入输出接口。

      (注意:这里的模块的输入口是指在matlab中显示的输入口, 而且在matlab中的输出口和simulink中的接口是对应的 可以参考帮助文件,里面有详细的提示 )菜单 In terface》create in terface icon (需要有接口的 lice nse)AMESim中接口设置2£1Funclion Block Parameters: S-FunttiunS ^FuncbiorUserdefriable block. Blacks can be written in 匚“ M (leveM L Fortran, and Ada and rnu^t conform to S-function standards. The variables t” x, u“ and flag are autofnaticall^i parsed to the S-function by Simulink. You can additional parameters in the 'S-function pafameler&' field. If the S-function block requires additional source files for the Real-Time Workshop build process specify the Renames in the'S-function modules' field. Enter the filenames only; de not use extensions oi full palhnames, e.g.H enter 'sre src1: not ':rc.c srcl.c'.ParameleisEditS -function name:S function parameter^: 10.00005 0.00005 le-6S-function modules: |"QK ICancelHelpfipply |Simulink 中 S-function 设置调用时会需要三个参数, 还不太清楚这三个参数是什么意义, 但可以试验出来第一个是仿真步长。

      第二个参数好像是定义 AMESim中记录数据的时间间隔,为零表示不记录第三个是 toleraneeFigure 2.13: The S-Function Parameters.The iist of parameters of the S-Furtction is shown in the following table. Note that / we want to set a value for the 4th parameter, it is necessary to grve a value to all parameters before t^is oneParameterDescriptionDefault valueSample timeTline between exchange of values betyt/een AMESim and SimuhnkRequired, no default valueAMESimcommunication intervalAs in AMESimRequired, no default valueTorrancethe same 已吕 in theAMES nn run parameters popup1,0e-5Max time stepthe same as in theAMESim run parameters popup1.0e20 sTime rangeHelps DASSL to decide how to initialize the time step100 s (do not change)在AMESim8.0中出现了不能再 AMESim中画曲线的问题, result文件有,大小也对,但就是无法画曲线。

      很奇怪的是有些能画,有些不能画,不知道怎么回事8. 记住在运行 Simulink仿真或使用File — >Write aux.files命令之前将 AMESim 放到参数模式 下AMESet编译时默认是 GCC,编译的模型的目标文件是在 win32-gcc中的,如果 AMESim改用了 VC作为编译器的话,会说找不到目标文件,需要对 AMESet中重新编译修改在 AMESet 中的 option-》AMESet preferenee编译成功之后,会产生一个和 ame文件名相同,多一个下划线的 C语言版的S-function ,可 以在simulink中调用,调用时会需要三个参数, 还不太清楚这三个参数是什么意义, 但可以 试验出来第一个是仿真步长第二个参数好像是定义 AMESim中记录数据的时间间隔Creating a simulation program for yourWorkingNumber of states 3Number of implicits 0MessagesCUB C:\AMESiSelect a compiler:[1]Ljcc^n32 匚 24.1 in CAMATLjiiB\R2007b\sysMcc2] Microsoft Visual C++ 6.0 in CAPR0GRA^1\MIAF9D[OJNoneclose。

      原来是要在 matlab里面选择编第一次用出现了这个对话框,现在也没有办法输入和 译器标准模式Figure 2,9: The S-Function parameters.Block Parameters: b-FunctionS-FunctiorUser-defnable block Slocks may be written in M, C, Foftran or Ada and must conf«m tc S^unction standards. Lxju and flag are automatical^ pas$ed to the S function by Sinnulrk. poi^neiets may be£|»cihed in lhe "S-function parameters' field.P«anel«tS-fmction 強昭[skyhook.5, function parameler$:fTOLGlI _1 g 1CancelHelpWith a normal AMESim run, a print interval is specified whereby the size of the results file can be controtled. Simultnk runs in a somewhat different way and consequently the AMESim result files can become unacceptable large. To prevent this from occurring a special AMESim print intervaf is specified in the S*Function. The data added to the 二IVIE Sim results file will be spaced with a time iinterval 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 meter indicates the special print interval If a zero or negative value is entered, Simulink will add to the a V E5im results file whenever it adds to its own results.Add the values shown in Figure 2,9 so that there will be an AMESim results file but with a print interval restriction of 0.01 s.注:1、 用标准模式时,只用 sim。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.