Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3396 handle properly complex init of variables in 06 file #3397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rosiereflo
Copy link
Contributor

closes #3396

Checklist before requesting a review

use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes

  • unit tests and non-regression tests were added (new model, new feature and bug fix)
  • main documentation was updated (update of input/output file, 3rd party, model, repository organization, solver)
  • example documentations were updated (new example in examples folder)
  • the corresponding milestone was added in the ticket and in this PR
  • if this PR modifies the parameters or inputs/outputs of a model/solver: the corresponding xsl was added in util/xsl and platform DB were updated
  • if this PR modifies a dictionary: the corresponding french dictionary was updated

closes #3396

Signed-off-by: Florentine Rosiere <florentine.rosiere@rte-france.com>
@rosiereflo rosiereflo added this to the v1.7.0 milestone Sep 17, 2024
@rosiereflo rosiereflo requested a review from gaouizer September 17, 2024 12:42
@@ -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<var>\S*)[ ]*\/\* (?P<varName>[\w\$\.()\[\],]*) [\w(),\.]+ \*\/[ ]*=[ ]*(?P<rhs>[^;]+);')
ptrn_assign_var_complex = re.compile(r'^[ ]*data->modelData->(?P<var>\S*)\.attribute[ ]*\/\* (?P<varName>[ \w\$\.()\[\],]*) [\w(),\.\[\]]+ \*\/.start[ ]*=[^;]*;$')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure you are using the group name 'var' from this regex, am I correct?

#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'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming seems a bit confusing : the python variable named var is filled with the data extracted from the regex group named "varName" whereas in the same regex there is another group named "var" which seems to be unused. Is my understanding correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Model compilation] handle complex init in 06 OM file
2 participants