Skip to content

Optimize buck/boost converter calculations, experimental infrastructure for serialized functions#410

Merged
ducky64 merged 40 commits intomasterfrom
coupled-inductor
Jun 16, 2025
Merged

Optimize buck/boost converter calculations, experimental infrastructure for serialized functions#410
ducky64 merged 40 commits intomasterfrom
coupled-inductor

Conversation

@ducky64
Copy link
Copy Markdown
Collaborator

@ducky64 ducky64 commented Jun 15, 2025

Optimizes component calculation for buck and boost converters by allowing the inductor picker to trade-off inductance and max current rating. This is enabled by new experimental infrastructure for serialized functions, that allows the inductor to take in an additional functional filter that encodes this trade-off calculated per-part, instead of static (and worst-case) inductance / current pairs, which would lead to over-sized (and higher-DCR) inductors.

Changes the buck / boost converter calculation to be more principled. It now uses two bounds, the optional ripple ratio at the actual output current (defaults to unbounded / unused, allowing wide range for optimization), and the fallback ripple ratio (0.1-0.5) at the switch current limits. The fallback ratio provides a minimum ripple current and maximum inductance at light-load operations where the converter will likely go into DCM.

DCM effects are not modeled, since that would require additional parameters like t_on, min. Instead, the fallback / limit ripple ratio is meant to provide a sane component sizing for DCM operation.

THIS IS AN API-BREAKING CHANGE. In most cases, Buck/BoostConverterPowerPath users will only need to delete the ripple_current parameter, which is now calculated in the power path. SwitchingVoltageRegulator also no longer provides a ripple_current_factor variable, and the passthrough to the power path can be eliminated.

Updates netlists too, the new inductor sizes are closer to values given in the datasheet. This mostly affects IC-based converters that are operating at a fraction of their rated load, and where the ripple ratio can be wider. For custom converters which have a specified ripple ratio, there is less room to optimize.

Detailed changes:

  • Ripple current factor removed from SwitchingVoltageRegulator - it's an internal variable that the system optimizes now. This also better accommodates all-in-one switching regulators where this may not be a specified parameter.
    • This is still required for custom buck / boost converters, since there isn't a reasonable fallback and is required to constrain inductance.
    • For custom converters, the parameter is renamed to ripple_ratio for consistency.
  • Buck/BoostConverterPowerPath _calculate_parameters now returns scales for inductance and capacitance (buck only, boost capacitance not dependent on ripple current)
    • Clarifies current_limits as sw_current_limits (peak current limit)
    • Adds optional ripple_ratio parameter
  • Inductor currents account for efficiency factor
  • Refactor all buck / boost converters to remove the inductor_current_ripple
  • Validate and correct that switch currents are used in the *PowerPath constructors
  • Remove fixed inductors in examples to allow new inductors to be tested

Infrastructure changes:

  • Add CastableTypes to all ConstraintExpr
  • Add tighter bounds to then_else type and allow casting in one of then or else exprs.

Resolves #405

TODO:

  • reversing ripple ratio for sw_current_limit: can that be done using limit_ripple_ratio? - use fallback_ripple_range
  • _buck_inductor_filter, needs a comment that this structure works for boost converters too
  • _calculate_parameters inductor_avg_current should take into account efficiency
  • Inductor through-current spec should be values.inductor_avg_current, as a min-bound
    • Unify w/ boost, buck, buckboost converters
  • BoostPowerPath: instead of ilim using Vin/Vout, use D to account for efficiency
  • pass through ripple_current_factor -> ripple_ratio in all converters
  • verify fcml power path impl consistency
  • remove ripple factor from converter api

@ducky64 ducky64 marked this pull request as ready for review June 16, 2025 00:54
@ducky64 ducky64 requested a review from Copilot June 16, 2025 00:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Optimizes buck/boost converter component sizing by moving ripple-current factors into the power-path and introducing an experimental serialized function filter for inductors. Key changes include:

  • Updated example netlists (IotFan, IotDisplay, Fcml) with new inductor selections and part references.
  • Refactored BuckConverterPowerPath and BoostConverterPowerPath to accept ripple_ratio and sw_current_limits, removing the old ripple_current_factor API.
  • Added ExperimentalUserFnPartsTable for registering, serializing, and deserializing user-provided filter functions in part-selection tables.

Reviewed Changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated 2 comments.

File Description
examples/IotFan/IotFan.ref.net & .net Swapped inductor footprints, values, and part numbers for new optimized selections
edg/abstract_parts/AbstractPowerConverters.py Refactored _calculate_parameters (buck/boost) to use ripple_ratio and sw_current_limits; added serialized user-fn support
edg/abstract_parts/PartsTable.py Introduced ExperimentalUserFnPartsTable for user-function serialization
edg/parts/BuckConverter_.py & BoostConverter_.py Updated all converter parts to remove inductor_current_ripple args and adapt to new API
Comments suppressed due to low confidence (6)

edg/parts/BoostConverter_Torex.py:93

  • The BoostConverterPowerPath instantiation is missing a ripple_ratio argument and will default to Range.all(), so ripple-based inductor sizing won’t be applied. Include ripple_ratio=self.ripple_current_factor (or similar) to constrain inductor ripple.
output_voltage_ripple=self.output_voltage_ripple,

edg/parts/BoostConverter_TexasInstruments.py:226

  • The BoostConverterPowerPath call no longer passes a ripple_ratio, so inductor sizing ignores ripple constraints. Add a ripple_ratio parameter to drive the new ripple-ratio-based calculation.
(0, 1)*Amp,

edg/parts/BoostConverter_DiodesInc.py:69

  • This BoostConverterPowerPath instantiation omits the ripple_ratio parameter, defaulting to Range.all() and bypassing ripple-based sizing. Pass ripple_ratio=self.ripple_current_factor (or a configured value) to the block.
self.pwr_out.link().current_drawn, (0, 0.5)*Amp,

edg/parts/BoostConverter_AnalogDevices.py:74

  • After removing inductor_current_ripple, this call no longer supplies ripple_ratio and relies on the default Range.all(), so the inductor filter won’t apply. Add ripple_ratio=self.ripple_current_factor or equivalent.
self.pwr_out.link().current_drawn, (0, self.NMOS_CURRENT_LIMIT)*Amp,

edg/parts/BuckConverter_Custom.py:10

  • [nitpick] The parameter name ripple_current_factor is deprecated in the new API in favor of ripple_ratio. Rename this parameter and corresponding ArgParameter to ripple_ratio for consistency with BuckConverterPowerPath.
ripple_current_factor: RangeLike = (0.2, 0.5),

edg/parts/BuckBoostConverter_Custom.py:28

  • [nitpick] Rename ripple_current_factor to ripple_ratio in both the constructor signature and ArgParameter to align with the updated power-path API.
ripple_current_factor: RangeLike = (0.2, 0.5),

rated_current=1.2*Amp),
self.pwr_out.link().current_drawn, (0, 1.2)*Amp, # output current limit, switch limit not given
input_voltage_ripple=self.input_ripple_limit,
output_voltage_ripple=self.output_ripple_limit,
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BuckConverterPowerPath instantiation no longer specifies a ripple_ratio, so it defaults to an unbounded Range.all(). To ensure the inductor is sized based on a target ripple current, pass a ripple_ratio argument (e.g. ripple_ratio=self.ripple_current_factor) to the power path.

Suggested change
output_voltage_ripple=self.output_ripple_limit,
output_voltage_ripple=self.output_ripple_limit,
ripple_ratio=self.ripple_current_factor

Copilot uses AI. Check for mistakes.
self.pwr_out.link().current_drawn, (0, 1.8)*Amp,
input_voltage_ripple=self.input_ripple_limit,
output_voltage_ripple=self.output_ripple_limit,
dutycycle_limit=(0, 1)
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This BuckConverterPowerPath call omits the new ripple_ratio parameter and will use the default Range.all(), which may lead to incorrect inductor sizing. Add ripple_ratio=self.ripple_current_factor (or another appropriate factor) to the block constructor.

Suggested change
dutycycle_limit=(0, 1)
dutycycle_limit=(0, 1),
ripple_ratio=self.ripple_current_factor

Copilot uses AI. Check for mistakes.
@ducky64 ducky64 merged commit ac0f39d into master Jun 16, 2025
12 checks passed
@ducky64 ducky64 deleted the coupled-inductor branch June 16, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better coupled current / inductance calculation for switching converters

2 participants