Bug: Multiple display unit changes in plotting with prefix unit
Description
When a display unit is changed multiple times in the plotting window the value is in a prefix unit (e.g. krpm) but the legend displays the base unit (e.g. rpm). Soryy for duplicate if this is already part of another plot unit related issue but I could not find an issue directly addressing this bug.
Steps to Reproduce
- Simulate the following model with the
Prefix Unitoption activated:
model PlotUnitError
Modelica.Mechanics.Rotational.Components.Inertia inertia annotation(
Placement(transformation(origin = {10, 10}, extent = {{-10, -10}, {10, 10}})));
Modelica.Mechanics.Rotational.Sources.Speed speed annotation(
Placement(transformation(origin = {-30, 10}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Sources.Ramp ramp(height = 1000, duration = 1) annotation(
Placement(transformation(origin = {-70, 10}, extent = {{-10, -10}, {10, 10}})));
equation
connect(speed.flange, inertia.flange_a) annotation(Line(points = {{-20, 10}, {0, 10}}));
connect(ramp.y, speed.w_ref) annotation(Line(points = {{-58, 10}, {-42, 10}}, color = {0, 0, 127}));
annotation(uses(Modelica(version = "4.0.0")));
end PlotUnitError;
- Change the display unit of
inertia.wtorpmand plot it. The plot looks as shown in the first screenshot (unit in legend =krpmand a ramp from 0 to around 9.5, which is correct) - Change to display unit to
rad/sand then back torpm. The plot looks as shown in the second screenshot. The value range is the same but the unit listed in the legend is nowrpminstead ofkrpm, which does not fit to the displayed values.
Expected Behavior
The unit in the plot legend and the value in the plot always match.
Screenshots
My colleague @niklwors will add the two mentioned screenshots as a comment.
Version and OS
- OpenModelica Version: 1.23.0
- OS: Windows 11, 64 bit
- MSL 4.0.0
Thanks for looking into this Aaron Buntrock - Bosch Rexroth
Looks perfect with todays nightly. Thanks a lot.
Will be available in the forthcoming 1.24.0 release.