main
John Lauer R0 engineering checkpoint: checked schematic, sourcing, servo evidence and safety-policy code; PCB and qualification incomplete 10054d3 1h ago
#!/usr/bin/env python3
"""R0 first-order load calculations. No measured performance implied.
IXTP15N50L2 datasheet DS100054B p2/5; DACx0501 Rev E; INA226 Rev B.
Thermal interface, ambient and heatsink allowances are design assumptions.
"""
import json
from pathlib import Path
r=json.loads((Path(__file__).parents[1]/'requirements.json').read_text())
e=r['inputs'][0]; I=e['I_max_A']; P=e['P_continuous_W']; V=e['range_V'][1]
RS=0.020; REF=2.5; RTOP=33000+5600; RBOT=1000
out={'status':'preliminary calculations; hardware unverified','envelope':{'max_V':V,'max_A':I,'max_W':P,'I_at_max_V_A':min(I,P/V)},'shunt':{'ohm':RS,'V_at_max_A':I*RS,'W_at_max_A':I*I*RS,'INA226_fullscale_V':.08192,'range_margin_V':.08192-I*RS},'dac':{'bits':12,'reference_V':REF,'divider_top_ohm':RTOP,'divider_bottom_ohm':RBOT,'full_scale_A':REF*RBOT/(RTOP+RBOT)/RS,'LSB_A':REF*RBOT/(RTOP+RBOT)/RS/4096,'note':'0.1% selected divider; DAC gain/reference, resistor tracking and shunt tolerance still require a complete error budget. Full-scale formula denotes ideal span; maximum code is 4095/4096 of span.'},'offset_error':{'OPA189_25C_max_A':3e-6/RS,'INA226_max_A':10e-6/RS,'note':'Offset only; not complete error budget'},'thermal':{'ambient_C':40,'case_limit_C':75,'interface_assumed_C_W':.5,'thetaJC_max_C_W':.42,'allowable_sink_C_W':(75-40)/P-.5,'junction_C_at_case_limit':75+P*.42,'note':'Worst-case all load power placed in MOSFET; interface is an assumption, must verify actual insulator and spreading. Fan free-air CFM is not installed airflow.'},'initial_DUT':{'V':5,'A':1,'W':5},'open_items':['Selected sink with local TO-220 heat spreading','Actual contact current ratings','Loop stability with vendor transistor model','Temperature sensor lag and trip margin','Complete error budget and calibration','Independent power and reverse polarity protection']}
(Path(__file__).parent/'calcs.json').write_text(json.dumps(out,indent=2));print(json.dumps(out,indent=2))