Skip to content

Filter transient CSWI Close before the Value Viewer - #3

Merged
masarray merged 2 commits into
mainfrom
fix/source-level-close-feedback-filter
Jul 13, 2026
Merged

masarray merged 2 commits into
mainfrom
fix/source-level-close-feedback-filter

Conversation

@masarray

Copy link
Copy Markdown
Owner

Regression confirmed

The previous workaround reacted after the control-result diagnostic. At that point the transient Closed sample had already entered the normal WPF point-update queue, and the command-row model could publish a deferred optimistic Closed again when ControlIsBusy ended. That explains why the latest build still flashed Closed and could hold it longer than before.

Corrected approach

  • Intercept PointUpdated before snapshots enter the 100 ms Value Viewer batch.
  • Debounce only CSWI*.Pos.stVal = Closed for 350 ms.
  • Cancel that pending snapshot immediately when Open/non-Closed follows.
  • Keep XCBR/XSWI equipment feedback and all Open updates immediate.
  • Mark stable Closed evidence only after the debounce survives.
  • Suppress direct command-result Closed assignments until fresh stable live-position evidence exists.
  • Keep the previous real value visible with Command accepted — waiting for stable Closed process feedback….

Safety

  • No automatic retry.
  • No second SBOw/Operate.
  • No protocol-sequence changes.
  • Raw event/SOE processing remains intact; only the live Value Viewer and command-row presentation filter the short CSWI command echo.

Expected OLSF501 behavior

  • Open remains fast.
  • Close no longer flashes in the Value Viewer.
  • Final Closed appears when the real stable position arrives around four seconds later, plus only the 350 ms stability window.

@masarray
masarray merged commit 6696798 into main Jul 13, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64aa083bc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return;
}

var key = NormalizeReference(reference);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the device in CSWI debounce keys

When two monitored IEDs expose the same IEC reference, such as CSWI1.Pos.stVal, this key collapses their PointUpdated streams. An Open/non-Closed update from device B can cancel device A's pending Closed, or a Closed from B can provide the stable evidence used by A's command, because the rest of the UI keys live points with DeviceId but this filter drops it. Include snapshot.Point.DeviceId in the pending/stable key so devices cannot interfere with each other.

Useful? React with 👍 / 👎.

Signal = signal,
BeforeValue = NormalizeControlState(signal.ControlCurrentValue),
RequestedValue = NormalizeControlState(requestedValue)
BeforeValue = NormalizeControlState(signal.ControlCurrentValue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip waiting when Close is already displayed

For a Close issued while the row already shows Closed, this still registers an active wait state and then clears prior stable evidence. Because the process value may not change, no fresh PointUpdated/ControlCurrentValue event is guaranteed; when the successful Feedback confirmed: Closed result arrives, the handler rewrites it to waiting and eventually times out. Keep the previous exception for BeforeValue == Closed so idempotent Close commands do not get reported as unconfirmed.

Useful? React with 👍 / 👎.

Comment on lines +367 to +371
private static bool IsControlFailureResult(string result)
=> result.Contains("failed", StringComparison.OrdinalIgnoreCase) ||
result.Contains("rejected", StringComparison.OrdinalIgnoreCase) ||
result.Contains("cancelled", StringComparison.OrdinalIgnoreCase) ||
result.Contains("unsupported", StringComparison.OrdinalIgnoreCase);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat timeout results as terminal failures

If the control service returns a terminal non-success such as Feedback timeout: or Validation:, this predicate does not match it, so the active Close state remains installed. A few seconds later the 15-second expiry overwrites the real failure/timeout message with Command accepted... stable Closed ... not confirmed, which hides the actual result from the operator. Classify timeout/validation non-success results as terminal here, or otherwise remove the active state when the command result is not successful.

Useful? React with 👍 / 👎.

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.

1 participant