【发布时间】:2021-09-22 10:23:46
【问题描述】:
很久以前,我使用 JModelica/pymodelica 将 modelica 模型编译成 FMU,使用一个简单的 python 脚本。现在我了解到 JModelica 作为一个开源项目已停止使用。 (运行 FMU 的库似乎已经扩展到新的开源项目,但我没有找到编译器。)
是否有最新、开源且同样简单的替代方案?
我从后面得到的脚本如下,我希望能找到一些东西让我将它更新到 Python3 并继续我多年前离开的地方。
#! /local/opt/modelica/bin/jm_python.sh
# Import the compiler function
from pymodelica import compile_fmu
import optparse
parser = optparse.OptionParser()
(options,args) = parser.parse_args()
# Specify Modelica model and model file (.mo or .mop)
mo_file = args[0]
model_name = mo_file.split(".")[0]
print mo_file, model_name
# Compile the model and save the return argument, which is the file name of the FMU
my_fmu = compile_fmu(model_name, mo_file, target='cs')
【问题讨论】:
标签: python modelica fmi jmodelica pymodelica