Repository navigation
WP2: fail-safe an inspector accepts - static share under everything - #10
Merged
Merged
Conversation
…hing
- sim.safe_share_kw(site) = min(p_max, (feed - max building load) / n)
(1.833 kW on site-1); Connector carries safe_kw: plug-in starts on it,
and a dynamic limit expires DYN_VALID_MIN (15) minutes after the last
set_limit, exactly like an OCPP profile with valid_to.
- pick_mode("full") plan, apply_limits() fallback and scheduler's linprog
fallback (_full_power) return the static share, not p_max.
- ocpp_gateway: two profiles per connector - static share at stack 0 sent
once after BootNotification (as a task; awaiting inside @after deadlocks
the message loop), dynamic plan at stack 1 with valid_to = now + 15 min,
refreshed every 10 sim-min. Charger keeps profiles and applies the highest
live one; self-check shows the revert once the dynamic one expires.
- StatusOut.safe_share_kw (additive); site.json: safe_share_kw 1.833.
- Tests: kill the control loop at 10:30 and tick 6 h - site never exceeds
headroom, after 15 min never exceeds n * share; full rung = share.
64 pass; smoke OK; prove.py unchanged (64.6 %, 0 fallbacks).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017thvbGo7rTVnG2f46cLMzU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WP2 of
prompt.md(solutions.md§5). Plan and deviations:.docs/implementation-plan.md(A4, deviation 5).What changed
sim.safe_share_kw(site)=min(p_max, (feed − max building load) / n_connectors)→ 1.833 kW on site-1 (site.json: safe_share_kw). 60 × 1.833 = 110 kW = feed − worst building load, with no controller at all.Connector(id, p_max_kw, safe_kw): plug-in starts on the static share; a dynamicset_limitexpires 15 sim-minutes after it was last refreshed (DYN_VALID_MIN) and the connector reverts to the share — the sim now behaves like a charger holding an OCPP profile withvalid_to. In normal operationapply_limits()refreshes every minute, so nothing changes.pick_mode("full")plan, theapply_limits()no-plan fallback and the scheduler's linprog fallback (_full_power(cars, site)) all return the static share instead ofp_max.ocpp_gateway: two profiles per connector — static share atstack_level 0, no expiry, sent once afterBootNotification; dynamic plan atstack_level 1,valid_to = now + 15 min, re-sent every 10 sim-minutes. The simulated charge point keeps both (Charger.profiles) and applies the highest live one;python -m noonshift.ocpp_gatewayshows the revert once the dynamic profile expires. Gotcha found on the way:await self.call()inside an@afterhandler deadlocks the ocpp message loop — it is sent as a task.StatusOut.safe_share_kw(additive); contract files regenerated.Tests (fail on old code)
test_when_the_control_loop_dies_the_site_falls_back_to_the_static_share: play to 10:30, then 6 h ofsim.tick()with nostep()— EV kW never exceeds feed − building, and after 15 min never exceeds n × share; every plugged car ends on the share.test_demo_signal_outage…: thefullrung now puts every charger on the share (wasp_max).64 pass ·
smoke.pySMOKE OK ·prove.pyunchanged: CO₂ −64.6 %, bill −2.9 %, peak −1.0 %, 0 fallbacks, max 63 ms.Assumption
safe_share_kwdefault = the computed value above; the demo ships it explicitly insite.json.🤖 Generated with Claude Code
https://claude.ai/code/session_017thvbGo7rTVnG2f46cLMzU