solver module#

class VoltageDividerSolution(R_h, R_l, vo)[source]#

Voltage Divider Solution Type

Parameters:
R_h: Resistor#
R_l: Resistor#
vo: Toleranced#
class Ratio(high, low, loss)[source]#
Parameters:
high: float#
low: float#
loss: float#
solve(constraints)[source]#

Solve the Voltage Divider Constraint Problem.

Return type:

VoltageDividerSolution

Parameters:

constraints (VoltageDividerConstraints)

solve_over_series(constraints, precision, search_prec)[source]#
Return type:

Optional[VoltageDividerSolution]

Parameters:
filter_query_results(constraints, ratio, precision)[source]#
Return type:

Optional[VoltageDividerSolution]

Parameters:
sort_pairs_by_best_fit(constraints, precision, hi_res, lo_res)[source]#
Return type:

List[Ratio]

Parameters:
query_resistance_by_values(constraints, goal_r, r_prec, min_prec)[source]#

Query for resistance values within the specified precision range using search_resistors. Returns a list of resistance values (float).

Return type:

List[float]

Parameters:
query_resistors(constraints, target, prec)[source]#

Query for resistors matching a particular target resistance and precision. Returns a list of Resistor objects.

Return type:

List[Resistor]

Parameters:
study_solution(constraints, r_hi, r_lo, temp_range)[source]#

Compute the voltage divider expected output over a temperature range. Returns a list of Toleranced values for [min_temp, max_temp].

Return type:

List[Toleranced]

Parameters:
get_resistance(r)[source]#

Get the resistance value as a Toleranced. Uses the internal information of the Resistor component object to construct the resistance value with tolerances. Raises an error if tolerance is None. Always expects MinMax for tolerance.

Return type:

Toleranced

Parameters:

r (Resistor)

tol_minmax(typ, tolerance)[source]#

Create a Toleranced value from the MinMax range. Mirrors the Stanza implementation: tol(v, tolerance:MinMaxRange):

coeff = min-max(1.0 + min(tolerance), 1.0 + max(tolerance)) v * coeff

Return type:

Toleranced

Parameters:
  • typ (float)

  • tolerance (MinMax)

compute_tcr_deviation(resistor, temperature)[source]#

Compute the expected deviation window of a given resistor at a given temperature.

This function mirrors the Stanza implementation in component-types.stanza: - Extracts tcr and reference temperature from the resistor. - Converts pos/neg to a Toleranced interval using Toleranced.min_max. - Calls compute_tcr_deviation_interval. - Returns None if tcr is not present.

NOTE: This includes a workaround for known database issues with TCR values, as described in the Stanza code and PROD-328.

Return type:

Optional[Toleranced]

Parameters:
  • resistor (Resistor)

  • temperature (float)

compute_tcr_deviation_interval(tcr, temperature, ref_temp=25.0)[source]#

Compute the expected deviation window of a given temperature coefficient.

This function mirrors the Stanza implementation: - Returns 1.0 + (diff * tcr), where diff = temperature - ref_temp. - The result is a Toleranced window for the deviation (typically ~0.9 to 1.1).

Return type:

Toleranced

Parameters: