@@ -116,7 +116,6 @@ def __init__(
116116 commandLineOptions : Optional [str ] = None ,
117117 variableFilter : Optional [str ] = None ,
118118 customBuildDirectory : Optional [str | os .PathLike ] = None ,
119- verbose : bool = True ,
120119 omhome : Optional [str ] = None ,
121120 session : Optional [OMCSessionBase ] = None
122121 ):
@@ -143,7 +142,6 @@ def __init__(
143142 customBuildDirectory: Path to a directory to be used for temporary
144143 files like the model executable. If left unspecified, a tmp
145144 directory will be created.
146- verbose: If True, enable verbose logging.
147145 omhome: OPENMODELICAHOME value to be used when creating the OMC
148146 session.
149147 session: OMC session to be used. If unspecified, a new session
@@ -173,8 +171,6 @@ def __init__(
173171 self .linearstates = [] # linearization states list
174172 self .tempdir = ""
175173
176- self ._verbose = verbose
177-
178174 if session is not None :
179175 if not isinstance (session , OMCSessionZMQ ):
180176 raise ModelicaSystemError ("Invalid session data provided!" )
@@ -300,12 +296,13 @@ def _run_cmd(self, cmd: list, timeout: Optional[int] = None):
300296 timeout = timeout )
301297 stdout = cmdres .stdout .strip ()
302298 stderr = cmdres .stderr .strip ()
299+
300+ logger .debug ("OM output for command %s:\n %s" , cmd , stdout )
301+
303302 if cmdres .returncode != 0 :
304303 raise ModelicaSystemError (f"Error running command { cmd } : return code = { cmdres .returncode } " )
305304 if stderr :
306305 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 )
309306 except subprocess .TimeoutExpired :
310307 raise ModelicaSystemError (f"Timeout running command { repr (cmd )} " )
311308 except Exception as ex :
@@ -321,8 +318,7 @@ def buildModel(self, variableFilter=None):
321318 varFilter = 'variableFilter=".*"'
322319 logger .debug ("varFilter=%s" , varFilter )
323320 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 )
326322
327323 self .xmlFile = pathlib .Path (buildModelResult [0 ]).parent / buildModelResult [1 ]
328324 self .xmlparse ()
@@ -821,12 +817,10 @@ def setParameters(self, pvals): # 14
821817 def isParameterChangeable (self , name , value ):
822818 q = self .getQuantities (name )
823819 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" )
830824 return False
831825 return True
832826
0 commit comments