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

Can constants be used in graphical annotations? #3464

Open
casella opened this issue Jan 10, 2024 · 1 comment
Open

Can constants be used in graphical annotations? #3464

casella opened this issue Jan 10, 2024 · 1 comment
Labels
clarification Specification of feature is unclear, but not incorrect discussion Indicates that there's a discussion; not clear if bug, enhancement, or working as intended
Milestone

Comments

@casella
Copy link
Collaborator

casella commented Jan 10, 2024

We are updating the PowerGrids library to version 2.0.0. One new feature there is that component icons optionally show variables such as active and reactive power, voltage magnitude and phase, using DynamicSelect for their values. This works fine.

One problem here is that we have one base partial class for one-port components and one base class for two-port components, but there is no single placement of those labels that fits all the components inheriting from those base classes, because of the much different shape of the icons of, say, a bus, a machine, or a load. Unfortunately, once these labels have been defined in the base class, there is no way to modify their location when extending them.

An easy solution for that is to set the coordinates of such labels to some class constants, and then change them appropriately when inheriting from the base classes. This works out of the box in OpenModelica, whose front-end constant-evaluates all constants, but apparently doesn't work in Dymola.

It is not clear to me what the specification actually says about it. The Placement modifier contains a component of Transformation type, which contains a Point that is an array of DrawingUnit, which is just a Real. Until Section 18.6.6 (Variable Graphics and Schematic Animation) there is no mention of the fact that those Reals should be constants, or even literal constants.

Section 18.6.6 says:

Any value (coordinates, color, text, etc.) in graphical annotations can be dependent on class variables using DynamicSelect.

It is not entirely clear to me if "variable" here means an actual, time-varying variable, or also a constant or a parameter. The words "Variable Graphics", "Animation" and "DynamicSelect" point out very clearly in the direction of time-varying stuff, there's not much animation or dynamics in a constant value. I guess this should be clarified.

In any case, I see two very different requirements here. One is to enable animation, and for that DynamicSelect is just fine. The other one is just to allow changing the location of graphical primitives when inheriting from a base class. For the latter purpose, being able to use constants (that can be changed when inheriting from base classes) to specify the placement of a graphic primitive would be really helpful. Restricting to constants that are bound directly to a literal constant value (i.e. non complicated constant expressions to evaluate) would be ok.

I would propose to allow this explicitly in the specification and to ask tool vendors to support this feature. This doesn't seem to me to be particularly difficult to implement.

What do you think?

Keeping @AndreaBartolini and @ceraolo in the loop.

@casella casella added discussion Indicates that there's a discussion; not clear if bug, enhancement, or working as intended clarification Specification of feature is unclear, but not incorrect labels Jan 10, 2024
@maltelenz
Copy link
Collaborator

See also #3376, which in turn links to more issues discussing whether non-literals are allowed in various annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Specification of feature is unclear, but not incorrect discussion Indicates that there's a discussion; not clear if bug, enhancement, or working as intended
Projects
None yet
Development

No branches or pull requests

3 participants