Skip to content

Commit 33ea460

Browse files
committed
[ModelicaSystem] remove class variable _xml_file
1 parent 3133f61 commit 33ea460

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

OMPython/ModelicaSystem.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ def __init__(
383383
if not isinstance(lmodel, list):
384384
raise ModelicaSystemError(f"Invalid input type for lmodel: {type(lmodel)} - list expected!")
385385

386-
self._xml_file = None
387386
self._lmodel = lmodel # may be needed if model is derived from other model
388387
self._model_name = modelName # Model class name
389388
self._file_name = pathlib.Path(fileName).resolve() if fileName is not None else None # Model file/package name
@@ -482,8 +481,6 @@ def buildModel(self, variableFilter: Optional[str] = None):
482481

483482
xml_file = pathlib.Path(buildModelResult[0]).parent / buildModelResult[1]
484483
self._xmlparse(xml_file=xml_file)
485-
# TODO: remove _xml_file?!
486-
self._xml_file = xml_file
487484

488485
def sendExpression(self, expr: str, parsed: bool = True):
489486
try:
@@ -1549,7 +1546,8 @@ def linearize(self, lintime: Optional[float] = None, simflags: Optional[str] = N
15491546
compatibility, because linearize() used to return `[A, B, C, D]`.
15501547
"""
15511548

1552-
if self._xml_file is None:
1549+
if len(self._quantities) == 0:
1550+
# if self._quantities has no content, the xml file was not parsed; see self._xmlparse()
15531551
raise ModelicaSystemError(
15541552
"Linearization cannot be performed as the model is not build, "
15551553
"use ModelicaSystem() to build the model first"

0 commit comments

Comments
 (0)