Skip to content

Commit f958964

Browse files
committed
[ModelicaSystem] remove class variable _xml_file
1 parent 111326f commit f958964

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
@@ -483,8 +482,6 @@ def buildModel(self, variableFilter: Optional[str] = None):
483482

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

489486
def sendExpression(self, expr: str, parsed: bool = True):
490487
try:
@@ -1460,7 +1457,8 @@ def load_module_from_path(module_name, file_path):
14601457

14611458
return module_def
14621459

1463-
if self._xml_file is None:
1460+
if len(self._quantities) == 0:
1461+
# if self._quantities has no content, the xml file was not parsed; see self._xmlparse()
14641462
raise ModelicaSystemError(
14651463
"Linearization cannot be performed as the model is not build, "
14661464
"use ModelicaSystem() to build the model first"

0 commit comments

Comments
 (0)