Opened 8 years ago

Closed 6 years ago

#4369 closed defect (fixed)

Improper use of square brackets

Reported by: anonymous Owned by: Adeel Asghar
Priority: normal Milestone: 1.14.0
Component: OMEdit Version:
Keywords: Cc: Francesco Casella

Description

The CGPM indicates that the unit of measure of a number follows the number and must not be surrounded by square bracket. See for instance:
http://www.physics.nist.gov/cuu/Units/checklist.html

But when moving the mouse pointer along the curve of a plot we see that the units of measure do have the square brackets. Moreover the units of measure are already shown in the plot legend, so is somehow pleonastic to repeat them.

I propose to adopt one of the following modifications to the current way:

1) remove the units of measure from the numerical labels (and their square brackets) shown when setting the mouse near a curve. So only the numbers are shown in this case
2) leave the units of measure but remove the square brackets, so, in this case the units are shown, in a SI compliant.

Change History (24)

comment:1 by Adeel Asghar, 8 years ago

Status: newaccepted

The CGPM indicates that the unit of measure of a number follows the number and must not be surrounded by square bracket. See for instance: http://www.physics.nist.gov/cuu/Units/checklist.html

Could you mention the rule number you are referring to?

2) leave the units of measure but remove the square brackets, so, in this case the units are shown, in a SI compliant.

I can remove square brackets but what about the plot legend? We can keep square brackets there?

in reply to:  1 comment:2 by massimo ceraolo, 8 years ago

Could you mention the rule number you are referring to?

All the examples in that page show correct writing of units, and square brackets are never used.

I can remove square brackets but what about the plot legend? We can keep square brackets there?

Square brackets in legends are incorrect, but VERY common (also Dymola uses them). I would say that, while square brackets when writing a unit near a value are to be considered plain wrong, square bracket in legends are just not plain correct.

But this is my opinion. The official opinion of CGPM and ISO is in their documents. NIST summarises well the decision in the site linked and in the pdf attached.

The many good examples in the attacked pdf never uses (nor even mentions) square brackets. By comparison there is a unique example of table and plot legends at section 5.3.1 of the attached NIST 330.pdf.
That example shows a simple, well known, but still somewhat surprising fact: every number of a physical quantity is a ratio and as such must be dealt width. So, writing I=2.5A is equivalent to write I/A=2.5. This writing explicits that 2.5 is the ratio of actual current and the corresponding unit. "Symbols for units are treated as mathematical entities" the NIST document says.

So we have two choices for the legend:

1) be totally ISO-compliant and therefore use "/". For instance show inductor.i /A instead of inductor.i [A], torque /(N.m) instead of torque [N.m], and rotorSpeed /(rad/s) instead of rotorSpeed [rad/s]
2) be non compliant in the legend, choosing a common non-standard solution: inductor.i [A] (BTW this Dymola's choice)

I have not a strong position on this additional decision.
Can someone tell what is the solution chosen by other tools (not necessarily Modelica-based)?
Can anyone comment on choice between 1) and 2)?

In case of no answers to this question, if asked about the two choices I would answer: use 1). This because not only it is plain standard, but it is also scientifically very sound.

Poscript. Sorry for not signing-in when opening this ticket. I could not retrieve my password.

comment:3 by Adeel Asghar, 8 years ago

Cc: openmodelicadevelopers.ida@… added

I am inviting more people to comment on this ticket.

comment:4 by massimo ceraolo, 8 years ago

@casella
Francesco, can you also have a look?

comment:5 by Adeel Asghar, 8 years ago

Cc: Francesco Casella added

Seems like our new mailing list restrictions doesn't allow trac to post on openmodelicadevelopers list. I just updated the settings so trac can post on the list.

I also added Francesco in the CC.

comment:6 by massimo ceraolo, 8 years ago

No comments are arrived. This means, for me, that there is no interest in making big changes.

Therefore, I warmly recommend to proceed in removing the square bracket only in tooltip text (shown when the mouse is near a curve).
These brackets are indeed really against both standards and common usage.

For me, any of the two choices originally proposed in this ticket's description are ok.

in reply to:  6 comment:7 by Francesco Casella, 8 years ago

Replying to ceraolo:

No comments are arrived. This means, for me, that there is no interest in making big changes.

Therefore, I warmly recommend to proceed in removing the square bracket only in tooltip text (shown when the mouse is near a curve).
These brackets are indeed really against both standards and common usage.

For me, any of the two choices originally proposed in this ticket's description are ok.

I agree with this proposal. I understand that "units should be treated as mathematical entities", so one should write I = 2.5 A and not I = 2.5 [A]. Honestly, writing the legend as Time/s instead of Time [s] would seem a bit weird to me.

@ceraolo, I know that the IEEE is quite strict with using SI units. Do they have a standard recommendation for plot legends in papers?

comment:8 by massimo ceraolo, 8 years ago

Their recommendations are not ISO compliant.

For instance they say:

As an example, write the quantity “Magnetization,” or “Magnetization, M,” not just “M.” If including units in the label, present them within parentheses. Do not label axes only with units. In the example, write “Magnetization (A/m)”. not just “A/m.” Do not label axes with a ratio of quantities and units. For example, write “Temperature (K),” not “Temperature/K.”

Indeed this appears a reasonable compromise: not to use the ISO recommendation (very brilliant but very uncommon) and still avoid square brackets (which should be used for a different purpose in the field of units of measure). Just use round brackets in legends and no bracket when the unit follows the number, i.e. in the tooltips.

comment:9 by Francesco Casella, 8 years ago

Fine for me

comment:10 by Adeel Asghar, 8 years ago

comment:11 by Adeel Asghar, 8 years ago

Cc: openmodelicadevelopers.ida@… removed

comment:12 by Adeel Asghar, 8 years ago

Any feedback on this ticket?
@ceraolo and @casella have you tested this?

comment:13 by massimo ceraolo, 8 years ago

Resolution: fixed
Status: acceptedclosed

For me the fix is ok and the ticket can be closed.

comment:14 by Jan Kokert, 7 years ago

Priority: lownormal
Resolution: fixed
Status: closedreopened

comment:15 by Jan Kokert, 7 years ago

In the latest nightly build (v1.13.0-dev-3-g29740e2) these issues are again present :(

comment:16 by Jan Kokert, 7 years ago

Ok, I need to be more precise: To reproduce the issue, run any simulation and then open/add a parametric plot. On the x-axis the plot will always show time [s] and not the selected quantity, which is actually another issue. If you switch back to Plot1 the x-axis is relabeled in time [s]. The relabeling remains until you restart OMEdit...

comment:17 by Jan Kokert, 7 years ago

Furthermore, the same thing happens if the Simulation Time Unit is changed e.g. from s to h. It seems that somewhere there is some "[] code" left...

comment:18 by Adeel Asghar, 7 years ago

Milestone: 1.12.01.13.0

comment:19 by massimo ceraolo, 7 years ago

another issue: once a x-y plot has been displayed, the time unit of time plots becomes erratic: either we see () (without s inside) or [s],

comment:20 by massimo ceraolo, 7 years ago

It looks like just a very minor effort is remaining to close this ticket (comments 16 to 19).
Isn't it?

comment:21 by Adeel Asghar, 7 years ago

Should work fine now 1d1f81/OMEdit.

comment:22 by massimo ceraolo, 6 years ago

Now the situation is little improved in comparison to what said in comment 16, but still faulty.

1) create a parametric plot and plot a quantity => the labels are ok
2) create a time plot and plot a quantity => the x-axis label, instead of being "time(s)" is "time()". Furthermore, this plot does not react to changes in "Simulation time Unit".

comment:23 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:24 by Adeel Asghar, 6 years ago

Resolution: fixed
Status: reopenedclosed

Done in 8db5bf7/OMEdit.

Note: See TracTickets for help on using tickets.