TRANSFORM库v0.4与OpenModelica v1.22.3兼容性咨询及测试报错
TRANSFORM库与OpenModelica兼容性问题
测试环境
- 操作系统:Windows 10 22H2
- TRANSFORM库版本:0.4
- OpenModelica版本:v1.22.3-64bit
问题描述
我想确认TRANSFORM库当前是否兼容OpenModelica,以及具体兼容程度。在尝试运行TRANSFORM流体包中的PumpingSystem示例(模型结构与MSL中的对应示例一致,但使用TRANSFORM组件)时,出现了一系列翻译错误,具体报错信息如下:
[1] 14:06:23 Translation Notification [TRANSFORM.Fluid.Pipes.BaseClasses.PartialDistributedVolume: 12:26-12:31]: From here: [2] 14:06:23 Translation Error [TRANSFORM.Fluid.Pipes.BaseClasses.PartialDistributedVolume: 12:3-13:40]: Non-array modification '0' for array component 'min', possibly due to missing 'each'. [3] 14:06:23 Translation Notification [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:29-27:62]: From here: [4] 14:06:23 Translation Error [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:3-28:50]: Non-array modification '(-Modelica.Constants.pi / 2.0) - 0.01' for array component 'min', possibly due to missing 'each'. [5] 14:06:23 Translation Notification [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:63-27:95]: From here: [6] 14:06:23 Translation Error [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:3-28:50]: Non-array modification 'Modelica.Constants.pi / 2.0 + 0.01' for array component 'max', possibly due to missing 'each'. [7] 14:06:23 Translation Notification [TRANSFORM.Fluid.Volumes.BaseClasses.PartialVolume: 78:36-78:66]: From here: [8] 14:06:23 Translation Error [TRANSFORM.Fluid.Volumes.BaseClasses.PartialVolume: 78:3-79:42]: Non-array modification 'StateSelect.prefer' for array component 'stateSelect', possibly due to missing 'each'. [1] 14:07:26 Translation Notification [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:29-27:62]: From here: [2] 14:07:26 Translation Error [TRANSFORM.Fluid.ClosureRelations.Geometry.Models.DistributedVolume_1D.GenericPipe: 27:3-28:50]: Non-array modification '(-Modelica.Constants.pi / 2.0) - 0.01' for array component 'min', possibly due to missing 'each'.
问题分析
这些报错的核心是数组组件的非数组修改未使用each关键字。在Modelica语法中,当修改数组类型的属性(如min、max、stateSelect)时,若要给数组的每个元素赋予相同值,必须使用each关键字明确声明。TRANSFORM库的这些基础组件代码中缺少该关键字,导致OpenModelica的翻译器无法正确解析。
兼容性结论
当前TRANSFORM 0.4版本与OpenModelica 1.22.3-64bit不兼容,至少流体包的核心组件存在语法兼容性问题,无法通过OpenModelica的翻译环节。这类问题通常是库开发时针对其他仿真器(如Dymola)编写,未严格遵循Modelica标准语法或适配OpenModelica的解析规则导致的。
内容的提问来源于stack exchange,提问作者Nels0n
相关产品推荐
相关产品推荐

