Skip to content

P3: standards-first SCL-driven SV profiles and IEC/IEEE 61850-9-3 PTP synchronization #24

Open

Description

@masarray

Goal

Turn the proven ESP32-P4 SV publisher from a hard-coded bench image into a standards-aware, interoperable process-bus source whose configuration is compiled from SCL/profile data on the host and executed deterministically on ESP32-P4.

The architecture keeps wire-observed facts, configured expectations, and profile claims separate; PTP traffic visibility and SV smpSynch truthfulness remain separate; unknowns remain unknown instead of being silently promoted to compliance claims.

Standards-facing architecture

SCD/CID/ICD/IID
      |
      v
Host SCL/profile compiler
      |- stream identity: MAC / APPID / VLAN / PCP
      |- svID / confRev / nofASDU / SmvOpts
      |- dataset order and element types
      |- sample-rate basis / counter policy
      |- scaling / quality policy / synchronization policy
      v
Versioned binary SvPublisherProfile
      |
      v
ESP32-P4 deterministic runtime
      |- prebuilt fixed templates
      |- waveform/fault engine
      |- exact smpCnt policy
      |- canonical SV publisher
      |- PTP disciplined clock + truthful smpSynch
      |- timing/evidence telemetry

SCL/XML parsing must stay out of the realtime hot path and preferably out of the ESP32 entirely. The host compiles an immutable/versioned binary profile that the ESP validates before activating.

Reuse / align with existing ARStack capabilities

ARStack already has an SCL model/parser and Sampled Values codecs. Extend those instead of creating a second configuration model. The runtime profile should be derivable from SclSampledValuesStream and dataset entries.

SV profile engine requirements

  • Introduce a transport-neutral SvPublisherProfile / compiled-profile model in the core library.
  • Compile a profile from an SCL SampledValueControl + Communication/SMV address + bound DataSet.
  • Preserve explicit field-presence options from SmvOpts rather than guessing.
  • Support APPID, destination MAC, VLAN ID, PCP, svID, confRev, dataset reference presence, smpRate, smpMod, smpSynch, nofASDU, payload layout and sample-counter policy.
  • Reject ambiguous/unresolved SCL bindings instead of silently inventing a dataset.
  • Keep profile family labels evidence-aware: Generic IEC 61850-9-2, IEC 61869-9, and Legacy 9-2LE compatibility must not be claimed from heuristics alone.
  • Add deterministic profile validation and golden-frame tests.
  • Add versioned host->ESP binary profile serialization with checksum/version/length validation.
  • Keep diagnostic mirror identity completely separate from canonical process-bus identity.

PTP / synchronization architecture

Use a layered, evidence-oriented PTP design and make the ESP32-P4 path hardware-timestamped and synchronization-capable rather than a software-only lab publisher.

Layers:

  1. PTP wire codec — IEEE 1588v2 / IEC 61588 L2 0x88F7 message parsing/serialization.
  2. Passive monitor — source/domain/message/sequence visibility without making a synchronization claim.
  3. Power-profile validator — explicit IEC/IEEE 61850-9-3 constraints and diagnostics.
  4. Hardware clock — ESP32-P4 EMAC IEEE1588v2 time enabled through the pinned toolchain.
  5. Servo/discipline state — offset/path-delay estimation and lock/holdover/unlocked state.
  6. SV synchronization policy — smpSynch derives from measured lock state; no unconditional global-sync claim in standards mode.
  7. Timestamp evidence — scheduled deadline vs EMAC hardware TX timestamp statistics.

ESP32-P4 hardware timing acceptance

Use EMAC IEEE1588v2 hardware timestamp capability as the device-side source of truth rather than host USB-Ethernet arrival timestamps.

  • Enable EMAC PTP hardware time on the tested toolchain version.
  • Capture actual hardware TX timestamps for SV frames where supported by the driver API.
  • Correlate smpCnt, scheduled target time, submit time and hardware TX time.
  • Export min/max/mean/P95/P99 TX timing error and missed-deadline counts.
  • Add 60 s / 4000 fps evidence run, then 60 s / 4800 fps.
  • Do not use host USB-Ethernet arrival jitter as the device conformance timing metric; keep it as capture-path evidence only.

Current bench evidence that motivates this split

The current GPTimer publisher sustains ~4000 frames/s with device-side missed=0, while the host USB-Ethernet capture path reports roughly the same average throughput but batches/perturbs arrival timestamps and produces >300 us excursions. Sequence integrity remains continuous and reconstructed 50 Hz waveforms are correct. This strongly suggests the next timing gate must move to EMAC hardware timestamps / trusted reference capture rather than trying to tune firmware against host capture jitter.

UX target

Open SCL
  -> detect SV streams
  -> select stream
  -> validate address + dataset + SmvOpts
  -> show exact/compatible/conflict findings
  -> compile profile
  -> deploy to ESP32-P4
  -> run waveform/fault scenario
  -> show PTP lock + smpSynch state + hardware TX timing evidence

Public-repository naming policy

Keep project-owned public documentation vendor-neutral. Do not add commercial competitor/product names, comparison tables, logos, screenshots, or marketing references. Standards and technical platform/dependency identifiers required to build or reproduce the project are allowed.

Safety / claim boundary

A successfully decoded SV frame is not a conformance certificate. Keep packet interoperability, SCL/configuration interoperability, semantic compatibility, timing evidence, synchronization evidence and relay interoperability as separate gates.

Depends on P2 timing evidence issue #21 and the hardware bring-up in PR #19.

P3-A profile foundation scope preserved from #33 · tracking consolidated 2026-10-23

This section replaces overlapping issue tracking, not P3-A acceptance. #33's own Oct 7 audit said P3-A0 is substantially complete on then-main (#140/#141/#142/#143/#145), while P3-A1 device binary integrity and P3-A2 hardware/profile breadth must remain explicitly tracked. We keep exact remaining requirements in the canonical P3 parent and focused OPEN children:

P3-A0 (host parser and profile correctness; still regression-protected):

  • Preserve SmvOpts optional-field semantics, exact configured MAC/APPID/VLAN/PCP, svID/confRev, nofASDU, sample basis/mode, explicit FCDA order/type, synchronization policy, and profile provenance. Never make configured intent identical to observed PCAP evidence automatically.
  • Expand structured FCDA without daName using DataTypeTemplates and FC semantics; fail closed for unsupported or ambiguous layout, no arbitrary vendor-derived fallback.
  • Preserve deterministic rational 4000/4800 (and explicitly supported other) cadence, distinguish sampling rate/ASDU/frame rate; do not equate SmpPerSec to validated counter wrap without independent policy.
  • Retain vendor-neutral anonymous 4800 4I4V fixture and read-only SCL/CID -> normalized profile CLI, with no proprietary identifiers in public repository.
  • Preserve profile-family explicit/evidence-backed Generic IEC 61850-9-2, IEC 61869-9 and legacy compatibility claims; do not guess family from APPID/MAC naming.

P3-A1 device integration (OPEN #36 owns acceptance):

P3-A2 configured vs observed resolution (OPEN #35 owns):

  • Measured SV wire fingerprint, deterministic configured-vs-observed MATCH/DIFF/MISSING_CONTEXT/UNSUPPORTED, provenance of user-confirmed overlay, PCAP/PCAPNG capture safety, independent profile-family compatibility; no silent runtime override or brand branch.

Adjacent open gates: #40 vendor SCL dialect quarantine; #139 standards/virtual WirePlan; #21 physical EMAC TX/jitter/4800; #154 PTP↔SV and external IED acceptance. The P3 parent #24 stays OPEN; no claim that P3 was finished by closing the redundant #33 tracking issue.
Original tracking: #33 .

P3-H completed foundation + remaining requirements (transferred from #139, 2026-10-23)

This is an issue-tracking consolidation, not an acceptance statement. The old #139 P3-H recovery/source ledger is archived; the historical source itself, comments and PR links remain accessible. Main P3 standards owner stays OPEN here in #24, specialized children #21/#35/#36/#40 and PTP #154/#162.

Already merged SOFTWARE, preserve these invariants:

  • P0 canonical 802.1Q VID 0..4094, reject VID 4095; PCP 0..7; permit SV priority-tagged VID0 but preserve stricter PTP policy where applicable. Source merged #140, including upstream compiler, runtime, PTP builder and edge tests; valid 4I4V frame bytes unchanged.
  • P0.1 encoder-produced fixed-bounds per-ASDU BER WirePlan patch offsets/widths; remove runtime byte-pattern search/second parser, avoid hidden secondary TX failure authority. Source merged #141.
  • P1 distinct sample basis/rate, ASDUs per Ethernet frame, rational publication cadence and explicit counter policy, no universal 1ASDU assumption. Source merged #142.
  • Explicit Generic IEC61850-9-2 vs legacy 9-2LE vs IEC61869-9 family provenance/capability. Source merged #143.
  • Host IEC61869-9 profile variant, ordered datasets and rational engineering scaling. Source merged #145. Host-only standards semantics ≠ physical ESP deployability/conformance.

Still OPEN P2+ / future architecture gates (do not mark completed):

Preserve old parallel-work handoff protocol: start from current accepted main + latest checkpoint rather than reimplementing old milestones; read NORTH_STAR.md/docs/SMV_INJECTOR_STATUS.md; own disjoint files; avoid duplicate standards authority/second PTP servo; record exact base/head SHA and rollback/test evidence in each future PR. Original historical anchor: #139.

Activity

  1. masarray commented on Aug 10, 2026

    @masarray
    OwnerAuthor

    Additional requirement from the current bench waveform result: raw diagnostic visualization currently shows about 1000 A and 5.77 kV while the generator intent is 1 A RMS and 57.74 V RMS. The waveform shape/phase is correct; this is an engineering-unit interpretation problem because the raw diagnostic stream is not SCL/profile-bound and the publisher currently uses legacy-style integer scaling (1 mA/count, 10 mV/count).

    Do not fix this by changing the realtime integer payload merely to satisfy one analyzer. The compiled profile must own scaling semantics and provenance:

    • generic SCL-driven mode: only apply engineering scaling that is actually defined/selected by the configuration/profile; otherwise expose raw counts;
    • legacy 9-2LE compatibility: apply the explicitly selected legacy scaling convention;
    • IEC 61869-9: use the sourced profile rules once implemented;
    • diagnostic/analyzer UI: display whether a value is raw counts, profile-scaled, or SCL-derived instead of guessing.

    This keeps publisher semantics interoperable and prevents a viewer-specific assumption from becoming wire behavior.

  2. masarray commented on Aug 11, 2026

    @masarray
    OwnerAuthor

    PTP Grandmaster Clock implementation is now split into focused sub-track #56. The separate implementation thread must stack from feature/smv-scl-profile-bridge, use feature/ptp-gmc-foundation, and follow docs/PTP_GMC_ROADMAP.md. The order is hardware-clock/codec -> passive monitor -> LAB GMC -> clock-source discipline -> PTP-anchored SV timeline -> evidence-derived smpSynch. This split prevents the GMC work from reopening or destabilizing the completed SCL-driven injector workflow.

  3. masarray commented on Oct 24, 2026

    @masarray
    OwnerAuthor

    P3 standards/SCL scope after M3.H main merge: source of Stable lab 4I+4V 4kHz simulator was integrated by #299 with 14/14 CI. This does NOT complete full standards-first SCL-compiled dynamic profiles, generic 4800Hz/hardware profile switching, or certified external PTP receiver/IED interoperability. Keep #24 OPEN for those independently testable P3 profile/standards milestones; do not conflate them with immutable M3.H lab release acceptance.

  4. masarray commented on Oct 24, 2026

    @masarray
    OwnerAuthor

    M3.H release backlog reconciliation — 2026-10-24

    Release boundary: M3.H stable covers a narrow 4I+4V, 4 kHz SV profile and internal simulated GM only, not all SCL-driven modes and real PTP peer interoperability. PR #299 merged the tested source into main; historic diverged timing stacks are archived. Keep remaining SCL/profile acceptance in #36/#35 and peer/relay tests in #154/#162. No need to delay the current lab simulator release for those extensions.

    Canonical ledger: https://github.com/masarray/arstack61850/blob/main/docs/integration/M3H_MAINLINE_RELEASE_SOURCE_CLOSURE_2026-10-24.md .

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions