Spaces:
Running

Elvis0001 commited on
Commit
f5aaddb
·
1 Parent(s): d4e37c8

Enable continuous sp2 Simulator inputs and custom sweeps

Browse files
.agents/skills/openpels-topology-development/SKILL.md CHANGED
@@ -15,6 +15,8 @@ Complete the [Analysis feature parity matrix](../../../docs/topology/analysis_fe
15
 
16
  Complete the [Simulator feature parity matrix](../../../docs/topology/simulator_feature_parity_matrix.md) for every integration alongside the Analysis matrix. Verify the default and edited inputs, executed decks, measurements, sweeps, downloads, operating-point handoff, error recovery, and normal Chrome reload. Use real NGSpice jobs and compare with the tagged XFLY6S, XFLY8S, and C3L Simulator. Document the physical basis for each N/A and the limits of every qualified parameter range. An unresolved applicable row blocks full integration.
17
 
 
 
18
  Use the original 4:1 XFLY6S implementation as the functional reference. Start a separate [feature parity checklist](../../../docs/topology/feature_parity_checklist.md) for each topology. Compare individual features and controls, including alternate budget modes, collapsed settings, and controls suppressed by topology-specific rendering. Trace each applicable control to the calculation, job, waveform, or export that uses it. Exercise it with the default and at least one meaningful change.
19
 
20
  Document the units, qualified range and physical basis of topology-specific defaults. Keep applicable controls accessible. Mark a control inapplicable only with a circuit- or model-specific explanation and supporting evidence. Treat missing, inaccessible, or unverified applicable controls as open qualification items.
 
15
 
16
  Complete the [Simulator feature parity matrix](../../../docs/topology/simulator_feature_parity_matrix.md) for every integration alongside the Analysis matrix. Verify the default and edited inputs, executed decks, measurements, sweeps, downloads, operating-point handoff, error recovery, and normal Chrome reload. Use real NGSpice jobs and compare with the tagged XFLY6S, XFLY8S, and C3L Simulator. Document the physical basis for each N/A and the limits of every qualified parameter range. An unresolved applicable row blocks full integration.
17
 
18
+ Previously validated Simulator parameter sets are regression benchmarks. Provide continuous numerical inputs and allow simultaneous changes wherever physically applicable. Apply physical, model, and resource bounds before running. Evaluate convergence, steady state, energy balance and reliability from the new result. Keep fixture restrictions out of the user input path.
19
+
20
  Use the original 4:1 XFLY6S implementation as the functional reference. Start a separate [feature parity checklist](../../../docs/topology/feature_parity_checklist.md) for each topology. Compare individual features and controls, including alternate budget modes, collapsed settings, and controls suppressed by topology-specific rendering. Trace each applicable control to the calculation, job, waveform, or export that uses it. Exercise it with the default and at least one meaningful change.
21
 
22
  Document the units, qualified range and physical basis of topology-specific defaults. Keep applicable controls accessible. Mark a control inapplicable only with a circuit- or model-specific explanation and supporting evidence. Treat missing, inaccessible, or unverified applicable controls as open qualification items.
AGENTS.md CHANGED
@@ -28,6 +28,7 @@ These rules apply to the entire repository.
28
  - For every newly integrated topology, complete the [Feature Parity Validation checklist](docs/topology/feature_parity_checklist.md) using the original 4:1 XFLY6S implementation. Compare each feature and UI control, including alternate modes and advanced settings. Accessibility of Gallery, Analysis, Simulator, and Schematic is an entry-point smoke check.
29
  - Complete the [Analysis feature parity matrix](docs/topology/analysis_feature_parity_matrix.md) row by row, with browser and numerical or export evidence for every applicable feature. Compare against XFLY6S at `local-baseline-v1.0`, including the candidate workflow, The Loss Lineup, and the advanced workbench. Record a technical reason for every exclusion and keep applicable blocked or unverified items open.
30
  - Complete the [Simulator feature parity matrix](docs/topology/simulator_feature_parity_matrix.md) for each integration alongside the Analysis matrix. Compare with the tagged 4:1 Simulator and verify each applicable control, real NGSpice run and sweep, outputs, downloads, handoff, and error recovery in Chrome. Record qualified bounds and justify exclusions. A pending applicable row blocks full integration.
 
31
  - Verify applicable design constraints, technology settings, analytical calculations and losses, efficiency, sizing, optimization objectives, simulation controls, sweeps, waveforms, and exports. Preserve applicable functionality and give a technical justification for each inapplicable control. Document and verify physically meaningful topology-specific defaults.
32
  - Test the actual user workflow in Chrome at `http://127.0.0.1:8765`, including frontend cache invalidation in an existing browser session. Use the repository [topology development skill](.agents/skills/openpels-topology-development/SKILL.md) for integration and qualification.
33
  - [Batch 3 acceptance](docs/topology/feature_parity_checklist.md#batch-3-acceptance) requires a passing checklist for every newly integrated Batch 3 topology. An open applicable item blocks full-integration status.
 
28
  - For every newly integrated topology, complete the [Feature Parity Validation checklist](docs/topology/feature_parity_checklist.md) using the original 4:1 XFLY6S implementation. Compare each feature and UI control, including alternate modes and advanced settings. Accessibility of Gallery, Analysis, Simulator, and Schematic is an entry-point smoke check.
29
  - Complete the [Analysis feature parity matrix](docs/topology/analysis_feature_parity_matrix.md) row by row, with browser and numerical or export evidence for every applicable feature. Compare against XFLY6S at `local-baseline-v1.0`, including the candidate workflow, The Loss Lineup, and the advanced workbench. Record a technical reason for every exclusion and keep applicable blocked or unverified items open.
30
  - Complete the [Simulator feature parity matrix](docs/topology/simulator_feature_parity_matrix.md) for each integration alongside the Analysis matrix. Compare with the tagged 4:1 Simulator and verify each applicable control, real NGSpice run and sweep, outputs, downloads, handoff, and error recovery in Chrome. Record qualified bounds and justify exclusions. A pending applicable row blocks full integration.
31
+ - Previously validated Simulator parameter sets are regression benchmarks. Provide continuous numerical inputs and simultaneous edits wherever physically applicable. Validate model and numerical bounds before execution, then assess convergence, steady state and result reliability from the run.
32
  - Verify applicable design constraints, technology settings, analytical calculations and losses, efficiency, sizing, optimization objectives, simulation controls, sweeps, waveforms, and exports. Preserve applicable functionality and give a technical justification for each inapplicable control. Document and verify physically meaningful topology-specific defaults.
33
  - Test the actual user workflow in Chrome at `http://127.0.0.1:8765`, including frontend cache invalidation in an existing browser session. Use the repository [topology development skill](.agents/skills/openpels-topology-development/SKILL.md) for integration and qualification.
34
  - [Batch 3 acceptance](docs/topology/feature_parity_checklist.md#batch-3-acceptance) requires a passing checklist for every newly integrated Batch 3 topology. An open applicable item blocks full-integration status.
README.md CHANGED
@@ -68,8 +68,9 @@ required for the local workbench.
68
  For `sp2`, select **2:1** in Gallery, open **2:1 series-parallel SC**, and
69
  choose **Edit schematic** or **Simulate**. The Analysis page reports the
70
  delivered-voltage efficiency estimate and equal device allocation. The
71
- Simulator defaults to 3 V and offers qualified 2.8 V and 3.2 V cases at
72
- nominal load. Choose or sweep one qualified setting at a time. The application reports delivered output
 
73
  separately from the 1.5 V ideal conversion reference.
74
  [Local integration and validation](docs/topology/2to1_switching_capacitors/local_integration.md)
75
 
 
68
  For `sp2`, select **2:1** in Gallery, open **2:1 series-parallel SC**, and
69
  choose **Edit schematic** or **Simulate**. The Analysis page reports the
70
  delivered-voltage efficiency estimate and equal device allocation. The
71
+ Simulator defaults to 3 V. Edit multiple numerical settings together and
72
+ optionally sweep an input over a custom range. Each run checks steady state,
73
+ energy balance, and numerical convergence. The application reports delivered output
74
  separately from the 1.5 V ideal conversion reference.
75
  [Local integration and validation](docs/topology/2to1_switching_capacitors/local_integration.md)
76
 
docs/topology/2to1_switching_capacitors/integration/qualify_simulator_extensions.py CHANGED
@@ -1,12 +1,26 @@
1
  """Replay the additional SP-SC fixtures with the Phase C/D acceptance checks."""
2
  import argparse
3
  from concurrent.futures import ThreadPoolExecutor
 
4
  import json
5
  from pathlib import Path
6
  from tempfile import TemporaryDirectory
7
 
8
- from sp2.run_ngspice_validation import run_case
9
- from sp2.sp2_preset import contract, fixture
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
  def check(selection):
@@ -37,9 +51,12 @@ def check(selection):
37
  def main():
38
  parser = argparse.ArgumentParser(description=__doc__)
39
  parser.add_argument('--workers', type=int, default=2)
 
40
  args = parser.parse_args()
41
- spec = contract()
42
  axes = ['vin', 'coss', 'cout', 'gate', 'gatecap', 'stop', 'step']
 
 
43
  selections = [(axis, point, spec) for axis in axes for point, _ in spec['axes'][axis]['points']
44
  if point != 'nominal']
45
  with ThreadPoolExecutor(max_workers=args.workers) as pool:
 
1
  """Replay the additional SP-SC fixtures with the Phase C/D acceptance checks."""
2
  import argparse
3
  from concurrent.futures import ThreadPoolExecutor
4
+ from dataclasses import replace
5
  import json
6
  from pathlib import Path
7
  from tempfile import TemporaryDirectory
8
 
9
+ from sp2.run_ngspice_validation import Case, run_case
10
+
11
+
12
+ def fixture(axis, point, spec):
13
+ base = Case(spec['fixture'], 'physical')
14
+ if point == 'nominal':
15
+ return base
16
+ value = dict(spec['axes'][axis]['points'])[point]
17
+ parameter, scale = {
18
+ 'fs': ('fs', 1e6), 'cf': ('cf', 1e-6), 'esr': ('esr', 1e-3),
19
+ 'rs': ('rs', 1.5e-3), 'load': ('load', 1), 'vin': ('vin', 1),
20
+ 'coss': ('coss', 1e-12), 'cout': ('cout', 1e-6), 'gate': ('gate_drive', 1),
21
+ 'gatecap': ('gate_cap_pf', 1), 'stop': ('minimum_cycles', 1), 'step': ('max_step_ps', 1),
22
+ }[axis]
23
+ return replace(base, name=f'physical_{axis}_{point}', axis=axis, **{parameter: value*scale})
24
 
25
 
26
  def check(selection):
 
51
  def main():
52
  parser = argparse.ArgumentParser(description=__doc__)
53
  parser.add_argument('--workers', type=int, default=2)
54
+ parser.add_argument('--all', action='store_true', help='Include the original five sweep axes')
55
  args = parser.parse_args()
56
+ spec = json.loads(Path(__file__).with_name('simulator_fixture_benchmarks.json').read_text())
57
  axes = ['vin', 'coss', 'cout', 'gate', 'gatecap', 'stop', 'step']
58
+ if args.all:
59
+ axes = list(spec['axes'])
60
  selections = [(axis, point, spec) for axis in axes for point, _ in spec['axes'][axis]['points']
61
  if point != 'nominal']
62
  with ThreadPoolExecutor(max_workers=args.workers) as pool:
docs/topology/2to1_switching_capacitors/integration/simulator_fixture_benchmarks.json ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fixture": "physical_nominal",
3
+ "axes": {
4
+ "fs": {
5
+ "label": "Switching frequency",
6
+ "unit": "MHz",
7
+ "points": [
8
+ [
9
+ "low",
10
+ 0.3
11
+ ],
12
+ [
13
+ "nominal",
14
+ 2
15
+ ],
16
+ [
17
+ "high",
18
+ 12
19
+ ]
20
+ ]
21
+ },
22
+ "cf": {
23
+ "label": "Flying capacitance per cap",
24
+ "unit": "µF",
25
+ "points": [
26
+ [
27
+ "low",
28
+ 0.4
29
+ ],
30
+ [
31
+ "nominal",
32
+ 1
33
+ ],
34
+ [
35
+ "high",
36
+ 2.5
37
+ ]
38
+ ]
39
+ },
40
+ "esr": {
41
+ "label": "Flying-cap ESR",
42
+ "unit": "mΩ",
43
+ "points": [
44
+ [
45
+ "low",
46
+ 5
47
+ ],
48
+ [
49
+ "nominal",
50
+ 20
51
+ ],
52
+ [
53
+ "high",
54
+ 80
55
+ ]
56
+ ]
57
+ },
58
+ "rs": {
59
+ "label": "Switch on-resistance",
60
+ "unit": "mΩ",
61
+ "points": [
62
+ [
63
+ "low",
64
+ 30
65
+ ],
66
+ [
67
+ "nominal",
68
+ 60
69
+ ],
70
+ [
71
+ "high",
72
+ 120
73
+ ]
74
+ ]
75
+ },
76
+ "load": {
77
+ "label": "Output current",
78
+ "unit": "A",
79
+ "points": [
80
+ [
81
+ "low",
82
+ 0.35
83
+ ],
84
+ [
85
+ "nominal",
86
+ 1.1404833
87
+ ],
88
+ [
89
+ "high",
90
+ 2
91
+ ]
92
+ ]
93
+ },
94
+ "vin": {
95
+ "label": "Input voltage",
96
+ "unit": "V",
97
+ "points": [
98
+ [
99
+ "low",
100
+ 2.8
101
+ ],
102
+ [
103
+ "nominal",
104
+ 3
105
+ ],
106
+ [
107
+ "high",
108
+ 3.2
109
+ ]
110
+ ]
111
+ },
112
+ "coss": {
113
+ "label": "Switch Coss",
114
+ "unit": "pF",
115
+ "points": [
116
+ [
117
+ "low",
118
+ 0
119
+ ],
120
+ [
121
+ "nominal",
122
+ 20
123
+ ],
124
+ [
125
+ "high",
126
+ 40
127
+ ]
128
+ ]
129
+ },
130
+ "cout": {
131
+ "label": "Output capacitance",
132
+ "unit": "µF",
133
+ "points": [
134
+ [
135
+ "low",
136
+ 5
137
+ ],
138
+ [
139
+ "nominal",
140
+ 10
141
+ ],
142
+ [
143
+ "high",
144
+ 20
145
+ ]
146
+ ]
147
+ },
148
+ "gate": {
149
+ "label": "Gate-drive high level",
150
+ "unit": "V",
151
+ "points": [
152
+ [
153
+ "low",
154
+ 3
155
+ ],
156
+ [
157
+ "nominal",
158
+ 3.3
159
+ ],
160
+ [
161
+ "high",
162
+ 3.6
163
+ ]
164
+ ]
165
+ },
166
+ "gatecap": {
167
+ "label": "Effective gate capacitance",
168
+ "unit": "pF",
169
+ "points": [
170
+ [
171
+ "low",
172
+ 0
173
+ ],
174
+ [
175
+ "nominal",
176
+ 7.631414141414141
177
+ ],
178
+ [
179
+ "high",
180
+ 15
181
+ ]
182
+ ]
183
+ },
184
+ "stop": {
185
+ "label": "Minimum run length",
186
+ "unit": "cycles",
187
+ "points": [
188
+ [
189
+ "nominal",
190
+ 0
191
+ ],
192
+ [
193
+ "high",
194
+ 64
195
+ ]
196
+ ],
197
+ "numerical": true
198
+ },
199
+ "step": {
200
+ "label": "Refined maximum step ceiling",
201
+ "unit": "ps",
202
+ "points": [
203
+ [
204
+ "low",
205
+ 400
206
+ ],
207
+ [
208
+ "nominal",
209
+ 0
210
+ ]
211
+ ],
212
+ "numerical": true
213
+ }
214
+ }
215
+ }
docs/topology/2to1_switching_capacitors/integration/verify_live.mjs CHANGED
@@ -78,56 +78,65 @@ try {
78
  assert(response.ok());
79
  return response.body();
80
  }
81
- const nominal = await submit({ ...preset.request, parameter: "fs", point: "nominal", sweep: "off" });
 
82
  const m = nominal.metrics[0];
83
  assert(Math.abs(m.vout_v - 1.40029) < 1e-4);
84
  assert(Math.abs(m.efficiency_with_gate - 0.9321274) < 1e-4);
85
  const deck = await download(m.deck);
86
  assert.equal(createHash("sha256").update(deck).digest("hex"), m.deck_sha256);
87
  assert.match((await download(m.waveform)).toString(), /phase_cycles,vout_v,icl_a,icr_a/);
88
- assert.match((await download("physical_nominal.log")).toString(), /No\. of Data Rows/);
89
  assert.equal(JSON.parse((await download("result.json")).toString()).model_provenance.id, "sp2");
90
  assert.equal(await sim.locator("#sp2-sweep-results").isVisible(), false);
91
  console.log("Chrome: Gallery, editable starter, delivered efficiency and nominal NGSpice downloads");
92
 
93
- let referredLoad = preset.request.output_current_a;
94
- for (const [axis, config] of Object.entries(preset.axes)) {
95
- if (config.numerical || (process.env.SP2_SWEEP_AXIS && process.env.SP2_SWEEP_AXIS !== axis)) continue;
96
- await sim.locator("#sp2-parameter").selectOption(axis);
97
- await sim.locator("#sp2-point").selectOption("high");
98
- await sim.locator("#sp2-include-sweep").check();
99
- const selected = Object.fromEntries(config.points).high;
100
- const result = await submit({ ...preset.request,
101
- output_current_a: axis === "load" ? selected : preset.request.output_current_a,
102
- input_voltage_v: axis === "vin" ? selected : preset.request.input_voltage_v,
103
- target_vout: axis === "vin" ? selected / 2 : preset.request.target_vout,
104
- parameter: axis, point: "high", sweep: "on" });
105
- assert.equal(result.metrics[0].value, selected);
106
- assert.deepEqual(result.sweep.map((row) => row.value), config.points.map(([, value]) => value));
107
- assert.equal(await sim.locator("#sp2-sweep-results tbody tr").count(), 3);
108
- await sim.locator("#sp2-sweep-results img").evaluate((image) => image.decode());
109
- const selectedRun = result.metrics[0];
110
- const selectedDeck = (await download(selectedRun.deck)).toString();
111
- assert.equal(createHash("sha256").update(selectedDeck).digest("hex"),selectedRun.deck_sha256);
112
- assert.notEqual(selectedRun.deck_sha256,m.deck_sha256);
113
- const deckParameters = Object.fromEntries([...selectedDeck.matchAll(/^\.param ([^\n]+)/gm)]
114
- .flatMap(match => match[1].match(/\S+=\S+/g) ?? [])
115
- .map(item => item.split("=",2)));
116
- const binding = {fs:["fs",1e6],cf:["cf",1e-6],esr:["esr",1e-3],rs:["ron",1e-3],
117
- load:["iload",1],vin:["bus",1],coss:["coff",1e-12],cout:["co",1e-6],gate:["vg",1]}[axis];
118
- if (binding) {
119
- const [parameter,scale] = binding;
120
- assert(Math.abs(Number(deckParameters[parameter])/(selected*scale)-1) < 1e-12);
121
- } else {
122
- assert.match(selectedDeck,/Effective gate capacitance per device .*: 15 pF/);
123
- }
124
- assert(Math.abs(selectedRun.efficiency_with_gate-m.efficiency_with_gate) > 1e-9);
125
- const csv = (await download("sp2-sweep.csv")).toString().trim().split(/\r?\n/);
126
- assert.equal(csv.length, 4);
127
- assert.match(csv[0], /efficiency_with_gate/);
128
- referredLoad = axis === "load" ? selected : preset.request.output_current_a;
129
- console.log(`Chrome: ${config.label} sweep executed with three downloadable results`);
 
 
130
  }
 
 
 
 
 
 
131
  await page.locator("#selected-analysis").click();
132
  // The iframe may still show the previous value while its next handoff message is queued.
133
  await page.waitForFunction((load) =>
@@ -156,7 +165,7 @@ try {
156
  console.log(`Chrome: original ${topology} ran and downloaded its deck`);
157
  }
158
  const illegal = await page.request.post(api("/api/simulation/jobs"), {
159
- data: { kind: "run", payload: { ...preset.request, parameter: "fs", point: "invented" } },
160
  });
161
  assert.equal(illegal.status(), 400);
162
  assert.deepEqual(errors, []);
 
78
  assert(response.ok());
79
  return response.body();
80
  }
81
+ const defaults = Object.fromEntries(Object.values(preset.parameters).map(entry => [entry.field,entry.default]));
82
+ const nominal = await submit({topologies:["sp2"],...defaults});
83
  const m = nominal.metrics[0];
84
  assert(Math.abs(m.vout_v - 1.40029) < 1e-4);
85
  assert(Math.abs(m.efficiency_with_gate - 0.9321274) < 1e-4);
86
  const deck = await download(m.deck);
87
  assert.equal(createHash("sha256").update(deck).digest("hex"), m.deck_sha256);
88
  assert.match((await download(m.waveform)).toString(), /phase_cycles,vout_v,icl_a,icr_a/);
89
+ assert.match((await download("physical_design.log")).toString(), /No\. of Data Rows/);
90
  assert.equal(JSON.parse((await download("result.json")).toString()).model_provenance.id, "sp2");
91
  assert.equal(await sim.locator("#sp2-sweep-results").isVisible(), false);
92
  console.log("Chrome: Gallery, editable starter, delivered efficiency and nominal NGSpice downloads");
93
 
94
+ const inputs = {vin:3.17,load:1.37,fs:2.65,cf:.83,esr:14.5,rs:73.25,gate:3.55,
95
+ gatecap:8.45,coss:23.5,cout:12.4,stop:22.35,step:387.5};
96
+ for (const [id,value] of Object.entries(inputs))
97
+ await sim.locator("#sp2-"+id).fill(String(value));
98
+ await sim.locator("#sp2-include-sweep").check();
99
+ await sim.locator("#sp2-parameter").selectOption("load");
100
+ for (const [id,value] of [["start",.77],["stop",1.62],["count",4]])
101
+ await sim.locator("#sp2-sweep-"+id).fill(String(value));
102
+ const request = Object.fromEntries(Object.entries(inputs).map(([k,v]) => [preset.parameters[k].field,v]));
103
+ const result = await submit({topologies:["sp2"],...request,sweep:{axis:"load",start:.77,stop:1.62,points:4}});
104
+ const measured = result.metrics[0];
105
+ assert.notEqual(result.validation,"failed");
106
+ assert(Math.abs(measured.vout_v-1.4569)<.0001);
107
+ assert(Math.abs(measured.stop_us-inputs.stop)<1e-9);
108
+ assert(measured.max_step_ps <= inputs.step);
109
+ assert(Math.abs(measured.balance_w) < .003 * measured.stage_w + 1e-8);
110
+ assert(Math.abs(measured.efficiency_with_gate - measured.delivered_w /
111
+ (measured.input_w + measured.supplemental_gate_w)) < 1e-12);
112
+ assert.notEqual(measured.deck_sha256,m.deck_sha256);
113
+ const bindings = {bus:3.17,iload:1.37,fs:2.65e6,cf:.83e-6,esr:.0145,
114
+ ron:.07325,vg:3.55,coff:23.5e-12,co:12.4e-6,voff:-2,ncycle:22.35*2.65};
115
+ const inspectDeck = async (row, bindings) => {
116
+ const body = (await download(row.deck)).toString();
117
+ assert.equal(createHash("sha256").update(body).digest("hex"), row.deck_sha256);
118
+ const parsed = Object.fromEntries([...body.matchAll(/^\.param ([^\n]+)/gm)]
119
+ .flatMap(match => match[1].match(/\S+=\S+/g) ?? []).map(item => item.split("=",2)));
120
+ for (const [key,value] of Object.entries(bindings))
121
+ assert(Math.abs(Number(parsed[key])/value-1) < 1e-12,key);
122
+ assert.match(body,/Effective gate capacitance per device .*: 8.45 pF/);
123
+ };
124
+ await inspectDeck(measured,bindings);
125
+ assert.equal(result.sweep.length,4);
126
+ assert.equal(result.sweep[0].value,.77);
127
+ assert.equal(result.sweep.at(-1).value,1.62);
128
+ assert.equal(await sim.locator("#sp2-sweep-results tbody tr").count(),4);
129
+ await sim.locator("#sp2-sweep-results img").evaluate(image => image.decode());
130
+ for (const row of result.sweep) {
131
+ assert.notEqual(row.status,"failed",row.message);
132
+ await inspectDeck(row,{...bindings,iload:row.value});
133
  }
134
+ assert(result.sweep.at(-1).vout_v < result.sweep[0].vout_v);
135
+ const csv = (await download("sp2-sweep.csv")).toString().trim().split(/\r?\n/);
136
+ assert.equal(csv.length,5);
137
+ assert.match(csv[0],/status.*efficiency_with_gate.*deck_sha256/);
138
+ const referredLoad = inputs.load;
139
+ console.log("Chrome: continuous multi-input design, four-point custom sweep, executable deck bindings and downloads verified");
140
  await page.locator("#selected-analysis").click();
141
  // The iframe may still show the previous value while its next handoff message is queued.
142
  await page.waitForFunction((load) =>
 
165
  console.log(`Chrome: original ${topology} ran and downloaded its deck`);
166
  }
167
  const illegal = await page.request.post(api("/api/simulation/jobs"), {
168
+ data: { kind: "run", payload: {topologies:["sp2"],input_voltage_v:4.01} },
169
  });
170
  assert.equal(illegal.status(), 400);
171
  assert.deepEqual(errors, []);
docs/topology/2to1_switching_capacitors/integration/verify_simulator_parity.mjs CHANGED
@@ -121,37 +121,39 @@ try {
121
  await page.locator('[data-topology-id="sp2"]').click();
122
  const analysis = page.frameLocator("#comparison");
123
  await expect(analysis.locator("#design-vout")).toHaveValue("1.5");
124
- await analysis.locator("#design-vout").fill("1.6");
 
125
  await expect(page.locator("#selected-simulate")).toBeEnabled();
126
  await page.locator("#selected-simulate").click();
127
  const sim = page.frameLocator("#simulator");
128
- await expect(sim.locator("#sp2-vin")).toHaveValue("high");
129
- await expect(sim.locator("#sp2-nominal-output")).toContainText("1.6 V");
130
  await expect(sim.locator('.topology-card[data-topology="sp2"] img')).toBeVisible();
131
  for (const axis of ["vin","load","fs","cf","esr","rs","cout","coss","gate","gatecap","stop","step"])
132
  await expect(sim.locator("#sp2-"+axis)).toBeVisible();
133
  for (const id of ["k","lout","dcr1","dcr2"])
134
  await expect(sim.locator("#"+id)).not.toBeVisible();
135
- await sim.locator("#sp2-vin").selectOption("low");
136
  await page.locator("#selected-analysis").click();
137
- await expect(analysis.locator("#design-vout")).toHaveValue("1.4");
138
- await analysis.locator("#design-io").fill("2");
139
  await expect(page.locator("#selected-simulate")).toBeDisabled();
140
- await analysis.locator("#design-vout").fill("1.5");
141
  await expect(page.locator("#selected-simulate")).toBeEnabled();
142
  await page.locator("#selected-simulate").click();
143
- await expect(sim.locator("#sp2-load")).toHaveValue("high");
144
- await expect(sim.locator("#sp2-vin")).toHaveValue("nominal");
145
 
146
- for (const [axis,point] of [["stop","high"],["step","low"]]) {
147
- await sim.locator("#sp2-"+axis).selectOption(point);
148
- await expect(sim.locator("#sp2-include-sweep")).toBeDisabled();
 
149
  const result = await run(page, sim, true);
150
  const measurement = result.metrics[0];
151
- assert.equal(result.settings.parameter,axis);
152
  const values = parameters(await artifact(page,result,measurement.deck));
153
- if (axis === "stop") assert.equal(Number(values.ncycle),64);
154
- else assert(measurement.max_step_ps <= 400);
155
  assert(Math.abs(measurement.balance_w) < .003 * measurement.stage_w + 1e-8);
156
  assert(Math.abs(measurement.efficiency_with_gate - measurement.delivered_w /
157
  (measurement.input_w + measurement.supplemental_gate_w)) < 1e-12);
@@ -161,15 +163,52 @@ try {
161
  await expect(sim.locator("#sp2-sweep-results")).not.toBeVisible();
162
  assert.match(await artifact(page,result,measurement.waveform),
163
  /input_current_a,iout_a,vfly_left_v,vfly_right_v,input_w,output_w/);
164
- console.log("Chrome numerical control verified for",axis);
165
  }
166
 
167
  const rejected = await page.request.post(origin+"/api/simulation/jobs",{data:{kind:"run",payload:{
168
- topologies:["sp2"],input_voltage_v:3.15,target_vout:1.575,output_current_a:1.1404833,
169
- parameter:"vin",point:"high",sweep:"off",
170
  }}});
171
  assert.equal(rejected.status(),400);
172
- assert.match(await rejected.text(),/requires input_voltage_v/);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  // Verify an HTTP failure unlocks the focused simulator and clears prior results.
175
  await page.route("**/api/simulation/jobs", route => route.fulfill({
 
121
  await page.locator('[data-topology-id="sp2"]').click();
122
  const analysis = page.frameLocator("#comparison");
123
  await expect(analysis.locator("#design-vout")).toHaveValue("1.5");
124
+ await analysis.locator("#design-vout").fill("1.585");
125
+ await analysis.locator("#design-io").fill("1.37");
126
  await expect(page.locator("#selected-simulate")).toBeEnabled();
127
  await page.locator("#selected-simulate").click();
128
  const sim = page.frameLocator("#simulator");
129
+ await expect(sim.locator("#sp2-vin")).toHaveValue("3.17");
130
+ await expect(sim.locator("#sp2-nominal-output")).toContainText("1.585 V");
131
  await expect(sim.locator('.topology-card[data-topology="sp2"] img')).toBeVisible();
132
  for (const axis of ["vin","load","fs","cf","esr","rs","cout","coss","gate","gatecap","stop","step"])
133
  await expect(sim.locator("#sp2-"+axis)).toBeVisible();
134
  for (const id of ["k","lout","dcr1","dcr2"])
135
  await expect(sim.locator("#"+id)).not.toBeVisible();
136
+ await sim.locator("#sp2-vin").fill("2.85");
137
  await page.locator("#selected-analysis").click();
138
+ await expect(analysis.locator("#design-vout")).toHaveValue("1.425");
139
+ await analysis.locator("#design-io").fill("4.1");
140
  await expect(page.locator("#selected-simulate")).toBeDisabled();
141
+ await analysis.locator("#design-io").fill("2.17");
142
  await expect(page.locator("#selected-simulate")).toBeEnabled();
143
  await page.locator("#selected-simulate").click();
144
+ await expect(sim.locator("#sp2-load")).toHaveValue("2.17");
145
+ await expect(sim.locator("#sp2-vin")).toHaveValue("2.85");
146
 
147
+ await sim.locator("#sp2-fs").fill("3.27");
148
+ await sim.locator("#sp2-stop").fill("29.35");
149
+ await sim.locator("#sp2-step").fill("313.5");
150
+ {
151
  const result = await run(page, sim, true);
152
  const measurement = result.metrics[0];
153
+ assert.equal(result.settings.switching_frequency_mhz,3.27);
154
  const values = parameters(await artifact(page,result,measurement.deck));
155
+ assert(Math.abs(Number(values.ncycle) - 29.35*3.27) < 1e-10);
156
+ assert(measurement.max_step_ps <= 313.5);
157
  assert(Math.abs(measurement.balance_w) < .003 * measurement.stage_w + 1e-8);
158
  assert(Math.abs(measurement.efficiency_with_gate - measurement.delivered_w /
159
  (measurement.input_w + measurement.supplemental_gate_w)) < 1e-12);
 
163
  await expect(sim.locator("#sp2-sweep-results")).not.toBeVisible();
164
  assert.match(await artifact(page,result,measurement.waveform),
165
  /input_current_a,iout_a,vfly_left_v,vfly_right_v,input_w,output_w/);
166
+ console.log("Chrome simultaneous timing and operating controls verified");
167
  }
168
 
169
  const rejected = await page.request.post(origin+"/api/simulation/jobs",{data:{kind:"run",payload:{
170
+ topologies:["sp2"],input_voltage_v:4.01,output_current_a:1.1404833,
 
171
  }}});
172
  assert.equal(rejected.status(),400);
173
+ assert.match(await rejected.text(),/Input voltage/);
174
+
175
+ await sim.locator("#sp2-vin").fill("1.9");
176
+ await sim.locator("#sp2-load").fill("3.4");
177
+ await sim.locator("#sp2-fs").fill("1.8");
178
+ await sim.locator("#sp2-cf").fill(".4");
179
+ await sim.locator("#sp2-rs").fill("150");
180
+ await sim.locator("#sp2-stop").fill("12.5");
181
+ await sim.locator("#sp2-step").fill("");
182
+ const accepted = page.waitForResponse(r => r.request().method() === "POST" && r.url().endsWith("/api/simulation/jobs"));
183
+ await sim.locator("#runButton").click();
184
+ assert.equal((await accepted).status(),202);
185
+ await expect(sim.locator("#status")).toContainText("result failed validation",{timeout:120000});
186
+ await expect(sim.locator("#metricsTable")).not.toBeVisible();
187
+
188
+ await sim.locator("#sp2-include-sweep").check();
189
+ await sim.locator("#sp2-parameter").selectOption("load");
190
+ await sim.locator("#sp2-sweep-start").fill(".75");
191
+ await sim.locator("#sp2-sweep-stop").fill("3.4");
192
+ await sim.locator("#sp2-sweep-count").fill("3");
193
+ const partialRequest = page.waitForResponse(r =>
194
+ r.request().method()==="POST" && r.url().endsWith("/api/simulation/jobs"));
195
+ await sim.locator("#runButton").click();
196
+ const partialResponse = await partialRequest;
197
+ assert.equal(partialResponse.status(),202);
198
+ const partialId = (await partialResponse.json()).id;
199
+ await expect(sim.locator("#sweepStatus")).toContainText("1 / 3 points passed checks",{timeout:150000});
200
+ await expect(sim.locator("#sp2-validation")).toContainText("nonperiodic mean voltage");
201
+ await expect(sim.locator("#sp2-sweep-results tbody tr").last()).toContainText("failed");
202
+ await sim.locator("#sp2-sweep-results img").evaluate(image => image.decode());
203
+ const partialJob = await (await page.request.get(origin + "/api/simulation/jobs/" + partialId)).json();
204
+ const partial = partialJob.result;
205
+ assert.equal(partial.validation,"failed");
206
+ assert.equal(partial.metrics.length,0);
207
+ assert.equal(partial.sweep[0].status,"passed");
208
+ assert.equal(partial.sweep[2].status,"failed");
209
+ assert(!Object.hasOwn(partial.sweep[2],"efficiency_with_gate"));
210
+ assert.match(await artifact(page,partial,"sp2-sweep.csv"),/3\.4,failed,/);
211
+ await sim.locator("#sp2-include-sweep").uncheck();
212
 
213
  // Verify an HTTP failure unlocks the focused simulator and clears prior results.
214
  await page.route("**/api/simulation/jobs", route => route.fulfill({
docs/topology/minjie_confirmation_list.md CHANGED
@@ -12,6 +12,8 @@
12
 
13
  ## Local implementation review
14
 
 
 
15
  - The sp2 Simulator uses the original panel and asynchronous job workflow. The same physical topology now exposes qualified input, gate-drive, Coss, output-capacitance and numerical presets. A gate-capacitance input affects the separate loss estimate. Stage Coss dissipation is already included in terminal power. The phase timing and −2 V negative-off assumption remain. The new points are one-setting variations. [Simulator parity and model scope](simulator_feature_parity_matrix.md)
16
 
17
  - The feature-level Analysis review restored the existing lineup, circuit cards, eligibility screening, width search and Design JSON for sp2. The sp2 width search uses its qualified finite-RC loss and separate gate/optional Coss terms. Per-unit comparison is scoped to verified 2:1 references with shared normalized weights. Existing 4:1 equations and shortlist behavior stay intact. [Analysis parity and exclusions](analysis_feature_parity_matrix.md)
 
12
 
13
  ## Local implementation review
14
 
15
+ - Continuous sp2 Simulator input replaces fixture-based UI, API and Gallery handoff gates. The same generic switched bench accepts simultaneous bounded inputs. Each run checks result reliability, and each configurable sweep holds the other entered settings fixed. Prior Phase C/D and parity points remain executable regression cases. [Continuous Simulator contract](simulator_feature_parity_matrix.md#continuous-sp2-parameter-contract)
16
+
17
  - The sp2 Simulator uses the original panel and asynchronous job workflow. The same physical topology now exposes qualified input, gate-drive, Coss, output-capacitance and numerical presets. A gate-capacitance input affects the separate loss estimate. Stage Coss dissipation is already included in terminal power. The phase timing and −2 V negative-off assumption remain. The new points are one-setting variations. [Simulator parity and model scope](simulator_feature_parity_matrix.md)
18
 
19
  - The feature-level Analysis review restored the existing lineup, circuit cards, eligibility screening, width search and Design JSON for sp2. The sp2 width search uses its qualified finite-RC loss and separate gate/optional Coss terms. Per-unit comparison is scoped to verified 2:1 references with shared normalized weights. Existing 4:1 equations and shortlist behavior stay intact. [Analysis parity and exclusions](analysis_feature_parity_matrix.md)
docs/topology/simulator_feature_parity_matrix.md CHANGED
@@ -1,8 +1,8 @@
1
  # Simulator feature parity matrix
2
 
3
- Use this matrix when integrating any topology. Record the tested commit, baseline, preset, Chrome URL, default and edited inputs, and evidence for every row. Mark each row **Pass**, **Fail**, **Blocked**, or **N/A**. Every applicable row must pass for acceptance. Explain the circuit or model behind every N/A. Parameter restrictions that reflect limited validation belong in the results as limitations.
4
 
5
- The functional and visual reference is the XFLY6S, XFLY8S, and C3L implementation at `local-baseline-v1.0` (`4cbae7715292e963c65e12e90d13699234ab26fe`). The pinned standalone engine exposes a three-topology comparison. The baseline **OpenPELS** frame already adapts that engine to a single topology selected by Gallery and an optional per-topology 15-point efficiency sweep. Both were inspected in Chrome. The matrix compares the OpenPELS-integrated workflow with sp2.
6
 
7
  ## Controls and navigation
8
 
@@ -10,17 +10,17 @@ The functional and visual reference is the XFLY6S, XFLY8S, and C3L implementatio
10
  | --- | --- | --- | --- |
11
  | Page and section layout | Parameters at left, schematic, summary, waveforms, measurement table, and Efficiency Sweep panel at right. | Used a short fixture form, a sparse summary, and a second sweep area below the waveform. | **Pass** for the qualified workflow. Restored labeled parameter controls, four summary metrics, measurement table and original sweep panel. Chrome checks DOM layout, results and panel visibility. |
12
  | Topology selector and schematic | Single preset dropdown, matching title and image. Standalone engine can compare three. | Selected sp2 with a bare schematic image. | **Pass** for the qualified workflow. sp2 uses the original card title/image frame. Physical comparison remains per preset. Chrome checks the selected schematic. |
13
- | Input voltage | Editable 1–12 V in 0.1 V steps, standalone default 3.6 V. In Gallery the initial rail is derived from ratio and nominal output. | Fixed 3 V. | **Pass** for the qualified workflow. Qualified 2.8, 3.0 and 3.2 V at nominal load. Chrome checks edited values, real rail sweep and handoff. |
14
- | Output voltage target | 0.30–1.10 V. Inferred 4:1 duty and resistive load depend on target. | 1.5 V nominal, no independent target. | **Pass** for nominal target and handoff. A desired operating point maps to the ideal no-load gain of 1/2. An independent output regulation control is N/A at fixed command duty. Display 1.4, 1.5 or 1.6 V nominal from Vin and report delivered voltage separately. Chrome checks derivation and handoff. |
15
- | Load current and load model | Editable 0.1–40 A, standalone default 4 A, uses a target-derived resistor in the standard preset. | 0.35, 1.1404833 and 2 A via fixture selector. | **Pass** for the qualified workflow. Explicit current field and load sweep. The standard sp2 testbench uses a measured constant-current sink. An independent resistive-load mode has no qualified sp2 implementation. |
16
- | Frequency | 1–500 MHz, defaults 100 MHz for XFLY6S and 50 MHz each for XFLY8S/C3L. | 0.3, 2 and 12 MHz via fixture selector. | **Pass** for the qualified workflow. Direct MHz selector and optional sweep. Frequency means the full period of either of the interleaved clocks. |
17
- | Flying capacitance and ESR | 1–2000 nF (100 nF default) with fixed capacitor ESR in the underlying decks. | 0.4/1/2.5 µF and 5/20/80 mΩ, only behind the generic fixture selector. | **Pass** for the qualified workflow. Direct per-cap controls and sweeps. Matching between the two cap paths is fixed. |
18
- | Switch Ron and device area | 0.2–100 mΩ (30 mΩ default), deck model edited by preset adapter. | 30/60/120 mΩ via fixture selector. | **Pass** for the qualified workflow. Direct per-switch Ron control. The qualified deck maps width as 0.602 Ω·mm divided by per-switch Ron and maintains eight equal devices. The simulator does not rerun Analysis sizing. |
19
- | Gate voltage and gate capacitance | 1–10 V (1.8 V default) and 0–1000 pF (20 pF default). Effective capacitance contributes to gate estimate. | 3.3 V and technology-derived gate estimate, both fixed. | **Pass** for the qualified workflow. 3.0/3.3/3.6 V high-level drive and auxiliary 0/derived/15 pF. Derived nominal is about 7.63 pF per switch at 60 mΩ. Effective gate capacitance changes the separate loss estimate, so deck provenance records it as a comment. Q3/Q7 retain −2 V off bias. |
20
- | Coss and Cout | 0–500 pF Coss (20 pF default). Output reservoir comes from the deck; it has no original form control. | Fixed 20 pF Coss, 10 µF Cout. | **Pass** for the qualified workflow. Qualified 0/20/40 pF per switch and 5/10/20 µF Cout. Specific capacitor or layout parasitics beyond this generic model remain outside qualification. |
21
  | Coupling coefficient, self-inductance, winding DCR | Editable 0–0.95, 0.2–50 nH and 1–100 mΩ per winding, defaults 0.70, 3 nH and 20 mΩ. | Hidden. | **N/A**. sp2 has no winding or magnetically coupled power path. No value is substituted for missing measurements. |
22
- | Stop time and max step | Editable 0.5–20 µs (4 µs default) and 5–200 ps (200 ps default). | Automatic only. | **Pass** for the qualified workflow. Automatic qualification remains default. Exposes a 64-cycle minimum or a 400 ps ceiling on the refined deck. The UI and JSON show actual duration, step, and measurement window. Coarse, refined, and extended runs still meet the qualification bounds. Chrome checks executed decks. |
23
- | Gallery, Analysis, Simulator handoff | Carries the selected topology, nominal Vout and Iout. Run completion preserves pending selection. | Synced at 3 V and the three qualified current settings. | **Pass** for the qualified workflow. Syncs the new qualified nominal voltages and currents in both directions. As in the original handoff, Analysis technology and simulation-specific settings are separate. Out-of-domain requests remain visible in Analysis with a qualification explanation, and simulation stays disabled. |
24
 
25
  Sources [pinned 4:1 UI and controls](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L557), [embedded layout](../../simulator_frame.py), [sp2 browser wiring](../../simulator_bridge.js), [presets](../../sp2/preset_contract.json), [Gallery eligibility and handoff](../../static/pe.js).
26
 
@@ -29,14 +29,14 @@ Sources [pinned 4:1 UI and controls](../../simulator/library/ngspice/studies/xfl
29
  | Feature | 4:1 baseline | sp2 before audit | Applicability, correction, and final verification |
30
  | --- | --- | --- | --- |
31
  | Main action, status and busy handling | Run Simulation, regular async polling, disables topology/point while active and draws results when ready. | Shared Run Simulation but separate sp2 rendering. | **Pass** for the qualified workflow. Keeps shared asynchronous jobs and locks sp2 controls while active. Uses the original progress card and displays sweep point progress. Restores controls on completion. |
32
- | Sweep interaction and progress | Opt-in. Three nominal output targets, five relative load currents each. Displays an efficiency curve per target and progress while running. | Opt-in three points on one of five axes. Separate plot and no point progress. | **Pass** for the qualified workflow. Uses the original efficiency panel and progress bar with 10 selectable physical axes, including absolute current and input/nominal-output sweeps. Three qualified points per axis. Combined off-nominal settings stay outside the qualified fixture set. |
33
- | Efficiency curves | Modeled efficiency per output target and load. | One curve including gate estimate. | **Pass** for the qualified workflow. Shows stage-only and including-gate curves, downloadable plot, per-point table and CSV. No sweep interpolation is presented as qualified. |
34
  | Waveforms | Delivered voltage, winding and output current, flying cap voltage and other traces as configured by the pinned engine. | Q3/Q7 gate voltage, flying currents, and output voltage. | **Pass** for the qualified workflow. Keeps gate and output traces and adds both flying voltages and the input/delivered currents. Raw result CSV includes both command clocks and input/output power. |
35
  | Winding currents, winding delta and sum ripple | Winding and combined current are displayed and measured. | Missing. | **N/A**. Uses measured flying-cap currents, RMS, mean floating-cap voltage and ripple instead. Stage port currents and output voltage remain measured. |
36
  | Summary cards and measurement table | Target point, efficiency, runtime, inferred duty, load voltage/current, winding and cap metrics. | Separate definition list and inactive baseline summaries. | **Pass** for the qualified workflow. Restored active summary and table with fixed nominal command duty, stage and including-gate efficiencies, measured port currents, cap metrics and timing. Additional detail reports power, losses, balance residual and two equivalent resistance definitions. |
37
  | Power boundaries | Stage electrical traces and reference gate-loss proxy. | Separate stage and gate accounting in JSON with limited UI. | **Pass** for the qualified workflow. Reports stage, measured MOS terminal/flying ESR and gate proxy separately. Coss is included in the stage current-path dissipation and does not become a second loss term. |
38
  | Artifacts | Executed netlist, log, sampled traces, plot and result JSON through same-origin routes. | Already supported, with a single-period waveform CSV and extra qualification JSON. | **Pass** for the qualified workflow. Retained downloads and added cap, port and power traces, refined timing, step and measurement-window metadata. Sweep output includes the table data and both plotted efficiencies. |
39
- | Validation, queue and errors | Shared HTTP validation, busy handling, job errors and artifact bounds. | Rejected unknown selectors and off-fixture points. | **Pass** for the qualified workflow. Added strict validation for new rail/ratio pairs and numerical-control scope, with no silent mapping. Checks queued failure in Chrome and unsupported requests via the real job API. |
40
  | Asset reload | Baseline renders the same-origin simulator frame. | Frame and bridge used the same runtime dispatch. | **Pass** for the qualified workflow. Warmed Chrome tab switched to the rebuilt frame after normal reload on the restarted port-8765 server. |
41
 
42
  Sources [original graph/table/sweep rendering](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L686), [job and artifact handling](../../simulator_service.py), [sp2 measurements and plotting](../../sp2/sp2_preset.py).
@@ -45,11 +45,42 @@ Sources [original graph/table/sweep rendering](../../simulator/library/ngspice/s
45
 
46
  - The same physical deck retains the eight level-1 generic MOSFETs, two equal flying capacitors, matched clock phases, 250 ps edges, 500 ps command-edge separation, and negative Q3/Q7 off-bias. The active state device order, polarity, off-state leakage, and overlap are checked each run. The nominal physical deck is unchanged. [Physical testbench](../../sp2/sp2_physical.cir) · [State checks](../../sp2/run_ngspice_validation.py)
47
  - Each run compares the last two four-cycle windows at a common phase offset. Voltage drift must be within 100 µV, normalized flying charge residual within 0.1%, and per-window loss change within 0.2%. Balance and overall convergence are within 0.3% and individual component convergence within 0.5%. The balance uses measured input, output, stage dissipation, and boundary stored energy. Coss contributes stored energy and MOS dissipation, while the effective gate-capacitance entry is a separate driver estimate. [Measurement windows and acceptance](2to1_switching_capacitors/ngspice_validation.md)
48
- - The additional rail, capacitance, gate and numerical fixture cases were checked at nominal remaining settings using coarse, refined and longer runs. This establishes discrete points of the generic bench. It does not qualify arbitrary combinations, continuous curves, physical devices, layout, gate-driver overhead, or loaded output regulation. The −2 V assumption does not establish hardware feasibility or device stress limits.
49
  - Use [the extra fixture replay](2to1_switching_capacitors/integration/qualify_simulator_extensions.py) for compact numerical validation, [the Chrome parity comparison](2to1_switching_capacitors/integration/verify_simulator_parity.mjs) for tagged 4:1 and focused sp2 behavior, and [the live regression](2to1_switching_capacitors/integration/verify_live.mjs) for actual downloads and sweeps. Browser execution uses the local workbench at port 8765.
50
 
51
  ### Additional fixture results
52
 
53
  The 12 additional endpoint and numerical variants passed the coarse-to-refined and refined-to-extended checks. At 1.1404833 A, the 2.8 V and 3.2 V inputs delivered 1.300290 V and 1.500289 V. Stage energy-balance residuals were −9.98 µW and −12.44 µW. The 400 ps refined case recorded a 400 ps ceiling and a −3.27 µW residual. The gate-capacitance endpoints preserved the measured stage result and changed only the auxiliary gate estimate. [Numerical fixture evidence](2to1_switching_capacitors/integration/simulator_extension_qualification.json)
54
 
55
- Chrome at port 8765 completed all ten three-point sp2 sweeps. Their executed decks and sweep CSVs matched the preset values, reported measurements, and checksums. The tagged and live 4:1 UIs returned identical measurements for XFLY6S, XFLY8S, and C3L at the regression settings. The XFLY6S 15-point sweep chart also matched. All 45 archived analytical tests passed, and the pinned 4:1 engine, physical sp2 deck template, and analytical equations were unchanged.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Simulator feature parity matrix
2
 
3
+ Use this matrix when integrating any topology. Record the tested commit, baseline, preset, Chrome URL, default and edited inputs, and evidence for every row. Mark each row **Pass**, **Fail**, **Blocked**, or **N/A**. Every applicable row must pass for acceptance. Explain the circuit or model behind every N/A. Previously validated parameter sets are regression benchmarks. Provide continuous numerical inputs and simultaneous changes wherever physically applicable. Record physical model limits and numerical resource bounds. Separate preflight validity from post-run reliability.
4
 
5
+ The functional and visual reference is the XFLY6S, XFLY8S, and C3L implementation at `local-baseline-v1.0` (`4cbae7715292e963c65e12e90d13699234ab26fe`). The pinned standalone engine exposes a three-topology comparison. The baseline **OpenPELS** frame already adapts that engine to a single topology selected by Gallery and an optional per-topology 15-point efficiency sweep. Both were inspected in Chrome. The matrix records the OpenPELS-integrated workflow against sp2. Its prior fixture-based results remain in Git at `d3fd70c`.
6
 
7
  ## Controls and navigation
8
 
 
10
  | --- | --- | --- | --- |
11
  | Page and section layout | Parameters at left, schematic, summary, waveforms, measurement table, and Efficiency Sweep panel at right. | Used a short fixture form, a sparse summary, and a second sweep area below the waveform. | **Pass** for the qualified workflow. Restored labeled parameter controls, four summary metrics, measurement table and original sweep panel. Chrome checks DOM layout, results and panel visibility. |
12
  | Topology selector and schematic | Single preset dropdown, matching title and image. Standalone engine can compare three. | Selected sp2 with a bare schematic image. | **Pass** for the qualified workflow. sp2 uses the original card title/image frame. Physical comparison remains per preset. Chrome checks the selected schematic. |
13
+ | Input voltage | Editable 1–12 V in 0.1 V steps, standalone default 3.6 V. In Gallery the initial rail is derived from ratio and nominal output. | Fixed 3 V. | **Pass** for the qualified workflow. Continuous 1.8–4 V. Prior rail cases remain regression benchmarks. Chrome checks a simultaneous rail/load edit and handoff. |
14
+ | Output voltage target | 0.30–1.10 V. Inferred 4:1 duty and resistive load depend on target. | 1.5 V nominal, no independent target. | **Pass** for nominal target and handoff. A desired operating point maps to the ideal no-load gain of 1/2. An independent output regulation control is N/A at fixed command duty. Display nominal output continuously from Vin and report delivered voltage separately. Chrome checks derivation and handoff. |
15
+ | Load current and load model | Editable 0.1–40 A, standalone default 4 A, uses a target-derived resistor in the standard preset. | 0.35, 1.1404833 and 2 A via fixture selector. | **Pass** for the qualified workflow. Continuous 0.05–4 A input and configurable load sweep. The standard sp2 testbench uses a measured constant-current sink. An independent resistive-load mode has no qualified sp2 implementation. |
16
+ | Frequency | 1–500 MHz, defaults 100 MHz for XFLY6S and 50 MHz each for XFLY8S/C3L. | 0.3, 2 and 12 MHz via fixture selector. | **Pass** for the qualified workflow. Continuous 0.2–20 MHz input and configurable sweep. Frequency means the full period of either of the interleaved clocks. |
17
+ | Flying capacitance and ESR | 1–2000 nF (100 nF default) with fixed capacitor ESR in the underlying decks. | 0.4/1/2.5 µF and 5/20/80 mΩ, only behind the generic fixture selector. | **Pass** for the qualified workflow. Continuous 0.1–5 µF per cap and 0.1–150 mΩ ESR, with configurable sweeps. Matching between the two cap paths is fixed. |
18
+ | Switch Ron and device area | 0.2–100 mΩ (30 mΩ default), deck model edited by preset adapter. | 30/60/120 mΩ via fixture selector. | **Pass** for the qualified workflow. Continuous 10–200 mΩ per-switch Ron input. The qualified deck maps width as 0.602 Ω·mm divided by per-switch Ron and maintains eight equal devices. The simulator does not rerun Analysis sizing. |
19
+ | Gate voltage and gate capacitance | 1–10 V (1.8 V default) and 0–1000 pF (20 pF default). Effective capacitance contributes to gate estimate. | 3.3 V and technology-derived gate estimate, both fixed. | **Pass** for the qualified workflow. Continuous 2.5–4.5 V high-level drive and auxiliary 0–100 pF, or derived automatically. Derived nominal is about 7.63 pF per switch at 60 mΩ. Effective gate capacitance changes the separate loss estimate, so deck provenance records it as a comment. Q3/Q7 retain −2 V off bias. |
20
+ | Coss and Cout | 0–500 pF Coss (20 pF default). Output reservoir comes from the deck; it has no original form control. | Fixed 20 pF Coss, 10 µF Cout. | **Pass** for the qualified workflow. Continuous 0–100 pF per switch and 1–50 µF Cout. Specific capacitor or layout parasitics beyond this generic model remain outside qualification. |
21
  | Coupling coefficient, self-inductance, winding DCR | Editable 0–0.95, 0.2–50 nH and 1–100 mΩ per winding, defaults 0.70, 3 nH and 20 mΩ. | Hidden. | **N/A**. sp2 has no winding or magnetically coupled power path. No value is substituted for missing measurements. |
22
+ | Stop time and max step | Editable 0.5–20 µs (4 µs default) and 5–200 ps (200 ps default). | Automatic only. | **Pass** for the qualified workflow. Automatic qualification remains default. Accepts a 1–500 µs requested duration and 50–5000 ps refined step ceiling, with preflight period and computational limits. The UI and JSON show actual duration, step, and measurement window. Coarse, refined, and extended runs still meet the qualification bounds. Chrome checks executed decks. |
23
+ | Gallery, Analysis, Simulator handoff | Carries the selected topology, nominal Vout and Iout. Run completion preserves pending selection. | Synced at 3 V and the three qualified current settings. | **Pass** for the qualified workflow. Syncs both numeric fields together within their individual bounds. As in the original handoff, Analysis technology and simulation-specific settings are separate. Out-of-domain requests remain visible in Analysis with a qualification explanation, and simulation stays disabled. |
24
 
25
  Sources [pinned 4:1 UI and controls](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L557), [embedded layout](../../simulator_frame.py), [sp2 browser wiring](../../simulator_bridge.js), [presets](../../sp2/preset_contract.json), [Gallery eligibility and handoff](../../static/pe.js).
26
 
 
29
  | Feature | 4:1 baseline | sp2 before audit | Applicability, correction, and final verification |
30
  | --- | --- | --- | --- |
31
  | Main action, status and busy handling | Run Simulation, regular async polling, disables topology/point while active and draws results when ready. | Shared Run Simulation but separate sp2 rendering. | **Pass** for the qualified workflow. Keeps shared asynchronous jobs and locks sp2 controls while active. Uses the original progress card and displays sweep point progress. Restores controls on completion. |
32
+ | Sweep interaction and progress | Opt-in. Three nominal output targets, five relative load currents each. Displays an efficiency curve per target and progress while running. | Opt-in three points on one of five axes. Separate plot and no point progress. | **Pass** for the qualified workflow. Uses the original efficiency panel and progress bar with configurable endpoints and 2–15 points on any of the 12 numerical inputs. Each sample holds the other user inputs fixed. The main waveform runs the user’s full operating point. |
33
+ | Efficiency curves | Modeled efficiency per output target and load. | One curve including gate estimate. | **Pass** for the qualified workflow. Shows stage-only and including-gate curves, downloadable plot, per-point table and CSV. Failed points appear as gaps, with reasons in the table and CSV. |
34
  | Waveforms | Delivered voltage, winding and output current, flying cap voltage and other traces as configured by the pinned engine. | Q3/Q7 gate voltage, flying currents, and output voltage. | **Pass** for the qualified workflow. Keeps gate and output traces and adds both flying voltages and the input/delivered currents. Raw result CSV includes both command clocks and input/output power. |
35
  | Winding currents, winding delta and sum ripple | Winding and combined current are displayed and measured. | Missing. | **N/A**. Uses measured flying-cap currents, RMS, mean floating-cap voltage and ripple instead. Stage port currents and output voltage remain measured. |
36
  | Summary cards and measurement table | Target point, efficiency, runtime, inferred duty, load voltage/current, winding and cap metrics. | Separate definition list and inactive baseline summaries. | **Pass** for the qualified workflow. Restored active summary and table with fixed nominal command duty, stage and including-gate efficiencies, measured port currents, cap metrics and timing. Additional detail reports power, losses, balance residual and two equivalent resistance definitions. |
37
  | Power boundaries | Stage electrical traces and reference gate-loss proxy. | Separate stage and gate accounting in JSON with limited UI. | **Pass** for the qualified workflow. Reports stage, measured MOS terminal/flying ESR and gate proxy separately. Coss is included in the stage current-path dissipation and does not become a second loss term. |
38
  | Artifacts | Executed netlist, log, sampled traces, plot and result JSON through same-origin routes. | Already supported, with a single-period waveform CSV and extra qualification JSON. | **Pass** for the qualified workflow. Retained downloads and added cap, port and power traces, refined timing, step and measurement-window metadata. Sweep output includes the table data and both plotted efficiencies. |
39
+ | Validation, queue and errors | Shared HTTP validation, busy handling, job errors and artifact bounds. | Rejected unknown selectors and off-fixture points. | **Pass** for the qualified workflow. Rejects invalid values, insufficient period count, and excessive numerical work before execution. Separately evaluates each result and shows warnings or failures. Chrome tests rejected input, an accepted operating point that fails after execution, and recovery. |
40
  | Asset reload | Baseline renders the same-origin simulator frame. | Frame and bridge used the same runtime dispatch. | **Pass** for the qualified workflow. Warmed Chrome tab switched to the rebuilt frame after normal reload on the restarted port-8765 server. |
41
 
42
  Sources [original graph/table/sweep rendering](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L686), [job and artifact handling](../../simulator_service.py), [sp2 measurements and plotting](../../sp2/sp2_preset.py).
 
45
 
46
  - The same physical deck retains the eight level-1 generic MOSFETs, two equal flying capacitors, matched clock phases, 250 ps edges, 500 ps command-edge separation, and negative Q3/Q7 off-bias. The active state device order, polarity, off-state leakage, and overlap are checked each run. The nominal physical deck is unchanged. [Physical testbench](../../sp2/sp2_physical.cir) · [State checks](../../sp2/run_ngspice_validation.py)
47
  - Each run compares the last two four-cycle windows at a common phase offset. Voltage drift must be within 100 µV, normalized flying charge residual within 0.1%, and per-window loss change within 0.2%. Balance and overall convergence are within 0.3% and individual component convergence within 0.5%. The balance uses measured input, output, stage dissipation, and boundary stored energy. Coss contributes stored energy and MOS dissipation, while the effective gate-capacitance entry is a separate driver estimate. [Measurement windows and acceptance](2to1_switching_capacitors/ngspice_validation.md)
48
+ - The Phase C/D cases and later fixture extensions are regression benchmarks for the generic bench. They provide evidence for particular conditions. New combinations receive the same post-run checks. Physical devices, layout and gate-driver overhead need separate characterization. The −2 V assumption does not establish hardware feasibility or device stress limits.
49
  - Use [the extra fixture replay](2to1_switching_capacitors/integration/qualify_simulator_extensions.py) for compact numerical validation, [the Chrome parity comparison](2to1_switching_capacitors/integration/verify_simulator_parity.mjs) for tagged 4:1 and focused sp2 behavior, and [the live regression](2to1_switching_capacitors/integration/verify_live.mjs) for actual downloads and sweeps. Browser execution uses the local workbench at port 8765.
50
 
51
  ### Additional fixture results
52
 
53
  The 12 additional endpoint and numerical variants passed the coarse-to-refined and refined-to-extended checks. At 1.1404833 A, the 2.8 V and 3.2 V inputs delivered 1.300290 V and 1.500289 V. Stage energy-balance residuals were −9.98 µW and −12.44 µW. The 400 ps refined case recorded a 400 ps ceiling and a −3.27 µW residual. The gate-capacitance endpoints preserved the measured stage result and changed only the auxiliary gate estimate. [Numerical fixture evidence](2to1_switching_capacitors/integration/simulator_extension_qualification.json)
54
 
55
+ The previous fixture-based audit at commit `d3fd70c` completed ten three-point sp2 sweeps in Chrome at port 8765. Their executed decks and sweep CSVs matched the preset values, reported measurements, and checksums. The tagged and live 4:1 UIs returned identical measurements for XFLY6S, XFLY8S, and C3L at the regression settings. The XFLY6S 15-point sweep chart also matched. All 45 archived analytical tests passed, and the pinned 4:1 engine, physical sp2 deck template, and analytical equations were unchanged.
56
+
57
+ ## Continuous sp2 parameter contract
58
+
59
+ The original 4:1 workflow collects numerical form values. The pinned engine bounds or defaults them in `settings_from_payload()`, derives the load resistor and inferred duty in `settings_for_operating_point()`, binds the netlist parameters and transient settings in `prepare_deck()`, and executes the resulting deck in `run_simulation()`. Its efficiency sweep varies target voltage and load against the entered settings. Those mechanisms and the original engine remain in place. The fixture-only sp2 release reset other controls in `syncSettings()`, required a named endpoint in `sp2_preset.validate()`, and gated Gallery on the same combinations in `simulationAvailable()`. All three gates have been replaced. [4:1 settings and run entry point](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L1439) · [4:1 deck binding](../../simulator/library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py#L1123)
60
+
61
+ | User input | Continuous range | Default |
62
+ | --- | --- | --- |
63
+ | Input voltage | 1.8–4 V | 3 V |
64
+ | Output current | 0.05–4 A | 1.1404833 A |
65
+ | Switching frequency | 0.2–20 MHz | 2 MHz |
66
+ | Flying capacitance per cap | 0.1–5 µF | 1 µF |
67
+ | Flying capacitor ESR | 0.1–150 mΩ | 20 mΩ |
68
+ | MOSFET on-resistance per switch | 10–200 mΩ | 60 mΩ |
69
+ | Gate-driver high level | 2.5–4.5 V | 3.3 V |
70
+ | Effective gate capacitance per switch | 0–100 pF | Automatic width-based proxy |
71
+ | Coss per switch | 0–100 pF | 20 pF |
72
+ | Output capacitance | 1–50 µF | 10 µF |
73
+ | Simulation duration | 1–500 µs, at least ten switching periods | Automatic settling estimate |
74
+ | Refined maximum time step | 50–5000 ps | Automatic period/RC bound |
75
+
76
+ The bounds are operating and computational limits for the generic deck. They are independent field ranges and do not guarantee that every combination can sustain a reliable output. There is no discrete operating-point eligibility list. A positive ESR represents the existing series component. A zero Coss or effective gate capacitance is an explicit model input. Gate capacitance affects the separate loss estimate and is recorded in deck provenance as a comment. The timing controls apply to the base and sweep runs. An explicit duration is applied to the coarse and refined decks at its entered value, including fractional periods. Each measurement uses two complete four-period windows. The longer verification deck extends the transient. A maximum step sets an upper bound for the refined deck, and the solver can use smaller steps. Preflight bounds planned integration work at one million intervals per point and six million per job across the coarse, refined and extended runs. [Input contract](../../sp2/preset_contract.json) · [Parameter validation and orchestration](../../sp2/sp2_preset.py)
77
+
78
+ A configurable sweep runs 2–15 linearly spaced samples of one selected variable per job. The base case runs separately with all entered values. Each sweep row records validation and available measurements, deck checksum and export names. A failed case carries its reason and contributes no efficiency value. Validated stage results with more than 2% loss difference from the passive analytical reference carry a scope warning. The transport accepts a valid numerical configuration before knowing whether NGSpice can produce a trustworthy result. Periodicity, switching-state checks, energy balance and convergence run after execution. A bounded tighter-step retry can recover time-resolution failures without relaxing thresholds. [Transient checks](../../sp2/run_ngspice_validation.py) · [Historical regression fixtures](2to1_switching_capacitors/integration/simulator_fixture_benchmarks.json)
79
+
80
+ ### Continuous-input verification
81
+
82
+ The Chrome integration test changed all twelve settings together. At 3.17 V input, 1.37 A, and 2.65 MHz, the refined run delivered 1.456902 V with 91.735% efficiency including the gate estimate. It used the entered 22.35 µs duration and a refined step at or below 387.5 ps. A four-point load sweep from 0.77 to 1.62 A held all other settings fixed. The downloaded decks, checksums, plots, measurements and CSV were checked. A second browser case changed both input and load through Analysis handoff, then changed the frequency, duration and step together in Simulator.
83
+
84
+ Standalone checks also covered a lighter-load configuration that passed after automatic step refinement and a higher-frequency configuration whose stage-loss difference triggered the model-scope warning. At 1.9 V input and 3.4 A, a short run was accepted by preflight and failed the periodic steady-state check. A sweep around that design retained its successful 0.75 A result and marked the two failed points with reasons and no efficiency.
85
+
86
+ The 22 historical endpoint runs passed again. All 12 previously recorded extension cases reproduced their executed-deck digests and numerical evidence. The current 4:1 measurements and original XFLY6S 15-point chart matched the tagged baseline in Chrome. All 45 archived Analysis tests passed. The local server was restarted and a normal Chrome reload acquired the new controls with cache enabled.
docs/topology/topology_addition_workflow.md CHANGED
@@ -55,6 +55,8 @@ The [local rebuild instructions](../../README.md#L66) cover the installed toolch
55
 
56
  ## 6. Verify the addition in the existing app
57
 
 
 
58
  Complete the [Simulator feature parity matrix](simulator_feature_parity_matrix.md) alongside the Analysis matrix. Exercise the default and edited settings at port 8765, verify executed decks and rendered/downloaded results, and record the qualification bounds and physical basis for each N/A. Test the baseline Simulator paths and cache-enabled reload.
59
 
60
  Complete the mandatory [Feature Parity Validation checklist](feature_parity_checklist.md) at the level of individual features and controls. For Analysis, complete the [feature parity matrix](analysis_feature_parity_matrix.md) for the new topology. Check every row against XFLY6S at `local-baseline-v1.0`, exercise visible and advanced controls, confirm synchronized calculations and exports, and attach the evidence. Record the physical basis for every N/A row. An applicable unresolved row blocks full integration. The checks below support that evidence. Run the final Chrome verification and cache invalidation check at port 8765. Link each topology’s completed checklist for [Batch 3 acceptance](feature_parity_checklist.md#batch-3-acceptance).
 
55
 
56
  ## 6. Verify the addition in the existing app
57
 
58
+ Previously validated simulation parameter sets are regression benchmarks. For each applicable input, provide a continuous numeric range and support simultaneous edits. Check physical and numerical bounds before execution, use the entered values in the netlist, and report result reliability after execution.
59
+
60
  Complete the [Simulator feature parity matrix](simulator_feature_parity_matrix.md) alongside the Analysis matrix. Exercise the default and edited settings at port 8765, verify executed decks and rendered/downloaded results, and record the qualification bounds and physical basis for each N/A. Test the baseline Simulator paths and cache-enabled reload.
61
 
62
  Complete the mandatory [Feature Parity Validation checklist](feature_parity_checklist.md) at the level of individual features and controls. For Analysis, complete the [feature parity matrix](analysis_feature_parity_matrix.md) for the new topology. Check every row against XFLY6S at `local-baseline-v1.0`, exercise visible and advanced controls, confirm synchronized calculations and exports, and attach the evidence. Record the physical basis for every N/A row. An applicable unresolved row blocks full integration. The checks below support that evidence. Run the final Chrome verification and cache invalidation check at port 8765. Link each topology’s completed checklist for [Batch 3 acceptance](feature_parity_checklist.md#batch-3-acceptance).
simulator_bridge.js CHANGED
@@ -65,83 +65,91 @@ window.addEventListener("DOMContentLoaded", () => {
65
  const summary = document.getElementById("summaryMetrics");
66
  const originalSummary = summary.innerHTML;
67
  const spec = JSON.parse(document.getElementById("sp2-contract").textContent);
68
- const fixture = spec.request;
69
  const form = document.getElementById("controls");
70
  const parameter = document.getElementById("sp2-parameter");
71
- const point = document.getElementById("sp2-point");
 
 
 
72
  const sweepControl = document.getElementById("sp2-include-sweep");
73
  const sp2Settings = document.getElementById("sp2-settings");
74
  const sp2Result = document.createElement("dl");
75
  sp2Result.id = "sp2-result";
76
  sp2Result.hidden = true;
 
 
 
 
77
  const sp2Sweep = document.createElement("section");
78
  sp2Sweep.id = "sp2-sweep-results";
79
  sp2Sweep.hidden = true;
80
- document.getElementById("plotWrap").after(sp2Result);
81
  const inputHost = document.getElementById("sp2-controls");
82
  const inputs = new Map();
83
- let selectedAxis = "fs", selectedPoint = "nominal";
84
- const same = (left, right) => Math.abs(left - right) <= 1e-7;
85
- const findPoint = (axis, value) => spec.axes[axis].points.find(([, v]) => same(v, value));
86
- function pointLabel(axis, id, value) {
87
- if (id === "nominal" && axis.numerical) return "Automatic (convergence checked)";
88
- if (id === "nominal" && axis === spec.axes.gatecap) return "From switch width (default)";
89
- return `${value} ${axis.unit}${id === "nominal" ? " (nominal)" : ""}`;
90
- }
91
- for (const [id, axis] of Object.entries(spec.axes)) {
92
  const field = document.createElement("div");
93
  field.className = "control";
94
  const label = document.createElement("label");
95
  label.htmlFor = "sp2-" + id;
96
- label.textContent = `${axis.label} (${axis.unit})`;
97
- const input = document.createElement("select");
98
- input.id = label.htmlFor;
99
- for (const [key, value] of axis.points)
100
- input.add(new Option(pointLabel(axis, key, value), key));
 
101
  field.append(label, input);
102
  inputHost.append(field);
103
  inputs.set(id, input);
104
- if (!axis.numerical) parameter.add(new Option(axis.label, id));
105
- input.addEventListener("change", () => selectPoint(id, input.value));
 
 
 
 
106
  }
107
  function operation() {
108
- const value = Object.fromEntries(spec.axes[selectedAxis].points)[selectedPoint];
109
- const vin = selectedAxis === "vin" ? value : fixture.input_voltage_v;
110
- return { vin, vout: vin/2, load: selectedAxis === "load" ? value : fixture.output_current_a };
111
  }
112
- function syncSettings() {
113
- for (const [id,input] of inputs)
114
- input.value = id === selectedAxis ? selectedPoint : "nominal";
115
- if (!spec.axes[selectedAxis].numerical) parameter.value = selectedAxis;
116
- const swept = spec.axes[parameter.value];
117
- point.replaceChildren(...swept.points.map(([id, value]) =>
118
- new Option(pointLabel(swept, id, value), id)));
119
- point.value = selectedAxis === parameter.value ? selectedPoint : "nominal";
120
- sweepControl.disabled = spec.axes[selectedAxis].numerical === true;
121
- if (sweepControl.disabled) sweepControl.checked = false;
122
  document.getElementById("sp2-nominal-output").textContent =
123
- `${operation().vout} V at no load · Vout = Vin/2`;
124
- sp2Settings.textContent = "Changing a preset replaces the previous nonnominal setting. The qualified deck keeps all other settings at nominal.";
125
  }
126
- function selectPoint(axis, at, report = true) {
127
- selectedAxis = spec.axes[axis].numerical && at === "nominal" ? parameter.value : axis;
128
- selectedPoint = at;
129
- syncSettings();
130
- if (report) {
131
- const status = document.getElementById("status");
132
- if (status.textContent.startsWith("Run "))
133
- status.textContent = "Settings changed. Run the simulation to update the displayed results.";
134
- reportPoint();
135
- }
 
 
 
 
136
  }
 
 
137
  parameter.value = "fs";
138
- parameter.addEventListener("change", () => selectPoint(parameter.value, "nominal"));
139
- point.addEventListener("change", () => selectPoint(parameter.value, point.value));
 
 
 
140
  sweepControl.addEventListener("change", () => {
141
- if (sweepControl.checked && parameter.value !== selectedAxis)
142
- selectPoint(parameter.value, point.value);
143
  });
144
- syncSettings();
 
 
 
145
 
146
  function artifactImage(path, alt) {
147
  const url = new URL(path, location.href);
@@ -222,7 +230,7 @@ window.addEventListener("DOMContentLoaded", () => {
222
  const table = document.createElement("table");
223
  const header = table.createTHead().insertRow();
224
  for (const label of [`Value (${run.parameter.unit})`, "Delivered Vout (V)",
225
- "Stage loss (mW)", "Efficiency incl. modeled gate (%)"]) {
226
  const th = document.createElement("th");
227
  th.scope = "col";
228
  th.textContent = label;
@@ -231,8 +239,10 @@ window.addEventListener("DOMContentLoaded", () => {
231
  const body = table.createTBody();
232
  for (const m of run.sweep) {
233
  const row = body.insertRow();
234
- for (const value of [m.value,m.vout_v.toFixed(5),(1000*m.stage_w).toFixed(3),
235
- (100*m.efficiency_with_gate).toFixed(3)])
 
 
236
  row.insertCell().textContent = value;
237
  }
238
  const chart = document.createElement("div");
@@ -250,39 +260,50 @@ window.addEventListener("DOMContentLoaded", () => {
250
  if (button.disabled) return;
251
  const status = document.getElementById("status");
252
  const plot = document.getElementById("plotWrap");
253
- const settings = operation();
254
- const request = {
255
- ...fixture, input_voltage_v: settings.vin, target_vout: settings.vout,
256
- output_current_a: settings.load, parameter: selectedAxis,
257
- point: selectedPoint, sweep: sweepControl.checked ? "on" : "off",
258
- };
259
- const controls = [select, button, parameter, point, sweepControl, ...inputs.values()];
 
 
 
260
  controls.forEach((control) => { control.disabled = true; });
261
- sp2Result.hidden = sp2Sweep.hidden = true;
262
  plot.replaceChildren();
263
  metricsTable.hidden = true;
264
  metricsTable.tBodies[0].replaceChildren();
265
  summary.querySelectorAll(".metric span").forEach(span => span.textContent = "-");
266
  resetSweep();
267
- document.getElementById("sweepStatus").textContent = request.sweep === "on"
268
  ? "Waiting for SP-SC convergence runs…" : "Sweep disabled for this run.";
269
  openpelsRenderArtifacts({ artifacts: [] });
270
- status.textContent = request.sweep === "on" ? "Running the three-point SP-SC sweep…" : "Running SP-SC…";
271
  const stopProgress = showProgress(["sp2"]);
272
  try {
273
  const response = await openpelsSimulationFetch("/api/run", {body: JSON.stringify(request)}, ({complete,total}) => {
274
- if (request.sweep === "on") {
275
  document.getElementById("sweepStatus").textContent = `Sweep running: ${complete} / ${total}`;
276
  document.getElementById("sweepProgressFill").style.width = `${100*complete/total}%`;
277
  }
278
  });
279
  const run = await response.json();
280
  if (!response.ok) throw new Error(run.error);
281
- plot.replaceChildren(artifactImage(run.plot_url, "SP-SC gate, flying-capacitor and output waveforms"));
282
- showMeasurements(run);
 
 
 
 
 
 
283
  if (run.sweep.length) {
284
  showSweep(run);
285
- document.getElementById("sweepStatus").textContent = `Sweep complete: ${run.sweep.length} qualified points`;
 
 
286
  document.getElementById("sweepProgressFill").style.width = "100%";
287
  }
288
  status.textContent = `Run ${run.run_id}${run.sweep.length ? " · sweep complete" : ""}`;
@@ -290,11 +311,10 @@ window.addEventListener("DOMContentLoaded", () => {
290
  } catch (error) {
291
  plot.textContent = "Run a simulation to show waveforms.";
292
  status.textContent = error.message;
293
- if (request.sweep === "on") document.getElementById("sweepStatus").textContent = "Sweep failed. Check the run status.";
294
  } finally {
295
  stopProgress();
296
  controls.forEach((control) => { control.disabled = false; });
297
- syncSettings();
298
  }
299
  }, true);
300
  let previous = select.value;
@@ -302,11 +322,16 @@ window.addEventListener("DOMContentLoaded", () => {
302
  frequencies[previous] = frequency.value;
303
  previous = select.value;
304
  frequency.value = frequencies[previous];
305
- form.classList.toggle("sp2-fixed", previous === "sp2");
 
 
 
 
 
306
  document.getElementById("sp2-fixture-info").hidden = previous !== "sp2";
307
  metricsTable.tHead.rows[0].replaceWith(originalHeader.cloneNode(true));
308
  summary.innerHTML = originalSummary;
309
- sp2Result.hidden = sp2Sweep.hidden = true;
310
  document.querySelectorAll(".topology-card").forEach((card) => {
311
  card.hidden = card.dataset.topology !== select.value;
312
  });
@@ -325,6 +350,8 @@ window.addEventListener("DOMContentLoaded", () => {
325
  }
326
  function reportPoint() {
327
  if (pendingReference || select.disabled) return;
 
 
328
  parent.postMessage(
329
  {
330
  type: "pe:simulation-point",
@@ -349,12 +376,9 @@ window.addEventListener("DOMContentLoaded", () => {
349
  select.value = next.topology;
350
  updateTopology();
351
  if (next.topology === "sp2") {
352
- if (!same(next.vout, operation().vout) || !same(next.iout, operation().load)) {
353
- if (!same(next.vout, fixture.target_vout))
354
- selectPoint("vin", findPoint("vin", next.vout*2)[0], false);
355
- else
356
- selectPoint("load", findPoint("load", next.iout)[0], false);
357
- }
358
  } else {
359
  document.getElementById("targetVout").value = next.vout;
360
  document.getElementById("iout").value = next.iout;
@@ -384,8 +408,7 @@ window.addEventListener("DOMContentLoaded", () => {
384
  !Object.hasOwn(frequencies, next.topology) ||
385
  (next.topology === "sp2"
386
  ? next.ratio !== 2 || !Number.isFinite(next.vout) || !Number.isFinite(next.iout) ||
387
- !findPoint("vin", next.vout*2) || !findPoint("load", next.iout) ||
388
- (!same(next.vout, fixture.target_vout) && !same(next.iout, fixture.output_current_a))
389
  : next.ratio !== 4 || !Number.isFinite(next.vout) ||
390
  next.vout < 0.3 || next.vout > 1.1 || !Number.isFinite(next.iout) ||
391
  next.iout < 0.1 || next.iout > 40)
 
65
  const summary = document.getElementById("summaryMetrics");
66
  const originalSummary = summary.innerHTML;
67
  const spec = JSON.parse(document.getElementById("sp2-contract").textContent);
68
+ const parameters = spec.parameters;
69
  const form = document.getElementById("controls");
70
  const parameter = document.getElementById("sp2-parameter");
71
+ const sweepBox = document.getElementById("sp2-sweep-controls");
72
+ const sweepStart = document.getElementById("sp2-sweep-start");
73
+ const sweepStop = document.getElementById("sp2-sweep-stop");
74
+ const sweepCount = document.getElementById("sp2-sweep-count");
75
  const sweepControl = document.getElementById("sp2-include-sweep");
76
  const sp2Settings = document.getElementById("sp2-settings");
77
  const sp2Result = document.createElement("dl");
78
  sp2Result.id = "sp2-result";
79
  sp2Result.hidden = true;
80
+ const validationStatus = document.createElement("p");
81
+ validationStatus.id = "sp2-validation";
82
+ validationStatus.setAttribute("role", "status");
83
+ validationStatus.hidden = true;
84
  const sp2Sweep = document.createElement("section");
85
  sp2Sweep.id = "sp2-sweep-results";
86
  sp2Sweep.hidden = true;
87
+ document.getElementById("plotWrap").after(validationStatus, sp2Result);
88
  const inputHost = document.getElementById("sp2-controls");
89
  const inputs = new Map();
90
+ const within = (axis, value) => Number.isFinite(value) &&
91
+ value >= parameters[axis].minimum && value <= parameters[axis].maximum;
92
+ for (const [id, entry] of Object.entries(parameters)) {
 
 
 
 
 
 
93
  const field = document.createElement("div");
94
  field.className = "control";
95
  const label = document.createElement("label");
96
  label.htmlFor = "sp2-" + id;
97
+ label.textContent = entry.label + " (" + entry.unit + ")";
98
+ const input = document.createElement("input");
99
+ Object.assign(input, {id: label.htmlFor, type: "number", step: "any",
100
+ min: entry.minimum, max: entry.maximum, required: !entry.optional,
101
+ value: entry.default ?? ""});
102
+ if (entry.optional) input.placeholder = "Automatic";
103
  field.append(label, input);
104
  inputHost.append(field);
105
  inputs.set(id, input);
106
+ parameter.add(new Option(label.textContent, id));
107
+ input.addEventListener("input", () => {
108
+ refreshPoint();
109
+ settingsChanged();
110
+ if (id === "vin" || id === "load") reportPoint();
111
+ });
112
  }
113
  function operation() {
114
+ return {vout: inputs.get("vin").valueAsNumber/2, load: inputs.get("load").valueAsNumber};
 
 
115
  }
116
+ function refreshPoint() {
117
+ const {vout} = operation();
 
 
 
 
 
 
 
 
118
  document.getElementById("sp2-nominal-output").textContent =
119
+ within("vin", vout*2) ? Number(vout.toPrecision(10)) + " V at no load · Vout = Vin/2" : "—";
120
+ sp2Settings.textContent = "The delivered output voltage is measured with the entered load.";
121
  }
122
+ function settingsChanged() {
123
+ const status = document.getElementById("status");
124
+ if (status.textContent.startsWith("Run "))
125
+ status.textContent = "Settings changed. Run the simulation to update the displayed results.";
126
+ }
127
+ function sweepLimits() {
128
+ const entry = parameters[parameter.value];
129
+ for (const input of [sweepStart,sweepStop])
130
+ Object.assign(input, {min:entry.minimum,max:entry.maximum,required:true});
131
+ const center = inputs.get(parameter.value).valueAsNumber;
132
+ const span = (entry.maximum-entry.minimum)/10;
133
+ const mid = Number.isFinite(center) ? center : (entry.minimum+entry.maximum)/2;
134
+ sweepStart.value = Number(Math.max(entry.minimum,mid-span/2).toPrecision(10));
135
+ sweepStop.value = Number(Math.min(entry.maximum,mid+span/2).toPrecision(10));
136
  }
137
+ Object.assign(sweepCount, {min:spec.sweep_points.minimum,max:spec.sweep_points.maximum,
138
+ value:spec.sweep_points.default,required:true});
139
  parameter.value = "fs";
140
+ sweepLimits();
141
+ parameter.addEventListener("change", () => {
142
+ sweepLimits();
143
+ settingsChanged();
144
+ });
145
  sweepControl.addEventListener("change", () => {
146
+ sweepBox.hidden = !sweepControl.checked;
147
+ settingsChanged();
148
  });
149
+ for (const input of [sweepStart,sweepStop,sweepCount])
150
+ input.addEventListener("input", settingsChanged);
151
+ const sweepInputs = [parameter,sweepStart,sweepStop,sweepCount];
152
+ refreshPoint();
153
 
154
  function artifactImage(path, alt) {
155
  const url = new URL(path, location.href);
 
230
  const table = document.createElement("table");
231
  const header = table.createTHead().insertRow();
232
  for (const label of [`Value (${run.parameter.unit})`, "Delivered Vout (V)",
233
+ "Stage loss (mW)", "Efficiency incl. modeled gate (%)", "Validation"]) {
234
  const th = document.createElement("th");
235
  th.scope = "col";
236
  th.textContent = label;
 
239
  const body = table.createTBody();
240
  for (const m of run.sweep) {
241
  const row = body.insertRow();
242
+ const metrics = m.status === "failed" ? ["—", "—", "—"] :
243
+ [m.vout_v.toFixed(5), (1000*m.stage_w).toFixed(3), (100*m.efficiency_with_gate).toFixed(3)];
244
+ for (const value of [Number(m.value.toPrecision(10)), ...metrics,
245
+ m.message ? m.status + ": " + m.message : m.status])
246
  row.insertCell().textContent = value;
247
  }
248
  const chart = document.createElement("div");
 
260
  if (button.disabled) return;
261
  const status = document.getElementById("status");
262
  const plot = document.getElementById("plotWrap");
263
+ const activeInputs = [...inputs.values(), ...(sweepControl.checked ? sweepInputs : [])];
264
+ if (activeInputs.some(input => !input.reportValidity())) return;
265
+ const request = {topologies: ["sp2"]};
266
+ for (const [id,input] of inputs)
267
+ request[parameters[id].field] = input.value === "" ? null : input.valueAsNumber;
268
+ if (sweepControl.checked) {
269
+ request.sweep = {axis:parameter.value, start:sweepStart.valueAsNumber,
270
+ stop:sweepStop.valueAsNumber, points:sweepCount.valueAsNumber};
271
+ }
272
+ const controls = [select,button,sweepControl,...activeInputs];
273
  controls.forEach((control) => { control.disabled = true; });
274
+ sp2Result.hidden = sp2Sweep.hidden = validationStatus.hidden = true;
275
  plot.replaceChildren();
276
  metricsTable.hidden = true;
277
  metricsTable.tBodies[0].replaceChildren();
278
  summary.querySelectorAll(".metric span").forEach(span => span.textContent = "-");
279
  resetSweep();
280
+ document.getElementById("sweepStatus").textContent = request.sweep
281
  ? "Waiting for SP-SC convergence runs…" : "Sweep disabled for this run.";
282
  openpelsRenderArtifacts({ artifacts: [] });
283
+ status.textContent = request.sweep ? "Running the SP-SC operating point and sweep…" : "Running SP-SC…";
284
  const stopProgress = showProgress(["sp2"]);
285
  try {
286
  const response = await openpelsSimulationFetch("/api/run", {body: JSON.stringify(request)}, ({complete,total}) => {
287
+ if (request.sweep) {
288
  document.getElementById("sweepStatus").textContent = `Sweep running: ${complete} / ${total}`;
289
  document.getElementById("sweepProgressFill").style.width = `${100*complete/total}%`;
290
  }
291
  });
292
  const run = await response.json();
293
  if (!response.ok) throw new Error(run.error);
294
+ if (run.metrics.length) {
295
+ plot.replaceChildren(artifactImage(run.plot_url, "SP-SC gate, flying-capacitor and output waveforms"));
296
+ showMeasurements(run);
297
+ } else {
298
+ plot.textContent = "The operating point did not pass validation.";
299
+ }
300
+ validationStatus.textContent = run.validation_message || "The operating point passed steady-state, energy-balance and convergence checks.";
301
+ validationStatus.hidden = false;
302
  if (run.sweep.length) {
303
  showSweep(run);
304
+ const passed = run.sweep.filter(row => row.status !== "failed").length;
305
+ document.getElementById("sweepStatus").textContent =
306
+ "Sweep complete: " + passed + " / " + run.sweep.length + " points passed checks";
307
  document.getElementById("sweepProgressFill").style.width = "100%";
308
  }
309
  status.textContent = `Run ${run.run_id}${run.sweep.length ? " · sweep complete" : ""}`;
 
311
  } catch (error) {
312
  plot.textContent = "Run a simulation to show waveforms.";
313
  status.textContent = error.message;
314
+ if (request.sweep) document.getElementById("sweepStatus").textContent = "Sweep failed. Check the run status.";
315
  } finally {
316
  stopProgress();
317
  controls.forEach((control) => { control.disabled = false; });
 
318
  }
319
  }, true);
320
  let previous = select.value;
 
322
  frequencies[previous] = frequency.value;
323
  previous = select.value;
324
  frequency.value = frequencies[previous];
325
+ const sp2Active = previous === "sp2";
326
+ form.classList.toggle("sp2-fixed", sp2Active);
327
+ form.noValidate = sp2Active;
328
+ for (const input of [...inputs.values(),...sweepInputs,sweepControl])
329
+ input.disabled = !sp2Active;
330
+ if (sp2Active) refreshPoint();
331
  document.getElementById("sp2-fixture-info").hidden = previous !== "sp2";
332
  metricsTable.tHead.rows[0].replaceWith(originalHeader.cloneNode(true));
333
  summary.innerHTML = originalSummary;
334
+ sp2Result.hidden = sp2Sweep.hidden = validationStatus.hidden = true;
335
  document.querySelectorAll(".topology-card").forEach((card) => {
336
  card.hidden = card.dataset.topology !== select.value;
337
  });
 
350
  }
351
  function reportPoint() {
352
  if (pendingReference || select.disabled) return;
353
+ if (select.value === "sp2" && (!within("vin", operation().vout*2) ||
354
+ !within("load", operation().load))) return;
355
  parent.postMessage(
356
  {
357
  type: "pe:simulation-point",
 
376
  select.value = next.topology;
377
  updateTopology();
378
  if (next.topology === "sp2") {
379
+ inputs.get("vin").value = Number((next.vout*2).toPrecision(15));
380
+ inputs.get("load").value = next.iout;
381
+ refreshPoint();
 
 
 
382
  } else {
383
  document.getElementById("targetVout").value = next.vout;
384
  document.getElementById("iout").value = next.iout;
 
408
  !Object.hasOwn(frequencies, next.topology) ||
409
  (next.topology === "sp2"
410
  ? next.ratio !== 2 || !Number.isFinite(next.vout) || !Number.isFinite(next.iout) ||
411
+ !within("vin", next.vout*2) || !within("load", next.iout)
 
412
  : next.ratio !== 4 || !Number.isFinite(next.vout) ||
413
  next.vout < 0.3 || next.vout > 1.1 || !Number.isFinite(next.iout) ||
414
  next.iout < 0.1 || next.iout > 40)
simulator_frame.py CHANGED
@@ -26,14 +26,21 @@ def simulator_html(original):
26
  <details class="sp2-model-note">
27
  <summary>Model and run limits</summary>
28
  <p>Fixed two-phase 2:1 gain. The output current is a constant-current load.
29
- Each preset changes one physical or numerical setting from nominal.
30
  Q3/Q7 use a −2 V off bias. Effective gate capacitance supplies the auxiliary loss estimate.</p>
31
  </details>
32
- <label for="sp2-parameter">Parameter to sweep</label>
33
- <select id="sp2-parameter"></select>
34
- <label for="sp2-point">Displayed sweep point</label>
35
- <select id="sp2-point"></select>
36
- <label class="check"><input id="sp2-include-sweep" type="checkbox"> Sweep the selected parameter</label>
 
 
 
 
 
 
 
37
  </section>'''
38
  html = html.replace('<form id="controls" class="panel controls">', '<form id="controls" class="panel controls">' + selector, 1)
39
  start = html.index(' <div class="control">\n <label>Topologies</label>')
@@ -111,7 +118,8 @@ def simulator_html(original):
111
  #sp2-fixture-info{display:grid;gap:8px}
112
  #sp2-fixture-info p{margin:0;font-size:12px;line-height:1.45}
113
  #sp2-fixture-info select{width:100%;padding:8px;border:1px solid var(--line);border-radius:6px;font:inherit;color:inherit;background:white}
114
- #sp2-controls .control{display:block}
 
115
  .sp2-model-note{font-size:12px}
116
  #sp2-sweep-results{overflow-x:auto}
117
  #sp2-sweep-results .sweep-chart img{width:100%;max-width:650px}
 
26
  <details class="sp2-model-note">
27
  <summary>Model and run limits</summary>
28
  <p>Fixed two-phase 2:1 gain. The output current is a constant-current load.
29
+ Leave gate capacitance, duration or maximum step blank for automatic settings. Every run checks periodic steady state, energy balance and convergence.
30
  Q3/Q7 use a −2 V off bias. Effective gate capacitance supplies the auxiliary loss estimate.</p>
31
  </details>
32
+ <label class="check"><input id="sp2-include-sweep" type="checkbox"> Include parameter sweep</label>
33
+ <div id="sp2-sweep-controls" hidden>
34
+ <label for="sp2-parameter">Parameter to sweep</label>
35
+ <select id="sp2-parameter"></select>
36
+ <div class="two">
37
+ <div class="control"><label for="sp2-sweep-start">Start</label><input id="sp2-sweep-start" type="number" step="any"></div>
38
+ <div class="control"><label for="sp2-sweep-stop">Stop</label><input id="sp2-sweep-stop" type="number" step="any"></div>
39
+ </div>
40
+ <label for="sp2-sweep-count">Points</label>
41
+ <input id="sp2-sweep-count" type="number" step="1">
42
+ <p>The main waveform uses the entered operating point. The sweep varies the selected input and keeps the other settings.</p>
43
+ </div>
44
  </section>'''
45
  html = html.replace('<form id="controls" class="panel controls">', '<form id="controls" class="panel controls">' + selector, 1)
46
  start = html.index(' <div class="control">\n <label>Topologies</label>')
 
118
  #sp2-fixture-info{display:grid;gap:8px}
119
  #sp2-fixture-info p{margin:0;font-size:12px;line-height:1.45}
120
  #sp2-fixture-info select{width:100%;padding:8px;border:1px solid var(--line);border-radius:6px;font:inherit;color:inherit;background:white}
121
+ #sp2-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
122
+ #sp2-sweep-controls{display:grid;gap:8px}
123
  .sp2-model-note{font-size:12px}
124
  #sp2-sweep-results{overflow-x:auto}
125
  #sp2-sweep-results .sweep-chart img{width:100%;max-width:650px}
simulator_service.py CHANGED
@@ -5,6 +5,7 @@ import hashlib
5
  import importlib.util
6
  import json
7
  import math
 
8
  import os
9
  import re
10
  import shutil
@@ -29,7 +30,7 @@ def finite_tree(value, depth=0):
29
  raise ValueError("Simulation input is too deeply nested")
30
  if isinstance(value, bool):
31
  raise ValueError('Use numeric values, not booleans')
32
- if isinstance(value, (int, float)) and not math.isfinite(value):
33
  raise ValueError('Simulation values must be finite')
34
  if isinstance(value, dict):
35
  for item in value.values():
 
5
  import importlib.util
6
  import json
7
  import math
8
+ import sys
9
  import os
10
  import re
11
  import shutil
 
30
  raise ValueError("Simulation input is too deeply nested")
31
  if isinstance(value, bool):
32
  raise ValueError('Use numeric values, not booleans')
33
+ if isinstance(value, (int, float)) and not -sys.float_info.max <= value <= sys.float_info.max:
34
  raise ValueError('Simulation values must be finite')
35
  if isinstance(value, dict):
36
  for item in value.values():
sp2/preset_contract.json CHANGED
@@ -1,17 +1,8 @@
1
  {
2
  "id": "sp2",
3
  "ratio": 2,
4
- "status": "local-qualified",
5
  "run_kind": "run",
6
- "fixture": "physical_nominal",
7
- "request": {
8
- "topologies": [
9
- "sp2"
10
- ],
11
- "input_voltage_v": 3.0,
12
- "target_vout": 1.5,
13
- "output_current_a": 1.1404833
14
- },
15
  "fixed_parameters": {
16
  "fs_hz": 2000000,
17
  "cf_f_per_flying_cap": 1e-06,
@@ -68,216 +59,119 @@
68
  "maximum_state_drift_v",
69
  "storage_w"
70
  ],
71
- "axes": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  "fs": {
 
73
  "label": "Switching frequency",
74
  "unit": "MHz",
75
- "points": [
76
- [
77
- "low",
78
- 0.3
79
- ],
80
- [
81
- "nominal",
82
- 2
83
- ],
84
- [
85
- "high",
86
- 12
87
- ]
88
- ]
89
  },
90
  "cf": {
 
91
  "label": "Flying capacitance per cap",
92
  "unit": "µF",
93
- "points": [
94
- [
95
- "low",
96
- 0.4
97
- ],
98
- [
99
- "nominal",
100
- 1
101
- ],
102
- [
103
- "high",
104
- 2.5
105
- ]
106
- ]
107
  },
108
  "esr": {
 
109
  "label": "Flying-cap ESR",
110
  "unit": "mΩ",
111
- "points": [
112
- [
113
- "low",
114
- 5
115
- ],
116
- [
117
- "nominal",
118
- 20
119
- ],
120
- [
121
- "high",
122
- 80
123
- ]
124
- ]
125
  },
126
  "rs": {
 
127
  "label": "Switch on-resistance",
128
  "unit": "mΩ",
129
- "points": [
130
- [
131
- "low",
132
- 30
133
- ],
134
- [
135
- "nominal",
136
- 60
137
- ],
138
- [
139
- "high",
140
- 120
141
- ]
142
- ]
143
- },
144
- "load": {
145
- "label": "Output current",
146
- "unit": "A",
147
- "points": [
148
- [
149
- "low",
150
- 0.35
151
- ],
152
- [
153
- "nominal",
154
- 1.1404833
155
- ],
156
- [
157
- "high",
158
- 2
159
- ]
160
- ]
161
  },
162
- "vin": {
163
- "label": "Input voltage",
 
164
  "unit": "V",
165
- "points": [
166
- [
167
- "low",
168
- 2.8
169
- ],
170
- [
171
- "nominal",
172
- 3
173
- ],
174
- [
175
- "high",
176
- 3.2
177
- ]
178
- ]
179
  },
180
  "coss": {
 
181
  "label": "Switch Coss",
182
  "unit": "pF",
183
- "points": [
184
- [
185
- "low",
186
- 0
187
- ],
188
- [
189
- "nominal",
190
- 20
191
- ],
192
- [
193
- "high",
194
- 40
195
- ]
196
- ]
197
  },
198
  "cout": {
 
199
  "label": "Output capacitance",
200
  "unit": "µF",
201
- "points": [
202
- [
203
- "low",
204
- 5
205
- ],
206
- [
207
- "nominal",
208
- 10
209
- ],
210
- [
211
- "high",
212
- 20
213
- ]
214
- ]
215
- },
216
- "gate": {
217
- "label": "Gate-drive high level",
218
- "unit": "V",
219
- "points": [
220
- [
221
- "low",
222
- 3
223
- ],
224
- [
225
- "nominal",
226
- 3.3
227
- ],
228
- [
229
- "high",
230
- 3.6
231
- ]
232
- ]
233
- },
234
- "gatecap": {
235
- "label": "Effective gate capacitance",
236
- "unit": "pF",
237
- "points": [
238
- [
239
- "low",
240
- 0
241
- ],
242
- [
243
- "nominal",
244
- 7.631414141414141
245
- ],
246
- [
247
- "high",
248
- 15
249
- ]
250
- ]
251
  },
252
  "stop": {
253
- "label": "Minimum run length",
254
- "unit": "cycles",
255
- "points": [
256
- [
257
- "nominal",
258
- 0
259
- ],
260
- [
261
- "high",
262
- 64
263
- ]
264
- ],
265
- "numerical": true
266
  },
267
  "step": {
 
268
  "label": "Refined maximum step ceiling",
269
  "unit": "ps",
270
- "points": [
271
- [
272
- "low",
273
- 400
274
- ],
275
- [
276
- "nominal",
277
- 0
278
- ]
279
- ],
280
- "numerical": true
281
  }
 
 
 
 
 
282
  }
283
  }
 
1
  {
2
  "id": "sp2",
3
  "ratio": 2,
4
+ "status": "local-generic-model",
5
  "run_kind": "run",
 
 
 
 
 
 
 
 
 
6
  "fixed_parameters": {
7
  "fs_hz": 2000000,
8
  "cf_f_per_flying_cap": 1e-06,
 
59
  "maximum_state_drift_v",
60
  "storage_w"
61
  ],
62
+ "parameters": {
63
+ "vin": {
64
+ "field": "input_voltage_v",
65
+ "label": "Input voltage",
66
+ "unit": "V",
67
+ "minimum": 1.8,
68
+ "maximum": 4,
69
+ "default": 3,
70
+ "optional": false
71
+ },
72
+ "load": {
73
+ "field": "output_current_a",
74
+ "label": "Output current",
75
+ "unit": "A",
76
+ "minimum": 0.05,
77
+ "maximum": 4,
78
+ "default": 1.1404833,
79
+ "optional": false
80
+ },
81
  "fs": {
82
+ "field": "switching_frequency_mhz",
83
  "label": "Switching frequency",
84
  "unit": "MHz",
85
+ "minimum": 0.2,
86
+ "maximum": 20,
87
+ "default": 2,
88
+ "optional": false
 
 
 
 
 
 
 
 
 
 
89
  },
90
  "cf": {
91
+ "field": "flying_cap_uf",
92
  "label": "Flying capacitance per cap",
93
  "unit": "µF",
94
+ "minimum": 0.1,
95
+ "maximum": 5,
96
+ "default": 1,
97
+ "optional": false
 
 
 
 
 
 
 
 
 
 
98
  },
99
  "esr": {
100
+ "field": "flying_esr_mohm",
101
  "label": "Flying-cap ESR",
102
  "unit": "mΩ",
103
+ "minimum": 0.1,
104
+ "maximum": 150,
105
+ "default": 20,
106
+ "optional": false
 
 
 
 
 
 
 
 
 
 
107
  },
108
  "rs": {
109
+ "field": "switch_ron_mohm",
110
  "label": "Switch on-resistance",
111
  "unit": "mΩ",
112
+ "minimum": 10,
113
+ "maximum": 200,
114
+ "default": 60,
115
+ "optional": false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  },
117
+ "gate": {
118
+ "field": "gate_drive_v",
119
+ "label": "Gate-drive high level",
120
  "unit": "V",
121
+ "minimum": 2.5,
122
+ "maximum": 4.5,
123
+ "default": 3.3,
124
+ "optional": false
125
+ },
126
+ "gatecap": {
127
+ "field": "gate_cap_pf",
128
+ "label": "Effective gate capacitance",
129
+ "unit": "pF",
130
+ "minimum": 0,
131
+ "maximum": 100,
132
+ "default": null,
133
+ "optional": true
 
134
  },
135
  "coss": {
136
+ "field": "switch_coff_pf",
137
  "label": "Switch Coss",
138
  "unit": "pF",
139
+ "minimum": 0,
140
+ "maximum": 100,
141
+ "default": 20,
142
+ "optional": false
 
 
 
 
 
 
 
 
 
 
143
  },
144
  "cout": {
145
+ "field": "output_cap_uf",
146
  "label": "Output capacitance",
147
  "unit": "µF",
148
+ "minimum": 1,
149
+ "maximum": 50,
150
+ "default": 10,
151
+ "optional": false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  },
153
  "stop": {
154
+ "field": "stop_us",
155
+ "label": "Simulation duration",
156
+ "unit": "µs",
157
+ "minimum": 1,
158
+ "maximum": 500,
159
+ "default": null,
160
+ "optional": true
 
 
 
 
 
 
161
  },
162
  "step": {
163
+ "field": "max_step_ps",
164
  "label": "Refined maximum step ceiling",
165
  "unit": "ps",
166
+ "minimum": 50,
167
+ "maximum": 5000,
168
+ "default": null,
169
+ "optional": true
 
 
 
 
 
 
 
170
  }
171
+ },
172
+ "sweep_points": {
173
+ "minimum": 2,
174
+ "maximum": 15,
175
+ "default": 5
176
  }
177
  }
sp2/run_ngspice_validation.py CHANGED
@@ -60,6 +60,7 @@ class Case:
60
  gate_cap_pf: float | None = None
61
  minimum_cycles: int = 0
62
  max_step_ps: float | None = None
 
63
 
64
  @property
65
  def ideal_req(self):
@@ -110,11 +111,15 @@ def cases():
110
 
111
 
112
  def render(case, cycles, samples):
113
- if case.clamp <= 0:
114
  raise ValueError(f'{case.name} is outside the positive-voltage analytical domain')
115
  path = HERE / f'sp2_{case.kind}.cir'
116
  default = path.read_text()
117
  initial_out = 1.2 if not case.load else case.clamp
 
 
 
 
118
  flags = [[f'bus={case.vin:.17g}', f'vout0={initial_out:.17g}', f'vic={case.vin/2:.17g}',
119
  f'fs={case.fs:.17g}', f'cf={case.cf:.17g}', f'esr={case.esr:.17g}',
120
  f'ncycle={cycles}'],
@@ -358,9 +363,13 @@ def detail(vector, case, offset):
358
  return state, None
359
 
360
 
361
- def required(test, case, text):
 
 
 
 
362
  if not test:
363
- raise AssertionError(f'{case.name}: {text}')
364
 
365
 
366
  def stable(case, metrics, previous):
@@ -375,7 +384,7 @@ def stable(case, metrics, previous):
375
  required(relative(metrics['stage_w'],previous['stage_w']) <= IDEAL_ERROR,case,
376
  f"loss between windows {metrics['stage_w']} vs {previous['stage_w']}")
377
  required(abs(metrics['balance_w']) <= BALANCE_ERROR*metrics['stage_w']+1e-8,case,
378
- f"balance residual {metrics['balance_w']}, stage {metrics['stage_w']}")
379
  required(metrics['iout_a'] > 0 and metrics['delivered_w'] > 0 and metrics['stage_w'] > 0,
380
  case, 'nonpositive delivered operating point')
381
  if case.kind == 'physical':
@@ -388,14 +397,14 @@ def stable(case, metrics, previous):
388
 
389
  def compare_convergence(case, fine, other):
390
  delta = {'vout_v':abs(fine['vout_v']-other['vout_v'])}
391
- required(delta['vout_v'] < VOLTAGE_ERROR,case,f'step/run-length output change {delta}')
392
  if case.load:
393
  for key in ('stage_w','resistance_power_ohm','resistance_droop_ohm','delivered_w'):
394
  delta[key] = relative(other[key],fine[key])
395
- required(delta[key] < NUMERICAL_ERROR,case,f'convergence {key}: {delta[key]}')
396
  for key in ('switch_w','esr_w'):
397
  delta[key] = max(relative(a,b) for a,b in zip(other[key],fine[key],strict=True))
398
- required(delta[key] < COMPONENT_ERROR,case,f'convergence {key}: {delta[key]}')
399
  return delta
400
 
401
 
@@ -435,7 +444,8 @@ def run_one(case, mode, cycles, samples, output, *, capture=False):
435
  if not np.all(np.isfinite(samples_data)) or np.any(np.diff(sequence['time'])<=0):
436
  raise ValueError(f'{case.name}/{mode}: bad raw data')
437
  vector = trace_vectors(sequence,case)
438
- stop = cycles-0.875
 
439
  metrics = window(vector,case,(stop-WINDOW)/case.fs,stop/case.fs)
440
  previous = window(vector,case,(stop-2*WINDOW)/case.fs,(stop-WINDOW)/case.fs)
441
  evidence = {'runs_cycles':cycles,'max_step_s':1/(case.fs*samples),
@@ -452,34 +462,45 @@ def run_one(case, mode, cycles, samples, output, *, capture=False):
452
  return {**evidence, 'q7_drain_current_mid_opposite_a':q7,
453
  'q7_vgs_command_v':vgs_off,'q7_gate_minus_low_external_terminal_v':low_terminal}
454
  stable(case,metrics,previous)
455
- state, wave_error = detail(vector,case,cycles-2)
456
  if mode == 'fine' and (capture or case.name.endswith('_nominal')):
457
- write_waveform(case,vector,cycles-2,output/f'{case.name}_waveform.csv')
458
  if capture:
459
  (output/f'{case.name}.cir').write_text(deck)
460
  (output/f'{case.name}.log').write_text(log)
461
  return {**evidence,'gate_state':state,'waveform_error':wave_error}
462
 
463
 
464
- def run_case(case, output, *, capture=False):
465
  _, paths = resistances(case.areas,case.rs,case.esr)
466
  time_constant = max(max(r for pair in paths for r in pair)*case.cf,
467
  case.cout*case.ideal_req if case.released_output else 0)
468
  cycles = max(32,case.minimum_cycles,int(np.ceil(time_constant*case.fs*12))+2*WINDOW)
 
 
 
 
469
  # Bound to max step relative to state period and minimize unresolved local ringing.
470
  minimum_rc = min(r for pair in paths for r in pair)*case.cf
471
  samples = max(350,int(np.ceil(40/(case.fs*minimum_rc))))
472
  if case.max_step_ps is not None:
473
  # The refined deck must remain at or below the user ceiling.
474
  samples = max(samples,int(np.ceil(1/(2*case.fs*case.max_step_ps*1e-12))))
 
 
 
 
 
 
 
475
  coarse = run_one(case,'coarse',cycles,samples,output)
476
  fine = run_one(case,'fine',cycles,2*samples,output,capture=capture)
477
- extended = run_one(case,'extended',cycles+max(12,cycles//3),2*samples,output)
478
  actual = fine['final']
479
  numerical = {'coarse_to_fine':compare_convergence(case,actual,coarse['final']),
480
  'fine_to_extended':compare_convergence(case,actual,extended['final'])}
481
  analytic, discrepancies = None, {}
482
- if case.load:
483
  ref_rail = case.vin/2-case.ideal_req*actual['iout_a']
484
  analytic, _, _ = phase_b(case,ref_rail if case.kind == 'physical' else case.clamp)
485
  for key in ('iout_a','switch_w','esr_w','resistance_power_ohm','resistance_droop_ohm','stage_w'):
 
60
  gate_cap_pf: float | None = None
61
  minimum_cycles: int = 0
62
  max_step_ps: float | None = None
63
+ stop_us: float | None = None
64
 
65
  @property
66
  def ideal_req(self):
 
111
 
112
 
113
  def render(case, cycles, samples):
114
+ if case.clamp <= 0 and case.kind != 'physical':
115
  raise ValueError(f'{case.name} is outside the positive-voltage analytical domain')
116
  path = HERE / f'sp2_{case.kind}.cir'
117
  default = path.read_text()
118
  initial_out = 1.2 if not case.load else case.clamp
119
+ if initial_out <= 0:
120
+ # The passive model is only a seed. Let the switched bench establish
121
+ # whether it can sustain a positive delivered operating point.
122
+ initial_out = case.vin * .1
123
  flags = [[f'bus={case.vin:.17g}', f'vout0={initial_out:.17g}', f'vic={case.vin/2:.17g}',
124
  f'fs={case.fs:.17g}', f'cf={case.cf:.17g}', f'esr={case.esr:.17g}',
125
  f'ncycle={cycles}'],
 
363
  return state, None
364
 
365
 
366
+ class NumericalValidationError(AssertionError):
367
+ """A failed result check that may benefit from a smaller time step."""
368
+
369
+
370
+ def required(test, case, text, error_type=AssertionError):
371
  if not test:
372
+ raise error_type(f'{case.name}: {text}')
373
 
374
 
375
  def stable(case, metrics, previous):
 
384
  required(relative(metrics['stage_w'],previous['stage_w']) <= IDEAL_ERROR,case,
385
  f"loss between windows {metrics['stage_w']} vs {previous['stage_w']}")
386
  required(abs(metrics['balance_w']) <= BALANCE_ERROR*metrics['stage_w']+1e-8,case,
387
+ f"balance residual {metrics['balance_w']}, stage {metrics['stage_w']}", NumericalValidationError)
388
  required(metrics['iout_a'] > 0 and metrics['delivered_w'] > 0 and metrics['stage_w'] > 0,
389
  case, 'nonpositive delivered operating point')
390
  if case.kind == 'physical':
 
397
 
398
  def compare_convergence(case, fine, other):
399
  delta = {'vout_v':abs(fine['vout_v']-other['vout_v'])}
400
+ required(delta['vout_v'] < VOLTAGE_ERROR,case,f'step/run-length output change {delta}', NumericalValidationError)
401
  if case.load:
402
  for key in ('stage_w','resistance_power_ohm','resistance_droop_ohm','delivered_w'):
403
  delta[key] = relative(other[key],fine[key])
404
+ required(delta[key] < NUMERICAL_ERROR,case,f'convergence {key}: {delta[key]}', NumericalValidationError)
405
  for key in ('switch_w','esr_w'):
406
  delta[key] = max(relative(a,b) for a,b in zip(other[key],fine[key],strict=True))
407
+ required(delta[key] < COMPONENT_ERROR,case,f'convergence {key}: {delta[key]}', NumericalValidationError)
408
  return delta
409
 
410
 
 
444
  if not np.all(np.isfinite(samples_data)) or np.any(np.diff(sequence['time'])<=0):
445
  raise ValueError(f'{case.name}/{mode}: bad raw data')
446
  vector = trace_vectors(sequence,case)
447
+ complete_cycles = int(np.floor(cycles+1e-10))
448
+ stop = complete_cycles-0.875
449
  metrics = window(vector,case,(stop-WINDOW)/case.fs,stop/case.fs)
450
  previous = window(vector,case,(stop-2*WINDOW)/case.fs,(stop-WINDOW)/case.fs)
451
  evidence = {'runs_cycles':cycles,'max_step_s':1/(case.fs*samples),
 
462
  return {**evidence, 'q7_drain_current_mid_opposite_a':q7,
463
  'q7_vgs_command_v':vgs_off,'q7_gate_minus_low_external_terminal_v':low_terminal}
464
  stable(case,metrics,previous)
465
+ state, wave_error = detail(vector,case,complete_cycles-2)
466
  if mode == 'fine' and (capture or case.name.endswith('_nominal')):
467
+ write_waveform(case,vector,complete_cycles-2,output/f'{case.name}_waveform.csv')
468
  if capture:
469
  (output/f'{case.name}.cir').write_text(deck)
470
  (output/f'{case.name}.log').write_text(log)
471
  return {**evidence,'gate_state':state,'waveform_error':wave_error}
472
 
473
 
474
+ def transient_plan(case):
475
  _, paths = resistances(case.areas,case.rs,case.esr)
476
  time_constant = max(max(r for pair in paths for r in pair)*case.cf,
477
  case.cout*case.ideal_req if case.released_output else 0)
478
  cycles = max(32,case.minimum_cycles,int(np.ceil(time_constant*case.fs*12))+2*WINDOW)
479
+ if case.stop_us is not None:
480
+ cycles = case.stop_us * 1e-6 * case.fs
481
+ if cycles < 10 - 1e-10:
482
+ raise ValueError('Simulation duration must span at least ten switching periods.')
483
  # Bound to max step relative to state period and minimize unresolved local ringing.
484
  minimum_rc = min(r for pair in paths for r in pair)*case.cf
485
  samples = max(350,int(np.ceil(40/(case.fs*minimum_rc))))
486
  if case.max_step_ps is not None:
487
  # The refined deck must remain at or below the user ceiling.
488
  samples = max(samples,int(np.ceil(1/(2*case.fs*case.max_step_ps*1e-12))))
489
+ extended_cycles = cycles + max(12, int(cycles)//3)
490
+ return cycles, samples, extended_cycles
491
+
492
+
493
+ def run_case(case, output, *, capture=False, refinement=1):
494
+ cycles, samples, extended_cycles = transient_plan(case)
495
+ samples *= refinement
496
  coarse = run_one(case,'coarse',cycles,samples,output)
497
  fine = run_one(case,'fine',cycles,2*samples,output,capture=capture)
498
+ extended = run_one(case,'extended',extended_cycles,2*samples,output)
499
  actual = fine['final']
500
  numerical = {'coarse_to_fine':compare_convergence(case,actual,coarse['final']),
501
  'fine_to_extended':compare_convergence(case,actual,extended['final'])}
502
  analytic, discrepancies = None, {}
503
+ if case.load and case.vin/2 > case.ideal_req*actual['iout_a']:
504
  ref_rail = case.vin/2-case.ideal_req*actual['iout_a']
505
  analytic, _, _ = phase_b(case,ref_rail if case.kind == 'physical' else case.clamp)
506
  for key in ('iout_a','switch_w','esr_w','resistance_power_ohm','resistance_droop_ohm','stage_w'):
sp2/sp2_preset.py CHANGED
@@ -1,9 +1,9 @@
1
- """Qualified SP-SC fixtures using the existing asynchronous simulator jobs."""
2
  from dataclasses import replace
3
  import csv
4
  import hashlib
5
  import json
6
- import math
7
  from pathlib import Path
8
  import time
9
 
@@ -14,32 +14,85 @@ def contract():
14
  return json.loads((HERE / 'preset_contract.json').read_text())
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  def validate(payload):
 
18
  spec = contract()
19
- fixed = spec['request']
20
- selection = {'parameter', 'point', 'sweep'}
21
- if not set(fixed) <= set(payload) or set(payload) - set(fixed) - selection or payload['topologies'] != ['sp2']:
22
- raise ValueError('Select a qualified SP-SC fixture.')
23
- axis, point, sweep = (payload.get('parameter', 'fs'), payload.get('point', 'nominal'),
24
- payload.get('sweep', 'off'))
25
- if not isinstance(axis, str) or axis not in spec['axes'] or sweep not in ('on', 'off'):
26
- raise ValueError('Choose a qualified SP-SC sweep parameter.')
27
- axis_spec = spec['axes'][axis]
28
- if sweep == 'on' and axis_spec.get('numerical'):
29
- raise ValueError('Numerical settings apply to a single convergence run.')
30
- points = dict(axis_spec['points'])
31
- if not isinstance(point, str) or point not in points:
32
- raise ValueError('Choose a qualified SP-SC parameter value.')
33
- checks = {key: fixed[key] for key in ('input_voltage_v', 'target_vout', 'output_current_a')}
34
- if axis == 'vin':
35
- checks.update(input_voltage_v=points[point], target_vout=points[point]/2)
36
- if axis == 'load':
37
- checks['output_current_a'] = points[point]
38
- for key, expected in checks.items():
39
- number = payload[key]
40
- if type(number) not in (int, float) or not math.isclose(number, expected, rel_tol=0, abs_tol=1e-7):
41
- raise ValueError(f'SP-SC {point} fixture requires {key} = {expected}')
42
- return axis, point, sweep == 'on'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
 
45
  def plot_waveform(run_dir, model, wave_path):
@@ -75,18 +128,26 @@ def plot_waveform(run_dir, model, wave_path):
75
 
76
 
77
  def write_sweep(run_dir, axis, rows):
 
 
78
  import matplotlib.pyplot as plt
79
 
80
  with (run_dir / 'sp2-sweep.csv').open('w', newline='') as file:
81
- columns = ('value', 'vout_v', 'iout_a', 'input_w', 'delivered_w', 'stage_w',
82
- 'supplemental_gate_w', 'stage_efficiency', 'efficiency_with_gate')
 
83
  writer = csv.DictWriter(file, columns, extrasaction='ignore')
84
  writer.writeheader()
85
  writer.writerows(rows)
86
  figure, ax = plt.subplots(layout='constrained')
87
  values = [row['value'] for row in rows]
88
- ax.plot(values, [100 * row['efficiency_with_gate'] for row in rows], 'o-', label='With gate estimate')
89
- ax.plot(values, [100 * row['stage_efficiency'] for row in rows], 's--', label='Stage only')
 
 
 
 
 
90
  ax.legend()
91
  ax.set(xlabel=f"{axis['label']} ({axis['unit']})", ylabel='Modeled efficiency with gate estimate (%)')
92
  ax.grid(alpha=.25)
@@ -94,61 +155,78 @@ def write_sweep(run_dir, axis, rows):
94
  plt.close(figure)
95
 
96
 
97
- def fixture(axis, point, spec):
98
- from .run_ngspice_validation import Case
99
-
100
- base = Case(spec['fixture'], 'physical')
101
- if point == 'nominal':
102
- return base
103
- value = dict(spec['axes'][axis]['points'])[point]
104
- parameter, scale = {
105
- 'fs': ('fs', 1e6), 'cf': ('cf', 1e-6), 'esr': ('esr', 1e-3),
106
- 'rs': ('rs', 1.5e-3), 'load': ('load', 1), 'vin': ('vin', 1),
107
- 'coss': ('coss', 1e-12), 'cout': ('cout', 1e-6), 'gate': ('gate_drive', 1),
108
- 'gatecap': ('gate_cap_pf', 1), 'stop': ('minimum_cycles', 1), 'step': ('max_step_ps', 1),
109
- }[axis]
110
- return replace(base, name=f'physical_{axis}_{point}', axis=axis, **{parameter: value*scale})
111
-
112
-
113
  def run(payload, run_dir, progress=lambda complete, total: None):
114
- from .run_ngspice_validation import run_case
115
 
116
- axis, selected, sweep = validate(payload)
117
  started = time.perf_counter()
118
  spec = contract()
119
- axis_spec = spec['axes'][axis]
120
- entries = axis_spec['points'] if sweep else [(selected, dict(axis_spec['points'])[selected])]
121
- rows = []
122
- progress(0, len(entries))
123
- for point, value in entries:
124
- model = fixture(axis, point, spec)
125
- result = run_case(model, run_dir, capture=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  fine = result['fine']
127
  deck = run_dir / f'{model.name}.cir'
128
  if hashlib.sha256(deck.read_bytes()).hexdigest() != fine['deck_sha256']:
129
  raise ValueError('Executed SP-SC deck checksum differs.')
130
- wave = run_dir / f'{model.name}_waveform.csv'
131
- measurement = {field: fine['final'][field] for field in spec['metrics']}
132
- rows.append({'point': point, 'value': value, 'deck': deck.name,
133
- 'waveform': wave.name, 'deck_sha256': fine['deck_sha256'],
134
- 'nominal_vout_v': model.vin/2, 'vin_v': model.vin,
135
- 'stop_us': fine['runs_cycles']/model.fs*1e6,
136
- 'max_step_ps': fine['max_step_s']*1e12,
137
- 'window_start_cycles': fine['window_start_cycles'],
138
- 'window_stop_cycles': fine['window_stop_cycles'], **measurement})
 
 
 
 
 
 
 
139
  (run_dir / f'{model.name}-measurements.json').write_text(
140
  json.dumps(result, allow_nan=False, indent=2) + '\n')
141
- if point == selected:
142
- main = rows[-1]
143
- plot_waveform(run_dir, model, wave)
144
- progress(len(rows), len(entries))
145
- if sweep:
146
- write_sweep(run_dir, axis_spec, rows)
 
 
 
 
 
 
 
 
 
 
147
  return {
148
- 'run_id': run_dir.name, 'settings': payload, 'elapsed_s': time.perf_counter() - started,
149
- 'model_provenance': {'id': 'sp2', 'phase_cd_commit': 'e5ecaaf', 'deck_sha256': main['deck_sha256']},
150
- 'metrics': [main], 'sweep': rows if sweep else [],
151
- 'parameter': {'label': axis_spec['label'], 'unit': axis_spec['unit']},
152
- 'plot_url': f'/runs/{run_dir.name}/sp2-waveforms.png',
153
- 'sweep_plot_url': f'/simulator/runs/{run_dir.name}/sp2-sweep.png' if sweep else None,
 
 
154
  }
 
1
+ """Validate continuous SP-SC settings and run them through the shared job interface."""
2
  from dataclasses import replace
3
  import csv
4
  import hashlib
5
  import json
6
+ import subprocess
7
  from pathlib import Path
8
  import time
9
 
 
14
  return json.loads((HERE / 'preset_contract.json').read_text())
15
 
16
 
17
+ # Bounds on planned fixed-step intervals. Adaptive NGSpice can add samples.
18
+ MAX_CASE_INTERVALS = 1_000_000
19
+ MAX_JOB_INTERVALS = 6_000_000
20
+
21
+
22
+ def number(value, minimum, maximum, label):
23
+ if type(value) not in (int, float) or not minimum <= value <= maximum:
24
+ raise ValueError(f'{label} must be a number between {minimum:g} and {maximum:g}.')
25
+ return value
26
+
27
+
28
+ def build_case(name, settings):
29
+ from .run_ngspice_validation import Case
30
+
31
+ return Case(
32
+ name, 'physical', vin=settings['input_voltage_v'], load=settings['output_current_a'],
33
+ fs=settings['switching_frequency_mhz'] * 1e6, cf=settings['flying_cap_uf'] * 1e-6,
34
+ esr=settings['flying_esr_mohm'] * 1e-3, rs=settings['switch_ron_mohm'] * 1.5e-3,
35
+ gate_drive=settings['gate_drive_v'], gate_cap_pf=settings['gate_cap_pf'],
36
+ coss=settings['switch_coff_pf'] * 1e-12, cout=settings['output_cap_uf'] * 1e-6,
37
+ stop_us=settings['stop_us'], max_step_ps=settings['max_step_ps'],
38
+ )
39
+
40
+
41
+ def estimated_intervals(case):
42
+ from .run_ngspice_validation import transient_plan
43
+
44
+ cycles, samples, extended = transient_plan(case)
45
+ return samples * (3*cycles + 2*extended)
46
+
47
+
48
  def validate(payload):
49
+
50
  spec = contract()
51
+ parameters = spec['parameters']
52
+ fields = {entry['field'] for entry in parameters.values()}
53
+ if set(payload) - fields - {'topologies', 'sweep'} or payload.get('topologies') != ['sp2']:
54
+ raise ValueError('Use supported numerical SP-SC settings.')
55
+ settings = {}
56
+ for entry in parameters.values():
57
+ field = entry['field']
58
+ value = payload.get(field, entry['default'])
59
+ settings[field] = None if value is None and entry['optional'] else number(
60
+ value, entry['minimum'], entry['maximum'], f"{entry['label']} ({entry['unit']})")
61
+
62
+ main = build_case('physical_design', settings)
63
+ sweep = payload.get('sweep')
64
+ axis = None
65
+ entries = []
66
+ if sweep is not None:
67
+ if not isinstance(sweep, dict) or set(sweep) != {'axis', 'start', 'stop', 'points'}:
68
+ raise ValueError('Specify a sweep parameter, start, stop, and point count.')
69
+ axis_id = sweep['axis']
70
+ if not isinstance(axis_id, str) or axis_id not in parameters:
71
+ raise ValueError('Choose a supported sweep parameter.')
72
+ axis = parameters[axis_id]
73
+ start = number(sweep['start'], axis['minimum'], axis['maximum'], 'Sweep start')
74
+ stop = number(sweep['stop'], axis['minimum'], axis['maximum'], 'Sweep stop')
75
+ limits = spec['sweep_points']
76
+ count = number(sweep['points'], limits['minimum'], limits['maximum'], 'Sweep point count')
77
+ if int(count) != count or stop <= start:
78
+ raise ValueError('Use a whole point count and a sweep stop above its start.')
79
+ for index in range(int(count)):
80
+ value = stop if index == count-1 else start + (stop-start)*index/(count-1)
81
+ case = build_case(f'physical_sweep_{index+1:02d}', {**settings, axis['field']: value})
82
+ entries.append((value, case))
83
+
84
+ work = 0
85
+ for label, case in [('Operating point', main), *((f'Sweep value {value:g}', case) for value,case in entries)]:
86
+ try:
87
+ estimated = estimated_intervals(case)
88
+ except ValueError as error:
89
+ raise ValueError(f'{label}: {error}') from error
90
+ if estimated > MAX_CASE_INTERVALS:
91
+ raise ValueError(f'{label} exceeds the numerical work limit. Shorten the duration or use a less demanding step or RC combination.')
92
+ work += estimated
93
+ if work > MAX_JOB_INTERVALS:
94
+ raise ValueError('Sweep exceeds the numerical work limit. Reduce the point count or duration.')
95
+ return settings, main, axis, entries
96
 
97
 
98
  def plot_waveform(run_dir, model, wave_path):
 
128
 
129
 
130
  def write_sweep(run_dir, axis, rows):
131
+ import matplotlib
132
+ matplotlib.use('Agg')
133
  import matplotlib.pyplot as plt
134
 
135
  with (run_dir / 'sp2-sweep.csv').open('w', newline='') as file:
136
+ columns = ('value', 'status', 'message', 'vout_v', 'iout_a', 'input_w',
137
+ 'delivered_w', 'stage_w', 'supplemental_gate_w', 'stage_efficiency',
138
+ 'efficiency_with_gate', 'deck_sha256', 'deck', 'waveform')
139
  writer = csv.DictWriter(file, columns, extrasaction='ignore')
140
  writer.writeheader()
141
  writer.writerows(rows)
142
  figure, ax = plt.subplots(layout='constrained')
143
  values = [row['value'] for row in rows]
144
+ for key, style, label in (
145
+ ('efficiency_with_gate', 'o-', 'With gate estimate'),
146
+ ('stage_efficiency', 's--', 'Stage only'),
147
+ ):
148
+ # Leave gaps at failed points. Do not interpolate across them.
149
+ ax.plot(values, [100*row[key] if key in row else float('nan') for row in rows],
150
+ style, label=label)
151
  ax.legend()
152
  ax.set(xlabel=f"{axis['label']} ({axis['unit']})", ylabel='Modeled efficiency with gate estimate (%)')
153
  ax.grid(alpha=.25)
 
155
  plt.close(figure)
156
 
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  def run(payload, run_dir, progress=lambda complete, total: None):
159
+ from .run_ngspice_validation import NumericalValidationError, run_case
160
 
161
+ settings, main_model, axis, entries = validate(payload)
162
  started = time.perf_counter()
163
  spec = contract()
164
+ remaining_work = MAX_JOB_INTERVALS - estimated_intervals(main_model) - sum(
165
+ estimated_intervals(model) for _, model in entries)
166
+
167
+ def execute(model, value=None):
168
+ nonlocal remaining_work
169
+ refined = False
170
+ try:
171
+ try:
172
+ result = run_case(model, run_dir, capture=True)
173
+ except NumericalValidationError:
174
+ retry_work = 3 * estimated_intervals(model)
175
+ if retry_work > min(MAX_CASE_INTERVALS, remaining_work):
176
+ raise
177
+ remaining_work -= retry_work
178
+ result = run_case(model, run_dir, capture=True, refinement=3)
179
+ refined = True
180
+ except (ValueError, AssertionError, subprocess.TimeoutExpired) as error:
181
+ for path in run_dir.glob(f'{model.name}.*'):
182
+ path.unlink()
183
+ (run_dir / f'{model.name}_waveform.csv').unlink(missing_ok=True)
184
+ return {'value': value, 'status': 'failed', 'message': str(error)[-1600:]}
185
  fine = result['fine']
186
  deck = run_dir / f'{model.name}.cir'
187
  if hashlib.sha256(deck.read_bytes()).hexdigest() != fine['deck_sha256']:
188
  raise ValueError('Executed SP-SC deck checksum differs.')
189
+ warnings = []
190
+ if refined:
191
+ warnings.append('A tighter time step was needed to pass energy-balance and convergence checks.')
192
+ differences = result['signed_differences_vs_phase_b']
193
+ if differences is None:
194
+ warnings.append('The passive reference predicts no positive output. Review the switched result and its model assumptions.')
195
+ elif abs(differences['stage_fraction']) > .02:
196
+ warnings.append('Measured stage loss differs from the passive analytical reference by more than 2%. The switched model includes parasitics and finite transitions.')
197
+ measurements = {field: fine['final'][field] for field in spec['metrics']}
198
+ row = {'value': value, 'deck': deck.name, 'waveform': f'{model.name}_waveform.csv',
199
+ 'deck_sha256': fine['deck_sha256'], 'status': 'warning' if warnings else 'passed',
200
+ 'message': ' '.join(warnings), 'nominal_vout_v': model.vin/2, 'vin_v': model.vin,
201
+ 'stop_us': fine['runs_cycles']/model.fs*1e6,
202
+ 'max_step_ps': fine['max_step_s']*1e12,
203
+ 'window_start_cycles': fine['window_start_cycles'],
204
+ 'window_stop_cycles': fine['window_stop_cycles'], **measurements}
205
  (run_dir / f'{model.name}-measurements.json').write_text(
206
  json.dumps(result, allow_nan=False, indent=2) + '\n')
207
+ return row
208
+
209
+ count = 1 + len(entries)
210
+ progress(0, count)
211
+ main = execute(main_model)
212
+ progress(1, count)
213
+ rows = []
214
+ for value, model in entries:
215
+ rows.append(execute(model, value))
216
+ progress(1 + len(rows), count)
217
+ if not rows and main['status'] == 'failed':
218
+ raise ValueError('SP-SC result failed validation: ' + main['message'])
219
+ if main['status'] != 'failed':
220
+ plot_waveform(run_dir, main_model, run_dir / main['waveform'])
221
+ if axis:
222
+ write_sweep(run_dir, axis, rows)
223
  return {
224
+ 'run_id': run_dir.name, 'settings': {**settings, 'topologies': ['sp2'], 'sweep': payload.get('sweep')},
225
+ 'elapsed_s': time.perf_counter() - started,
226
+ 'model_provenance': {'id': 'sp2', 'phase_cd_commit': 'e5ecaaf', 'deck_sha256': main.get('deck_sha256')},
227
+ 'metrics': [main] if main['status'] != 'failed' else [], 'validation': main['status'],
228
+ 'validation_message': main['message'], 'sweep': rows,
229
+ 'parameter': {'label': axis['label'], 'unit': axis['unit']} if axis else None,
230
+ **({'plot_url': f'/runs/{run_dir.name}/sp2-waveforms.png'} if main['status'] != 'failed' else {}),
231
+ 'sweep_plot_url': f'/simulator/runs/{run_dir.name}/sp2-sweep.png' if axis else None,
232
  }
static/openpels-source.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:951b718334d89199fa45c73d4f2b1f04ed86e866144358a68035640edecc905e
3
- size 24854458
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e040b45ee859dbcd10edb5190846458bde032694f9680f57dd4c6b82037eb61b
3
+ size 24856426
static/pe.js CHANGED
@@ -26,8 +26,10 @@ let selectedTopology = null,
26
  currentView = "gallery";
27
  const sp2Nominal = { vout: 1.5, iout: 1.1404833 };
28
  let sp2Preset;
29
- const qualifiedPoint = (axis, value) =>
30
- sp2Preset?.axes[axis].points.some(([, point]) => Math.abs(value - point) <= 1e-7);
 
 
31
  let legacyPoint = { vout: 0.8, iout: 2 };
32
  let sp2Point = { ...sp2Nominal };
33
  let operatingPoint = legacyPoint;
@@ -76,10 +78,8 @@ const simulator = createSimulator(notify, (topology, point) => {
76
  });
77
  function simulationAvailable() {
78
  if (selectedTopology?.simulator === "sp2")
79
- return selectedRatio === 2 && qualifiedPoint("vin", operatingPoint.vout*2) &&
80
- qualifiedPoint("load", operatingPoint.iout) &&
81
- (Math.abs(operatingPoint.vout - sp2Nominal.vout) <= 1e-7 ||
82
- Math.abs(operatingPoint.iout - sp2Nominal.iout) <= 1e-7);
83
  return (
84
  !!selectedTopology?.simulator &&
85
  selectedRatio === 4 &&
@@ -114,8 +114,8 @@ function renderSelection() {
114
  ? "Analytical model available. A validated NGSpice preset is not yet available for this topology."
115
  : entry.simulator === "sp2"
116
  ? simulationAvailable()
117
- ? "Qualified input, load, and one-parameter sweeps."
118
- : "Use 1.5 V nominal output with 0.35, 1.1404833, or 2 A. The 1.4 and 1.6 V nominal points use 1.1404833 A."
119
  : selectedRatio !== 4
120
  ? "This preset currently supports simulation in the 4:1 family; the selected ratio has an analytical model."
121
  : !simulationAvailable()
 
26
  currentView = "gallery";
27
  const sp2Nominal = { vout: 1.5, iout: 1.1404833 };
28
  let sp2Preset;
29
+ const sp2InBounds = (axis, value) => {
30
+ const range = sp2Preset?.parameters[axis];
31
+ return range && Number.isFinite(value) && value >= range.minimum && value <= range.maximum;
32
+ };
33
  let legacyPoint = { vout: 0.8, iout: 2 };
34
  let sp2Point = { ...sp2Nominal };
35
  let operatingPoint = legacyPoint;
 
78
  });
79
  function simulationAvailable() {
80
  if (selectedTopology?.simulator === "sp2")
81
+ return selectedRatio === 2 && sp2InBounds("vin", operatingPoint.vout*2) &&
82
+ sp2InBounds("load", operatingPoint.iout);
 
 
83
  return (
84
  !!selectedTopology?.simulator &&
85
  selectedRatio === 4 &&
 
114
  ? "Analytical model available. A validated NGSpice preset is not yet available for this topology."
115
  : entry.simulator === "sp2"
116
  ? simulationAvailable()
117
+ ? "Continuous inputs and configurable sweeps. Each run checks result reliability."
118
+ : "Set nominal output to 0.9–2 V and output current to 0.05–4 A to open the SP-SC Simulator."
119
  : selectedRatio !== 4
120
  ? "This preset currently supports simulation in the 4:1 family; the selected ratio has an analytical model."
121
  : !simulationAvailable()
static/testbenches/sp2-preset.json CHANGED
@@ -1,17 +1,8 @@
1
  {
2
  "id": "sp2",
3
  "ratio": 2,
4
- "status": "local-qualified",
5
  "run_kind": "run",
6
- "fixture": "physical_nominal",
7
- "request": {
8
- "topologies": [
9
- "sp2"
10
- ],
11
- "input_voltage_v": 3.0,
12
- "target_vout": 1.5,
13
- "output_current_a": 1.1404833
14
- },
15
  "fixed_parameters": {
16
  "fs_hz": 2000000,
17
  "cf_f_per_flying_cap": 1e-06,
@@ -68,216 +59,119 @@
68
  "maximum_state_drift_v",
69
  "storage_w"
70
  ],
71
- "axes": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  "fs": {
 
73
  "label": "Switching frequency",
74
  "unit": "MHz",
75
- "points": [
76
- [
77
- "low",
78
- 0.3
79
- ],
80
- [
81
- "nominal",
82
- 2
83
- ],
84
- [
85
- "high",
86
- 12
87
- ]
88
- ]
89
  },
90
  "cf": {
 
91
  "label": "Flying capacitance per cap",
92
  "unit": "µF",
93
- "points": [
94
- [
95
- "low",
96
- 0.4
97
- ],
98
- [
99
- "nominal",
100
- 1
101
- ],
102
- [
103
- "high",
104
- 2.5
105
- ]
106
- ]
107
  },
108
  "esr": {
 
109
  "label": "Flying-cap ESR",
110
  "unit": "mΩ",
111
- "points": [
112
- [
113
- "low",
114
- 5
115
- ],
116
- [
117
- "nominal",
118
- 20
119
- ],
120
- [
121
- "high",
122
- 80
123
- ]
124
- ]
125
  },
126
  "rs": {
 
127
  "label": "Switch on-resistance",
128
  "unit": "mΩ",
129
- "points": [
130
- [
131
- "low",
132
- 30
133
- ],
134
- [
135
- "nominal",
136
- 60
137
- ],
138
- [
139
- "high",
140
- 120
141
- ]
142
- ]
143
- },
144
- "load": {
145
- "label": "Output current",
146
- "unit": "A",
147
- "points": [
148
- [
149
- "low",
150
- 0.35
151
- ],
152
- [
153
- "nominal",
154
- 1.1404833
155
- ],
156
- [
157
- "high",
158
- 2
159
- ]
160
- ]
161
  },
162
- "vin": {
163
- "label": "Input voltage",
 
164
  "unit": "V",
165
- "points": [
166
- [
167
- "low",
168
- 2.8
169
- ],
170
- [
171
- "nominal",
172
- 3
173
- ],
174
- [
175
- "high",
176
- 3.2
177
- ]
178
- ]
179
  },
180
  "coss": {
 
181
  "label": "Switch Coss",
182
  "unit": "pF",
183
- "points": [
184
- [
185
- "low",
186
- 0
187
- ],
188
- [
189
- "nominal",
190
- 20
191
- ],
192
- [
193
- "high",
194
- 40
195
- ]
196
- ]
197
  },
198
  "cout": {
 
199
  "label": "Output capacitance",
200
  "unit": "µF",
201
- "points": [
202
- [
203
- "low",
204
- 5
205
- ],
206
- [
207
- "nominal",
208
- 10
209
- ],
210
- [
211
- "high",
212
- 20
213
- ]
214
- ]
215
- },
216
- "gate": {
217
- "label": "Gate-drive high level",
218
- "unit": "V",
219
- "points": [
220
- [
221
- "low",
222
- 3
223
- ],
224
- [
225
- "nominal",
226
- 3.3
227
- ],
228
- [
229
- "high",
230
- 3.6
231
- ]
232
- ]
233
- },
234
- "gatecap": {
235
- "label": "Effective gate capacitance",
236
- "unit": "pF",
237
- "points": [
238
- [
239
- "low",
240
- 0
241
- ],
242
- [
243
- "nominal",
244
- 7.631414141414141
245
- ],
246
- [
247
- "high",
248
- 15
249
- ]
250
- ]
251
  },
252
  "stop": {
253
- "label": "Minimum run length",
254
- "unit": "cycles",
255
- "points": [
256
- [
257
- "nominal",
258
- 0
259
- ],
260
- [
261
- "high",
262
- 64
263
- ]
264
- ],
265
- "numerical": true
266
  },
267
  "step": {
 
268
  "label": "Refined maximum step ceiling",
269
  "unit": "ps",
270
- "points": [
271
- [
272
- "low",
273
- 400
274
- ],
275
- [
276
- "nominal",
277
- 0
278
- ]
279
- ],
280
- "numerical": true
281
  }
 
 
 
 
 
282
  }
283
  }
 
1
  {
2
  "id": "sp2",
3
  "ratio": 2,
4
+ "status": "local-generic-model",
5
  "run_kind": "run",
 
 
 
 
 
 
 
 
 
6
  "fixed_parameters": {
7
  "fs_hz": 2000000,
8
  "cf_f_per_flying_cap": 1e-06,
 
59
  "maximum_state_drift_v",
60
  "storage_w"
61
  ],
62
+ "parameters": {
63
+ "vin": {
64
+ "field": "input_voltage_v",
65
+ "label": "Input voltage",
66
+ "unit": "V",
67
+ "minimum": 1.8,
68
+ "maximum": 4,
69
+ "default": 3,
70
+ "optional": false
71
+ },
72
+ "load": {
73
+ "field": "output_current_a",
74
+ "label": "Output current",
75
+ "unit": "A",
76
+ "minimum": 0.05,
77
+ "maximum": 4,
78
+ "default": 1.1404833,
79
+ "optional": false
80
+ },
81
  "fs": {
82
+ "field": "switching_frequency_mhz",
83
  "label": "Switching frequency",
84
  "unit": "MHz",
85
+ "minimum": 0.2,
86
+ "maximum": 20,
87
+ "default": 2,
88
+ "optional": false
 
 
 
 
 
 
 
 
 
 
89
  },
90
  "cf": {
91
+ "field": "flying_cap_uf",
92
  "label": "Flying capacitance per cap",
93
  "unit": "µF",
94
+ "minimum": 0.1,
95
+ "maximum": 5,
96
+ "default": 1,
97
+ "optional": false
 
 
 
 
 
 
 
 
 
 
98
  },
99
  "esr": {
100
+ "field": "flying_esr_mohm",
101
  "label": "Flying-cap ESR",
102
  "unit": "mΩ",
103
+ "minimum": 0.1,
104
+ "maximum": 150,
105
+ "default": 20,
106
+ "optional": false
 
 
 
 
 
 
 
 
 
 
107
  },
108
  "rs": {
109
+ "field": "switch_ron_mohm",
110
  "label": "Switch on-resistance",
111
  "unit": "mΩ",
112
+ "minimum": 10,
113
+ "maximum": 200,
114
+ "default": 60,
115
+ "optional": false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  },
117
+ "gate": {
118
+ "field": "gate_drive_v",
119
+ "label": "Gate-drive high level",
120
  "unit": "V",
121
+ "minimum": 2.5,
122
+ "maximum": 4.5,
123
+ "default": 3.3,
124
+ "optional": false
125
+ },
126
+ "gatecap": {
127
+ "field": "gate_cap_pf",
128
+ "label": "Effective gate capacitance",
129
+ "unit": "pF",
130
+ "minimum": 0,
131
+ "maximum": 100,
132
+ "default": null,
133
+ "optional": true
 
134
  },
135
  "coss": {
136
+ "field": "switch_coff_pf",
137
  "label": "Switch Coss",
138
  "unit": "pF",
139
+ "minimum": 0,
140
+ "maximum": 100,
141
+ "default": 20,
142
+ "optional": false
 
 
 
 
 
 
 
 
 
 
143
  },
144
  "cout": {
145
+ "field": "output_cap_uf",
146
  "label": "Output capacitance",
147
  "unit": "µF",
148
+ "minimum": 1,
149
+ "maximum": 50,
150
+ "default": 10,
151
+ "optional": false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  },
153
  "stop": {
154
+ "field": "stop_us",
155
+ "label": "Simulation duration",
156
+ "unit": "µs",
157
+ "minimum": 1,
158
+ "maximum": 500,
159
+ "default": null,
160
+ "optional": true
 
 
 
 
 
 
161
  },
162
  "step": {
163
+ "field": "max_step_ps",
164
  "label": "Refined maximum step ceiling",
165
  "unit": "ps",
166
+ "minimum": 50,
167
+ "maximum": 5000,
168
+ "default": null,
169
+ "optional": true
 
 
 
 
 
 
 
170
  }
171
+ },
172
+ "sweep_points": {
173
+ "minimum": 2,
174
+ "maximum": 15,
175
+ "default": 5
176
  }
177
  }