@@ -388,7 +388,6 @@ def __init__(
388
388
self ._lmodel = lmodel # may be needed if model is derived from other model
389
389
self ._model_name = modelName # Model class name
390
390
self ._file_name = pathlib .Path (fileName ).resolve () if fileName is not None else None # Model file/package name
391
- self ._has_inputs = False # for model with input quantity
392
391
self ._simulated = False # True if the model has already been simulated
393
392
self ._csvFile : Optional [pathlib .Path ] = None # for storing inputs condition
394
393
self ._result_file : Optional [pathlib .Path ] = None # for storing result file
@@ -969,7 +968,7 @@ def simulate(self,
969
968
970
969
om_cmd .arg_set (key = "overrideFile" , val = overrideFile .as_posix ())
971
970
972
- if self ._has_inputs : # if model has input quantities
971
+ if self ._inputs : # if model has input quantities
973
972
for i in self ._inputs :
974
973
val = self ._inputs [i ]
975
974
if val is None :
@@ -1334,8 +1333,6 @@ def setInputs(
1334
1333
else :
1335
1334
raise ModelicaSystemError (f"Data cannot be evaluated for { repr (key )} : { repr (val )} " )
1336
1335
1337
- self ._has_inputs = True
1338
-
1339
1336
return True
1340
1337
1341
1338
def _createCSVData (self ) -> pathlib .Path :
@@ -1521,13 +1518,13 @@ def load_module_from_path(module_name, file_path):
1521
1518
1522
1519
om_cmd .arg_set (key = "overrideFile" , val = overrideLinearFile .as_posix ())
1523
1520
1524
- if self ._has_inputs :
1525
- nameVal = self . getInputs ()
1526
- for n in nameVal :
1527
- tupleList = nameVal . get ( n )
1528
- if tupleList is not None :
1529
- for l in tupleList :
1530
- if l [0 ] < float (self ._simulate_options ["startTime" ]):
1521
+ inputs = self .getInputs ()
1522
+ if inputs :
1523
+ for key in inputs :
1524
+ data = inputs [ key ]
1525
+ if data is not None :
1526
+ for value in data :
1527
+ if value [0 ] < float (self ._simulate_options ["startTime" ]):
1531
1528
raise ModelicaSystemError ('Input time value is less than simulation startTime' )
1532
1529
self ._csvFile = self ._createCSVData ()
1533
1530
om_cmd .arg_set (key = "csvInput" , val = self ._csvFile .as_posix ())
0 commit comments