File size: 9,427 Bytes
96a7f6a
 
3f7f105
89206e4
3f7f105
 
 
ecaa5fe
 
1ea609a
96a7f6a
 
3f7f105
1ea609a
96a7f6a
1ea609a
96a7f6a
 
 
 
 
3f7f105
 
1ea609a
96a7f6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Constraint screening and width optimization within the verified analytical library. */
(function(root){'use strict';
const specs=Object.freeze({buck2:{ratio:2,caps:0,windings:2,magnetics:'inverse-coupled'},sp2:{ratio:2,caps:2,windings:0,magnetics:'none'},xfly2p:{ratio:4,caps:2,windings:2,magnetics:'coupled'},xfly4p:{ratio:4,caps:4,windings:2,magnetics:'coupled'},'3lbuck':{ratio:4,ratios:[2,4],caps:2,windings:2,magnetics:'coupled'},'2sbuck':{ratio:4,caps:4,windings:2,magnetics:'coupled'},buck:{ratio:2,caps:0,windings:2,magnetics:'coupled'}});
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}});
function familyIds(ratio){return Object.keys(excitation).filter(id=>(specs[id].ratios??[specs[id].ratio]).includes(ratio))}
function ripplePoint(id,p){const ldm=p.lk_nh*1e-9+2*p.lm_uh*1e-6;if(id==='3lbuck'&&p.ratio===2)return {ripple_model:'ideal_midpoint_hold',phase_ripple_pp:0,phase_ripple_percent:0,effective_duty:1,gate_duty:.5,effective_frequency:0,ldm,residual_ripple_unmodeled:true,condition:'Ideal balanced flying capacitor holds winding input at Vin/2 = Vout; ideal winding voltage and ripple are zero. Real capacitor-voltage ripple, mismatch and timing effects are not quantified; coupling is not the cause of this ideal cancellation.'};const e=excitation[id],pp=p.vin*e.level/(4*p.fs_mhz*1e6*e.pulses*ldm);return {ripple_model:'complementary_excitation',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.'}}

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'};
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)}}
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]');
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;
if(calibrated&&(!Number.isFinite(Wmax)||Wmax<=0))throw Error('Invalid area/width budget');
const rows=data.catalog.filter(c=>familyIds(p.ratio).includes(c.id)).map(c=>{const s=specs[c.id],r={id:c.id,name:c.name,short:c.short,native_ratio:p.ratio,reference_match:true,asset:c.asset,allocation_reference_ratio:['buck2','sp2'].includes(c.id)?2:4,status:'excluded',reasons:[]};if(!s){r.status='unmodeled';r.reasons=['No verified loss model for recommendation'];return r}Object.assign(r,{capacitors:s.caps,windings:s.windings,magnetics:s.magnetics},ripplePoint(c.id,p));if(r.phase_ripple_percent>=200)r.reasons.push('Predicted phase-current ripple leaves the assumed CCM region');if(r.phase_ripple_percent>p.max_phase_ripple_percent)r.reasons.push('Predicted phase ripple exceeds '+p.max_phase_ripple_percent+'% of average phase current');if(!engine.valid(c.id,m))r.reasons.push(c.id==='sp2'?'Fixed 2:1 conversion only':'Outside the verified duty range');if(s.windings>p.max_windings)r.reasons.push('Requires '+s.windings+' power windings; limit is '+p.max_windings);if(s.caps>p.max_caps)r.reasons.push('Requires '+s.caps+' flying/clamp capacitors; limit is '+p.max_caps);if(s.caps&&p.cap_uf<=0)r.reasons.push('A positive flying/clamp capacitor budget is required');if(!calibrated)r.reasons.push('Enter positive Ron × area (mΩ·mm²)');if(r.reasons.length)return r;
if(!op.voltage_ratio_match)r.reasons.push('Requested Vout does not match Vin/'+p.ratio+' at the cancellation point');if(r.reasons.length)return r;
const cf=s.caps?p.cap_uf*1e-6/s.caps:null;
function at(width){const rs=technology.reference.ron*12/width,v=engine.evaluate(c.id,m,{rs,rc:p.rc_mohm/1000,rl:p.rl_mohm/1000,cf:cf??1,fs}),gate=p.vgs*fs*technology.fom.gate*width/technology.reference.ron,loss=p.io*p.io*v.total+gate;return {width_mm:width,rs,req:v.total,rout:v.total,rout_over_rload:v.total/op.load_resistance,req_pu:v.total/(technology.reference.ron*12/Wmax),req_used_width_pu:v.total/rs,conduction_power:p.io*p.io*v.total,gate_power:gate,loss,drop_percent:100*p.io*v.total/vo,estimated_open_loop_vout:vo-p.io*v.total,cf,parts:v}}
// Search total width, not individual device ratios; include both boundaries.
let best=null,bestIndex=0;const grid=Array.from({length:65},(_,i)=>Wmax*10**(-4+4*i/64));for(let i=0;i<grid.length;i++){const v=at(grid[i]);if(!best||v.loss<best.loss){best=v;bestIndex=i}}
let lo=Math.log(grid[Math.max(0,bestIndex-1)]),hi=Math.log(grid[Math.min(64,bestIndex+1)]);for(let i=0;i<50;i++){const a=lo+(hi-lo)/3,b=hi-(hi-lo)/3,va=at(Math.exp(a)),vb=at(Math.exp(b));if(va.loss<best.loss)best=va;if(vb.loss<best.loss)best=vb;if(va.loss<vb.loss)hi=b;else lo=a}
// Droop is a hard screen. A loss-minimizing width can fail it although Wmax passes.
if(best.drop_percent>p.max_drop_percent){const full=at(Wmax);if(full.drop_percent<=p.max_drop_percent){let a=best.width_mm,b=Wmax;for(let i=0;i<60;i++){const mid=(a+b)/2;if(at(mid).drop_percent>p.max_drop_percent)a=mid;else b=mid}best=at(b)}else r.reasons.push('Estimated open-loop droop exceeds '+p.max_drop_percent+'% even at full FET budget')}
Object.assign(r,best,{used_die_mm2:p.budget_mode==='area'?best.width_mm*p.ron_area_mohm_mm2*1e-3/technology.reference.ron:null,available_width_mm:Wmax,reference_note:'Nominal coupled-inductor cancellation point at '+p.ratio+':1; loss allocation remains fixed at '+(['buck2','sp2'].includes(c.id)?2:4)+':1'});r.status=r.reasons.length?'excluded':'eligible';return r});
const eligible=rows.filter(r=>r.status==='eligible');eligible.sort((a,b)=>{if(p.objective==='capacitors'&&a.capacitors!==b.capacitors)return a.capacitors-b.capacitors;if(p.objective==='magnetics'&&a.windings!==b.windings)return a.windings-b.windings;return a.loss-b.loss});eligible.forEach((r,i)=>r.rank=i+1);return {parameters:p,available_width_mm:Wmax,rs_budget:calibrated?technology.reference.ron*12/Wmax:null,calibrated,requested_vout:op.requested_vout,output_current:op.output_current,output_power:op.output_power,load_resistance:op.load_resistance,requested_ratio:op.requested_ratio,voltage_ratio_match:op.voltage_ratio_match,nominal_vout:vo,eligible,rows,winner:eligible[0]??null,native_models:rows.filter(r=>r.reference_match).length,scope:'Coupled-inductor cancellation-point shortlist only. First-order phase ripple is screened with Ldm=Lk+2Lm, balanced complementary 50% effective excitation or the ideal 3L 2:1 midpoint-hold state. Finite capacitor ripple, mismatch, losses and timing errors can break ideal cancellation. Loss ranking remains flat-current FSL/SSL plus gate drive; Coss, ripple-loss corrections, core loss, saturation, layout, startup and control/headroom are not qualified. Fixed per-device allocations; total width optimized. One gate-charge event per device per period assumed. Budgets cover power FETs, flying/clamp capacitors and power windings; drivers/Cin/Cout are outside these budgets.'};}
const api={recommend,specs,defaults,excitation,familyIds,ripplePoint,operatingPoint};root.ThinkPowerRecommendation=api;if(typeof module!=='undefined')module.exports=api;
})(typeof window!=='undefined'?window:globalThis);