Skip to content

fix(snapshot): a panel with no MID is on-grid whatever grid power reads - #216

Merged
cayossarian merged 1 commit into
prerelease/3.8from
fix/no-mid-on-grid-3.8
Oct 14, 2026
Merged

cayossarian merged 1 commit into
prerelease/3.8from
fix/no-mid-on-grid-3.8

Conversation

@cayossarian

Copy link
Copy Markdown
Member

Refs #215.

On a panel with no MID, dsm_state and current_run_config dropped to UNKNOWN for one update each time power-flows/grid read within 1 W of zero, then returned. A sub-panel with a small net draw does that many times a day, and an automation watching the sensor saw each return as the grid coming back.

Cause

resolve_islanding_state falls to tier 3 when the tree declares no MID. Tier 3 answered ON_GRID only while abs(power-flows/grid) > 1.0 and None otherwise.

Change

Tier 3 now answers ON_GRID without reading grid power. A panel with no MID cannot separate from what feeds it, and what feeds it is what SPAN treats as the grid. This is the elimination resolve_dominant_power_source already makes for the same trees.

The threshold was written to avoid calling a generator-fed island on-grid. It never did that: such a panel reads far above 1 W under any load and was reported on-grid all the same. Its only effect was to withdraw the answer near zero flow.

mid is None means no MID is declared, not that one is still being discovered, because the adapter builds no snapshot until every declared device has described itself. A MID that exists and has not answered still reports unknown.

  • panel.py: tier 3 returns ON_GRID; the schema-1 _GRID_POWER_EPSILON_W is removed; the resolve_islanding_state and resolve_dominant_power_source docstrings are brought in line.
  • snapshot.py: one comment updated.
  • tests/adapter_fidelity/rules.py: the rule that let power-flows/grid move the grid answers is removed with the read it described.
  • tests/adapter_fidelity/rules_captured.py: the reference captures declare no MID, so dsm_state DSM_ON_GRID and current_run_config PANEL_ON_GRID are documented as derivations, beside the GRID elimination already documented for dominant_power_source. Each admits only the on-grid value.
  • packages/schema-1/CHANGELOG.md: one Fixed entry under Unreleased.

Checks

  • test_no_mid_is_on_grid_whatever_grid_power_reads replaces the tier 3 test, and test_a_panel_with_no_mid_keeps_its_grid_answers_through_a_zero_grid_reading replays the samples from the issue through a tree with no MID. Both fail against the previous panel.py with None and UNKNOWN on the 0.0 sample.
  • The capture fidelity cells r202639-a, -b and -e pass with the two derivations, and test_every_derivation_is_needed holds both to a capture that uses them.
  • pre-commit run: all hooks pass. Tests: 1857 passed, 7 skipped, 9 xfailed, coverage 96.68%.

With no MID, resolve_islanding_state answered on-grid only while
power-flows/grid read more than 1 W and nothing otherwise, so dsm_state
and current_run_config dropped to UNKNOWN for one update each time the
reading touched zero. A sub-panel with a small net draw does that many
times a day, and a consumer saw each return as the grid coming back.

A panel with no MID cannot separate from what feeds it, and what feeds
it is what SPAN treats as the grid, so tier 3 now answers on-grid
without reading grid power. This is the elimination
resolve_dominant_power_source already makes. The threshold never
defended the generator-fed island it was written for, which read far
above 1 W under any load and was reported on-grid all the same.

The fidelity rule that let power-flows/grid move the grid answers goes
with the read it described. The reference captures declare no MID, so
their rules document the two on-grid answers as derivations, beside
the GRID elimination already documented for dominant_power_source.

Refs #215
@cayossarian
cayossarian merged commit 7194d2b into prerelease/3.8 Oct 14, 2026
5 checks passed
@cayossarian
cayossarian deleted the fix/no-mid-on-grid-3.8 branch October 14, 2026 21:52
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