main
John Lauer
Record explicit-terminal current diagnostics and reviewed Fields walkthrough
9ead993
#!/usr/bin/env python3
"""Conditional DC envelope: 0.3 A from J3.1 to each auxiliary consumer in turn."""
import hashlib,json,subprocess,sys
from pathlib import Path
root=Path(__file__).resolve().parents[1]
solver=Path(sys.argv[1]).resolve()
base=json.loads((root/'design/spec-current-mesh.json').read_text())
board=root/'aiflow/run/board-19.kicad_pcb'
rows=[]
for ref,pad in [('J9','1'),('U9','1'),('U9','3'),('U5','4'),('U5','5'),('L1','1')]:
out=root/'design/aux-current-envelope'/f'{ref}-{pad}';out.mkdir(parents=True,exist_ok=True)
spec={'board':f'Auxiliary DC diagnostic J3.1 to {ref}.{pad}', 'copperUm':base['copperUm'],'stackupMm':base['stackupMm'],'dcMaxIterations':base['dcMaxIterations'],'loads':{'5V_AUX':{'amps':0.3,'maxRiseC':10,'terminals':[{'reference':'J3','pad':'1','amps':0.3},{'reference':ref,'pad':pad,'amps':-0.3}]}},'hot':{}}
p=out/'spec.json';p.write_text(json.dumps(spec,indent=2)+'\n')
with (out/'solve.log').open('w') as log:
r=subprocess.run([str(solver),'analyze','--board',str(board),'--spec',str(p),'--out',str(out),'--pitch','0.2','--no-parts'],stdout=log,stderr=subprocess.STDOUT)
if r.returncode:raise SystemExit(f'{ref}.{pad}: solver failed; see {out}/solve.log')
f=json.loads((out/'fields.json').read_text());assert len(f['nets'])==1
rows.append({'sink':f'{ref}.{pad}','inputIdentity':f['inputIdentity'],'result':f['nets'][0],'issues':f['issues']})
print(ref,pad,'peakJ',f['nets'][0]['peakJ'],flush=True)
report={'kind':'conditional-auxiliary-DC-envelope','formalAcceptance':False,'boardSha256':hashlib.sha256(board.read_bytes()).hexdigest(),'solverSha256':hashlib.sha256(solver.read_bytes()).hexdigest(),'source':'J3.1','totalAmps':0.3,'cases':rows,'limits':['Assumes J3.1 is sole 5 V source and total continuous current <= 0.3 A; budget must be validated separately','One consumer pin gets the entire current in each case; linear DC combinations are bounded by these cases at fixed conductivity','Capacitor startup and boost switching pulses excluded; this is not a transient or thermal acceptance','No heat-source or external heatsink qualification; fixed nominal copper and plating']}
(root/'design/aux-current-envelope/summary.json').write_text(json.dumps(report,indent=2)+'\n')