Spaces:
Running
Running
Publish ThinkPower topology analysis website
Browse filesIndependent static website with browser-based analysis and optional direct vision inference. Links to the restored original XFLY simulation Space.
- README.md +8 -0
- static/app.js +9 -10
- static/index.html +2 -2
- static/recommend.js +2 -2
- test_recommendation.py +9 -0
README.md
CHANGED
|
@@ -283,3 +283,11 @@ specified current with a solved resistive-load equilibrium.
|
|
| 283 |
The main comparison no longer features a single winning topology. All qualifying
|
| 284 |
candidates appear as equally styled drawing panels beside the design inputs,
|
| 285 |
with the existing priority sort, numerical results and exclusion details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
The main comparison no longer features a single winning topology. All qualifying
|
| 284 |
candidates appear as equally styled drawing panels beside the design inputs,
|
| 285 |
with the existing priority sort, numerical results and exclusion details.
|
| 286 |
+
|
| 287 |
+
The GUI operating point now has only output voltage and output power inputs.
|
| 288 |
+
Vin is derived as selected_ratio * Vout; Iout = Pout/Vout and
|
| 289 |
+
Rload = Vout²/Pout. Changing ratio preserves output voltage/power. The separate
|
| 290 |
+
device-reference panel also consumes this derived operating point instead of
|
| 291 |
+
exposing competing Vin/Iout fields. Resource and technology constraints remain
|
| 292 |
+
editable. The numerical API retains its legacy explicit-Vin mode for previous
|
| 293 |
+
verification cases; the GUI uses voltage_mode=output_ratio and load_mode=power.
|
static/app.js
CHANGED
|
@@ -65,7 +65,7 @@ function chart(id,series,{xlabel='',ylabel='',logx=false,logy=false,xrange,yrang
|
|
| 65 |
}
|
| 66 |
function drawSweep(){if(!report)return;chart('rout-chart',report.curves,{xlabel:'Nominal Vout / Vin',ylabel:'Req / Rs (p.u.)',logy:true,xrange:[0,.5],yrange:[Math.max(.001,Math.min(...report.curves.flatMap(s=>s.points.map(p=>p[1])))*.8),50],marker:report.M});$('#legend').innerHTML=report.curves.map(s=>`<span><i style="background:${s.color}"></i>${s.name}</span>`).join('')}
|
| 67 |
$('#sweep-section').addEventListener('toggle',()=>{if($('#sweep-section').open)drawSweep()});
|
| 68 |
-
$$('[data-ratio]').forEach(b=>b.onclick=()=>{ratio=Number(b.dataset.ratio);
|
| 69 |
$('#apply-weights').onclick=update;$('#reset').onclick=()=>{for(const [k,v] of Object.entries({rho_c:1,rho_l:1,rho_q:20}))$('#'+k).value=v;$('#toast').hidden=true;clearTimeout(timer);update()};
|
| 70 |
$('#export-csv').onclick=()=>{if(!report)return;const rows=[['Topology','Target_ratio','kFET_Rs','kCAP_Rc','kIND_Rl','kSSL_over_Cf_fs','RFET_pu','RCAP_pu','RIND_pu','RSSL_pu','Req_pu','RFSL_pu','RSSL_add_pu','Switching_loss_scope','rho_C','rho_L','rho_Q','Model_domain'],...report.rows.map(r=>[r.short,ratio,...(r.valid?r.coefficients:['','','','']),...['fet','cap','ind','ssl','total','fsl','ssl_series'].map(k=>r.valid?r[k]:''),'Separate technology example; Coss requires energy data',report.normalization.rho_c,report.normalization.rho_l,report.normalization.rho_q,r.domain])];download('thinkpower-per-unit-comparison.csv',rows.map(r=>r.map(v=>'"'+String(v).replaceAll('"','""')+'"').join(',')).join('\n'),'text/csv')};
|
| 71 |
$('#open-upload').onclick=()=>$('#upload-dialog').showModal();$('#close-upload').onclick=()=>$('#upload-dialog').close();
|
|
@@ -76,31 +76,30 @@ if($('#confirm-model')){$('#confirm-model').onchange=e=>$('#apply-model').disabl
|
|
| 76 |
if(d.state_table){const area=document.createElement('textarea');area.rows=9;area.value=JSON.stringify(d.state_table,null,2);const button=document.createElement('button'),result=document.createElement('pre');button.textContent='Evaluate reviewed FSL state table';button.onclick=async()=>{try{const r=await api('/api/state-model-pu',JSON.parse(area.value));result.textContent=JSON.stringify(r,null,2)}catch(e){result.textContent=e.message}};$('#interpretation').append(area,button,result)}
|
| 77 |
$('#upload-status').textContent=d.configured?'Review required before using the reference equations.':'No inference token: image recognition has not been performed.';
|
| 78 |
}catch(e){$('#upload-status').textContent=e.message}finally{$('#api-key').value='';b.disabled=false}};
|
| 79 |
-
const techFields=[['
|
| 80 |
$('#tech-settings').innerHTML=techFields.map(([k,label,v])=>`<label>${label}<input id="tech-${k}" type="number" value="${v}" min="0" step="any" placeholder="unknown"></label>`).join('');
|
| 81 |
let technologyReport;
|
| 82 |
-
function renderTechnology(){if(!report)return;try{const p=Object.fromEntries(techFields.filter(([k])=>k!=='eoss_pj'||$('#tech-'+k).value.trim()!=='').map(([k])=>[k,Number($('#tech-'+k).value)]));technologyReport=ThinkPowerTechnology.example(report.rows,p);const t=technologyReport,unit=(v,scale=1)=>v==null?'unknown':!Number.isFinite(v)?'∞':fmt(v*scale);
|
| 83 |
$('#technology-status').textContent=`Rs = ${fmt(t.rs*1e3)} mΩ · RΣ = ${fmt(t.parallel*1e3)} mΩ · gate demand = ${fmt(t.gate_power*1e3)} mW · physical example is separate from the per-unit weights above`;
|
| 84 |
$('#technology-results').innerHTML=`<table><caption>Fixed-width example: flat-current buck models; exact linear periodic RC for SP-SC. Not measured efficiency.</caption><thead><tr><th>Topology</th><th>CF each (μF)</th><th>RFET (mΩ)</th><th>RCAP (mΩ)</th><th>RIND (mΩ)</th><th>RHC,add (mΩ)</th><th>Req (mΩ)</th><th>Rg at Vx (Ω)</th><th>Ross at Vx (Ω)</th><th>Iout²Req + Pg + known Poss (mW)</th></tr></thead><tbody>${t.rows.map(r=>r.valid?`<tr><th>${esc(report.rows.find(a=>a.id===r.id).short)}</th><td>${r.cf?unit(r.cf,1e6):'—'}</td>${['fet','cap','ind','hc','req'].map(k=>`<td>${unit(r[k],1e3)}</td>`).join('')}<td>${unit(r.gate_r)}</td><td>${unit(r.oss_r)}</td><td>${unit(r.partial_loss,1e3)}${r.poss===null?' + unknown Coss':''}</td></tr>`:`<tr><th>${esc(r.id)}</th><td colspan="9">Outside the supported analytical model</td></tr>`).join('')}</tbody></table>`;
|
| 85 |
}catch(e){technologyReport=null;$('#technology-status').textContent=e.message;$('#technology-results').innerHTML=''}}
|
| 86 |
$('#apply-technology').onclick=renderTechnology;$('#export-technology').onclick=()=>{if(technologyReport)download('thinkpower-180nm-example.json',JSON.stringify({...technologyReport,source:'User-supplied XFLY_Power_Analysis.md; not independently verified foundry data',method:'Paper FSL/SSL interpolation; separate gate demand; Qoss does not establish Eoss'},(k,v)=>typeof v==='number'&&!Number.isFinite(v)?String(v):v,2),'application/json')};
|
| 87 |
(function rcChart(){const w=600,h=210,x=a=>45+(Math.log10(a)+2)/4*530,y=v=>175-(Math.log10(v)+.3)/3*155,points=fn=>Array.from({length:161},(_,i)=>{const a=10**(-2+i/40);return `${x(a)},${y(fn(a))}`}).join(' ');$('#rc-limit-chart').innerHTML=`<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="Finite RC event resistance and its SSL and FSL limits on log axes"><defs><clipPath id="rc-plot-clip"><rect x="45" y="15" width="530" height="160"/></clipPath></defs><rect width="600" height="210" fill="white"/><path d="M45 15V175H575" fill="none" stroke="#a6b6aa"/><g clip-path="url(#rc-plot-clip)"><polyline points="${points(a=>1/Math.tanh(a/2))}" fill="none" stroke="#157e70" stroke-width="2"/><polyline points="${points(a=>2/a)}" fill="none" stroke="#5c70b8" stroke-dasharray="5 4"/><polyline points="${points(()=>1)}" fill="none" stroke="#cf7b30" stroke-dasharray="5 4"/></g><g font-family="Arial" font-size="10" fill="#526b5e"><text x="65" y="18">Revent / RSSL · log axis</text><text x="340" y="18">green: finite RC · blue: FSL · orange: SSL</text>${[.01,.1,1,10,100].map(a=>`<text x="${x(a)}" y="190" text-anchor="middle">${a}</text>`).join('')}${[1,10,100].map(v=>`<text x="36" y="${y(v)+3}" text-anchor="end">${v}</text>`).join('')}<text x="310" y="207" text-anchor="middle">d / (fs Rpath C) · log axis</text></g></svg>`})();
|
| 88 |
const designFields=[
|
| 89 |
-
['
|
| 90 |
['budget_mode','Silicon budget','area','select',[['area','Die area + Ron × area'],['width','Total FET width']]],
|
| 91 |
['die_mm2','Total die area (mm²)',1],['utilization','Usable transistor fraction',.5],['ron_area_mohm_mm2','Ron × area (mΩ·mm²)',1],['width_mm','Maximum FET width (mm)',360],
|
| 92 |
['cap_uf','Flying / clamp budget (μF)',4],['max_caps','Maximum flying / clamp caps',4],['max_windings','Maximum power windings',2],['rc_mohm','Main-cap ESR (mΩ)',20],['rl_mohm','DCR per winding (mΩ)',38],['lk_nh','Leakage Lk per winding (nH)',50],['lm_uh','Magnetizing Lm (μH)',1],['max_phase_ripple_percent','Max phase ripple pp (% avg)',5],['max_drop_percent','Maximum estimated droop (%)',10],
|
| 93 |
['objective','Priority','loss','select',[['loss','Lowest modeled loss'],['capacitors','Fewest capacitors, then loss'],['magnetics','Fewest power windings, then loss']]]
|
| 94 |
];
|
| 95 |
$('#design-fields').innerHTML=designFields.map(([k,label,value,type,options])=>`<label data-design-field="${k}">${label}${type==='select'?`<select id="design-${k}">${options.map(([v,t])=>`<option value="${v}" ${value===v?'selected':''}>${t}</option>`).join('')}</select>`:`<input id="design-${k}" type="number" value="${value}" min="0" step="any">`}</label>`).join('');
|
| 96 |
-
const loadBudgetField=$('[data-design-field="budget_mode"]');$('#design-fields').insertBefore($('#load-summary'),loadBudgetField);
|
| 97 |
let recommendationReport;
|
| 98 |
-
function designParameters(){return {ratio,...Object.fromEntries(designFields.map(([k,label,v,type])=>[k,type==='select'?$('#design-'+k).value:Number($('#design-'+k).value)]))}}
|
| 99 |
function showBudgetFields(){const mode=$('#design-budget_mode').value;for(const k of ['die_mm2','utilization','ron_area_mohm_mm2'])$(`[data-design-field="${k}"]`).hidden=mode!=='area';$('[data-design-field="width_mm"]').hidden=mode!=='width'}
|
| 100 |
showBudgetFields();$('#design-budget_mode').onchange=showBudgetFields;
|
| 101 |
-
function
|
| 102 |
-
|
| 103 |
-
$('#match-output-ratio').onclick=()=>{$('#design-vout').value=Number($('#design-vin').value)/ratio;updateLoadSummary();renderRecommendation()};updateLoadSummary();
|
| 104 |
|
| 105 |
function inspectRecommendation(id){const r=recommendationReport?.rows.find(r=>r.id===id);if(!r||r.status!=='eligible')return;selected=new Set([id]);const p=recommendationReport.parameters;$('#rho_c').value=(p.rc_mohm/1000/r.rs).toPrecision(8);$('#rho_l').value=(p.rl_mohm/1000/r.rs).toPrecision(8);$('#rho_q').value=r.cf?(1/(r.cf*p.fs_mhz*1e6*r.rs)).toPrecision(8):0;$('#analysis-workbench').open=true;$('#inspection-context').textContent=`${r.short}: ${fmt(r.width_mm)} mm total FET width, Rs = ${fmt(r.rs*1e3)} mΩ, modeled loss = ${fmt(r.loss*1e3)} mW. Reference die-map proportions are scaled to this width; A₀ = ${fmt(r.width_mm/12)} mm of width. The shortlist uses the common full-budget RS base; these diagrams use the actual sized-device Rs. The device example below is a separate reference calculation.`;picker();update();$('#analysis-workbench').scrollIntoView({behavior:'smooth',block:'start'})}
|
| 106 |
function renderRecommendation(){if(!catalog.length)return;try{recommendationReport=ThinkPowerRecommendation.recommend(designParameters(),{catalog},ThinkPowerEngine,ThinkPowerTechnology);$('#design-error').textContent='';$('#recommend-design').textContent='Update candidates';$('#export-recommendation').disabled=false;const t=recommendationReport,p=t.parameters,native=t.native_models;
|
|
@@ -113,7 +112,7 @@ const candidatePanel=r=>{
|
|
| 113 |
return `<article class="candidate-panel ${eligible?'':'candidate-excluded'}" data-candidate="${r.id}" data-candidate-status="${r.status}"><div class="candidate-heading"><span class="candidate-rank">${eligible?'#'+r.rank:'Not eligible'}</span><span class="candidate-family">${r.native_ratio}:1 cancellation point</span></div><h3>${esc(r.name)}</h3><div class="candidate-drawing"><img src="./assets/${image}" alt="${esc(r.name)} schematic with Rs, Rc and Rl resistance labels; gate-control annotations omitted" loading="lazy"></div>${eligible?`<div class="candidate-metrics"><div><strong>${fmt(r.loss*1e3,1)} mW</strong><span>Modeled loss</span></div><div><strong>${fmt(r.rout*1e3,2)} mΩ</strong><span>Converter Rout · ${fmt(r.req_pu)} p.u.</span></div></div><p class="candidate-resistances">R<sub>load</sub> = ${fmt(t.load_resistance,4)} Ω · R<sub>out</sub>/R<sub>load</sub> = ${fmt(r.rout_over_rload*100,2)}%<br>R<sub>S</sub> = ${fmt(r.rs*1e3,2)} mΩ${r.capacitors?' · R<sub>C</sub> = '+fmt(p.rc_mohm,1)+' mΩ':''}${r.windings?' · R<sub>L</sub> = '+fmt(p.rl_mohm,1)+' mΩ/winding':''}</p><p class="candidate-resources">${r.capacitors} flying/clamp caps · ${r.windings} windings<br>${fmt(r.width_mm,1)} mm FET width · ${fmt(r.drop_percent,1)}% nominal droop<br><b>${fmt(r.phase_ripple_percent,2)}% phase ripple pp</b> · ${fmt(r.phase_ripple_pp*1e3,1)} mA · ${fmt(r.effective_frequency/1e6,1)} MHz effective excitation</p><button data-inspect-design="${r.id}">Inspect circuit and die allocation →</button>`:`<p class="candidate-reason">${r.reasons.map(esc).join('; ')}</p>`}</article>`;
|
| 114 |
};
|
| 115 |
$('#shortlist-results').innerHTML=`<p class="candidate-legend">R<sub>S</sub>: unit-area MOSFET on-resistance · R<sub>C</sub>: main-capacitor ESR · R<sub>L</sub>: winding resistance. Device multipliers follow each topology’s die allocation; clamp ESR is zero in the clamp-cell model. Gate-control annotations are omitted from these previews.</p><div class="candidate-grid">${t.eligible.map(candidatePanel).join('')||'<p class="no-candidates">No candidate satisfies all currently modeled screens.</p>'}</div><details class="excluded-list"><summary>Cancellation-point candidates failing constraints (${t.rows.length-t.eligible.length})</summary><div class="candidate-grid">${t.rows.filter(r=>r.status==='excluded').map(candidatePanel).join('')}</div>${t.rows.filter(r=>r.status==='unmodeled').map(candidatePanel).join('')}</details>`;
|
| 116 |
-
$$('[data-inspect-design]').forEach(b=>b.onclick=()=>inspectRecommendation(b.dataset.inspectDesign));
|
| 117 |
}catch(e){recommendationReport=null;$('#design-error').textContent=e.message;$('#candidate-status').textContent='Check the design inputs to calculate the candidates.';$('#shortlist-results').innerHTML=''}}
|
| 118 |
$('#design-fields').addEventListener('input',()=>{updateLoadSummary();$('#design-error').textContent='Inputs changed — update the recommendation.';$('#recommend-design').textContent='Update candidates';$('#export-recommendation').disabled=true;$$('[data-inspect-design]').forEach(b=>b.disabled=true)});$('#recommend-design').onclick=renderRecommendation;$('#export-recommendation').onclick=()=>{if(recommendationReport)download('thinkpower-design-shortlist.json',JSON.stringify(recommendationReport,null,2),'application/json')};
|
| 119 |
let resizeTimer;window.addEventListener('resize',()=>{clearTimeout(resizeTimer);resizeTimer=setTimeout(()=>{if($('#sweep-section').open)drawSweep()},200)});
|
|
|
|
| 65 |
}
|
| 66 |
function drawSweep(){if(!report)return;chart('rout-chart',report.curves,{xlabel:'Nominal Vout / Vin',ylabel:'Req / Rs (p.u.)',logy:true,xrange:[0,.5],yrange:[Math.max(.001,Math.min(...report.curves.flatMap(s=>s.points.map(p=>p[1])))*.8),50],marker:report.M});$('#legend').innerHTML=report.curves.map(s=>`<span><i style="background:${s.color}"></i>${s.name}</span>`).join('')}
|
| 67 |
$('#sweep-section').addEventListener('toggle',()=>{if($('#sweep-section').open)drawSweep()});
|
| 68 |
+
$$('[data-ratio]').forEach(b=>b.onclick=()=>{ratio=Number(b.dataset.ratio);updateLoadSummary();selected=new Set(ThinkPowerRecommendation.familyIds(ratio));$$('[data-ratio]').forEach(v=>v.classList.toggle('active',v===b));picker();update()});
|
| 69 |
$('#apply-weights').onclick=update;$('#reset').onclick=()=>{for(const [k,v] of Object.entries({rho_c:1,rho_l:1,rho_q:20}))$('#'+k).value=v;$('#toast').hidden=true;clearTimeout(timer);update()};
|
| 70 |
$('#export-csv').onclick=()=>{if(!report)return;const rows=[['Topology','Target_ratio','kFET_Rs','kCAP_Rc','kIND_Rl','kSSL_over_Cf_fs','RFET_pu','RCAP_pu','RIND_pu','RSSL_pu','Req_pu','RFSL_pu','RSSL_add_pu','Switching_loss_scope','rho_C','rho_L','rho_Q','Model_domain'],...report.rows.map(r=>[r.short,ratio,...(r.valid?r.coefficients:['','','','']),...['fet','cap','ind','ssl','total','fsl','ssl_series'].map(k=>r.valid?r[k]:''),'Separate technology example; Coss requires energy data',report.normalization.rho_c,report.normalization.rho_l,report.normalization.rho_q,r.domain])];download('thinkpower-per-unit-comparison.csv',rows.map(r=>r.map(v=>'"'+String(v).replaceAll('"','""')+'"').join(',')).join('\n'),'text/csv')};
|
| 71 |
$('#open-upload').onclick=()=>$('#upload-dialog').showModal();$('#close-upload').onclick=()=>$('#upload-dialog').close();
|
|
|
|
| 76 |
if(d.state_table){const area=document.createElement('textarea');area.rows=9;area.value=JSON.stringify(d.state_table,null,2);const button=document.createElement('button'),result=document.createElement('pre');button.textContent='Evaluate reviewed FSL state table';button.onclick=async()=>{try{const r=await api('/api/state-model-pu',JSON.parse(area.value));result.textContent=JSON.stringify(r,null,2)}catch(e){result.textContent=e.message}};$('#interpretation').append(area,button,result)}
|
| 77 |
$('#upload-status').textContent=d.configured?'Review required before using the reference equations.':'No inference token: image recognition has not been performed.';
|
| 78 |
}catch(e){$('#upload-status').textContent=e.message}finally{$('#api-key').value='';b.disabled=false}};
|
| 79 |
+
const techFields=[['fs_mhz','fs (MHz)',10],['vgs','VGS (V)',3.3],['width_mm','Total FET width (mm)',360],['cap_uf','Flying + clamp budget (μF)',4],['rc_mohm','Main-cap ESR (mΩ)',20],['rl_mohm','Winding ESR (mΩ)',38],['events','Gate charges / period',1],['eoss_pj','Effective Eoss (pJ/mm/cycle)','']];
|
| 80 |
$('#tech-settings').innerHTML=techFields.map(([k,label,v])=>`<label>${label}<input id="tech-${k}" type="number" value="${v}" min="0" step="any" placeholder="unknown"></label>`).join('');
|
| 81 |
let technologyReport;
|
| 82 |
+
function renderTechnology(){if(!report)return;try{const p=Object.fromEntries(techFields.filter(([k])=>k!=='eoss_pj'||$('#tech-'+k).value.trim()!=='').map(([k])=>[k,Number($('#tech-'+k).value)]));const point=ThinkPowerRecommendation.operatingPoint(designParameters());p.vin=point.parameters.vin;p.io=point.output_current;technologyReport=ThinkPowerTechnology.example(report.rows,p);const t=technologyReport,unit=(v,scale=1)=>v==null?'unknown':!Number.isFinite(v)?'∞':fmt(v*scale);
|
| 83 |
$('#technology-status').textContent=`Rs = ${fmt(t.rs*1e3)} mΩ · RΣ = ${fmt(t.parallel*1e3)} mΩ · gate demand = ${fmt(t.gate_power*1e3)} mW · physical example is separate from the per-unit weights above`;
|
| 84 |
$('#technology-results').innerHTML=`<table><caption>Fixed-width example: flat-current buck models; exact linear periodic RC for SP-SC. Not measured efficiency.</caption><thead><tr><th>Topology</th><th>CF each (μF)</th><th>RFET (mΩ)</th><th>RCAP (mΩ)</th><th>RIND (mΩ)</th><th>RHC,add (mΩ)</th><th>Req (mΩ)</th><th>Rg at Vx (Ω)</th><th>Ross at Vx (Ω)</th><th>Iout²Req + Pg + known Poss (mW)</th></tr></thead><tbody>${t.rows.map(r=>r.valid?`<tr><th>${esc(report.rows.find(a=>a.id===r.id).short)}</th><td>${r.cf?unit(r.cf,1e6):'—'}</td>${['fet','cap','ind','hc','req'].map(k=>`<td>${unit(r[k],1e3)}</td>`).join('')}<td>${unit(r.gate_r)}</td><td>${unit(r.oss_r)}</td><td>${unit(r.partial_loss,1e3)}${r.poss===null?' + unknown Coss':''}</td></tr>`:`<tr><th>${esc(r.id)}</th><td colspan="9">Outside the supported analytical model</td></tr>`).join('')}</tbody></table>`;
|
| 85 |
}catch(e){technologyReport=null;$('#technology-status').textContent=e.message;$('#technology-results').innerHTML=''}}
|
| 86 |
$('#apply-technology').onclick=renderTechnology;$('#export-technology').onclick=()=>{if(technologyReport)download('thinkpower-180nm-example.json',JSON.stringify({...technologyReport,source:'User-supplied XFLY_Power_Analysis.md; not independently verified foundry data',method:'Paper FSL/SSL interpolation; separate gate demand; Qoss does not establish Eoss'},(k,v)=>typeof v==='number'&&!Number.isFinite(v)?String(v):v,2),'application/json')};
|
| 87 |
(function rcChart(){const w=600,h=210,x=a=>45+(Math.log10(a)+2)/4*530,y=v=>175-(Math.log10(v)+.3)/3*155,points=fn=>Array.from({length:161},(_,i)=>{const a=10**(-2+i/40);return `${x(a)},${y(fn(a))}`}).join(' ');$('#rc-limit-chart').innerHTML=`<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="Finite RC event resistance and its SSL and FSL limits on log axes"><defs><clipPath id="rc-plot-clip"><rect x="45" y="15" width="530" height="160"/></clipPath></defs><rect width="600" height="210" fill="white"/><path d="M45 15V175H575" fill="none" stroke="#a6b6aa"/><g clip-path="url(#rc-plot-clip)"><polyline points="${points(a=>1/Math.tanh(a/2))}" fill="none" stroke="#157e70" stroke-width="2"/><polyline points="${points(a=>2/a)}" fill="none" stroke="#5c70b8" stroke-dasharray="5 4"/><polyline points="${points(()=>1)}" fill="none" stroke="#cf7b30" stroke-dasharray="5 4"/></g><g font-family="Arial" font-size="10" fill="#526b5e"><text x="65" y="18">Revent / RSSL · log axis</text><text x="340" y="18">green: finite RC · blue: FSL · orange: SSL</text>${[.01,.1,1,10,100].map(a=>`<text x="${x(a)}" y="190" text-anchor="middle">${a}</text>`).join('')}${[1,10,100].map(v=>`<text x="36" y="${y(v)+3}" text-anchor="end">${v}</text>`).join('')}<text x="310" y="207" text-anchor="middle">d / (fs Rpath C) · log axis</text></g></svg>`})();
|
| 88 |
const designFields=[
|
| 89 |
+
['vout','Output voltage (V)',.825],['pout_w','Output power (W)',1.65],['fs_mhz','Frequency (MHz)',10],
|
| 90 |
['budget_mode','Silicon budget','area','select',[['area','Die area + Ron × area'],['width','Total FET width']]],
|
| 91 |
['die_mm2','Total die area (mm²)',1],['utilization','Usable transistor fraction',.5],['ron_area_mohm_mm2','Ron × area (mΩ·mm²)',1],['width_mm','Maximum FET width (mm)',360],
|
| 92 |
['cap_uf','Flying / clamp budget (μF)',4],['max_caps','Maximum flying / clamp caps',4],['max_windings','Maximum power windings',2],['rc_mohm','Main-cap ESR (mΩ)',20],['rl_mohm','DCR per winding (mΩ)',38],['lk_nh','Leakage Lk per winding (nH)',50],['lm_uh','Magnetizing Lm (μH)',1],['max_phase_ripple_percent','Max phase ripple pp (% avg)',5],['max_drop_percent','Maximum estimated droop (%)',10],
|
| 93 |
['objective','Priority','loss','select',[['loss','Lowest modeled loss'],['capacitors','Fewest capacitors, then loss'],['magnetics','Fewest power windings, then loss']]]
|
| 94 |
];
|
| 95 |
$('#design-fields').innerHTML=designFields.map(([k,label,value,type,options])=>`<label data-design-field="${k}">${label}${type==='select'?`<select id="design-${k}">${options.map(([v,t])=>`<option value="${v}" ${value===v?'selected':''}>${t}</option>`).join('')}</select>`:`<input id="design-${k}" type="number" value="${value}" min="0" step="any">`}</label>`).join('');
|
| 96 |
+
const loadBudgetField=$('[data-design-field="budget_mode"]');$('#design-fields').insertBefore($('#load-summary'),loadBudgetField);
|
| 97 |
let recommendationReport;
|
| 98 |
+
function designParameters(){return {ratio,voltage_mode:'output_ratio',load_mode:'power',...Object.fromEntries(designFields.map(([k,label,v,type])=>[k,type==='select'?$('#design-'+k).value:Number($('#design-'+k).value)]))}}
|
| 99 |
function showBudgetFields(){const mode=$('#design-budget_mode').value;for(const k of ['die_mm2','utilization','ron_area_mohm_mm2'])$(`[data-design-field="${k}"]`).hidden=mode!=='area';$('[data-design-field="width_mm"]').hidden=mode!=='width'}
|
| 100 |
showBudgetFields();$('#design-budget_mode').onchange=showBudgetFields;
|
| 101 |
+
function updateLoadSummary(){try{const op=ThinkPowerRecommendation.operatingPoint(designParameters());$('#load-summary').innerHTML=`<div><span>Calculated load resistance R<sub>load</sub></span><strong>${fmt(op.load_resistance,4)} Ω</strong></div><div><span>Calculated output current</span><strong>${fmt(op.output_current)} A</strong></div><p>Derived input voltage: ${ratio} × ${fmt(op.requested_vout)} V = <b>${fmt(op.parameters.vin)} V</b>. Output voltage and power stay fixed when the ratio changes.</p>`}catch(e){$('#load-summary').textContent=e.message}}updateLoadSummary();
|
| 102 |
+
|
|
|
|
| 103 |
|
| 104 |
function inspectRecommendation(id){const r=recommendationReport?.rows.find(r=>r.id===id);if(!r||r.status!=='eligible')return;selected=new Set([id]);const p=recommendationReport.parameters;$('#rho_c').value=(p.rc_mohm/1000/r.rs).toPrecision(8);$('#rho_l').value=(p.rl_mohm/1000/r.rs).toPrecision(8);$('#rho_q').value=r.cf?(1/(r.cf*p.fs_mhz*1e6*r.rs)).toPrecision(8):0;$('#analysis-workbench').open=true;$('#inspection-context').textContent=`${r.short}: ${fmt(r.width_mm)} mm total FET width, Rs = ${fmt(r.rs*1e3)} mΩ, modeled loss = ${fmt(r.loss*1e3)} mW. Reference die-map proportions are scaled to this width; A₀ = ${fmt(r.width_mm/12)} mm of width. The shortlist uses the common full-budget RS base; these diagrams use the actual sized-device Rs. The device example below is a separate reference calculation.`;picker();update();$('#analysis-workbench').scrollIntoView({behavior:'smooth',block:'start'})}
|
| 105 |
function renderRecommendation(){if(!catalog.length)return;try{recommendationReport=ThinkPowerRecommendation.recommend(designParameters(),{catalog},ThinkPowerEngine,ThinkPowerTechnology);$('#design-error').textContent='';$('#recommend-design').textContent='Update candidates';$('#export-recommendation').disabled=false;const t=recommendationReport,p=t.parameters,native=t.native_models;
|
|
|
|
| 112 |
return `<article class="candidate-panel ${eligible?'':'candidate-excluded'}" data-candidate="${r.id}" data-candidate-status="${r.status}"><div class="candidate-heading"><span class="candidate-rank">${eligible?'#'+r.rank:'Not eligible'}</span><span class="candidate-family">${r.native_ratio}:1 cancellation point</span></div><h3>${esc(r.name)}</h3><div class="candidate-drawing"><img src="./assets/${image}" alt="${esc(r.name)} schematic with Rs, Rc and Rl resistance labels; gate-control annotations omitted" loading="lazy"></div>${eligible?`<div class="candidate-metrics"><div><strong>${fmt(r.loss*1e3,1)} mW</strong><span>Modeled loss</span></div><div><strong>${fmt(r.rout*1e3,2)} mΩ</strong><span>Converter Rout · ${fmt(r.req_pu)} p.u.</span></div></div><p class="candidate-resistances">R<sub>load</sub> = ${fmt(t.load_resistance,4)} Ω · R<sub>out</sub>/R<sub>load</sub> = ${fmt(r.rout_over_rload*100,2)}%<br>R<sub>S</sub> = ${fmt(r.rs*1e3,2)} mΩ${r.capacitors?' · R<sub>C</sub> = '+fmt(p.rc_mohm,1)+' mΩ':''}${r.windings?' · R<sub>L</sub> = '+fmt(p.rl_mohm,1)+' mΩ/winding':''}</p><p class="candidate-resources">${r.capacitors} flying/clamp caps · ${r.windings} windings<br>${fmt(r.width_mm,1)} mm FET width · ${fmt(r.drop_percent,1)}% nominal droop<br><b>${fmt(r.phase_ripple_percent,2)}% phase ripple pp</b> · ${fmt(r.phase_ripple_pp*1e3,1)} mA · ${fmt(r.effective_frequency/1e6,1)} MHz effective excitation</p><button data-inspect-design="${r.id}">Inspect circuit and die allocation →</button>`:`<p class="candidate-reason">${r.reasons.map(esc).join('; ')}</p>`}</article>`;
|
| 113 |
};
|
| 114 |
$('#shortlist-results').innerHTML=`<p class="candidate-legend">R<sub>S</sub>: unit-area MOSFET on-resistance · R<sub>C</sub>: main-capacitor ESR · R<sub>L</sub>: winding resistance. Device multipliers follow each topology’s die allocation; clamp ESR is zero in the clamp-cell model. Gate-control annotations are omitted from these previews.</p><div class="candidate-grid">${t.eligible.map(candidatePanel).join('')||'<p class="no-candidates">No candidate satisfies all currently modeled screens.</p>'}</div><details class="excluded-list"><summary>Cancellation-point candidates failing constraints (${t.rows.length-t.eligible.length})</summary><div class="candidate-grid">${t.rows.filter(r=>r.status==='excluded').map(candidatePanel).join('')}</div>${t.rows.filter(r=>r.status==='unmodeled').map(candidatePanel).join('')}</details>`;
|
| 115 |
+
$$('[data-inspect-design]').forEach(b=>b.onclick=()=>inspectRecommendation(b.dataset.inspectDesign));renderTechnology();
|
| 116 |
}catch(e){recommendationReport=null;$('#design-error').textContent=e.message;$('#candidate-status').textContent='Check the design inputs to calculate the candidates.';$('#shortlist-results').innerHTML=''}}
|
| 117 |
$('#design-fields').addEventListener('input',()=>{updateLoadSummary();$('#design-error').textContent='Inputs changed — update the recommendation.';$('#recommend-design').textContent='Update candidates';$('#export-recommendation').disabled=true;$$('[data-inspect-design]').forEach(b=>b.disabled=true)});$('#recommend-design').onclick=renderRecommendation;$('#export-recommendation').onclick=()=>{if(recommendationReport)download('thinkpower-design-shortlist.json',JSON.stringify(recommendationReport,null,2),'application/json')};
|
| 118 |
let resizeTimer;window.addEventListener('resize',()=>{clearTimeout(resizeTimer);resizeTimer=setTimeout(()=>{if($('#sweep-section').open)drawSweep()},200)});
|
static/index.html
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Power converter topologies and their ideal conversion ratio plus effective output resistance."><title>ThinkPower — Choose Your Converter</title><link rel="stylesheet" href="./style.css"></head><body>
|
| 3 |
<header><a class="brand" href="./index.html"><span>╳</span>ThinkPower</a><div>Constraints → topology recommendation</div><a href="https://huggingface.co/spaces/minjiechen/XFLY" target="_blank" rel="noopener">NGSpice ↗</a></header>
|
| 4 |
<main><div class="intro"><div><h1>Compare converter candidates for your design.</h1><p>Choose a conversion ratio and compare coupled-inductor cells at their nominal ripple-cancellation points.</p></div><button id="open-upload">+ Upload topology</button></div>
|
| 5 |
-
<section class="family-navigation" aria-label="Conversion ratio families"><div class="ratio-control"><label>1 · Target conversion ratio</label><div id="ratios"><button data-ratio="2"><strong>2:1</strong><small>Coupled buck cells</small></button><button data-ratio="4" class="active"><strong>4:1</strong><small>Coupled hybrid cells</small></button><button data-ratio="6"><strong>6:1</strong><small>Model pending</small></button><button data-ratio="8"><strong>8:1</strong><small>Model pending</small></button><button data-ratio="16"><strong>16:1</strong><small>Model pending</small></button></div></div></section><p id="family-context" class="family-context"></p><section class="design-workspace"><div class="design-inputs"><div class="section-kicker">2 · DESIGN CONSTRAINTS</div><h2>Your available resources</h2><div class="design-fields" id="design-fields"></div><div id="load-summary" class="load-summary" aria-live="polite"></div><
|
| 6 |
-
<details class="secondary-panel" id="technology-panel"><summary>
|
| 7 |
<div id="topology-picker" class="picker" aria-label="Topologies to compare"></div><div id="status" role="status" class="status">Loading topology models…</div>
|
| 8 |
<div class="column-labels"><span>CONVERTER TOPOLOGY</span><span>AVERAGED DC EQUIVALENT CIRCUIT</span></div><section id="circuits" aria-label="Topology and equivalent circuit comparison"></section>
|
| 9 |
<details id="sweep-section" class="secondary-panel"><summary>Effective resistance versus conversion ratio</summary><div id="legend"></div><div id="rout-chart" class="chart"></div><p>The horizontal axis is the step-down ratio M = Vout/Vin. Only supported duty ranges are plotted.</p></details>
|
|
|
|
| 2 |
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Power converter topologies and their ideal conversion ratio plus effective output resistance."><title>ThinkPower — Choose Your Converter</title><link rel="stylesheet" href="./style.css"></head><body>
|
| 3 |
<header><a class="brand" href="./index.html"><span>╳</span>ThinkPower</a><div>Constraints → topology recommendation</div><a href="https://huggingface.co/spaces/minjiechen/XFLY" target="_blank" rel="noopener">NGSpice ↗</a></header>
|
| 4 |
<main><div class="intro"><div><h1>Compare converter candidates for your design.</h1><p>Choose a conversion ratio and compare coupled-inductor cells at their nominal ripple-cancellation points.</p></div><button id="open-upload">+ Upload topology</button></div>
|
| 5 |
+
<section class="family-navigation" aria-label="Conversion ratio families"><div class="ratio-control"><label>1 · Target conversion ratio</label><div id="ratios"><button data-ratio="2"><strong>2:1</strong><small>Coupled buck cells</small></button><button data-ratio="4" class="active"><strong>4:1</strong><small>Coupled hybrid cells</small></button><button data-ratio="6"><strong>6:1</strong><small>Model pending</small></button><button data-ratio="8"><strong>8:1</strong><small>Model pending</small></button><button data-ratio="16"><strong>16:1</strong><small>Model pending</small></button></div></div></section><p id="family-context" class="family-context"></p><section class="design-workspace"><div class="design-inputs"><div class="section-kicker">2 · DESIGN CONSTRAINTS</div><h2>Your available resources</h2><div class="design-fields" id="design-fields"></div><div id="load-summary" class="load-summary" aria-live="polite"></div><p class="input-scope">Ron × area defaults to an illustrative 1 mΩ·mm², not a characterized TSMC layout value. Capacitor budget covers flying/clamp caps; winding limits count power windings. Driver area and Cin/Cout are outside these budgets. Lk = 50 nH and Lm = 1 μH are editable illustrative defaults, not characterized TSMC magnetics.</p><button id="recommend-design" class="primary">Update candidates</button><p id="design-error" role="status"></p></div><section id="shortlist-section" class="shortlist-section"><div class="shortlist-heading"><div><div class="section-kicker">3 · COMPARE ALL QUALIFYING CANDIDATES</div><h2>Topology candidates</h2></div><button id="export-recommendation">↓ Design JSON</button></div><p id="candidate-status" class="candidate-status" role="status"></p><div id="shortlist-results"></div><details class="selection-method"><summary>Ripple-cancellation criterion and recommendation scope</summary><p>Output voltage and output power are the operating-point inputs. The selected conversion ratio N:1 sets the nominal required input voltage Vin = N Vout. Current and load resistance are calculated: Iout = Pout/Vout and Rload = Vout²/Pout. Converter Rout is the modeled output-referred series resistance (RFET + RCAP + RIND + the non-double-counted charging increment), not the load resistance. Each panel shows Rout in mΩ as well as its per-unit value. Rout/Rload gives the nominal constant-current droop fraction when requested Vout = Vin/ratio. The specified load current is used in the loss model; this is not a solved resistive-load equilibrium. Only coupled-inductor cells with a verified nominal two-level excitation pattern at this ratio are listed. The admitted pattern has matched winding inputs at 50% effective duty and complementary phase timing. A two-phase buck reaches this at ideal 2:1; balanced half-input hybrid cells reach it at ideal 4:1. A four-pulse or three-level sequence must preserve the complementary winding-input pattern; arbitrary pulse permutations are not admitted by this estimate.</p><div class="equation">Lself = Lk + Lm; M = −Lm; LDM = Lk + 2Lm</div><div class="equation">Δiphase,pp ≈ Vstep / (4 feff LDM)</div><p>Vstep is Vin for buck cells and Vin/2 for the admitted hybrid cells. feff is fs for the two-command cells, and 2fs for the specified four-pulse / three-level excitation. Phase ripple percentage is Δiphase,pp divided by Iout/2. The symmetric common-mode switching excitation cancels ideally; individual phase ripple is finite and approaches zero only with sufficiently large differential-mode inductance. This is not a measured zero-ripple claim.</p><p>We screen the entered phase-ripple threshold, winding/capacitor counts, capacitance budget and estimated open-loop droop. Total FET width is searched under the silicon budget with each model’s relative allocation held fixed. Die-area mode uses RΣ = (Ron × area)/(usable transistor area); the 1 mΩ·mm² default is an illustrative editable layout assumption. Shortlist resistances share the full-budget RS base. Loss ranking remains the flat-current model plus gate drive; ripple-loss corrections and Coss energy are not inferred.</p><p>Ripple estimates assume equal winding turns, inverse polarity, balanced capacitor voltages, stiff ideal switching levels and matched timing. Capacitor ripple, imbalance, dead time, resistive voltage errors and control action can spoil cancellation. Vin is derived from the selected ideal cancellation ratio and requested output voltage. Changing ratio preserves both output voltage and power. Open-loop output under the specified current is predicted as Vin/ratio − Iout Rout, so matching the ideal target does not prove loaded regulation. Correcting loaded output voltage by duty adjustment can move away from the nominal cancellation point. Saturation, core loss and magnetic implementation need separate verification.</p><p>The current library establishes only the 2:1 and 4:1 cancellation-point families. The 6:1, 8:1 and 16:1 tabs remain empty until a higher-order switching and magnetic model is available. Off-duty buck comparisons and the nonmagnetic SC option are omitted. The stacked buck is grouped at its electrical 2:1 cancellation point while retaining its existing 4:1 loss-sizing allocation.</p><p>For coupled-inductor modal behavior, see <a href="https://www.analog.com/en/resources/analog-dialogue/articles/output-current-and-volt-ripple-in-multiphase-buck.html" target="_blank" rel="noopener">ADI’s phase- and output-ripple analysis</a>. The formulas above follow directly from the stated symmetric inductance matrix.</p></details></section></section><details id="analysis-workbench" class="analysis-workbench"><summary>Inspect schematics, die allocation, and loss derivations</summary><p id="inspection-context">Reference drawings use normalized resistances. Inspect a shortlisted design to load its loss weights.</p><div class="advanced-toolbar"><details class="weights"><summary>Per-unit loss weights</summary><div><label>R<sub>C</sub> / R<sub>S</sub><input id="rho_c" type="number" value="1" min="0" step="0.1"></label><label>R<sub>L</sub> / R<sub>S</sub><input id="rho_l" type="number" value="1" min="0" step="0.1"></label><label>1 / (C<sub>F</sub> f<sub>s</sub> R<sub>S</sub>)<input id="rho_q" type="number" value="20" min="0" step="1"></label><button id="apply-weights">Apply</button><button id="reset">Reset</button></div></details><button id="export-csv" class="plain">↓ CSV</button></div>
|
| 6 |
+
<details class="secondary-panel" id="technology-panel"><summary>180 nm device reference · uses the specified output voltage and power</summary><p>User-supplied device example from XFLY_Power_Analysis.md; not independently verified foundry data. FOM<sub>g</sub> = 1.51102 Ω·pC; FOM<sub>oss</sub> = 0.67424 Ω·pC. First-order width scaling; same device technology for all FETs. Device voltage rating and PVT limits require a PDK check.</p><div class="tech-settings" id="tech-settings"></div><p>Optional Eoss entry: dissipated Coss energy in pJ per 1 mm of total FET width per cycle, averaged over the actual device transitions after recovery. Leave blank when unknown. Qoss is not converted to Eoss.</p><button id="apply-technology">Update example</button> <button id="export-technology">↓ Technology JSON</button><p id="technology-status" role="status"></p><div class="technology-table" id="technology-results"></div><details><summary>Derivation and model scope</summary><p>RΣ is the resistance of all available FET width in parallel. With the existing twelve-unit area budget, RΣ = RS/12. A device assigned fraction α has width αWtot and on-resistance RΣ/α. FOMg = Ron·Qg and FOMoss = Ron·Qoss are width independent under the supplied scaling.</p><div class="equation">Pg = VGS fs ng FOMg / RΣ; Rg = Vx² RΣ / (VGS fs ng FOMg)</div><p>Vx = M Vin is the ideal secondary voltage, ahead of the series loss resistances. Both loss shunts use Vx, rather than the loaded Vout. Gate power is a separate supply demand unless the driver is explicitly powered from the main input. The shunts are accounting equivalents; their current does not enter the conduction-loss calculations.</p><div class="equation">Poss = fs Σ νi Eoss,diss,i; Ross = Vx² / Poss</div><p>ng is the width-weighted number of gate-charge events per period, assumed uniform in this example. Actual four-pulse sequences require event counts for each physical device. No exact Eoss follows from FOMoss alone: Q(V), Eoss(V), switching swings, and recovery are needed. The optional aggregate Eoss input must already include these effects.</p><p>The numerical table uses matched flat winding currents for inductive converters. The added SP-SC uses an exact linear periodic RC model, with no power winding. Width allocations remain fixed at each topology’s reference ratio (2:1 for the added cells; 4:1 for the paper cells). These allocations are not automatically reoptimized at another sizing duty. The 4 μF budget covers flying and clamp capacitors only; Cin and Cout are excluded. Adopted allocation: equal main capacitors for two-capacitor cells; equal main and clamp capacitances in four-capacitor cells, consistent with the existing 2SBUCK model. This is a disclosed comparison assumption, not a capacitor-allocation optimum. Additional XFLY4P clamp recharge is not derived. Turn-on/off overlap, dead time, core loss, interconnects and ripple corrections remain outside these estimates.</p><p>RFET, RCAP and RIND use the existing closed-form duty expressions below. The charging increment uses the paper's asymptotic interpolation for the paper cells. The added SP-SC has its own exact linear periodic RC model. Unknown Coss loss is excluded from the displayed partial loss, so no total efficiency is claimed.</p></details><details><summary>Finite-RC charge-event check</summary><p>For a single linear RC charging event lasting d/fs, let q = a Iout/fs be the required transferred charge. Integrating i²R for an exponential current and eliminating its initial amplitude gives:</p><div class="equation">Revent = a²/[2 C fs] coth[d/(2 fs Rpath C)]</div><div class="equation">RSSL = a²/(2 C fs); RFSL = a² Rpath/d</div><p>Here C is the effective capacitance seen by that event. The exact result approaches both limits; they must not be added to another RMS model of the same event. It assumes a fixed linear path, settled initial conditions specified by the event, and a driving step chosen to transfer q. Each converter needs its own event capacitance, duration, charge multiplier, and periodic initial conditions before this expression can replace the existing interpolation.</p><div id="rc-limit-chart"></div></details></details>
|
| 7 |
<div id="topology-picker" class="picker" aria-label="Topologies to compare"></div><div id="status" role="status" class="status">Loading topology models…</div>
|
| 8 |
<div class="column-labels"><span>CONVERTER TOPOLOGY</span><span>AVERAGED DC EQUIVALENT CIRCUIT</span></div><section id="circuits" aria-label="Topology and equivalent circuit comparison"></section>
|
| 9 |
<details id="sweep-section" class="secondary-panel"><summary>Effective resistance versus conversion ratio</summary><div id="legend"></div><div id="rout-chart" class="chart"></div><p>The horizontal axis is the step-down ratio M = Vout/Vin. Only supported duty ranges are plotted.</p></details>
|
static/recommend.js
CHANGED
|
@@ -4,8 +4,8 @@ const specs=Object.freeze({buck2:{ratio:2,caps:0,windings:2,magnetics:'inverse-c
|
|
| 4 |
const excitation=Object.freeze({buck2:{level:1,pulses:1},buck:{level:1,pulses:1},xfly2p:{level:.5,pulses:1},xfly4p:{level:.5,pulses:2},'3lbuck':{level:.5,pulses:2},'2sbuck':{level:.5,pulses:1}});
|
| 5 |
function familyIds(ratio){return Object.keys(excitation).filter(id=>specs[id].ratio===ratio)}
|
| 6 |
function ripplePoint(id,p){const e=excitation[id],ldm=p.lk_nh*1e-9+2*p.lm_uh*1e-6,pp=p.vin*e.level/(4*p.fs_mhz*1e6*e.pulses*ldm);return {phase_ripple_pp:pp,phase_ripple_percent:100*pp/(p.io/2),effective_duty:.5,effective_frequency:p.fs_mhz*1e6*e.pulses,ldm,condition:'Balanced 0/Vstep winding inputs, complementary 50% effective duty, matched inverse coupling; first-order phase-current ripple, not measured zero ripple.'}}
|
| 7 |
-
const defaults={ratio:4,vin:3.3,vout:null,load_mode:'current',io:2,pout_w:1.65,fs_mhz:10,vgs:3.3,budget_mode:'area',width_mm:360,die_mm2:1,utilization:.5,ron_area_mohm_mm2:1,cap_uf:4,max_caps:4,max_windings:2,rc_mohm:20,rl_mohm:38,max_drop_percent:10,lk_nh:50,lm_uh:1,max_phase_ripple_percent:5,objective:'loss'};
|
| 8 |
-
function operatingPoint(input){const p={...defaults,...input};if(p.vout==null)p.vout=p.vin/p.ratio;for(const k of ['vin','vout','ratio'])if(!Number.isFinite(p[k])||p[k]<=0)throw Error(k+' must be positive');if(!['current','power'].includes(p.load_mode))throw Error('Choose current or power as the output-load input');if(p.load_mode==='power'){if(!Number.isFinite(p.pout_w)||p.pout_w<=0)throw Error('Output load power must be positive');p.io=p.pout_w/p.vout}if(!Number.isFinite(p.io)||p.io<=0)throw Error('Output load current must be positive');p.pout_w=p.vout*p.io;const nominal=p.vin/p.ratio;return {parameters:p,requested_vout:p.vout,output_current:p.io,output_power:p.pout_w,load_resistance:p.vout/p.io,nominal_vout:nominal,requested_ratio:p.vin/p.vout,voltage_ratio_match:Math.abs(p.vout-nominal)<=1e-6*Math.max(p.vout,nominal)}}
|
| 9 |
function recommend(input,data,engine,technology){const op=operatingPoint(input),p=op.parameters;for(const k of ['ratio','vin','io','fs_mhz','vgs','width_mm','die_mm2','lk_nh','lm_uh'])if(!Number.isFinite(p[k])||p[k]<=0)throw Error(k+' must be positive');for(const k of ['cap_uf','max_caps','max_windings','rc_mohm','rl_mohm','max_drop_percent','max_phase_ripple_percent'])if(!Number.isFinite(p[k])||p[k]<0)throw Error(k+' must be nonnegative');if(![2,4,6,8,16].includes(p.ratio))throw Error('Choose a supported ratio');if(!['width','area'].includes(p.budget_mode)||!['loss','capacitors','magnetics'].includes(p.objective))throw Error('Choose a budget mode and objective');if(!Number.isInteger(p.max_caps)||!Number.isInteger(p.max_windings))throw Error('Component limits must be integers');if(!Number.isFinite(p.utilization)||p.utilization<=0||p.utilization>1)throw Error('Usable die fraction must be in (0,1]');
|
| 10 |
const calibrated=p.budget_mode==='width'||Number.isFinite(p.ron_area_mohm_mm2)&&p.ron_area_mohm_mm2>0,Wmax=p.budget_mode==='width'?p.width_mm:calibrated?technology.reference.ron*p.die_mm2*p.utilization/(p.ron_area_mohm_mm2*1e-3):null,fs=p.fs_mhz*1e6,m=1/p.ratio,vo=p.vin*m;
|
| 11 |
if(calibrated&&(!Number.isFinite(Wmax)||Wmax<=0))throw Error('Invalid area/width budget');
|
|
|
|
| 4 |
const excitation=Object.freeze({buck2:{level:1,pulses:1},buck:{level:1,pulses:1},xfly2p:{level:.5,pulses:1},xfly4p:{level:.5,pulses:2},'3lbuck':{level:.5,pulses:2},'2sbuck':{level:.5,pulses:1}});
|
| 5 |
function familyIds(ratio){return Object.keys(excitation).filter(id=>specs[id].ratio===ratio)}
|
| 6 |
function ripplePoint(id,p){const e=excitation[id],ldm=p.lk_nh*1e-9+2*p.lm_uh*1e-6,pp=p.vin*e.level/(4*p.fs_mhz*1e6*e.pulses*ldm);return {phase_ripple_pp:pp,phase_ripple_percent:100*pp/(p.io/2),effective_duty:.5,effective_frequency:p.fs_mhz*1e6*e.pulses,ldm,condition:'Balanced 0/Vstep winding inputs, complementary 50% effective duty, matched inverse coupling; first-order phase-current ripple, not measured zero ripple.'}}
|
| 7 |
+
const defaults={ratio:4,vin:3.3,vout:null,voltage_mode:'input_output',load_mode:'current',io:2,pout_w:1.65,fs_mhz:10,vgs:3.3,budget_mode:'area',width_mm:360,die_mm2:1,utilization:.5,ron_area_mohm_mm2:1,cap_uf:4,max_caps:4,max_windings:2,rc_mohm:20,rl_mohm:38,max_drop_percent:10,lk_nh:50,lm_uh:1,max_phase_ripple_percent:5,objective:'loss'};
|
| 8 |
+
function operatingPoint(input){const p={...defaults,...input};if(!['input_output','output_ratio'].includes(p.voltage_mode))throw Error('Choose a valid voltage-input mode');if(p.vout==null)p.vout=p.vin/p.ratio;if(p.voltage_mode==='output_ratio')p.vin=p.ratio*p.vout;for(const k of ['vin','vout','ratio'])if(!Number.isFinite(p[k])||p[k]<=0)throw Error(k+' must be positive');if(!['current','power'].includes(p.load_mode))throw Error('Choose current or power as the output-load input');if(p.load_mode==='power'){if(!Number.isFinite(p.pout_w)||p.pout_w<=0)throw Error('Output load power must be positive');p.io=p.pout_w/p.vout}if(!Number.isFinite(p.io)||p.io<=0)throw Error('Output load current must be positive');p.pout_w=p.vout*p.io;const nominal=p.vin/p.ratio;return {parameters:p,requested_vout:p.vout,output_current:p.io,output_power:p.pout_w,load_resistance:p.vout/p.io,nominal_vout:nominal,requested_ratio:p.vin/p.vout,voltage_ratio_match:Math.abs(p.vout-nominal)<=1e-6*Math.max(p.vout,nominal)}}
|
| 9 |
function recommend(input,data,engine,technology){const op=operatingPoint(input),p=op.parameters;for(const k of ['ratio','vin','io','fs_mhz','vgs','width_mm','die_mm2','lk_nh','lm_uh'])if(!Number.isFinite(p[k])||p[k]<=0)throw Error(k+' must be positive');for(const k of ['cap_uf','max_caps','max_windings','rc_mohm','rl_mohm','max_drop_percent','max_phase_ripple_percent'])if(!Number.isFinite(p[k])||p[k]<0)throw Error(k+' must be nonnegative');if(![2,4,6,8,16].includes(p.ratio))throw Error('Choose a supported ratio');if(!['width','area'].includes(p.budget_mode)||!['loss','capacitors','magnetics'].includes(p.objective))throw Error('Choose a budget mode and objective');if(!Number.isInteger(p.max_caps)||!Number.isInteger(p.max_windings))throw Error('Component limits must be integers');if(!Number.isFinite(p.utilization)||p.utilization<=0||p.utilization>1)throw Error('Usable die fraction must be in (0,1]');
|
| 10 |
const calibrated=p.budget_mode==='width'||Number.isFinite(p.ron_area_mohm_mm2)&&p.ron_area_mohm_mm2>0,Wmax=p.budget_mode==='width'?p.width_mm:calibrated?technology.reference.ron*p.die_mm2*p.utilization/(p.ron_area_mohm_mm2*1e-3):null,fs=p.fs_mhz*1e6,m=1/p.ratio,vo=p.vin*m;
|
| 11 |
if(calibrated&&(!Number.isFinite(Wmax)||Wmax<=0))throw Error('Invalid area/width budget');
|
test_recommendation.py
CHANGED
|
@@ -85,6 +85,15 @@ class RecommendationTest(unittest.TestCase):
|
|
| 85 |
self.assertAlmostEqual(mismatch['load_resistance'],.4)
|
| 86 |
for row in mismatch['rows']:self.assertTrue(any('Requested Vout' in reason for reason in row['reasons']))
|
| 87 |
for p in [dict(vout=0),dict(vout=-1),dict(load_mode='power',pout_w=0),dict(load_mode='unknown')]:self.assertIn('error',run(p))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
def test_missing_calibration_and_invalid_inputs(self):
|
| 89 |
r=run(dict(ron_area_mohm_mm2=0));self.assertFalse(r['calibrated']);self.assertIsNone(r['winner'])
|
| 90 |
for p in [dict(io=-1),dict(utilization=2),dict(max_caps=1.5),dict(objective='anything'),dict(cap_uf=-1)]:self.assertIn('error',run(p))
|
|
|
|
| 85 |
self.assertAlmostEqual(mismatch['load_resistance'],.4)
|
| 86 |
for row in mismatch['rows']:self.assertTrue(any('Requested Vout' in reason for reason in row['reasons']))
|
| 87 |
for p in [dict(vout=0),dict(vout=-1),dict(load_mode='power',pout_w=0),dict(load_mode='unknown')]:self.assertIn('error',run(p))
|
| 88 |
+
def test_output_only_operating_point(self):
|
| 89 |
+
for ratio in [2,4,6,8,16]:
|
| 90 |
+
r=run(dict(voltage_mode='output_ratio',load_mode='power',vout=.8,pout_w=1.6,ratio=ratio,vin=999))
|
| 91 |
+
self.assertAlmostEqual(r['parameters']['vin'],ratio*.8)
|
| 92 |
+
self.assertAlmostEqual(r['requested_vout'],.8)
|
| 93 |
+
self.assertAlmostEqual(r['output_current'],2)
|
| 94 |
+
self.assertAlmostEqual(r['output_power'],1.6)
|
| 95 |
+
self.assertAlmostEqual(r['load_resistance'],.4)
|
| 96 |
+
self.assertTrue(r['voltage_ratio_match'])
|
| 97 |
def test_missing_calibration_and_invalid_inputs(self):
|
| 98 |
r=run(dict(ron_area_mohm_mm2=0));self.assertFalse(r['calibrated']);self.assertIsNone(r['winner'])
|
| 99 |
for p in [dict(io=-1),dict(utilization=2),dict(max_caps=1.5),dict(objective='anything'),dict(cap_uf=-1)]:self.assertIn('error',run(p))
|