-
Notifications
You must be signed in to change notification settings - Fork 164
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
Avoid function names with single-quoted idents in ComplexMath #3047
Conversation
I tried this in OpenModelica. It does not like reductions using |
Does this mean we cannot fix #883 according to spec 3.4? |
Well, I think it can be fixed according to the spec (just skip the leading the dot). But then Dymola and SimulationX might have problems because they find a different |
Hm, I am confused. In modelica/ModelicaSpecification#880 (comment) @perost reported that it (i.e., abs with a leading dot = .abs) works in OpenModelica as expected. |
@sjoelund is talking about reduction expressions, i.e. |
cf99051
to
d146777
Compare
Hence my confusion, since I interpreted that comment rather generously that built-in operators with a leading dot work in OM, no matter if it is a reduction operator or not. |
@beutlich: I'm pushing in support for fully qualified reduction expressions in OM now. The specification might technically not say that it's allowed, but I suspect that's just an oversight. Our current frontend used to give a rather confusing error message in that case, while our new frontend allowed it. So I decided to just allow it everywhere to be consistent. |
@henrikt-ma The above test model also fails in Wolfram SystemModeler. Can you have a look at it?
|
@beutlich that's the behaviour of OpenModelica (which WSM still has parts of). Easy to fix, if the specification is clarified... |
I confirm that this is a tool issue. The code itself is fine. I will be fixed in next release. |
d146777
to
4ade6cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have nothing to say in addition to what @sjoelund has already said.
@henrikt-ma Are you going to fix it in Wolfram SystemModeler? |
Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
@HansOlsson Please confirm the tool-issue such that I know you'll be going to fix it. Thanks. |
Yes, as far as I can see that tool-issue is fixed. Modelica.Blocks.Sources.Sine amplitude( I assume that issue is unrelated, and I could continue check - but it will be hard to know what issues are related to this PR and which ones are unrelated. |
(To be clear, there was an issue and it was corrected for the next release. However, I haven't verified that is the only issue.) |
Using |
Yes, that is a remaining issue with this PR. However, I view that as a change (or extension) not a clarification. The specification currently requires that the function-name is one of array, sum, product, min, and max. We could also allow ".sum" - but on the other hand it shouldn't be needed; the reduction-operators rely on certain names - not function lookup leading to those names. |
@HansOlsson: That's a good point. The leading |
I think that might be a bad direction if we want future additional reductions added (or user-defined reductions). |
As I see it, the If we want user-defined reductions I think it would be better to just add a
Here, we don't need lookup for This way, functions don't have to deal with the |
Clarified: We will ensure that However, I also found an inconsistency related to this. If we agree that the second variant should work as specified with We can later consider adding more general reductions, e.g. using fold as suggested by @henrikt-ma |
Can this be merged as is? |
5907d6c
to
08c55dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. MapleSim had no issue with .sum
There is some work left to do for tool vendors since the converted test model ModelicaTestConversion4.ComplexMath.Issue883 aborts the translation for various reasons.
@HansOlsson Dymola 2020 has an issue with the modified function Modelica.ComplexMath.Vectors.norm and reports
If that line is removed the model simulates as expected.
@gkurzbach SimulationX 4.0.2 reports singular systems (error
Check.Singular
) for the variables c4.re, c4.im, c5.re, c5.im, i.e., the renamed max and min functions in Modelica.ComplexMath. If these two lines are removed from the model it simulates as expected.@christiankral I did not try OpenModelica 1.14.
@harmanpa FYI
closes #883