diff --git a/dynawo/sources/ModelicaCompiler/Scripts_OMC_1_13_2/readerOMC.py b/dynawo/sources/ModelicaCompiler/Scripts_OMC_1_13_2/readerOMC.py index 97cdd5ecbfa..3675ac59e26 100755 --- a/dynawo/sources/ModelicaCompiler/Scripts_OMC_1_13_2/readerOMC.py +++ b/dynawo/sources/ModelicaCompiler/Scripts_OMC_1_13_2/readerOMC.py @@ -1020,6 +1020,7 @@ def read_06inz_c_file(self): # Find functions of type MODEL_NAME_eqFunction_N and variable assignment expressions # Regular expression to recognize a line of type var = rhs ptrn_assign_var = re.compile(r'^[ ]*data->localData(?P\S*)[ ]*\/\* (?P[\w\$\.()\[\],]*) [\w(),\.]+ \*\/[ ]*=[ ]*(?P[^;]+);') + ptrn_assign_var_complex = re.compile(r'^[ ]*data->modelData->(?P\S*)\.attribute[ ]*\/\* (?P[ \w\$\.()\[\],]*) [\w(),\.\[\]]+ \*\/.start[ ]*=[^;]*;$') ptrn_param = re.compile(r'^[ ]*data->simulationInfo->(?P\S*)[ ]*\/\* (?P[ \w\$\.()\[\],]*) PARAM \*\/[ ]*=[ ]*(?P[^;]+);') for init_file in self._06inz_c_file: with open(init_file, 'r') as f: @@ -1039,6 +1040,14 @@ def read_06inz_c_file(self): (list_body, depend) = replace_dynamic_indexing(list_body) for line in list_body: + #Sometime a complex init ends up in 06... + #data->modelData->realVarsData[...].attribute.start = data->simulationInfo->realParameter[..]; + #data->localData[0]->realVars[...] = data->modelData->realVarsData[...].attribute.start; + if ptrn_assign_var_complex.search(line) is not None: + match = re.search(ptrn_assign_var_complex, line) + var = str(match.group('varName')) + self.var_init_val[ var ] = list_body + break if ptrn_assign_var.search(line) is not None: match = re.search(ptrn_assign_var, line) var = str(match.group('varName'))