@@ -788,7 +788,7 @@ def sendExpression(self, command, parsed=True):
788
788
789
789
790
790
class ModelicaSystem (object ):
791
- def __init__ (self , fileName = None , modelName = None , lmodel = [], useCorba = False , commandLineOptions = None ): # 1
791
+ def __init__ (self , fileName = None , modelName = None , lmodel = [], useCorba = False , commandLineOptions = None , variableFilter = None ): # 1
792
792
"""
793
793
"constructor"
794
794
It initializes to load file and build a model, generating object, exe, xml, mat, and json files. etc. It can be called :
@@ -846,6 +846,8 @@ def __init__(self, fileName=None, modelName=None, lmodel=[], useCorba=False, com
846
846
self .outputFlag = False
847
847
self .csvFile = '' # for storing inputs condition
848
848
self .resultfile = "" # for storing result file
849
+ self .variableFilter = variableFilter
850
+
849
851
if not os .path .exists (self .fileName ): # if file does not eixt
850
852
print ("File Error:" + os .path .abspath (self .fileName ) + " does not exist!!!" )
851
853
return
@@ -920,9 +922,17 @@ def __loadingModel(self):
920
922
print (loadmodelError )
921
923
self .buildModel ()
922
924
923
- def buildModel (self ):
925
+ def buildModel (self , variableFilter = None ):
926
+ if variableFilter is not None :
927
+ self .variableFilter = variableFilter
928
+
929
+ if self .variableFilter is not None :
930
+ varFilter = "variableFilter=" + "\" " + self .variableFilter + "\" "
931
+ else :
932
+ varFilter = ".*"
933
+
924
934
# buildModelResult=self.getconn.sendExpression("buildModel("+ mName +")")
925
- buildModelResult = self .requestApi ("buildModel" , self .modelName )
935
+ buildModelResult = self .requestApi ("buildModel" , self .modelName , properties = varFilter )
926
936
buildModelError = self .requestApi ("getErrorString" )
927
937
# Issue #145. Always print the getErrorString since it might contains build warnings.
928
938
if buildModelError :
0 commit comments