如何在 Dymola (Modelica) 中使用/bigobj 进行编译 [英] How to compile with /bigobj within Dymola (Modelica)

查看:56
本文介绍了如何在 Dymola (Modelica) 中使用/bigobj 进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个相对较小的有限元 (FE) 模型集成到 Modelica 中.为此,我创建了一个模型(Modelica 类),它可以读取 Matlab 二进制文件格式的质量 (M) 和刚度 (K) 矩阵.我将 FE 模型与 Modelica 标准库 (Modelica.Mechanics.MultiBody) 中的一些组件连接起来.如果 M 和 K 非常小(比如 20x20),那么 Dymola 能够运行模型并提供与 Abaqus 相比非常准确的结果(但计算效率不高).但是,如果我增加包含较大 M 和 K 的 FE 模型的复杂性(例如 size(M)=[200,200]),则 Dymola 会提供以下错误:

I am integrating a relative small Finite Element (FE) model into Modelica. In doing so, I created a Model (Modelica class) that can read the mass (M) and stiffness (K) matrix in Matlab binary file format. I connected the FE model with some components from the Modelica Standard Library (Modelica.Mechanics.MultiBody). If M and K are very small (say 20x20), then Dymola is able to run the Model and provides pretty accurate results compared to Abaqus (but computational not that efficient). However, if I increase the complexity of the FE model that includes larger M and K (e.g. size(M)=[200,200]), then Dymola provides the following error:

编译和链接模型(Visual C++).

Compiling and linking the model (Visual C++).

设置使用 Microsoft Visual Studio 2010 x86 工具的环境.dsmodel.cdsmodelext1.cdsmodelext10.cdsmodelext11.cdsmodelext12.cdsmodelext13.cdsmodelext14.cdsmodelext15.cdsmodelext16.cdsmodelext2.cdsmodelext3.cdsmodelext4.cdsmodelext5.cdsmodelext6.cdsmodelext7.cdsmodelext8.cdsmodelext9.c

Setting environment for using Microsoft Visual Studio 2010 x86 tools. dsmodel.c dsmodelext1.c dsmodelext10.c dsmodelext11.c dsmodelext12.c dsmodelext13.c dsmodelext14.c dsmodelext15.c dsmodelext16.c dsmodelext2.c dsmodelext3.c dsmodelext4.c dsmodelext5.c dsmodelext6.c dsmodelext7.c dsmodelext8.c dsmodelext9.c

正在生成代码...

c:\sentient\src\gll\gearlibrary\dsmodel.c(185115):致命错误 C1128:节数超出目标文件格式限制:使用/bigobj 编译

c:\sentient\src\gll\gearlibrary\dsmodel.c(185115) : fatal error C1128: number of sections exceeded object file format limit : compile with /bigobj

生成 Dymosim 时出错.

Error generating Dymosim.

我将 Visual Studio C++ Express Edition (10.0) 与 Dymola 连接起来.

I connected Visual Studio C++ Express Edition (10.0) with Dymola.

在我看来,Dymola 为 M 和 K 的每个实体提供了一个变量名称.这超出了 C++ 编译器的最大对象限制.

It looks to me that Dymola provides a variable name to each entity of M and K. This exceeds the maximum limit of objects for the C++ compiler.

如何防止 Dymola 这样做?如何在 Dymola 环境中设置/bigobj?

How can I prevent Dymola of doing this? How can I set /bigobj within the Dymola environment?

推荐答案

Dymola 确实会为数组的每个元素分配一个名称.您可以在这里尝试两件事.第一个是简单的,但我不能说它是否真的有帮助.Visual C++ 提示在命令行中包含 /bigobj 开关可能会有所帮助.如果您想这样做,您应该查看安装 Dymola 的 /bin 目录中的各种构建脚本.您可以修改这些脚本以更改用于编译模型的命令.但是,在您弄乱这些脚本之前,我一定会备份这些脚本,否则您可能会遇到无法再编译任何模型的情况.我认为主要脚本是build.bat(虽然还有其他的,我不知道是什么决定了调用哪些).

It is true that Dymola will assign a name to every element of an array. There are two things you can try here. The first is the simple one, but I cannot say whether it will actually help. Visual C++ hints that including the /bigobj switch on the command line might help. If you want to do that, you should look at the various build scripts in the /bin directory whereever you have Dymola installed. You can modify these scripts to change the commands used to compile models. However, I would be sure to backup those scripts before you mess with them or you may get into a situation where you can no longer compile any of your models. I think the main script is build.bat (although there are others and I don't know what determines which ones are invoked).

如果这不起作用,另一种处理大量数据的方法是使用 Modelica 中的 ExternalObject 工具.这允许您在 C 语言级别而不是 Modelica 级别加载数据.例如,这可用于将插值表加载到内存中,而不会因插值中使用的数千个数据点而堵塞 Modelica 命名空间.但是,我怀疑这是否真的对您有帮助,因为您似乎需要 Dymola 来求解由您的质量和刚度矩阵生成的方程.因此,将它们置于外部将无济于事.它适用于插值情况,因为 Dymola 并不真正需要知道所有这些数据(只有插值函数需要它).但是,如果您使用(全部)这些数据来求解方程组,我认为您真的无法避免将其隐藏在 Dymola 中.

If that doesn't work, another way to deal with large amounts of data is to use the ExternalObject facility in Modelica. This allows you to load data at the C language level, rather than at the Modelica level. This can be used to, for example, load interpolation tables into memory without clogging up the Modelica namespace with thousands of data points used in the interpolation. However, I'm skeptical this would really help you since it seems you require Dymola to solve the equations generated by your mass and stiffness matrices. As such, making them external won't help. It works in the interpolation case because Dymola doesn't really need to be aware of all of that data (only the interpolation function needs it). But if you are using (all of) that data to solve a system of equations, I don't think you can really get away with hiding it from Dymola.

这篇关于如何在 Dymola (Modelica) 中使用/bigobj 进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆