From efe1e118ef179bb98c1569fb6a8ac4356e494cc6 Mon Sep 17 00:00:00 2001 From: Bichen Li <bichen.li@eonerc.rwth-aachen.de> Date: Fri, 13 Jul 2018 15:08:27 +0200 Subject: [PATCH] - Add the simulate funciton --- .../ModPowerSystemsCI/RunOMSimulationCI.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Scripts/ModPowerSystemsCI/RunOMSimulationCI.py b/Scripts/ModPowerSystemsCI/RunOMSimulationCI.py index e69de29..f4146c7 100644 --- a/Scripts/ModPowerSystemsCI/RunOMSimulationCI.py +++ b/Scripts/ModPowerSystemsCI/RunOMSimulationCI.py @@ -0,0 +1,23 @@ +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 -- GitLab