I want to simulate a OpenModelica Model in Python with the help of OMPython. The following is my code:
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()
And I am getting the following error:
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
The error is at line,
mod = ModelicaSystem("Li_ionBattery.mo", "Li_ionBattery.TestBench.VaryingCurrent")as it reports,
Error: Class Li_ionBattery.TestBench.VaryingCurrent not found in scope <top>.Make sure the class
Li_ionBattery.TestBench.VaryingCurrentexists inLi_ionBattery.mo.