Skip to content

Visualize alarm limits in data browser - #3949

Open
georgweiss wants to merge 29 commits into
masterfrom
CSSTUDIO-2788
Open

georgweiss wants to merge 29 commits into
masterfrom
CSSTUDIO-2788

Conversation

@georgweiss

@georgweiss georgweiss commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds support for visualizing alarm limits in data browser plots for PVs stored by the Archiver Appliance. Screen shots attached below.

How this works

In the traces tab, the added Show Alarm Limits column will render a check box for each trace if the following conditions are met:

  • Item is not a formula item.
  • Request type is RAW.
  • PV (EPICS record) defines alarm limits.
  • Archiver policy file does omit alarm limits.

When the Show Alarm Limits checkbox is ticked by the user, additional traces are added to the plot to show the alarm limits defined by that PV. To be noted:

  • If the limit traces fall outside the current value range, they would be visible only if the value axis is set to auto-scale.
  • All alarm limits (LOLO, LOW, HIGH, HIHI) are by default rendered using the same line style and color as the PV plot proper. The line width is hard coded, though.
  • User may tweak the MINOR (LOW/HIGH) and MAJOR (LOLO/HIHI) alarm limit trace colors to improve visibility.
  • Adding alarm limit traces will not make the plot dirty. Saving alarm limit traces visibility an color was considered for a while, but dropped as it came with some side effects.

Limitations

  • In case a PV does not define all four alarm limits, the undefined ones will be rendered as traces at zero. This is essentially due to native EPICS behavior. Since an undefined alarm limit cannot be distinguished from an alarm limit at zero, users will need to be familiar with the PV in question to resolve this ambiguity.
  • If an alarm limit has changed within the time span of the plot, that alarm limit will be (incorrectly) plotted at its current value. A fix for this corner case is pending a change in the Archiver Appliance.
  • For a very noisy PV plot, alarm limit traces may not be discernible as they are by default are rendered using the same color.

Aspects on trace rendering

Ideally users should not be bothered with changing the color of alarm limit traces to improve the visual presentation. I leave that as a challenge for future improvements. Ideas are welcome.

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature
Screenshot 2026-10-12 at 15 40 29 Screenshot 2026-10-12 at 15 40 39 Screenshot 2026-10-12 at 15 41 02 Screenshot 2026-10-12 at 15 41 20

@jacomago jacomago left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer would big changes like this to have a clear commit structure. 3000 lines changed can be hard to track what's going on over all the code.

AddPV_PeriodTT,
AppendSearchResults,
AppendSearchResultsTT,
AreaOpacity,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing all these messages?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the definition (in messages.properties) is referenced only in FXML, not in Java code.

private final Range controlRange = Range.of(-1000, 1000);

@Test
public void testHasAlarmLimits1(){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more descriptive test names, if these are all the same it would be better to use ParametizedTests for test case variation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this.

AlarmLimitItem alarmLimitItem = AlarmLimitItem.createAlarmLimitItem(pvItem, limitType);
alarmLimitItem.setAxis(pvItem.getAxis());
alarmLimitItem.setDisplayName("");
alarmLimitItem.setColor(pvItem.getPaintColor());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this default. Maybe we can ask Balazs for UI opinion. But I think being the same colour and opacity as the main line is really not a great option. Some options:

  • desaturate the colour
  • Reduce the opacity (similar to the area colour)
  • Saturate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As pointed out in the PR comment, visualization is not ideal as it stands. Tweaking saturation may be an option, but then again user may choose to give the PV plot a less saturated color. Reduced opacity won't help if the alarm limit trace is painted on top of a very noisy PV plot.

At this point I would like the PR to demonstrate a feature we can improve incrementally.

public class AlarmLimitItemTest {

@Test
public void testConstructor1(){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again here the test cases are almost identical, better to use parametized tests to make clear the difference between them.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look into this.

/**
* Helper enum...
*/
public enum LimitType {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of this class and AlarmLimits class would be better in the VType module where it can be reused across the other modules.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree. AlarmLimits is particular to the data browser app. It manages colors, which should be of no concern of the VType module.

public class AlarmLimitItemTest {

@Test
public void testConstructor1(){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are pretty much the same and I think could be improved by using ParametizedTest

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into that.

final Range warningRange = Range.of((low != null) ? Double.parseDouble(low) : currentDisplay.getWarningRange().getMinimum(),
(high != null) ? Double.parseDouble(high) : currentDisplay.getWarningRange().getMaximum());

return Display.of(displayRange,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @abrahamwolk work to create the description provider would help here. Having the alarm information split out from Display I think would improve the code api.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be updated when that change is available.

* @param value {@link VType} under test.
* @return <code>true</code> if alarm or warning limits have been set.
*/
public final static boolean hasAlarmLimits(final VType value) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better this method as part of VType

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, why not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then again... that brings up the question on moving all org.phoebus.archive.vtype.VTypeHelper methods to org.phoebus.core.vtypes.VTypeHelper, which in my view is a different PR.

}

@Test
void testUpdateDisplay1() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer either more descriptive test cases or using ParametizedTest

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into that.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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