@@ -314,8 +314,8 @@ def parse_simflags(simflags: str) -> dict[str, Optional[str | dict[str, str]]]:
314314class ModelicaSystem :
315315 def __init__ (
316316 self ,
317- modelName : str ,
318317 fileName : Optional [str | os .PathLike | pathlib .Path ] = None ,
318+ modelName : Optional [str ] = None ,
319319 lmodel : Optional [list [str | tuple [str , str ]]] = None ,
320320 commandLineOptions : Optional [str ] = None ,
321321 variableFilter : Optional [str ] = None ,
@@ -330,10 +330,10 @@ def __init__(
330330 xml files, etc.
331331
332332 Args:
333- modelName: The name of the model class. If it is contained within
334- a package, "PackageName.ModelName" should be used.
335333 fileName: Path to the model file. Either absolute or relative to
336334 the current working directory.
335+ modelName: The name of the model class. If it is contained within
336+ a package, "PackageName.ModelName" should be used.
337337 lmodel: List of libraries to be loaded before the model itself is
338338 loaded. Two formats are supported for the list elements:
339339 lmodel=["Modelica"] for just the library name
@@ -360,9 +360,13 @@ def __init__(
360360 mod = ModelicaSystem("ModelicaModel.mo", "modelName", ["Modelica"])
361361 mod = ModelicaSystem("ModelicaModel.mo", "modelName", [("Modelica","3.2.3"), "PowerSystems"])
362362 """
363+
363364 if fileName is None and modelName is None and not lmodel : # all None
364365 raise ModelicaSystemError ("Cannot create ModelicaSystem object without any arguments" )
365366
367+ if modelName is None :
368+ raise ModelicaSystemError ("A modelname must be provided (argument modelName)!" )
369+
366370 self .quantitiesList = []
367371 self .paramlist = {}
368372 self .inputlist = {}
@@ -421,7 +425,7 @@ def __init__(
421425 self .loadFile (fileName = self .fileName )
422426
423427 # allow directly loading models from MSL without fileName
424- else :
428+ elif fileName is None and modelName is not None :
425429 self .loadLibrary (lmodel = self .lmodel )
426430
427431 if build :
0 commit comments