Skip to content

Plan-faithfulness simulator doesn't model the shadow-price intra-period discharge gate #388

Description

@johanzander

Summary

core/bess/simulation/inverter_simulator.py's _map_rates (called by derive_control_command, which run_scenario_realized/verify_plan_faithfulness rely on) is a hand-maintained "mirror" of InverterController._map_intent_to_rates, but it does NOT call intra_period_discharge_gate and has no shadow_price parameter anywhere:

grep -rn "intra_period_discharge_gate\|shadow_price" core/bess/simulation/*.py
# (no matches)

For SOLAR_EXPORT it hardcodes discharge_rate=0; for SOLAR_STORAGE/LOAD_SUPPORT it scales purely from the DP's planned action. The shadow-price gate (introduced in #187/#319 for SOLAR_EXPORT/SOLAR_STORAGE, extended to LOAD_SUPPORT in PR #385) is invisible to the simulator.

Why this matters

docs/agents/simulator.md states the simulator "reuses the production controller mappings so the simulator executes exactly what the real controller would write" — that claim is currently false for any gate-affected intent. Concretely:

  • A run_scenario_realized/verify_plan_faithfulness test cannot validate the gate logic at all right now (for SOLAR_EXPORT/SOLAR_STORAGE or the new LOAD_SUPPORT extension in PR fix: LOAD_SUPPORT discharge ceiling leaks real-time load spikes to grid #385) — it would pass trivially without exercising the gate branch, since the simulator's mirror doesn't have the concept.
  • docs/agents/testing.md's REQUIRED plan-faithfulness verification for control/rate-mapping changes is currently unsatisfiable for gate-related changes, since the tool it requires doesn't model the mechanism being changed.

Suggested fix direction

  1. Extend derive_control_command/_map_rates to accept a shadow_price (and whatever else intra_period_discharge_gate needs) and call the real gate function, so the mirror is faithful again.
  2. _scenario_inputs/scenario dicts in core/bess/tests/helpers.py will need a way to supply shadow_price per period for scenarios that exercise the gate.
  3. Once fixed, add an R == P scenario test for PR fix: LOAD_SUPPORT discharge ceiling leaks real-time load spikes to grid #385's LOAD_SUPPORT gate extension (and ideally backfill one for the existing SOLAR_EXPORT/SOLAR_STORAGE gates too, since they have the same gap).

Related

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