@@ -116,7 +116,6 @@ def __init__(
116
116
commandLineOptions : Optional [str ] = None ,
117
117
variableFilter : Optional [str ] = None ,
118
118
customBuildDirectory : Optional [str | os .PathLike ] = None ,
119
- verbose : bool = True ,
120
119
omhome : Optional [str ] = None ,
121
120
session : Optional [OMCSessionBase ] = None
122
121
):
@@ -143,7 +142,6 @@ def __init__(
143
142
customBuildDirectory: Path to a directory to be used for temporary
144
143
files like the model executable. If left unspecified, a tmp
145
144
directory will be created.
146
- verbose: If True, enable verbose logging.
147
145
omhome: OPENMODELICAHOME value to be used when creating the OMC
148
146
session.
149
147
session: OMC session to be used. If unspecified, a new session
@@ -173,8 +171,6 @@ def __init__(
173
171
self .linearstates = [] # linearization states list
174
172
self .tempdir = ""
175
173
176
- self ._verbose = verbose
177
-
178
174
if session is not None :
179
175
if not isinstance (session , OMCSessionZMQ ):
180
176
raise ModelicaSystemError ("Invalid session data provided!" )
@@ -300,12 +296,13 @@ def _run_cmd(self, cmd: list, timeout: Optional[int] = None):
300
296
timeout = timeout )
301
297
stdout = cmdres .stdout .strip ()
302
298
stderr = cmdres .stderr .strip ()
299
+
300
+ logger .debug ("OM output for command %s:\n %s" , cmd , stdout )
301
+
303
302
if cmdres .returncode != 0 :
304
303
raise ModelicaSystemError (f"Error running command { cmd } : return code = { cmdres .returncode } " )
305
304
if stderr :
306
305
raise ModelicaSystemError (f"Error running command { cmd } : { stderr } " )
307
- if self ._verbose and stdout :
308
- logger .info ("OM output for command %s:\n %s" , cmd , stdout )
309
306
except subprocess .TimeoutExpired :
310
307
raise ModelicaSystemError (f"Timeout running command { repr (cmd )} " )
311
308
except Exception as ex :
@@ -321,8 +318,7 @@ def buildModel(self, variableFilter=None):
321
318
varFilter = 'variableFilter=".*"'
322
319
logger .debug ("varFilter=%s" , varFilter )
323
320
buildModelResult = self .requestApi ("buildModel" , self .modelName , properties = varFilter )
324
- if self ._verbose :
325
- logger .info ("OM model build result: %s" , buildModelResult )
321
+ logger .debug ("OM model build result: %s" , buildModelResult )
326
322
327
323
self .xmlFile = pathlib .Path (buildModelResult [0 ]).parent / buildModelResult [1 ]
328
324
self .xmlparse ()
@@ -821,12 +817,10 @@ def setParameters(self, pvals): # 14
821
817
def isParameterChangeable (self , name , value ):
822
818
q = self .getQuantities (name )
823
819
if q [0 ]["changeable" ] == "false" :
824
- if self ._verbose :
825
- logger .info ("setParameters() failed : It is not possible to set "
826
- f'the following signal "{ name } ", It seems to be structural, final, '
827
- "protected or evaluated or has a non-constant binding, use sendExpression("
828
- f"setParameterValue({ self .modelName } , { name } , { value } ), "
829
- "parsed=false) and rebuild the model using buildModel() API" )
820
+ logger .verbose (f"setParameters() failed : It is not possible to set the following signal { repr (name )} . "
821
+ "It seems to be structural, final, protected or evaluated or has a non-constant binding, "
822
+ f"use sendExpression(\" setParameterValue({ self .modelName } , { name } , { value } )\" , "
823
+ "parsed=False) and rebuild the model using buildModel() API" )
830
824
return False
831
825
return True
832
826
0 commit comments