Opened 5 years ago

Closed 3 years ago

#5839 closed enhancement (fixed)

Plotting curves with toggled sign

Reported by: massimo ceraolo Owned by: Adeel Asghar
Priority: normal Milestone: 1.18.0
Component: OMEdit Version: v1.16.0-dev
Keywords: Cc:

Description (last modified by massimo ceraolo)

Currently, OMEdit does not allow plotting mathematical elaboration of variables, such as sum or product of two variables, FFT, etc. I understand that adding this would require a strong effort and I'm not discussing it here.

However, there is one single operation that is, I think, by far the most useful that, I suppose should be added very easily: change of sign.
In fact, very often we have models in which two quantities should be very near to each other in absolute value, but opposite in sign. A graphical comparison of them would be greatly enhanced if one of them would be plotted with the opposite sign.

Just as an idea, we could exploit the fact that now right-clicking on the name of a curve in a plot does nothing. This could be used to toggle sign. The variable name should be displayed with the correct sign. For instance, Resistor.p.i, once toggled should read -Resistor.p.i

Attachments (1)

Test.mo (1.6 KB ) - added by massimo ceraolo 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by massimo ceraolo, 5 years ago

Description: modified (diff)

comment:2 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

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 Adeel Asghar, 4 years ago

Resolution: fixed
Status: newclosed

comment:5 by massimo ceraolo, 4 years ago

what's the way to toggle?

comment:6 by Adeel Asghar, 4 years ago

Sorry I forgot to write that. Right click is used to open a context menu so I added it inside the setup window. Basically right click variable name in the legend and then select setup, inside the setup window you have a checkbox for Toggle Sign.

comment:7 by Francesco Casella, 4 years ago

@adeas31, would you mind adding a short note about this in the documentation?

I'm not sure if this only works for time plots or also for parametric plots, please put this info in the appropriate position based on that.

Thanks!

comment:8 by Adeel Asghar, 4 years ago

Resolution: fixed
Status: closedreopened

Sure. I will update the users guide.

comment:9 by massimo ceraolo, 4 years ago

Ah, I see.

However, at present the context menu has now just one item (setup), which is a little wierd. A single-item menu is not optimal from the user-friendliness point of view. I mean, it requires without any need an extra click.

So, I propose one of the following two options:

  • right-clicking gives immediate access to setup for the variable clicked on (in that case the checkbox would stay where you've just put)
  • right clicking gives access to a real menu (not a single item). In this case, for the time being, we could have just two items: one (the first) is "toggle", the second "setup".

A very easy way to proceed is to leave things as you did, but add the item "toggle sign" to the context menu: so, one would toggle in two ways using this menu and through the setup dialog.

Maybe documentation writing should wait that the user-interface is finalised.

Last edited 4 years ago by massimo ceraolo (previous) (diff)

comment:10 by Adeel Asghar, 4 years ago

See bba553f/OpenModelica.

Added Toggle Sign to context menu.
Updated users guide.

comment:11 by massimo ceraolo, 4 years ago

Resolution: fixed
Status: reopenedclosed

This is exactly the behaviour I expected. I like it.

comment:12 by massimo ceraolo, 3 years ago

Resolution: fixed
Status: closedreopened

This feature is faulty when re-simulating.
Consider Test.mo.
1) simulate
2) put on the same plot resistor.i and sineVoltage.i.
3) toggle sign of sineVoltage.i => the result is ok.
4) re-simulate: sine Voltage has not its sign reversed toggled, even though the name has a '-' on front of it.
5) if I open new plot and plot resistor.i and sineVoltage.i, sneVoltage is toggled, but the '-' sign is not in front of its name.
5) even if I simultae the model from scratch (without closing OMEdit) , the bad signs stay there

Expected behaviour:

  • curves in existing plots should stay toggled
  • curves in new plots should be untoggled.
Last edited 3 years ago by massimo ceraolo (previous) (diff)

by massimo ceraolo, 3 years ago

Attachment: Test.mo added

comment:13 by Adeel Asghar, 3 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in bf2e73a/OpenModelica and also ported to 1.18

Note: See TracTickets for help on using tickets.