Commit 280bb40d authored by Bichen Li's avatar Bichen Li

- Add a simulate_modelica function for simulation the model

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