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

Final Complex parameters not updating after compilation #7156

Closed
tinrabuzin opened this issue Feb 14, 2021 · 2 comments
Closed

Final Complex parameters not updating after compilation #7156

tinrabuzin opened this issue Feb 14, 2021 · 2 comments

Comments

@tinrabuzin
Copy link

Description

When changing the real and imaginary variables after compilation, the complex number does not change.

Steps to reproduce

If one compiles the example model below, and after compilation tries to change a or b, this change is not reflected in cplx1. If I am not mistaken, cplx1 should be updated accordingly. At least that is what happens with Real parameters.

model example_complex
parameter Real a=1;
parameter Real b=1;

final parameter Complex cplx1 = Complex(a,b);
equation

end example_complex;

I am running OpenModelica v1.16.2.

perost added a commit to perost/OpenModelica that referenced this issue Feb 14, 2021
- Try to inline operator record constructors instead of evaluating them
  when trying to split them during flattening.
perost added a commit to perost/OpenModelica that referenced this issue Feb 14, 2021
- Try to inline operator record constructors instead of evaluating them
  when trying to split them during flattening.
perost added a commit to perost/OpenModelica that referenced this issue Feb 14, 2021
- Try to inline operator record constructors instead of evaluating them
  when trying to split them during flattening.
@perost
Copy link
Member

perost commented Feb 14, 2021

My fix is causing some minor changes in some of our test cases. It's probably fine, but I will do some more testing to make sure before merging the PR.

perost added a commit to perost/OpenModelica that referenced this issue Feb 15, 2021
- Try to inline operator record constructors instead of evaluating them
  when trying to split them during flattening.
@perost perost closed this as completed in a489e50 Feb 15, 2021
@tinrabuzin
Copy link
Author

tinrabuzin commented Feb 23, 2021

I found another related problem for the following model

model test
parameter Real phi = Modelica.Constants.pi/4;
final parameter Complex x = Complex(cos(phi),sin(phi))*1;
end test;

If *1 is removed from the binding expression, the change in phi is reflected. With *1 included, x is not updated.

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

No branches or pull requests

2 participants