Opened 4 years ago
Last modified 3 years ago
#6389 new defect
Impossible to expand the latest release of library PowerSysPro (2.1.2)
Reported by: | Owned by: | Francesco Casella | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OMEdit | Version: | v1.17.0-dev |
Keywords: | Cc: |
Description
I uploaded a new version of library PowerSysPro that perfectly operates with Dymola.
The problem is that after opening it with OpenModelica, then I cannot expand the library in the brower, there is a tool crash, not depending I think on the version of OM.
Trying to more identify the issue I limited to simply two packages the library to reproduce the issue.
This reduced library is enclosed here.
The problem is related to redeclarations of functions cos, sin, asin with external builtins.
I see two issues in fact here:
- expanding the package should be always possible, even when models are not successfully checkable.
- why is not it possible to redefine functions as cos, sin, asin (possible with Dymola)?
Attachments (1)
Change History (16)
by , 4 years ago
comment:1 by , 4 years ago
follow-up: 3 comment:2 by , 4 years ago
The OMEdit crash is clearly a bug. I think it happens because you are using Functions.asin
but you are already inside the Functions
package. I will investigate more.
Both these two should work, if they are not, then is a bug:
1) expanding the package should be always possible, even when models are not successfully checkable
2) why is not it possible to redefine functions as cos, sin, asin (possible with Dymola)?
Can you clarify a bit more what is the problem that you get with 2)?
comment:3 by , 4 years ago
Replying to adrpo:
The OMEdit crash is clearly a bug. I think it happens because you are using
Functions.asin
but you are already inside theFunctions
package. I will investigate more.
Both these two should work, if they are not, then is a bug:
1) expanding the package should be always possible, even when models are not successfully checkable
2) why is not it possible to redefine functions as cos, sin, asin (possible with Dymola)?
Can you clarify a bit more what is the problem that you get with 2)?
About 2), when you load the file temp.mo, you can try to check the redefined function cos (or sin) and you get this error:
[2] 11:23:04 Traduction Erreur
[PowerSysPro: 34:3-40:10]: Class specialization violation: cos is a function, which may not contain an external declaration.
follow-up: 5 comment:4 by , 4 years ago
I can confirm that if you uncomment the line and change it to:
final constant Real pi= 2 * asin(1.0) "Pi number";
then it doesn't crash.
comment:5 by , 4 years ago
Replying to adrpo:
I can confirm that if you uncomment the line and change it to:
final constant Real pi= 2 * asin(1.0) "Pi number";then it doesn't crash.
Strange I get a crash on my machine (Windows).
comment:7 by , 4 years ago
When I check the cos function I get:
[2] 11:30:21 Translation Error Cannot instantiate PowerSysPro.Functions.cos due to class specialization FUNCTION.
I think Per changed this recently so we don't check functions anymore as the check was wrong.
You can now check only models.
What OpenModelica version do you have?
comment:8 by , 4 years ago
Replying to adrpo:
Did you remove
Functions.
before the asin?
Oh yes, I see: whenremoving the prefix Function. before asin in the line defining pi, the model can be expanded!
But perpahs it's an issue, is not it?
comment:10 by , 4 years ago
This is a problem with the old frontend. The following fails because the old frontend is used for evaluation:
loadFile("temp.mo");getErrorString(); PowerSysPro.Functions.pi;getErrorString();
But the following works:
model M constant Real pi = PowerSysPro.Functions.pi; end M;
So we need to fix whatever call OMEdit would make to the old frontend in this case (since we are not fixing bugs in the old frontend, right?)
Although for me it's just a stack overflow, so OMEdit should not crash anyway. Unless OMEdit does something really bad internally independent of old/new frontend.
comment:11 by , 4 years ago
The OMC API that handles fetching the information needs to be changed to use the new front-end. Yes, the old front-end does stack overflow in this case.
follow-up: 13 comment:12 by , 4 years ago
For me, OMEdit doesn't crash. But maybe the stack overflow detection doesn't work on Windows?
comment:13 by , 4 years ago
Replying to sjoelund.se:
For me, OMEdit doesn't crash. But maybe the stack overflow detection doesn't work on Windows?
Waiting for the Windows stack overflow correction, I will remove the prefix Function. in the redefinition of pi.
comment:14 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
To reproduce the crash with temp.mo, you can uncomment the first line in package Functions.
This line is: