Python错误:未生成应用程序文件



我想在OMPython的帮助下用Python模拟OpenModelica模型。以下是我的代码:

import matplotlib.pyplot as plt  
import OMPython
from OMPython import OMCSessionZMQ
from OMPython import ModelicaSystem
omc = OMCSessionZMQ()
mod = ModelicaSystem("Li_ionBattery.mo", "Li_ionBattery.TestBench.VaryingCurrent")
Li_simulation = mod.getSimulationOptions()
mod.setSimulationOptions(["stopTime=2000", "stepSize=50"])
variables_vary = mod.getQuantities()
Parameters_vary = mod.getParameters() 
continous_vary = mod.getContinuous() 
mod.setParameters(["nMC_Data.Q_nom=11", "nMC_Data.Rs=0.0003"])
mod.simulate()

我得到以下错误:

Notification: Li_ionBattery requested package Modelica of version 3.2.2. Modelica 3.2.3 is used instead which states that it is fully compatible without conversion script needed.
Error: Class Li_ionBattery.TestBench.VaryingCurrent not found in scope <top>.
Error: Class Li_ionBattery.TestBench.VaryingCurrent not found in scope <TOP>.
stopTime !is not a simulation-option variable
Traceback (most recent call last):

raise Exception("Error: application file not generated yet")
Exception: Error: application file not generated yet

错误在行

mod = ModelicaSystem("Li_ionBattery.mo", "Li_ionBattery.TestBench.VaryingCurrent")

据报道,

Error: Class Li_ionBattery.TestBench.VaryingCurrent not found in scope <top>.

确保类Li_ionBattery.TestBench.VaryingCurrent存在于Li_ionBattery.mo中。

相关内容

最新更新