Skip to content

fix (rtplot): RTTank ignores inverted ranges and the label format on linear scales - #3929

Open
emilioheredia-source wants to merge 2 commits into
ControlSystemStudio:masterfrom
emilioheredia-source:rtplot/rttank-fixes
Open

emilioheredia-source wants to merge 2 commits into
ControlSystemStudio:masterfrom
emilioheredia-source:rtplot/rttank-fixes

Conversation

@emilioheredia-source

@emilioheredia-source emilioheredia-source commented Sep 18, 2026

Copy link
Copy Markdown

Target branch: ControlSystemStudio/phoebus:master
Source branch: emilioheredia-source/phoebus:rtplot/rttank-fixes
Depends on: nothing. Independent of #3767 and #3768; it touches only RTTank.setRange() / setValue() and LinearTicks, which those PRs do not modify.


Summary

Two small regressions in the Tank widget, both introduced with the dual-scale refactoring in #3760. I found them while testing the Progress Bar and Thermometer follow-ups and think they are worth fixing on their own, ahead of those PRs.

1. Inverted ranges are ignored

RTTank.setRange() got a guard that rejects any range with low >= high. Before #3760 the Tank accepted minimum > maximum: the scale ran top-down and the tank filled from the top, which is also how the stock Progress Bar treats an inverted range. Since #3760 such a Tank silently keeps the default 0..10 range.

The guard now only rejects non-finite and zero-width ranges. Alarm limit lines follow the orientation of the range (they used to be skipped for inverted ranges). Since LogTicks only supports ascending ranges, an inverted range is applied ascending while the scale is logarithmic and re-applied as requested when the scale goes back to linear, so a log-scale tank with minimum > maximum does not log a warning on every update. A non-finite value shows an empty tank for both range directions (it used to show a full tank when the range was inverted).

2. format / precision have no effect on linear scales

LinearTicks stores the label format set through setLabelFormat(), but only LogTicks applied it. The Tank's format and precision properties therefore only worked with log_scale=true. LinearTicks.format() now applies the override, which covers every label that compute() creates in both classes and keeps the "almost zero" patch that avoids labels like -0.00. The extra relabeling pass in LogTicks is dropped since it is no longer needed.


Screenshot

Tank with format=Decimal, precision=1 (left) and with minimum=100, maximum=0 (right), both on the same PV:

tank_inverted_range

Testing

  1. Tank with minimum=100, maximum=0: scale reads 0 at the top, 100 at the bottom, fill grows from the top; alarm limit lines at the right positions.
  2. Same Tank, disconnect the PV or write NaN: tank shows empty.
    2b. Same Tank with log_scale=true (and a positive minimum): scale ascending, no warnings logged while the PV updates.
  3. Tank with log_scale=false, format=Decimal, precision=1: labels read 0.0, 20.0, ... Change format to Exponential: labels update.
  4. Tank with default format: unchanged automatic labels.
  5. Progress Bar and Thermometer are not affected (they do not use RTTank on master).

Checklist

  • Testing:
    • The feature has automated tests (RTTankTest: accepted and ignored ranges, log scale; LinearTicksTest: label format override and the zero patch)
    • Tests were run (mvn verify on the full reactor, plus the manual checks above)
  • Documentation:
    • Release notes:
      • Added an entry when adding a new feature (bug fix only)

The guard added to setRange() with the dual-scale refactoring (ControlSystemStudio#3760)
rejected any range where low >= high. That silently dropped inverted
ranges (minimum > maximum), which the Tank widget used to render with
the scale running top-down and the fill growing from the top.

Only non-finite and zero-width ranges are ignored now. Since LogTicks
only supports ascending ranges, an inverted range is applied ascending
while the scale is logarithmic, and re-applied as requested when the
scale goes back to linear. Alarm limit lines follow the orientation of
the range instead of being skipped for inverted ranges. A non-finite
value shows an empty tank for both range directions instead of a full
one when the range is inverted.

RTTankTest covers the accepted and ignored ranges.
LinearTicks stores the format set through setLabelFormat() but only
LogTicks applied it, so the 'format' and 'precision' properties of the
Tank widget had no effect unless the scale was logarithmic.

format() now applies the override, which covers every label that
compute() creates in both classes and keeps the "almost zero" patch
that avoids labels like "-0.00". The extra relabeling pass in LogTicks
is dropped since it is no longer needed. Also strips the trailing
whitespace in LinearTicks that fails the pre-commit hook.

LinearTicksTest covers the override and the zero patch.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants