You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
_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.
Summary
core/bess/simulation/inverter_simulator.py's_map_rates(called byderive_control_command, whichrun_scenario_realized/verify_plan_faithfulnessrely on) is a hand-maintained "mirror" ofInverterController._map_intent_to_rates, but it does NOT callintra_period_discharge_gateand has noshadow_priceparameter anywhere: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.mdstates 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:run_scenario_realized/verify_plan_faithfulnesstest 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
derive_control_command/_map_ratesto accept ashadow_price(and whatever elseintra_period_discharge_gateneeds) and call the real gate function, so the mirror is faithful again._scenario_inputs/scenario dicts incore/bess/tests/helpers.pywill need a way to supplyshadow_priceper period for scenarios that exercise the gate.R == Pscenario 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