【发布时间】:2018-02-05 14:51:19
【问题描述】:
我正在从 dymola python 界面运行这个示例(见下文),如何将输出绘制/存储在表格/文本文件或类似文件中?
from dymola.dymola_interface import DymolaInterface
from dymola.dymola_exception import DymolaException
dymola = None
try:
# Instantiate the Dymola interface and start Dymola
dymola = DymolaInterface()
# Call a function in Dymola and check its return value
result = dymola.simulateModel("Modelica.Mechanics.Rotational.Examples.CoupledClutches")
if not result:
print("Simulation failed. Below is the translation log.")
log = dymola.getLastError()
print(log)
exit(1)
dymola.plot(["J1.w", "J2.w", "J3.w", "J4.w"])
dymola.ExportPlotAsImage("C:/temp/plot.png")
print("OK")
except DymolaException as ex:
print("Error: " + str(ex))
finally:
if dymola is not None:
dymola.close()
dymola = None
【问题讨论】:
标签: python output modelica dymola