diff --git a/src/common/core.py b/src/common/core.py
index c8dfcae3..b391d56e 100644
--- a/src/common/core.py
+++ b/src/common/core.py
@@ -149,7 +149,7 @@ def _exec_algorithm(self, module, algorithm, options):
Exception if algorithm is not a subclass of
common.algorithm_drivers.AlgorithmBase.
"""
- from .algorithm_drivers import AlgorithmBase
+ from pyfmi.algorithm_drivers import AlgorithmBase
if isinstance(algorithm, str):
module = __import__(module, globals(), locals(), [algorithm], 0)
@@ -182,7 +182,7 @@ def _exec_simulate_algorithm(self,
Exception if algorithm is not a subclass of
common.algorithm_drivers.AlgorithmBase.
"""
- from .algorithm_drivers import AlgorithmBase
+ from pyfmi.algorithm_drivers import AlgorithmBase
if isinstance(algorithm, str):
module = __import__(module, globals(), locals(), [algorithm], 0)
diff --git a/src/common/log/__init__.py b/src/common/log/__init__.py
index bdc25805..d1e16cee 100644
--- a/src/common/log/__init__.py
+++ b/src/common/log/__init__.py
@@ -19,7 +19,7 @@
The log analysis toolkit.
"""
-from .parser import parse_xml_log, parse_xml_log, extract_xml_log, parse_fmu_xml_log
-from .prettyprinter import prettyprint_to_file
+from pyfmi.common.log.parser import parse_xml_log, parse_xml_log, extract_xml_log, parse_fmu_xml_log
+from pyfmi.common.log.prettyprinter import prettyprint_to_file
__all__=['parser','tree','prettyprinter']
diff --git a/src/common/log/parser.py b/src/common/log/parser.py
index 18eba0ca..b2a8627e 100644
--- a/src/common/log/parser.py
+++ b/src/common/log/parser.py
@@ -23,7 +23,7 @@
import os
import numpy as np
from distutils.util import strtobool
-from .tree import *
+from pyfmi.common.log.tree import *
from pyfmi.fmi_util import python3_flag
from pyfmi.fmi import FMUException
diff --git a/src/common/log/prettyprinter.py b/src/common/log/prettyprinter.py
index 66d9774d..ac463772 100644
--- a/src/common/log/prettyprinter.py
+++ b/src/common/log/prettyprinter.py
@@ -19,7 +19,7 @@
"""
from numpy import ndarray
-from .tree import *
+from pyfmi.common.log.tree import *
def prettyprint(write, node):
"""Prettyprint a log node to the write callback write."""
diff --git a/src/pyfmi/__init__.py b/src/pyfmi/__init__.py
index 6dee1238..4b1e25e7 100644
--- a/src/pyfmi/__init__.py
+++ b/src/pyfmi/__init__.py
@@ -21,11 +21,11 @@
__all__ = ['fmi_algorithm_drivers', 'examples', 'fmi', 'common']
#Import the model class allowing for users to type e.g.,: from pyfmi import FMUModelME1
-from .fmi import load_fmu, FMUModelME1, FMUModelME2
-from .fmi import FMUModelCS1, FMUModelCS2
-from .fmi_coupled import CoupledFMUModelME2
-from .master import Master
-from .fmi_extended import FMUModelME1Extended
+from pyfmi.fmi import load_fmu, FMUModelME1, FMUModelME2
+from pyfmi.fmi import FMUModelCS1, FMUModelCS2
+from pyfmi.fmi_coupled import CoupledFMUModelME2
+from pyfmi.master import Master
+from pyfmi.fmi_extended import FMUModelME1Extended
import numpy as N
import os.path
import sys
diff --git a/src/pyfmi/fmi.pyx b/src/pyfmi/fmi.pyx
index 5eff2f85..f2ac4163 100644
--- a/src/pyfmi/fmi.pyx
+++ b/src/pyfmi/fmi.pyx
@@ -14,6 +14,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
"""
Module containing the FMI interface Python wrappers.
"""
diff --git a/src/pyfmi/fmi_coupled.pyx b/src/pyfmi/fmi_coupled.pyx
index 69cd110e..13829f9a 100644
--- a/src/pyfmi/fmi_coupled.pyx
+++ b/src/pyfmi/fmi_coupled.pyx
@@ -15,8 +15,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
import pyfmi.fmi as fmi
-from fmi cimport FMUModelME2
+from pyfmi.fmi cimport FMUModelME2
cimport fmil_import as FMIL
from pyfmi.fmi_util import cpr_seed, enable_caching, Graph
diff --git a/src/pyfmi/fmi_extended.pyx b/src/pyfmi/fmi_extended.pyx
index bfad504b..01ee7045 100644
--- a/src/pyfmi/fmi_extended.pyx
+++ b/src/pyfmi/fmi_extended.pyx
@@ -14,6 +14,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
"""
Module containing the FMI interface Python wrappers.
"""
@@ -30,9 +33,9 @@ cimport numpy as N
N.import_array()
cimport fmil_import as FMIL
-from fmi cimport FMUModelME1
-from fmi import FMUException
-from fmi import FMI_OK, FMI_DEFAULT_LOG_LEVEL, FMI_ME
+from pyfmi.fmi cimport FMUModelME1
+from pyfmi.fmi import FMUException
+from pyfmi.fmi import FMI_OK, FMI_DEFAULT_LOG_LEVEL, FMI_ME
cdef class FMUModelME1Extended(FMUModelME1):
diff --git a/src/pyfmi/fmi_util.pyx b/src/pyfmi/fmi_util.pyx
index c6bbd448..2150f406 100644
--- a/src/pyfmi/fmi_util.pyx
+++ b/src/pyfmi/fmi_util.pyx
@@ -14,6 +14,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
"""
Module containing the FMI interface Python wrappers.
"""
@@ -34,7 +37,7 @@ from pyfmi.fmi cimport FMUModelME2, FMUModelBase
import functools
import marshal
-import fmi
+import pyfmi.fmi as fmi
import sys
python3_flag = True if sys.hexversion > 0x03000000 else False
diff --git a/src/pyfmi/master.pyx b/src/pyfmi/master.pyx
index 838ef17f..79f4976f 100644
--- a/src/pyfmi/master.pyx
+++ b/src/pyfmi/master.pyx
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
import pyfmi.fmi as fmi
from pyfmi.common.algorithm_drivers import OptionBase, InvalidAlgorithmOptionException, AssimuloSimResult
from pyfmi.common.io import ResultDymolaTextual, ResultHandlerFile, ResultHandlerDummy, ResultHandlerBinaryFile, ResultDymolaBinary
@@ -37,10 +39,10 @@ import scipy.sparse.linalg as splin
import scipy.optimize as sopt
import scipy.version
-from fmi cimport FMUModelCS2
+from pyfmi.fmi cimport FMUModelCS2
from cpython cimport bool
cimport fmil_import as FMIL
-from fmi_util import Graph
+from pyfmi.fmi_util import Graph
from cython.parallel import prange, parallel
IF WITH_OPENMP:
@@ -373,7 +375,7 @@ cdef class Master:
cdef public dict statistics, models_id_mapping
cdef public object opts
cdef public object models_dict, L, L_discrete
- cdef public object I
+ cdef public object _ident_matrix
cdef public object y_prev, yd_prev, input_traj
cdef public object DL_prev
cdef public int algebraic_loops, storing_fmu_state
@@ -466,7 +468,7 @@ cdef class Master:
self.y_prev = None
self.input_traj = None
- self.I = sp.eye(self._len_inputs, self._len_outputs, format="csr") #y = Cx + Du , u = Ly -> DLy DL[inputsXoutputs]
+ self._ident_matrix = sp.eye(self._len_inputs, self._len_outputs, format="csr") #y = Cx + Du , u = Ly -> DLy DL[inputsXoutputs]
self._error_data = {"time":[], "error":[], "step-size":[], "rejected":[]}
@@ -853,7 +855,7 @@ cdef class Master:
else:
return C.dot(xd)+D.dot(ud)
else: #First step
- return splin.spsolve((self.I-D.dot(self.L)),C.dot(xd)).reshape((-1,1))
+ return splin.spsolve((self._ident_matrix-D.dot(self.L)),C.dot(xd)).reshape((-1,1))
y_last = self.get_last_y()
if y_last is not None:
@@ -898,7 +900,7 @@ cdef class Master:
if ud is not None and udd is not None:
return C.dot(A.dot(xd))+C.dot(B.dot(ud+self.get_current_step_size()*udd))+D.dot(udd)
else: #First step
- return splin.spsolve((self.I-D.dot(self.L)),C.dot(A.dot(xd)+B.dot(self.L.dot(yd_cur)))).reshape((-1,1))
+ return splin.spsolve((self._ident_matrix-D.dot(self.L)),C.dot(A.dot(xd)+B.dot(self.L.dot(yd_cur)))).reshape((-1,1))
yd_last = self.get_last_yd()
if yd_last is not None:
@@ -965,7 +967,7 @@ cdef class Master:
z = yd - D.dot(uhat)
- yd = splin.spsolve((self.I-DL),z).reshape((-1,1))
+ yd = splin.spsolve((self._ident_matrix-DL),z).reshape((-1,1))
"""
return ydd
@@ -980,7 +982,7 @@ cdef class Master:
z = yd - D.dot(uhat)
- yd = splin.spsolve((self.I-DL),z).reshape((-1,1))
+ yd = splin.spsolve((self._ident_matrix-DL),z).reshape((-1,1))
return yd
@@ -1016,7 +1018,7 @@ cdef class Master:
z = y - DL.dot(y_prev)
#z = y - matvec(DL, y_prev.ravel())
- y = splin.spsolve((self.I-DL),z).reshape((-1,1))
+ y = splin.spsolve((self._ident_matrix-DL),z).reshape((-1,1))
#y = splin.lsqr((sp.eye(*DL.shape)-DL),z)[0].reshape((-1,1))
elif self.algebraic_loops and self.support_directional_derivatives:
@@ -1339,15 +1341,15 @@ cdef class Master:
C = self.compute_global_C()
if C is not None:
C = C.todense()
- I = np.eye(*DL.shape)
- LIDLC = self.L.dot(lin.solve(I-DL,C))
+ _ident_matrix = np.eye(*DL.shape)
+ LIDLC = self.L.dot(lin.solve(_ident_matrix-DL,C))
print(" , rho(L(I-DL)^(-1)C)=%s"%(str(numpy.linalg.eig(LIDLC)[0])))
A = self.compute_global_A()
B = self.compute_global_B()
if C is not None and A is not None and B is not None:
A = A.todense(); B = B.todense()
eAH = slin.expm(A*step_size)
- K1 = lin.solve(I-DL,C)
+ K1 = lin.solve(_ident_matrix-DL,C)
K2 = lin.solve(A,(eAH-np.eye(*eAH.shape)).dot(B.dot(self.L.todense())))
R1 = np.hstack((eAH, K1))
R2 = np.hstack((K2.dot(eAH), K2.dot(K1)))
diff --git a/src/pyfmi/simulation/assimulo_interface.pxd b/src/pyfmi/simulation/assimulo_interface.pxd
index 044e12c0..91f7c0d6 100644
--- a/src/pyfmi/simulation/assimulo_interface.pxd
+++ b/src/pyfmi/simulation/assimulo_interface.pxd
@@ -18,6 +18,7 @@
import numpy as N
cimport numpy as N
+import logging
from pyfmi.fmi cimport FMUModelME2
@@ -33,7 +34,6 @@ if assimulo_present:
from assimulo.problem import Implicit_Problem
from assimulo.problem import Explicit_Problem
from assimulo.problem cimport cExplicit_Problem
- from assimulo.exception import *
else:
class Implicit_Problem:
pass
diff --git a/src/pyfmi/simulation/assimulo_interface.pyx b/src/pyfmi/simulation/assimulo_interface.pyx
index 3b93e989..4928610a 100644
--- a/src/pyfmi/simulation/assimulo_interface.pyx
+++ b/src/pyfmi/simulation/assimulo_interface.pyx
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
+
"""
This file contains code for mapping FMUs to the Problem specifications
required by Assimulo.
@@ -54,7 +56,7 @@ if assimulo_present:
from assimulo.problem import Implicit_Problem
from assimulo.problem import Explicit_Problem
from assimulo.problem cimport cExplicit_Problem
- from assimulo.exception import *
+ from assimulo.exception import AssimuloRecoverableError, TerminateSimulation
else:
class Implicit_Problem:
pass