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: jean-philippe.tavella@… 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)

temp.mo (5.5 KB ) - added by jean-philippe.tavella@… 4 years ago.

Download all attachments as: .zip

Change History (16)

by jean-philippe.tavella@…, 4 years ago

Attachment: temp.mo added

comment:1 by jean-philippe.tavella@…, 4 years ago

To reproduce the crash with temp.mo, you can uncomment the first line in package Functions.
This line is:

final constant Real pi= 2 * Functions.asin(1.0) "Pi number";

comment:2 by Adrian Pop, 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)?

in reply to:  2 comment:3 by jean-philippe.tavella@…, 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 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)?


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.

comment:4 by Adrian Pop, 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.

in reply to:  4 comment:5 by jean-philippe.tavella@…, 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:6 by Adrian Pop, 4 years ago

Did you remove Functions. before the asin?

comment:7 by Adrian Pop, 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?

in reply to:  6 comment:8 by jean-philippe.tavella@…, 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:9 by Adrian Pop, 4 years ago

Of course this is a bug, OMEdit should never crash.

comment:10 by Martin Sjölund, 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.

Last edited 4 years ago by Martin Sjölund (previous) (diff)

comment:11 by Adrian Pop, 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.

comment:12 by Martin Sjölund, 4 years ago

For me, OMEdit doesn't crash. But maybe the stack overflow detection doesn't work on Windows?

in reply to:  12 comment:13 by jean-philippe.tavella@…, 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 Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:15 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.