r.status==="CCM");
info.textContent=`${points.length} of ${count} points inside the loaded positive-current CCM range. Device widths remain fixed.`;
$("#si-export-sweep").disabled=false;
const curves=[];
let line;
for (const row of siSweepRows) {
if (row.status!=="CCM"){line=null;continue;}
if (!line) {
line={name:"Analytical loaded output",color:"#436864",points:[]};
curves.push(line);
}
line.points.push([row.value,row.analytical_v]);
}
if(curves.length)chart("si-voltage-chart",curves,{xlabel:axes[axis].label,
ylabel:"Loaded output (V)",cursorLabel:axes[axis].label});
}
$("#si-sweep-axis").onchange=()=>{setSISweepDefaults();drawSIOperatingSweep()};
$("#si-run-sweep").onclick=drawSIOperatingSweep;
$("#si-export-sweep").onclick=()=>{
const columns=["value","target_v","duty","ideal_v","analytical_v","loaded_gain","req_ohm","efficiency","status","vin_v","load_a","frequency_hz"];
if(isStacked()) columns.push("efficiency_includes_coss");
const csv=[columns.join(","),...siSweepRows.map(row=>columns.map(k=>JSON.stringify(row[k]??"")).join(","))];
download(isStacked()?"openpels-buck-stacked-operating-sweep.csv":"openpels-si-operating-sweep.csv",csv.join("\n"),"text/csv");
};
$('#sweep-section').addEventListener('toggle',()=>{if($('#sweep-section').open){drawSweep();drawSIOperatingSweep()}});
$$('[data-ratio]').forEach(b=>b.onclick=()=>{ratio=Number(b.dataset.ratio);updateLoadSummary();selected=new Set(OpenPELSRecommendation.familyIds(ratio));$$('[data-ratio]').forEach(v=>v.classList.toggle('active',v===b));picker();update()});
$('#apply-weights').onclick=()=>update(true);$('#reset').onclick=()=>{for(const [k,v] of Object.entries({rho_c:1,rho_l:1,rho_q:20,rho_t:.61,si_coupling:.6,si_ripple:.75}))$('#'+k).value=v;$('#toast').hidden=true;clearTimeout(timer);update(true)};
const sp2LossColumns=[
['SP2_RFET_fsl_pu','fsl_fet'],['SP2_RCAP_fsl_pu','fsl_cap'],
['SP2_R_finite_rc_increment_pu','finite_rc_increment'],
['SP2_RFET_finite_rc_pu','rms_fet'],['SP2_RCAP_finite_rc_pu','rms_cap'],
];
function quoteCSV(rows){
return rows.map(row=>row.map(v=>'"'+String(v??'').replaceAll('"','""')+'"').join(',')).join('\n');
}
$('#export-csv').onclick=()=>{
if(!report)return;
const hasTank=report.rows.some(r=>r.id==='rsc2'),hasSI=report.rows.some(r=>isDutyBuck(r.id)),
hasSP2=report.rows.some(r=>r.id==='sp2');
const header=['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',...(hasTank?['rho_T']:[]),
...(hasSI?['Duty','Coupling','Vin_over_L_fs_Iout']:[]),
...(hasSP2?sp2LossColumns.map(([label])=>label):[])];
const rows=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]:''),
r.resonant?'Tank RMS partition in RFSL_pu; independent SSL and charging increment are inapplicable. Separate gate and optional Coss.':
r.id==='sp2'?'RFET_pu and RCAP_pu are FSL baselines. Physical finite-RC terms sum independently to Req. Separate gate and optional Coss.':
'Separate technology example; Coss requires energy data',
report.normalization.rho_c,report.normalization.rho_l,report.normalization.rho_q,r.domain,
...(hasTank?[r.id==='rsc2'?report.normalization.rho_t:'']:[]),
...(hasSI?isDutyBuck(r.id)?[report.normalization.si_duty,report.normalization.si_coupling,report.normalization.si_ripple]:['','','']:[]),
...(hasSP2?sp2LossColumns.map(([,key])=>r.sp2_loss?.[key]):[])]);
download('openpels-per-unit-comparison.csv',quoteCSV([header,...rows]),'text/csv');
};
$('#open-upload').onclick=()=>$('#upload-dialog').showModal();$('#close-upload').onclick=()=>$('#upload-dialog').close();
async function loadImage(file){if(!file)return;if(!['image/png','image/jpeg','image/webp'].includes(file.type)||file.size>8000000){toast('Choose a PNG, JPEG or WebP smaller than 8 MB.');return}imageData=await new Promise((resolve,reject)=>{const r=new FileReader();r.onload=()=>resolve(r.result);r.onerror=reject;r.readAsDataURL(file)});$('#image-preview').src=imageData;$('#image-preview').hidden=false;$('#inspect').disabled=false;$('#upload-status').textContent=file.name+' · ready for interpretation';$('#interpretation').hidden=true}
$('#image-upload').onchange=e=>loadImage(e.target.files[0]);$('#dropzone').ondragover=e=>{e.preventDefault();$('#dropzone').classList.add('drag')};$('#dropzone').ondragleave=()=>$('#dropzone').classList.remove('drag');$('#dropzone').ondrop=e=>{e.preventDefault();$('#dropzone').classList.remove('drag');loadImage(e.dataTransfer.files[0])};
$('#inspect').onclick=async()=>{const b=$('#inspect');b.disabled=true;$('#upload-status').textContent='Reading circuit connections…';try{const d=await api('/api/inspect',{image:imageData,api_key:$('#api-key').value,model:$('#vision-model').value,operating_notes:$('#operating-notes').value});$('#interpretation').hidden=false;const candidate=catalog.find(c=>c.id===d.candidate_id);$('#interpretation').innerHTML=`${esc(d.summary)}
Candidate: ${esc(candidate?.name||'not identified')}
${d.uncertainties.map(v=>''+esc(v)+' ').join('')} Review extracted connections and model conditions ${esc(JSON.stringify({components:d.components,gates:d.gates,magnetic_coupling:d.magnetic_coupling,model_conditions:d.model_conditions,derivation:d.derivation},null,2))} ${esc(candidate?.note||'An unfamiliar topology needs its own state and loss derivation.')}
${d.configured&&candidate?' I checked the connections, winding polarity where applicable, and gate sequence against this reference model.Show topology and equivalent circuit → ':''}`;
if($('#confirm-model')){$('#confirm-model').onchange=e=>$('#apply-model').disabled=!e.target.checked;$('#apply-model').onclick=()=>{if(!OpenPELSRecommendation.referenceFamilyIds(ratio).includes(d.candidate_id)){toast('This topology has no qualified reference model at the selected ratio.');return}selected.add(d.candidate_id);picker();update();$('#upload-dialog').close()}}
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)}
$('#upload-status').textContent=d.configured?'Review required before using the reference equations.':'No inference token: image recognition has not been performed.';
}catch(e){$('#upload-status').textContent=e.message}finally{$('#api-key').value='';b.disabled=false}};
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)','']];
$('#tech-settings').innerHTML=techFields.map(([k,label,v])=>`${label} `).join('');
const sp2DesignColumns=[
['FSL_MOSFET_W','fsl_fet'],['FSL_capacitor_ESR_W','fsl_cap'],
['Finite_RC_increment_W','finite_rc_increment'],['Physical_MOSFET_W','rms_fet'],
['Physical_capacitor_ESR_W','rms_cap'],
];
function sp2DesignLoss(report){
const row=report.rows.find(r=>r.sp2_loss);
if(!row)return '';
const currentSquared=report.parameters.io**2,loss=row.sp2_loss;
const power=key=>fmt(1000*currentSquared*loss[key]);
const total=fmt(row.conduction_power*1e3);
return `SP-SC series loss at the calculated device settings Loss calculation MOSFET (mW) Capacitor ESR (mW) Finite-RC increment (mW) Total (mW)
FSL baselines plus increment ${power('fsl_fet')} ${power('fsl_cap')} ${power('finite_rc_increment')} ${total}
Physical finite-RC RMS ${power('rms_fet')} ${power('rms_cap')} Included in RMS terms ${total}
Download SP-SC loss CSV `;
}
let technologyReport;
function technologyParameters(){return Object.fromEntries(techFields.filter(([k])=>k!=='eoss_pj'||$('#tech-'+k).value.trim()!=='').map(([k])=>[k,Number($('#tech-'+k).value)]))}
function renderTechnology(){if(!report)return;try{
const switchedCap=typeof isDedicatedReference==='function'&&isDedicatedReference();
const p=technologyParameters();const design=designParameters();
if(!isSI()){const point=OpenPELSRecommendation.operatingPoint(design);p.vin=point.parameters.vin;p.io=point.output_current;}if(selected.has('rsc2')&&!switchedCap)p.tank_nh=Number($('#design-tank_nh').value);technologyReport=switchedCap?sp2Analysis?.deviceReport:OpenPELSTechnology.example(report.rows,p);
if(!technologyReport)throw Error(sp2Error||'Enter a positive flying-capacitor budget for the device calculation.');
$('#export-technology').disabled=false;const t=technologyReport,unit=(v,scale=1)=>v==null?'unknown':!Number.isFinite(v)?'∞':fmt(v*scale);
$('#technology-status').textContent=`Rs = ${fmt(t.rs*1e3)} mΩ · RΣ = ${fmt(t.parallel*1e3)} mΩ · gate demand = ${fmt(t.gate_power*1e3)} mW · ${switchedCap?'same sized device result as the loss lineup':'physical example is separate from the per-unit weights above'}`;
$('#technology-results').innerHTML=`${switchedCap?(isSI()?'Optimized-width switched inductor · winding and capacitor RMS loss.':focusedTopology==='rsc2'?'Resonant SC equal-area constrained optimum · exact periodic RLC.':'Optimized-width SP-SC result · exact linear periodic RC.'):'Fixed-width example: flat-current buck models; exact linear periodic RC for SP-SC. Not measured efficiency.'} Topology ${isSI()?'Cout':'CF each'} (μF) RFET (mΩ) RCAP (mΩ) RIND (mΩ) RHC,add (mΩ) Req (mΩ) Rg at Vx (Ω) Ross at Vx (Ω) Iout²Req + Pg + known Poss (mW) ${t.rows.map(r=>r.valid?`${esc(report.rows.find(a=>a.id===r.id).short)} ${r.cf?unit(r.cf,1e6):'—'} ${['fet','cap','ind','hc','req'].map(k=>`${(k==='ind'&&r.id==='sp2'||k==='hc'&&['rsc2','si2','buck_stacked'].includes(r.id))?'N/A':unit(r[k],1e3)} `).join('')}${unit(r.gate_r)} ${unit(r.oss_r)} ${unit(r.partial_loss,1e3)}${r.poss===null?' + unknown Coss':''} `:`${esc(r.id)} Outside the supported analytical model `).join('')}
`;
$('#sp2-design-loss').innerHTML=sp2DesignLoss(t);
const exportLoss=$('[data-export-sp2-loss]');
if(exportLoss)exportLoss.onclick=()=>{
const row=t.rows.find(r=>r.sp2_loss),currentSquared=t.parameters.io**2;
download('openpels-sp2-loss-breakdown.csv',quoteCSV([
['Output_current_A',...sp2DesignColumns.map(([label])=>label),'Series_loss_W'],
[t.parameters.io,...sp2DesignColumns.map(([,key])=>currentSquared*row.sp2_loss[key]),row.conduction_power],
]),'text/csv');
};
}catch(e){technologyReport=null;$('#technology-status').textContent=e.message;$('#technology-results').innerHTML='';$('#sp2-design-loss').innerHTML='';$('#export-technology').disabled=true}}
$('#apply-technology').onclick=()=>document.body.classList.contains('sp2-focused')?update():renderTechnology();$('#export-technology').onclick=()=>{if(technologyReport)download('openpels-180nm-example.json',JSON.stringify({...technologyReport,source:'User-supplied XFLY_Power_Analysis.md; not independently verified foundry data',method:document.body.classList.contains('sp2-focused')?(isSI()?'Piecewise-linear positive-current CCM with separate gate and optional Coss energy.':focusedTopology==='rsc2'?'Exact periodic RLC with separate gate and optional effective Coss energy.':'Exact periodic RC plus separate gate and optional effective Coss energy; Qoss does not establish Eoss'):'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')};
(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=`Revent / RSSL · log axis green: finite RC · blue: FSL · orange: SSL ${[.01,.1,1,10,100].map(a=>`${a} `).join('')}${[1,10,100].map(v=>`${v} `).join('')}d / (fs Rpath C) · log axis `})();
const designFields=[
['vout','Output voltage (V)',.825],['io','Output current (A)',2],['fs_mhz','Frequency (MHz)',10],
['budget_mode','Silicon budget','area','select',[['area','Die area + Ron × area'],['width','Total FET width']]],
['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],
['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],['tank_nh','Series inductance per leg (nH)',5.5],['si_mode','Voltage operating mode','duty_cycle','select',[['duty_cycle','Duty cycle'],['output_voltage','Output voltage']]],
['si_target_v','Target output voltage (V)',1.5],['si_duty','High-side duty',.5],['si_l_nh','Self-inductance per winding (nH)',1000],['si_coupling','Inverse coupling magnitude',.6],['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],
['objective','Priority','loss','select',[['loss','Lowest modeled loss'],['capacitors','Fewest capacitors, then loss'],['magnetics','Fewest power windings, then loss']]]
];
$('#design-fields').innerHTML=designFields.map(([k,label,value,type,options])=>`${label}${type==='select'?`${options.map(([v,t])=>`${t} `).join('')} `:` `} `).join('');
const loadBudgetField=$('[data-design-field="budget_mode"]');$('#design-fields').insertBefore($('#load-summary'),loadBudgetField);
let recommendationReport;
function designParameters(){
const fields=Object.fromEntries(designFields
.filter(([k])=>k.startsWith('si_')?isSI():k!=='tank_nh'||focusedTopology==='rsc2')
.map(([k,label,value,type])=>[k,type==='select'?$('#design-'+k).value:Number($('#design-'+k).value)]));
if(!isSI())return {ratio,voltage_mode:'output_ratio',load_mode:'current',...fields};
const {vout:vin,si_mode,si_target_v,si_duty,...values}=fields;
return {ratio,vin,voltage_mode:si_mode,load_mode:'current',...values,
...(si_mode==='output_voltage'?{si_target_v}:{si_duty})};
}
function showVoltageMode(){
const target=isSI()&&$('#design-si_mode').value==='output_voltage';
$('[data-design-field="si_target_v"]').hidden=!target;
$('[data-design-field="si_duty"]').hidden=target;
}
$('#design-si_mode').addEventListener('change',showVoltageMode);
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'}
showBudgetFields();$('#design-budget_mode').onchange=showBudgetFields;
function updateLoadSummary(){
try{
if (isSI()) {
const op=sp2Analysis?.operating_point;
if(!op){
$('#load-summary').textContent=sp2Error||'Enter an operating point to calculate the loaded output.';
return;
}
const label=op.target==null?'':`Target ${fmt(op.target,4)} V · `;
$('#load-summary').textContent=`${label}Command duty ${fmt(op.duty,6)} · Ideal ${fmt(op.idealVoltage,5)} V · Analytical loaded ${fmt(op.analyticalVoltage,5)} V · Ideal gain ${fmt(op.idealGain,6)} · Loaded gain ${fmt(op.loadedGain,6)} · ${fmt(op.analyticalVoltage/sp2Analysis.output_current,4)} Ω · ${fmt(op.analyticalVoltage*sp2Analysis.output_current)} W.`;
return;
}
const op=OpenPELSRecommendation.operatingPoint(designParameters());
$('#load-summary').innerHTML=`Calculated load resistance Rload ${fmt(op.load_resistance,4)} Ω
Calculated output power ${fmt(op.output_power)} W
Derived input voltage: ${ratio} × ${fmt(op.requested_vout)} V = ${fmt(op.parameters.vin)} V . Output voltage and current stay fixed when the ratio changes.
`}catch(e){$('#load-summary').textContent=e.message}}updateLoadSummary();
function inspectRecommendation(id){const r=recommendationReport?.rows.find(r=>r.id===id);if(!r||r.status!=='eligible')return;
if(document.body.classList.contains('sp2-focused')){
$('#analysis-workbench').open=true;update();$('#analysis-workbench').scrollIntoView({behavior:'smooth',block:'start'});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'})}
let comparisonView='scoreboard';
function lossScoreboard(t){const data=t.loss_scoreboard;if(!data.rows.length)return '';
const switchedCap=t.rows[0]?.id==='sp2', resonant=t.rows[0]?.id==='rsc2', si=isDutyBuck(t.rows[0]?.id);
const lossValue=(d,m)=>d.powers[m.id]===null?(m.id==='ind'?'N/A':'Unknown'):`${fmt(d.powers[m.id]*1e3,2)} mW `;const byId=Object.fromEntries(t.eligible.map(r=>[r.id,r]));const rating=n=>n==null?'—':String(n),tone=n=>n==null?'neutral':n>=66?'good':n>=33?'mid':'weak';
return `THE LOSS LINEUP Higher score = lower modeled loss · actual values in mW
${esc(data.scale)} Unknown losses are not scored as zero. The stacked color strip shows each mechanism’s share of modeled loss; ratings compare mechanisms separately.
What is included in each loss? ${si?'Winding and channel RMS currents set resistive loss. Output-capacitor ESR uses the summed winding ripple. Gate and optional Coss energy are tracked separately.':resonant?'The periodic tank RMS current gives switch conduction, flying-capacitor ESR and inductor DCR losses. Gate demand and any entered Coss energy are separate. Core and dead-time effects are unquantified.':switchedCap?'Conduction and ESR are the fast-switching baseline. The finite-charge addition is Iout² (Req − RFSL). The exact finite-RC path dissipation is represented by the baseline plus this increment; the raw SSL asymptote is never summed again. Gate demand is separate. Coss is included once when effective energy is provided. Winding DCR and magnetic losses are not applicable.':`Switch = Iout² RFET; capacitor = Iout² RCAP; winding = Iout² RIND; charging = Iout² (Req − RFSL); gate = the FOM-based gate-drive demand. These five terms sum to the displayed modeled total. The raw RSSL asymptote is not added again. Coss, core and ripple corrections remain unquantified. Pros and tradeoffs identify the largest mW difference versus the mean of the other displayed circuits; ratings are recalculated when this comparison set changes.`}
`;
}
function setComparisonView(view){comparisonView=view;$('#loss-scoreboard-view').hidden=view!=='scoreboard';$('#candidate-cards-view').hidden=view!=='circuits';$$('[data-comparison-view]').forEach(b=>{b.classList.toggle('active',b.dataset.comparisonView===view);b.setAttribute('aria-pressed',String(b.dataset.comparisonView===view))})}
function renderRecommendation(){if(!catalog.length)return;
const switchedCap=typeof isDedicatedReference==='function'&&isDedicatedReference();
try{
if(switchedCap&&!sp2Analysis)throw Error(sp2Error||'Enter valid fixed-ratio design inputs.');
recommendationReport=switchedCap?sp2Analysis:OpenPELSRecommendation.recommend(designParameters(),{catalog},OpenPELSEngine,OpenPELSTechnology);
if(!switchedCap&&typeof focusRecommendation==='function')recommendationReport=focusRecommendation(recommendationReport);
recommendationReport.loss_scoreboard=OpenPELSScores.build(recommendationReport);$('#design-error').textContent='';$('#recommend-design').textContent=switchedCap?'Update design':'Update candidates';$('#export-recommendation').disabled=false;const t=recommendationReport,p=t.parameters,native=t.native_models;
$('#family-context').textContent=switchedCap?(isSI()?'Duty-regulated switched inductor · 2:1 nominal at 50%':focusedTopology==='rsc2'?'Fixed 2:1 resonant SC · two uncoupled series-RLC legs':'Fixed 2:1 switched-capacitor reference · 50% duty · two flying capacitors'):native?`${ratio}:1 cancellation family · ${native} coupled-inductor candidates. Complementary winding excitation or ideal midpoint hold is admitted; estimated phase ripple must satisfy the entered limit.`:`${ratio}:1 · no verified coupled-inductor cancellation-point model in the current library. Off-duty and uncoupled circuits are omitted.`;
$('#candidate-status').textContent=t.eligible.length?`${t.eligible.length} candidates meet the current limits · Rload = ${fmt(t.load_resistance,4)} Ω. Inspect any panel to review its model.`:!native?'No qualified coupled-inductor cancellation-point model is available for this ratio.':!t.voltage_ratio_match?'The requested output voltage does not match this ratio’s nominal cancellation point.':'No candidate passes the current constraints. Expand the excluded candidates below for reasons.';
const candidatePanel=r=>{
const supported=!!OpenPELSRecommendation.specs[r.id],eligible=r.status==='eligible';
if(!supported)return `${esc(r.short)} · ${r.reasons.map(esc).join('; ')}
`;
const image=r.asset.replace('.svg','-candidate.svg');
return `${eligible?'#'+r.rank:'Not eligible'} ${r.native_ratio}:1 ${isSI()?'nominal':switchedCap?'fixed ratio':'cancellation point'}
${esc(r.name)} ${eligible?`${fmt(r.loss*1e3,1)} mW Modeled loss
${fmt(r.rout*1e3,2)} mΩ Converter Rout · ${fmt(r.req_pu)} p.u.
Rload = ${fmt(t.load_resistance,4)} Ω · Rout /Rload = ${fmt(r.rout_over_rload*100,2)}% RS = ${fmt(r.rs*1e3,2)} mΩ${r.capacitors?' · RC = '+fmt(p.rc_mohm,1)+' mΩ':''}${r.windings?' · RL = '+fmt(p.rl_mohm,1)+' mΩ/winding':''}
${r.capacitors} ${isSI()?'output capacitor':'flying/clamp caps'} · ${r.windings} windings ${fmt(r.width_mm,1)} mm FET width · ${fmt(r.drop_percent,1)}% nominal droop ${isSI()?`${fmt(100*r.efficiency,2)}% modeled efficiency · ${fmt(r.phase_ripple_percent,2)}% phase ripple pp`:switchedCap?`${fmt(100*r.efficiency,2)}% modeled efficiency · ${fmt(r.cf*1e6)} μF each`:r.ripple_model==='ideal_midpoint_hold'?'Ideally zero winding ripple at 2:1 Capacitor-ripple and mismatch effects are not quantified.':`${fmt(r.phase_ripple_percent,2)}% phase ripple pp · ${fmt(r.phase_ripple_pp*1e3,1)} mA · ${fmt(r.effective_frequency/1e6,1)} MHz effective excitation`}
Inspect circuit and die allocation → `:`${r.reasons.map(esc).join('; ')}
${r.ripple_model==='ideal_midpoint_hold'?'Ideal 2:1 midpoint hold gives zero winding ripple; real capacitor-ripple and mismatch effects are not quantified.
':''}`} `;
};
$('#shortlist-results').innerHTML=`${switchedCap?sp2EfficiencySummary(t):''}${t.eligible.length?`Loss scoreboard Circuit cards
${lossScoreboard(t)}
`:''}${isSI()?'RC is output-capacitor ESR. RL is DCR per winding. Device areas follow their RMS currents.':focusedTopology==='rsc2'?'RC and RL are per-leg losses. A and B identify the two complementary clock commands. Eight devices share the used width equally.':switchedCap?'RS : unit-area MOSFET on-resistance · RC : flying-capacitor ESR. Eight equal-width devices. Gate-control annotations are omitted from these previews.':`RS : unit-area MOSFET on-resistance · RC : main-capacitor ESR · RL : 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.`}
${t.eligible.map(candidatePanel).join('')||'
No candidate satisfies all currently modeled screens.
'}
${isSI()?'Switched inductor candidates failing constraints':switchedCap?'Fixed-ratio candidates failing constraints':'Cancellation-point candidates failing constraints'} (${t.rows.length-t.eligible.length}) ${t.rows.filter(r=>r.status==='excluded').map(candidatePanel).join('')}
${t.rows.filter(r=>r.status==='unmodeled').map(candidatePanel).join('')} `;
if(t.eligible.length){setComparisonView(comparisonView);$$('[data-comparison-view]').forEach(b=>b.onclick=()=>setComparisonView(b.dataset.comparisonView))}$$('[data-inspect-design]').forEach(b=>b.onclick=()=>inspectRecommendation(b.dataset.inspectDesign));renderTechnology();
}catch(e){recommendationReport=null;$('#design-error').textContent=e.message;$('#candidate-status').textContent='Check the design inputs to calculate the candidates.';$('#shortlist-results').innerHTML='';$('#export-recommendation').disabled=true;renderTechnology()}}
$('#design-fields').addEventListener('input',()=>{updateLoadSummary();if(document.body.classList.contains('sp2-focused'))return;$('#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=()=>document.body.classList.contains('sp2-focused')?update():renderRecommendation();$('#export-recommendation').onclick=()=>{if(recommendationReport)download('openpels-design-shortlist.json',JSON.stringify(recommendationReport,(k,v)=>k==='deviceReport'?undefined:v,2),'application/json')};
let resizeTimer;window.addEventListener('resize',()=>{clearTimeout(resizeTimer);resizeTimer=setTimeout(()=>{if($('#sweep-section').open)drawSweep()},200)});
(async()=>{try{await OpenPELSOperatingPoint.load('./operating-conditions.json');catalog=await api('/api/catalog');selected=new Set(OpenPELSRecommendation.familyIds(ratio));picker();await update();announceAnalysisReady()}catch(e){toast(e.message)}})();
// Appended inside the preserved analytical UI's scope.
function focusRecommendation(result) {
if (!focusedTopology) return result;
const rows = result.rows.filter((row) => row.id === focusedTopology);
const eligible = result.eligible.filter((row) => row.id === focusedTopology);
return {
...result,
rows,
eligible,
winner: eligible[0] ?? null,
native_models: rows.filter((row) => row.reference_match).length,
};
}
function isDedicatedReference() {
return ['sp2','rsc2','si2','buck_stacked'].includes(focusedTopology) && ratio === 2;
}
let sp2Analysis, sp2Error, manualSp2Weights = false;
function prepareSp2Analysis(base, useEnteredWeights) {
manualSp2Weights = useEnteredWeights;
try {
const {vgs, events, eoss_pj} = technologyParameters();
if(isStacked()) $('#tech-vgs').value=(Number($('#design-vout').value)/2).toString();
const recommend = isSI()?OpenPELSRecommendation.recommendSwitchedInductor:OpenPELSRecommendation.recommendSwitchedCap;
sp2Analysis = recommend(
designParameters(), {vgs:isStacked()?Number($('#design-vout').value)/2:vgs, events, ...(isStacked()?{stack_coss_pf_per_mm:eoss_pj}:{eoss_pj})}, base,
catalog.find((item) => item.id === focusedTopology), OpenPELSTechnology,
);
sp2Error = "";
} catch (error) {
sp2Analysis = null;
sp2Error = error.message;
}
const r = sp2Analysis?.deviceReport?.rows[0];
const context = $("#inspection-context");
if (useEnteredWeights || !r) {
context.textContent = useEnteredWeights
? "Manual comparison weights are active. The physical results still use Design Constraints. Update the design to restore linked weights."
: "No physical design result. The per-unit cards use the last valid comparison weights.";
return;
}
const t = sp2Analysis.deviceReport;
$("#rho_c").value = (t.parameters.rc_mohm / 1000 / t.rs).toPrecision(12);
// The winding term is identically zero for SP-SC. Use the legacy
// DCR assumption for any optional inductive comparison curves.
$("#rho_l").value = (Number($("#design-rl_mohm").value) / 1000 / t.rs).toPrecision(12);
$("#rho_q").value = (1 / (r.cf * t.parameters.fs_mhz * 1e6 * t.rs)).toPrecision(12);
if (r.si) {
$("#si_coupling").value = t.parameters.si_coupling;
$("#si_ripple").value = (t.parameters.vin/(t.parameters.si_l_nh*1e-9*t.parameters.fs_mhz*1e6*t.parameters.io)).toPrecision(12);
context.textContent = `Switched inductor design weights · Rs = ${fmt(t.rs*1e3)} mΩ at ${fmt(t.parameters.width_mm)} mm total width.`;
return;
}
if (r.tank) {
$("#rho_t").value = (t.parameters.tank_nh*1e-9*t.parameters.fs_mhz*1e6/t.rs).toPrecision(12);
context.textContent = `Resonant design weights · Rs = ${fmt(t.rs*1e3)} mΩ, tank frequency ${fmt(r.tank.natural_frequency_hz/1e6)} MHz.`;
return;
}
context.textContent = `SP-SC design weights · Rs = ${fmt(t.rs*1e3)} mΩ at ${fmt(t.parameters.width_mm)} mm of used FET width. Optional 2:1 circuit cards use the same normalized weights, with the legacy DCR assumption for windings only. The physical design and The Loss Lineup are for SP-SC.`;
}
function sp2EfficiencySummary(t) {
const r = t.rows[0];
if (r.efficiency == null)
return 'This operating point has no positive delivered-voltage estimate or capacitance budget. Check the design constraints and load.
';
return `Modeled efficiency: ${(100*r.efficiency).toFixed(2)}% · delivered output ${r.estimated_open_loop_vout.toFixed(4)} V / ${r.delivered_w.toFixed(4)} W · modeled loss ${(1000*r.loss).toFixed(2)} mW.${r.sizing_constraint?' · '+esc(r.sizing_constraint)+'.':''}
Used ${fmt(r.width_mm)} mm of ${fmt(t.available_width_mm)} mm available. ${r.si?`Width per upper switch ${fmt(r.device[0].width_mm)} mm, per lower switch ${fmt(r.device[isStacked()?2:1].width_mm)} mm. Winding ripple ${fmt(r.phase_ripple_pp)} A pp. Winding RMS ${fmt(r.operating_waveforms.winding_rms_a)} A per leg and capacitor RMS ${fmt(r.operating_waveforms.output_cap_rms_a)} A. Droop resistance ${fmt(1000*r.droop_resistance)} mΩ. Ideal capacitor ripple ${fmt(r.capacitor_ripple_vpp*1000)} mV pp before ESR. `:`Each of eight devices gets 12.5% of used width (${r.device[0].width_mm.toFixed(3)} mm each).`} ${r.tank?`Tank RMS ${fmt(r.tank.tank_rms_per_output_amp*t.output_current)} A per leg · commutation current magnitude ${fmt(r.tank.commutation_current_per_output_amp*t.output_current)} A. `: ''}${r.coss_power===null?'Coss energy is unknown and is excluded from this estimate.':isStacked()?'It includes the half-input Coss event energy.':'It includes the entered Coss energy.'}
`;
}
const sp2Profile = {
"design-si_mode":"duty_cycle","design-si_target_v":1.5,
"design-fs_mhz": 2, "design-budget_mode": "width", "design-width_mm": 80.2666667,
"design-die_mm2": 1, "design-utilization": .5, "design-ron_area_mohm_mm2": 1,
"design-cap_uf": 2, "design-rc_mohm": 20, "design-max_caps": 2,
"design-max_drop_percent": 10, "design-objective": "loss",
"tech-vgs": 3.3, "tech-events": 1, "tech-eoss_pj": "",
rho_c: 1, rho_l: 1, rho_q: 20, si_coupling:.6, si_ripple:.75,
'design-si_duty':.5,'design-si_l_nh':1000,'design-si_coupling':.6,'design-max_phase_ripple_percent':5,
};
const profiles = new Map([
['si2',{...sp2Profile,'design-width_mm':200,'design-cap_uf':47,'design-max_caps':1,
'design-max_windings':2,'design-rc_mohm':5,'design-rl_mohm':4,'design-max_phase_ripple_percent':100,
'design-tank_nh':5.5,rho_t:.61}],
['sp2', {...sp2Profile, 'design-tank_nh':5.5, 'design-max_windings':2, 'design-rl_mohm':38, rho_t:.61}],
['rsc2', {...sp2Profile, 'design-width_mm':401.3333333333, 'design-rc_mohm':5,
'design-tank_nh':5.5, 'design-max_windings':2, 'design-rl_mohm':4, rho_t:.61}],
]);
profiles.set('buck_stacked',{...profiles.get('si2'),'design-width_mm':400,'tech-eoss_pj':.4});
let otherProfile = null;
const defaultInputScope = $(".input-scope").textContent;
const defaultIntro = $(".intro p").textContent;
const defaultCossScope = $("#tech-coss-scope").textContent;
const siLabels = {vout:'Input voltage (V)', cap_uf:'Output capacitance (μF)',max_caps:'Maximum output capacitors',rc_mohm:'Output capacitor ESR (mΩ)'};
const defaultLabels = Object.fromEntries(designFields.map(([key,label])=>[key,label]));
function setInputLabels(si){
for (const [key,label] of Object.entries(siLabels))
$("[data-design-field='"+key+"']").firstChild.textContent=si?label:defaultLabels[key];
}
function switchAnalysisScope(nextId) {
const entering = profiles.has(nextId), previousFixed = isDedicatedReference();
if ((!entering&&!previousFixed)||nextId===focusedTopology) return;
const fields = Object.keys(profiles.get('sp2')).map((id) => document.getElementById(id));
const current = Object.fromEntries(fields.map((field) => [field.id, field.value]));
const next = entering ? profiles.get(nextId) : otherProfile;
if (!previousFixed) {
current.inspection = $("#inspection-context").textContent;
otherProfile = current;
}
else profiles.set(focusedTopology,current);
for (const field of fields) field.value = next[field.id];
setInputLabels(isDutyBuck(nextId));
const stacked=nextId==='buck_stacked';
for(const key of ['vgs','events']) $('#tech-'+key).readOnly=stacked;
$('#tech-eoss_pj').parentElement.firstChild.textContent=stacked?'Linear Coss density (pF/mm)':techFields.find(([k])=>k==='eoss_pj')[1];
$("#tech-coss-scope").textContent=stacked
? "Linear Coss scales with transistor width. Each MOSFET discharges its nominal half-input voltage once per phase period. A blank entry leaves Coss loss unknown."
: defaultCossScope;
const declared=OpenPELSOperatingPoint.definition(nextId);
if (declared?.simulator?.axes) {
const select=$("#design-si_mode"), mode=select.value;
select.replaceChildren(...declared.modes.map(id=>new Option(
id==="duty_cycle"?"Duty cycle":"Output voltage",id)));
select.value=mode||declared.default_mode;
}
if (!entering) $("#inspection-context").textContent = otherProfile.inspection;
$("#design-objective option[value=magnetics]").hidden = nextId==='sp2';
$(".selection-method summary").textContent = entering
? (isDutyBuck(nextId)?"CCM feasibility and recommendation scope":"Fixed-ratio feasibility and recommendation scope")
: "Ripple-cancellation criterion and recommendation scope";
$(".selection-method").classList.toggle("fixed-ratio-method", entering);
$('.sp2-method').textContent = isDutyBuck(nextId)
? (stacked?'The design screens positive-current CCM, phase ripple, component counts and droop. Eight switches share the silicon budget. Fixed component counts leave the optimum unchanged under every priority.':'The design screens positive-current CCM, phase ripple, component counts and open-loop droop. The width budget covers all four switches. Fixed component counts leave the loss-minimizing width unchanged under every priority.') : nextId==='rsc2'
? 'Matched resonant legs use synchronized 50% commands. The design screens component counts, damping and droop, then sizes FET width. The capacitors and windings have fixed counts under all priorities. Tank current reverses during every period.'
: sp2Method;
showBudgetFields();
$(".intro p").textContent = entering
? (isDutyBuck(nextId)?"Size the inverse-coupled buck at a target output voltage or a commanded duty cycle.":"Size the fixed 2:1 switched-capacitor design and compare its per-unit loss model with other 2:1 references.")
: defaultIntro;
$(".input-scope").textContent = entering
? (stacked?"Eight switch areas follow RMS current. Gate swing and nominal blocking are fixed at Vin/2.":isDutyBuck(nextId)?"Four switch areas follow the RMS current weights. Gate and optional Coss data are in the 180 nm device panel.":"Total FET width is sized within the silicon budget for minimum modeled loss subject to droop. Each of eight switches gets equal width. Two matched flying capacitors share the budget. Gate and optional Coss inputs are in the 180 nm device panel.")
: defaultInputScope;
}
function reportOperatingPoint(includeSolution=false) {
if (!focusedTopology) return;
const point={type:"pe:analysis-point",id:focusedTopology,ratio,
operating_point:includeSolution&&sp2Analysis?.rows[0]?.id===focusedTopology?sp2Analysis.operating_point:undefined,
iout:Number($("#design-io").value),vout:Number($("#design-vout").value)};
if (isSI()) {
const input=designParameters();
const target=input.voltage_mode==="output_voltage";
Object.assign(point,{vin:input.vin,voltage_mode:input.voltage_mode,
vout:target?input.si_target_v:input.vin*input.si_duty,
duty:target?undefined:input.si_duty,target_vout:input.si_target_v});
const command=sp2Analysis?.operating_point;
const row=sp2Analysis?.winner;
if (command) point.operating_point=command;
if (command && row && command.vin===input.vin) {
point.duty=command.duty;
point.analytical_vout=command.analyticalVoltage;
const p=sp2Analysis.parameters;
point.plant={fs:p.fs_mhz,lt:p.si_l_nh,coupling:p.si_coupling,dcr:p.rl_mohm,
cout:p.cap_uf,esr:p.rc_mohm,rs:1000*row.device[0].ron,rslow:1000*row.device[isStacked()?2:1].ron,
...(isStacked()?{gatecap:sp2Analysis.deviceReport.rows[0].gate_cap_pf,coss:sp2Analysis.deviceReport.rows[0].coss_pf}:{gate:p.vgs})};
}
}
parent.postMessage(point,location.origin);
}
window.addEventListener("message", (event) => {
if (
event.origin !== location.origin ||
event.source !== parent ||
event.data?.type !== "pe:topology"
)
return;
const next = event.data;
if (
![2, 4, 6, 8, 16].includes(next.ratio) ||
!OpenPELSRecommendation.referenceFamilyIds(next.ratio).includes(next.id)
)
return;
if (!catalog.some((entry) => entry.id === next.id)) return;
switchAnalysisScope(next.id);
document.body.classList.toggle("sp2-focused", profiles.has(next.id));
document.body.classList.toggle("rsc2-focused", next.id==='rsc2');
document.body.classList.toggle("si2-focused", isDutyBuck(next.id));
ratio = next.ratio;
focusedTopology = next.id;
selected = new Set([next.id]);
if (Number.isFinite(next.vout) && next.vout > 0)
document.querySelector("#design-vout").value = isSI()?next.vin:next.vout;
if (isSI()) {
$("#design-si_mode").value=next.voltage_mode??"duty_cycle";
if (Number.isFinite(next.duty)) $("#design-si_duty").value=next.duty;
if (Number.isFinite(next.target_vout)) $("#design-si_target_v").value=next.target_vout;
if (next.plant) {
const fields=OpenPELSOperatingPoint.definition(focusedTopology).simulator.handoff;
for (const [axis,id] of Object.entries(fields))
if (Number.isFinite(next.plant[axis])) $("#design-"+id).value=next.plant[axis];
}
}
showVoltageMode();
if (Number.isFinite(next.iout) && next.iout > 0)
document.querySelector("#design-io").value = next.iout;
document.body.classList.add("focused-topology");
document.querySelector("#analysis-workbench").open = true;
document
.querySelectorAll("[data-ratio]")
.forEach((button) =>
button.classList.toggle("active", Number(button.dataset.ratio) === ratio),
);
updateLoadSummary();
picker();
update();
if (!isSI()) reportOperatingPoint();
});
document
.querySelector("#design-fields")
.addEventListener("input", () => {
if (!isSI()) reportOperatingPoint();
if (isDedicatedReference()) update();
});
$("#tech-settings").addEventListener("input", () => {
if (isDedicatedReference()) update();
});
const sp2Method = "The fixed-ratio design checks a two-capacitor minimum, a positive capacitance budget and the allowable open-loop droop. The 2:1 operating point assumes 50% duty and matched capacitors. Fewest capacitors ties for this fixed circuit, so both priorities minimize loss over width. The per-unit comparison supports other qualified 2:1 references.";
function renderSp2Method() {
const panel = $(".selection-method");
const method = document.createElement("p");
method.className = "sp2-method";
method.textContent = sp2Method;
panel.append(method);
}
renderSp2Method();
function announceAnalysisReady() {
parent.postMessage({ type: "pe:analysis-ready" }, location.origin);
}