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

Mixture of Real and Integer in index expressions in MSL Electrical.Analog.Lines #363

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 4 comments
Assignees
Labels
bug Critical/severe issue L: Electrical.Analog Issue addresses Modelica.Electrical.Analog
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by clauss on 27 Apr 2010 12:45 UTC
The index expression ((j-2)*(j-1))*0.5. is not an Integer expression but a Real expression,because of the multiplication by 0.5. Dymola failed to recognize this,because it did not distinguish between integer 1 and real 1.0, respectively integer 2 and real 2.0.

However, Dymola distinguishes between 3 and 3.0, so it implies that this model has only been tested with small values for lines. Next version of Dymola will handle 1, 1.0, 2 and 2.0 appropriately.

Such index expressions have to be replaced by div((j-2)*(j-1),2).

Reported by Sven Erik Mattsson


Migrated-From: https://trac.modelica.org/Modelica/ticket/363

@modelica-trac-importer
Copy link
Author

Comment by dietmarw on 28 Apr 2010 06:46 UTC
Was fixed in f9cc3c1 (and 0e19975).

Note: In the future we should avoid such tool-specific "workarounds". Even if they are legal Modelica. If there is a problem with a specific tool then the tool should be fixed and not the perfectly correct Modelica code in the MSL.

@modelica-trac-importer modelica-trac-importer added the L: Electrical.Analog Issue addresses Modelica.Electrical.Analog label Jan 14, 2017
@modelica-trac-importer modelica-trac-importer added this to the MSL3.2 milestone Jan 14, 2017
@modelica-trac-importer
Copy link
Author

Comment by HansOlsson on 28 Apr 2010 08:21 UTC
I agree with the change and the comment is in itself correct.

However, I don't see how the comment relates to this ticket, since the old code was incorrect Modelica (handled correctly for some cases by Dymola 7.4 (and earlier)) whereas the new code is correct Modelica.

And I can't understand how the old code would be a tool-specific workaround.

@modelica-trac-importer
Copy link
Author

Comment by dietmarw on 28 Apr 2010 08:43 UTC
OK from reading the description I got the impression that the code itself was correct but was handled differently/incorrect by the tool. If this is however not the case and the old code was indeed incorrect to start with then my comment is not applicable in this case. (However there exist a ticket where perfectly legal Modelica was changed just so that it works in Dymola and that's something we should avoid, see #314).

@modelica-trac-importer
Copy link
Author

Comment by beutlich on 20 Dec 2016 13:45 UTC
Unhide in agreement with clauss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Electrical.Analog Issue addresses Modelica.Electrical.Analog
Projects
None yet
Development

No branches or pull requests

2 participants