solver module#
- class VoltageDividerSolution(R_h, R_l, vo)[source]#
Voltage Divider Solution Type
- Parameters:
R_h (Resistor)
R_l (Resistor)
vo (Toleranced)
-
R_h:
Resistor#
-
R_l:
Resistor#
-
vo:
Toleranced#
- solve(constraints)[source]#
Solve the Voltage Divider Constraint Problem.
- Return type:
- Parameters:
constraints (VoltageDividerConstraints)
- solve_over_series(constraints, precision, search_prec)[source]#
- Return type:
- Parameters:
constraints (VoltageDividerConstraints)
precision (float)
search_prec (float)
- filter_query_results(constraints, ratio, precision)[source]#
- Return type:
- Parameters:
constraints (VoltageDividerConstraints)
ratio (Ratio)
precision (float)
- 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).
- 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:
constraints (VoltageDividerConstraints)
target (float)
prec (float)
- 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:
- Parameters:
constraints (VoltageDividerConstraints)
r_hi (Resistor)
r_lo (Resistor)
temp_range (Toleranced)
- 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:
- 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:
- 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:
- 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:
- Parameters:
tcr (Toleranced)
temperature (float)
ref_temp (float)