main
John Lauer
Document cooling envelope tradeoff and verify published shutdown replay
65bd320
from pathlib import Path
import json
import matplotlib;matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle,Circle
import sys;sys.path.insert(0,str(Path(__file__).resolve().parent));import sexp
R=Path(__file__).resolve().parents[1];a=json.loads((R/'checkpoints/board32-temperature-bound/passive-body-audit.json').read_text());r=json.loads((R/'checkpoints/board32-temperature-bound/passive-offset-screen.json').read_text());b=r['best'][0]['envelopeMm'];bb=r['outlineBoundsMm']
plt.rcParams.update({'text.color':'#e7eef5','axes.labelcolor':'#b7c6d1','xtick.color':'#b7c6d1','ytick.color':'#b7c6d1','font.size':13})
f,ax=plt.subplots(figsize=(16,9),dpi=120,facecolor='#101820');ax.set_facecolor('#101820');f.subplots_adjust(left=.07,right=.71,top=.88,bottom=.11)
ax.add_patch(Rectangle((bb[0],bb[1]),bb[2]-bb[0],bb[3]-bb[1],facecolor='#183e39',edgecolor='#7bd2ad',lw=2))
ax.add_patch(Rectangle((b[0],b[1]),b[3]-b[0],b[4]-b[1],facecolor='#e0ae55',alpha=.16,edgecolor='#e0ae55',lw=3))
for row in a['rows']:
x,y,z,X,Y,Z=row['boundsMm'];color='#a4b6c5' if row['ref']!='Q1' else '#ffc767';ax.add_patch(Rectangle((x,y),X-x,Y-y,fill=False,edgecolor=color,lw=.7))
if row['ref'] in ('Q1','J9','J10','J11','J8'):ax.text((x+X)/2,(y+Y)/2,row['ref'],ha='center',va='center',fontsize=9,color='#ffffff')
for fp in sexp.find(sexp.parse((R/'aiflow/run/board-32.kicad_pcb').read_text()),'footprint'):
props={p[1]:p[2] for p in sexp.find(fp,'property')}
if props['Reference'].startswith('TP'):
x,y=map(float,sexp.first(fp,'at')[1:3]);ax.add_patch(Circle((x,y),2,fill=False,edgecolor='#55bdff',lw=1))
ax.add_patch(Rectangle((115.649,44.131),45.974,45.974,fill=False,edgecolor='#24c8bb',lw=2,ls='--'))
ax.set_xlim(92,195);ax.set_ylim(109,14);ax.set_aspect('equal');ax.set_xlabel('Board X (mm)');ax.set_ylabel('Board Y (mm)');ax.grid(alpha=.08);ax.spines[['top','right']].set_visible(False)
f.text(.06,.945,'A passive alternative needs more room',fontsize=27,weight='bold');f.text(.73,.81,'OFFSET ENVELOPE STUDY',fontsize=17,color='#ffc767',weight='bold');f.text(.73,.73,'76.10 × 76.20 × 50.80 mm\nproposed sink envelope',fontsize=16,linespacing=1.6);f.text(.73,.60,'22.10 mm right overhang\n6.00 mm top overhang',fontsize=16,linespacing=1.6);f.text(.73,.45,'91 fitted part bounds checked\n13 probe approaches clear\n0.5 mm body / 2 mm probe margin',fontsize=13,linespacing=1.7);f.text(.73,.30,'Dashed teal: compact sink\nBlue circles: probe access',fontsize=13,linespacing=1.7);f.text(.73,.14,'NOT ADOPTED\nMounting, plugs, fan, workcell\nand thermal performance unqualified.',fontsize=12,color='#ffc767',linespacing=1.6);f.text(.06,.035,'Board32 • actual STEP bounds plus a conservative solid sink envelope • geometry screen only',fontsize=12,color='#9bb0c1')
f.savefig(R/'aiflow/run/timeline/board32-passive-offset.png',facecolor=f.get_facecolor())