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

- Add a simulate_modelica function for simulation the model

parent 45aa3db8
No related branches found
No related tags found
No related merge requests found
......@@ -3,10 +3,33 @@ import os
import sys
sys.path.append(r"D:\HIWI\Git\data-processing\dataprocessing")
sys.path.append(r"D:\HIWI\Git\python-for-modelica-dev_interface\Py4Mod\py4mod")
from ModelicaModel import ModelicaModel
from validationtools import *
from readtools import *
os.chdir(r"D:\HIWI\Git")
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()
print("Test Start")
# We need to extract all the result files from git now
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment