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

getModelInstance only dumps the evaluated bindings for structural parameters #10188

Closed
perost opened this issue Feb 10, 2023 · 0 comments · Fixed by #10419
Closed

getModelInstance only dumps the evaluated bindings for structural parameters #10188

perost opened this issue Feb 10, 2023 · 0 comments · Fixed by #10419
Assignees
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature
Milestone

Comments

@perost
Copy link
Member

perost commented Feb 10, 2023

Description

getModelInstance does not have access to the original bindings of structural parameters, only the evaluated ones.

Steps to Reproduce

Call getModelInstance on a model such as this:

model M
  parameter String controller = "Torque";
  Real x if controlMode == 1;
protected
  parameter Integer controlMode = if controller == "Torque" then 1 else -1;
end M;

The binding for controlModel will only be 1 instead of the original binding.

Expected Behavior

The binding for controlModel should be the whole original if-expression, so that e.g. OMEdit can reevaluate it when the user changes the value of controller.

Additional Context

We currently overwrite the original binding expression when we evaluate a binding, and we also keep track of whether a binding is unevaluated, being evaluated, or is evaluated. This could potentially be changed to instead store the evaluated expression as an optional value in the binding.

@perost perost added the COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature label Feb 10, 2023
@perost perost self-assigned this Feb 10, 2023
perost added a commit to perost/OpenModelica that referenced this issue Mar 20, 2023
- Keep references to the original bindings for components in
  getModelInstance, so they can be dumped also for components whose
  bindings are evaluated and overwritten by the frontend.

Fixes OpenModelica#10188
perost added a commit to perost/OpenModelica that referenced this issue Mar 20, 2023
- Keep references to the original bindings for components in
  getModelInstance, so they can be dumped also for components whose
  bindings are evaluated and overwritten by the frontend.

Fixes OpenModelica#10188
@perost perost closed this as completed in 379daf2 Mar 20, 2023
@casella casella added this to the 1.21.0 milestone Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants