Skip to content

Commit 59ff73b

Browse files
authored
add linearFile to system path (#197)
1 parent bd17a66 commit 59ff73b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

OMPython/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,9 @@ def linearize(self, lintime = None, simflags= None): # 22
17481748
# this function is called from the generated python code linearized_model.py at runtime,
17491749
# to improve the performance by directly reading the matrices A, B, C and D from the julia code and avoid building the linearized modelica model
17501750
try:
1751+
## add the generated linearfile directory to system path, as running from script does not find the module
1752+
## https://github.com/OpenModelica/OMPython/issues/196
1753+
sys.path.append(os.path.dirname(linearFile))
17511754
from linearized_model import linearized_model
17521755
result = linearized_model()
17531756
(n, m, p, x0, u0, A, B, C, D, stateVars, inputVars, outputVars) = result

0 commit comments

Comments
 (0)