Repository navigation
test(sitesim): judge Core with device-simulator's fuse model - #1812
Merged
Merged
Conversation
sitesim drops its port of the old gG curve and steps each phase through github.com/srcfl/device-simulator/fuse (iec_gg) at 736051f, the thermal model the site rig uses. Fuse.Preheat starts a phase warm; the field matrix's 2-20-2 probe uses it. No verdict changes in the scenarios or the field matrix. TestSiteSimRandomHouse runs seeds 1-5 for an hour each: random house steps up to the fuse less 2 A, a warm fuse, a car on Charge now. The fuse never blows. Seed 2 breaks invariant (a) and is listed as known: a cut that landed 94 s earlier still nets against the next overage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What
go/internal/sitesimdrops its port of the old gG curve and importsgithub.com/srcfl/device-simulator/fuseat 736051f (srcfl/device-simulator#9, merged 23 Oct). Each plant second steps every phase throughfuse.Lookup("iec_gg").Stepat the package's default 25 °C.Fuse.Preheatstarts a phase warm through the package'sPreheat. No tuning of the model, and no change to Core.The site rig judges Core by the same package: on the device-simulator stack (#8 → #10 → #11, now on main),
cmd/simulatorstepsfuse/, and the stack head 3bf737d carries the samefuse/fuse.goas main. Sogo/test/site(#1797) and sitesim share one fuse model once #1797 movesdevsim.versionto that stack; it still pins cba7142, which has the old curve.Test-only. Core's binaries do not link device-simulator (
go list -deps ./cmd/...for linux and darwin).Preheat
Only where a scenario starts with the house near its limit:
probe/25A/auto/mixed/*/car3p/2-20-2/1p-to-3pcases (L2 at 20 A of 25 A), through a newfieldCase.warmthat is not part of the case name;Every other case starts cold, as before.
Old curve and new model
Seconds to blow at a held current, from cold (the old curve was the same at every rating) and, for the model, warm after hours at the fuse less 2 A:
They agree around 1.5 ×. At 2 × and above the old curve was 14 to 35 times slower (600 s at 2 ×, against 32 to 42 s). Just above the rating it blew in an hour, where a gG fuse never does. Cooling differs too: the old damage fell to zero over 300 s, while the model keeps heat in the body and holder. After 20 s at 2 × 25 A and 15 min at 0 A, a second 2 × overload melts in 38 s, against 41 s cold.
Verdicts
None changed.
TestSiteSimScenarios: every row as on master.FTW_FIELD_KNOWN=writeleavessitesim_field_known.txtas it was.No case reaches the range where the two differ. The matrix peaks at 1.25 × (20 A on 16 A, the kettle); the scenarios peak at 1.56 × for 3 s (39 A on 25 A, "meter every 30 s after a cut"). A preloaded case that fails, or a 2 × case that passes, needs an overload of 1.4 to 2 × held for tens of seconds to minutes, and the matrix has none. The warm 2-20-2 cases peak at 20 A.
Property test
TestSiteSimRandomHouse, ingo/internal/control/sitesim_property_test.go, runs seeds 1 to 5 for an hour each. Each seed picks a fuse (16, 20 or 25 A) and a charger delay (2, 5 or 40 s). The house steps every 15 to 180 s to random currents up to the fuse less 2 A on each phase. The fuse starts warm from the first load, and the car charges on Charge now.simSite.checkjudges every plant second:The run goes on after a failure, so a later blow still shows. Idle time with room is logged, not judged; the matrix judges it with the fuse's own memory. All five seeds take 0.5 s wall.
The fuse holds in every seed. Seed 2 breaks (a), and the test lists it as known.
Finding: a landed cut still covers the next overage (seed 2)
25 A fuse, 40 s charger with no declared response time, so Core counts a cut as possibly unshown for 180 s.
The fuse is not at risk: 1.15 × never melts, and damage peaks at 0.60. It belongs to the matrix's
nettingfamily, where a cut nets the overage against the run's earlier cuts (ev_fuse_budget.go:436).randomHouseKnownlists it; the test fails once it passes, as the matrix's known rows do.Cost
The model costs CPU.
go test ./internal/sitesim/ ./internal/control/ -run 'SiteSim|Fuse'took 72 s user and 15 s wall on master, and 100 s and 21 s here (M5, 10 cores). EachStepfinds the melting time twice: from cold for itsStatus, and from now. At a current that never melts, both searches scan to 10⁷ s.Dependency
go get github.com/srcfl/device-simulator@736051f. Thefusepackage imports only the standard library. Minimal version selection raisesgithub.com/go-ole/go-ole1.2.6 → 1.3.0 (indirect, through gopsutil's WMI), which only Windows builds link. Dependabot's #1749 also editsgo/go.mod.Open PRs on these files
#1782 and #1789 (drafts) change the meter reading in
sitesim.goand the checks incontrol/sitesim_test.go. This PR leaves both files alone: the fuse keepsstepandAnyBlown, andDamageandBlownmirror the package's state. #1807 edits other hunks ofsitesim_field_test.go.Test evidence
This branch, M5 MacBook:
🤖 Generated with Claude Code