Adams2013编译C语言用户子程序生成dll超详细教程讲解0001.docx

Adams2013编译C语言用户子程序生成dll超详细教程讲解0001.docx

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1.操作系统:2.软件版本:3.编译软件:4. 1.操作系统: 2.软件版本: 3.编译软件: 4.环境配置: 在操作系统环境变量 Path 中增加 Adams 启动文件 mdi.bat 的路径,如 D:\MSC.Software\Adams\2013\common\mdi.bat 把 Fortran 安装路径,如 D:\IVF2011\Intel\ComposerXE-2011\compiler\lib\ia32 把 libifcoremd.lib (1) (2) 、libifcoremd.lib 、libmmd.lib 、libifportmd.lib 、libirc.lib 、svml_dispmd.lib Adams 安装路径下 win32 文件夹下 D:\MSC.Software\Adams\2013\solver\c_usersubs 文件夹下有 C 语言编写 其中 slv_c_utils.h 文件是用户子程序的头文件。编写用户子程序时, Assign readable variable names to passed parameters */ double c=vfo-PAR[0]; int ipar[3]={( int )vfo-PAR[1], ( int )vfo-PAR[2],( int )vfo-PAR[1]}; Local variables */ /* Windows xp 32 位 Adams 2013 32 位、 Visual Studio 2010 专业版 32 位 Intel Visual Fortran 11.0 (3) 这 6 个库文件复制到 5.编写用户子程序 Adams 安装程序 的常用的用户子程序, 在这些程序的基础上进行更改会有事半功倍的效果。 本文以编写 VForce 用户子程序为例,对其编写、编译操作过程进行说明。 复制 vfosub.c 和 slv_c_utils.h 两个文件到个人工作文件夹 Adams_Matlab ,本文直接使用 vfosub.c 的原始代码,其代码为: #include slv_c_utils.h adams_c_Vfosub Vfosub; /* * Note: * Use mixed case names for the Adams subroutine names when using the C * style interface. For the default subroutine name capitalize the first * letter and have the remaining letters lower case; Gfosub for example. * Doing this insures that Adams Solver correctly distinguishes a C style * subroutine from Fortran and calls with the appropriate interface. */ void Vfosub( const struct sAdamsVforce* vfo, double time, int dflag, int iflag, double * result) { /* double vel[3]; int nstates; int errflg; /* call SYSARY for translation velocities TVEL */ c_sysary( TVEL, ipar, 3, vel, nstates, errflg); c_errmes(errflg, Error calling SYSARY for TVEL , vfo-ID, STOP); /* --- Evaluate VFORCE components */ result[0] = -c * vel[0]; result[2] = -c * vel[1]; result[2] = -c * vel[2]; } 注意:因为代码中引用了 slv_c_utils.h,复制时必须同时复制 slv_c_utils.h文件,否则编 译时会报错。 6■编译操作 (1)在开始菜单下,启动 Visual Studio 2010命令提示工具。 (2)把工作路径设置到用户子程序文件所在路径 D:\Adams_Matlab, 输入指令 cd D:\Adams_Matlab并按回车。 (3)输入指令 D:\MSC.Software\Adams\2013\common\mdi.bat 并按回车, ⑷系统进入Adams环境中 Visual Studio 命令提示(2010) D: \ISC. S

文档评论(0)

wangsux + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档