Skip to content
2,917 changes: 246 additions & 2,671 deletions OMPython/ModelicaSystem.py

Large diffs are not rendered by default.

1,937 changes: 55 additions & 1,882 deletions OMPython/OMCSession.py

Large diffs are not rendered by default.

109 changes: 66 additions & 43 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,67 @@
```
import OMPython
omc = OMPython.OMCSessionLocal()
omc.sendExpression("command")
omc.sendExpression("getVersion()")
```

"""

from OMPython.ModelicaSystem import (
LinearizationResult,
ModelicaSystem,
ModelicaSystemOMC,
from OMPython.model_execution import (
ModelExecutionCmd,
ModelicaSystemDoE,
ModelicaDoEOMC,
ModelicaSystemError,
ModelicaSystemRunner,
ModelicaDoERunner,

doe_get_solutions,

ModelicaSystemCmd,
ModelExecutionData,
ModelExecutionException,
)
from OMPython.OMCSession import (
from OMPython.om_session_abc import (
OMPathABC,
OMSessionABC,
OMSessionException,
)
from OMPython.om_session_omc import (
OMCPath,

OMSessionRunner,

OMCSessionABC,

ModelExecutionData,
ModelExecutionException,

OMCSessionCmd,
OMCSessionDocker,
OMCSessionDockerContainer,
OMCSessionException,
OMCSessionLocal,
OMCSessionPort,

OMCSessionWSL,
)
from OMPython.om_session_runner import (
OMPathRunnerBash,
OMPathRunnerLocal,
OMSessionRunner,
)
from OMPython.modelica_system_abc import (
LinearizationResult,
ModelicaSystemABC,
ModelicaSystemError,
)
from OMPython.modelica_system_omc import (
ModelicaSystemOMC,
)
from OMPython.modelica_system_runner import (
ModelicaSystemRunner,
)
from OMPython.modelica_doe_abc import (
ModelicaDoEABC,
)
from OMPython.modelica_doe_omc import (
doe_get_solutions,

OMCSessionWSL,
ModelicaDoEOMC,
)
from OMPython.modelica_doe_runner import (
ModelicaDoERunner,
)

# the imports below are compatibility functionality (OMPython v4.0.0)
from OMPython.ModelicaSystem import (
ModelicaSystem,
ModelicaSystemDoE,
parse_simflags,
)
from OMPython.OMCSession import (
OMCSessionCmd,
OMCSessionException,
OMCSessionZMQ,

OMCProcessLocal,
Expand All @@ -58,42 +77,46 @@

# global names imported if import 'from OMPython import *' is used
__all__ = [
'doe_get_solutions',

'LinearizationResult',

'ModelExecutionCmd',
'ModelExecutionData',
'ModelExecutionException',

'ModelicaSystem',
'ModelicaSystemOMC',
'ModelicaSystemCmd',
'ModelExecutionCmd',
'ModelicaSystemDoE',
'ModelicaDoEABC',
'ModelicaDoEOMC',
'ModelicaDoERunner',
'ModelicaSystemABC',
'ModelicaSystemError',

'ModelicaSystemOMC',
'ModelicaSystemRunner',
'ModelicaDoERunner',

'OMPathABC',
'OMCPath',

'OMSessionRunner',
'OMSessionABC',
'OMSessionException',

'OMCPath',
'OMCSessionABC',

'doe_get_solutions',

'OMCSessionCmd',
'OMCSessionDocker',
'OMCSessionDockerContainer',
'OMCSessionException',
'OMCSessionPort',
'OMCSessionLocal',
'OMCSessionPort',
'OMCSessionWSL',

'OMPathRunnerBash',
'OMPathRunnerLocal',
'OMSessionRunner',

'ModelicaSystem',
'ModelicaSystemDoE',
'parse_simflags',

'OMCSessionCmd',

'OMCSessionException',

'OMCSessionWSL',
'OMCSessionZMQ',

'OMCProcessLocal',
Expand Down
39 changes: 39 additions & 0 deletions OMPython/compatibility_v400.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""
Helper functions for compatibility with OMPython v4.0.0
"""
import warnings
from typing import Optional


def depreciated_class(msg: Optional[str] = None):
"""
Decorator for depreciated / compatibility classes.
"""

def depreciated(cls):
"""
Helper functions to do the decoration part.
"""

class Wrapper(cls):
"""
Wrapper to define the depreciation message.
"""

def __init__(self, *args, **kwargs):
message = f"The class {cls.__name__} is depreciated and will be removed in future versions!"
if msg is not None:
message += f" {msg}"

warnings.warn(
message=message,
category=DeprecationWarning,
stacklevel=3,
)

super().__init__(*args, **kwargs)

return Wrapper

return depreciated
Loading
Loading