Opened 4 years ago

Last modified 3 years ago

#6277 new defect

Parameter with negative sign changes display unit

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Adeel Asghar
Priority: high Milestone:
Component: OMEdit Version: v1.17.0-dev
Keywords: Cc:

Description

Consider the following (attached) example:

model Degree
  Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Ground ground annotation(
    Placement(visible = true, transformation(origin = {0, -26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VoltageSource voltageSource(phi (displayUnit = "deg") = 0)  annotation(
    Placement(visible = true, transformation(origin = {0, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation
  connect(voltageSource.pin_n, ground.pin) annotation(
    Line(points = {{0, 0}, {0, -16}}, color = {85, 170, 255}));
  annotation(
    uses(Modelica(version = "3.2.3")));
end Degree;

For the angle phi the display unit deg is defined.

I perform a double click on the voltage source model to change the parameter settings. I mark the 0 of phi by double clicking on it and to then overwrite it with a new negative number. As I start typing the negative sign, e.g. in -240, the display unit switches to rad.

Attachments (3)

Degree.mo (647 bytes ) - added by Christian Kral <dr.christian.kral@…> 4 years ago.
Example model showing the issue
0.png (53.3 KB ) - added by Christian Kral <dr.christian.kral@…> 4 years ago.
Marked zero with display unit "deg"
-240.png (53.4 KB ) - added by Christian Kral <dr.christian.kral@…> 4 years ago.
Entering a negative number switches to display unit "rad"

Download all attachments as: .zip

Change History (7)

by Christian Kral <dr.christian.kral@…>, 4 years ago

Attachment: Degree.mo added

Example model showing the issue

by Christian Kral <dr.christian.kral@…>, 4 years ago

Attachment: 0.png added

Marked zero with display unit "deg"

by Christian Kral <dr.christian.kral@…>, 4 years ago

Attachment: -240.png added

Entering a negative number switches to display unit "rad"

comment:1 by Francesco Casella, 4 years ago

The rationale here is that as soon as you type an expression, and not just a literal value, it makes no sense to interpret it in any other unit than the native (SI) unit.

I guess the problem is that OMEdit inteprets the unary minus operator attached to a literal value as an expression. Of course it shouldn't.

@adeas31, can you get this in 1.16.2? Otherwise please reschedule to 1.17.0

comment:2 by Francesco Casella, 4 years ago

Milestone: 1.16.21.17.0

comment:3 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:4 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.