Skip to content
Snippets Groups Projects
Commit efe1e118 authored by Bichen Li's avatar Bichen Li
Browse files

- Add the simulate funciton

parent d66d60ff
No related branches found
No related tags found
No related merge requests found
import os
import sys
sys.path.append(r"D:\HIWI\Git\python-for-modelica-dev_interface\Py4Mod\py4mod")
from ModelicaModel import ModelicaModel
def simulate_modelica(model_name, model_path):
interface = ModelicaModel(model_name, model_path)
# Initialization
interface.createInterface("OPENMODELICA")
interface.loadFile(model_path + '\ModPowerSystems\package.mo')
# Redirection
cwd = os.getcwd()
wd = os.path.join(cwd, 'test')
if not os.path.exists(wd):
os.makedirs(wd)
interface.changeWorkingDirectory(wd.replace("\\", "/"))
# Build & Run
interface.buildModel()
interface.simulate()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment