Skip to content

feat(relay bench): Studio VLAN controls, simulated PTP GM and locked SV gmIdentity - #282

Open
masarray wants to merge 27 commits into
feat/bench-emulated-ptp-gm-sv-global-lock-20261022from
feat/studio-vlan-ptp-gm-sv-siprotec-bench-20261022
Open

masarray wants to merge 27 commits into
feat/bench-emulated-ptp-gm-sv-global-lock-20261022from
feat/studio-vlan-ptp-gm-sv-siprotec-bench-20261022

Conversation

@masarray

Copy link
Copy Markdown
Owner

User target

ARStack Studio + ESP32-P4 shall operate as an isolated test-set Merging Unit plus PTP Grandmaster, or follow a selected external PTP source. SIPROTEC 5 subscriber must see matched PTP and SV time identity. No change to production main or stable release.

Changes

  • Editable per-SCL-stream SV VLAN (enabled, VID 0-4094, PCP 0-7), compiled into canonical binary profile and checked before flash; PTP VLAN separately configurable and optional Match SV VLAN button.
  • SOURCE-only explicit test-bench GNSS-like PTP GM mode; Studio supplies a fresh host UTC epoch in a backward-compatible optional PTP CONFIG suffix, firmware seeds EMAC IEEE1588 hardware/TAI clock with elapsed monotonic time. Announce carries bench reference clock properties when enabled. Default/external PTP receiver remains unchanged.
  • AUTO smpSynch=2 only if existing independent SV sample-phase + MAC TX evidence gate has qualified and bench PTP SOURCE is fresh. The preexisting local mode and override modes remain separate.
  • IEC 61850-9-2 Ed2.1 gmIdentity BER context tag 0x89, 8 bytes matching SOURCE PTP clockIdentity (or selected RECEIVER source) in canonical SV frames, with malformed/roundtrip regression.
  • Retain prior PTP VLAN0 PCP4 and all other fix(PTP): Power Profile VLAN0/PCP4 priority tagging for relay interoperability #281 modifications.

Verification gates

Run PTP, SV, ESP32-P4, Studio Qt, native Windows lifecycle and matched firmware installer workflows. Explicit pending physical relay interoperability: Pdelay exchange, GM selection, receiver offset/lock, smpSynch and measured currents/voltages, alarm state. Isolated relay test network only; this is simulated GNSS-like reference, not a traceable reference. Do not merge until reviewer acceptance.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T01:25:46.080066Z dcb0402 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: dcb040253c

ℹ️ 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".

if (profile.value(QStringLiteral("benchGlobalGm")).toBool()) {
// Studio supplies a fresh host UTC epoch. The device then uses
// one EMAC IEEE1588 timebase for both PTP TX and SV sampling.
command += QStringLiteral(" 1 %1").arg(QDateTime::currentSecsSinceEpoch());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve subsecond time when seeding the simulated GM

When bench GM mode is enabled, currentSecsSinceEpoch() truncates the host timestamp to a whole second before the command is queued and transmitted. The firmware then treats command receipt as that second boundary and reconstructs nanoseconds only from subsequent board-monotonic elapsed time, so the advertised PTP clock can be offset from UTC by nearly one second plus transport latency while declaring within_1_us accuracy and time traceability. Send a seconds-plus-subseconds timestamp with a correlated monotonic sample, or downgrade the advertised accuracy/traceability.

AGENTS.md reference: AGENTS.md:L172-L180

Useful? React with 👍 / 👎.

Comment on lines +340 to +344
} else if (ptp_config.role == AR_PTP_ROLE_TIME_RECEIVER &&
authority.source_selected) {
std::array<std::uint8_t, 8> identity{};
std::copy_n(authority.selected_source_clock_identity, 8U, identity.begin());
asdu.gm_identity = identity;

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 Keep gmIdentity out of legacy receiver frames

When the deployed stream is the built-in/default 9-2LE profile and PTP runs in RECEIVER mode with a selected source, this branch unconditionally adds the Ed.2.1 context tag 9 to the fixed legacy ASDU. RuntimePublisherProfile does not retain profile_family, so this path cannot enforce the preceding promise to keep legacy 9-2LE unchanged; strict legacy relay/test-set decoders can therefore reject the modified frames. Preserve the compiled profile family in the runtime profile and gate this field accordingly.

AGENTS.md reference: AGENTS.md:L174-L182

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