Struct resistor_calc::RCalc [−][src]
pub struct RCalc { /* fields omitted */ }
Main calculator struct
Methods
impl RCalc
[src]
impl RCalc
pub fn new(rs: Vec<&'static RSeries>) -> Self
[src]
pub fn new(rs: Vec<&'static RSeries>) -> Self
Creates a new RCalc with the series used for the R values provided as a vec.
Examples
To create a calculator that will vary over 4 resistors R1, R2, R3 and R4, where we want to draw R1 and R2 from the E24 series, R3 from the E6 series and R4 from the E12 series would be done as follows:
let rcal = RCalc::new(vec![&E24, &E24, &E6, &E12]);
pub fn e3(count: usize) -> Self
[src]
pub fn e3(count: usize) -> Self
Creates a new RCalc with count
resistors drawn from the E3 series.
pub fn e6(count: usize) -> Self
[src]
pub fn e6(count: usize) -> Self
Creates a new RCalc with count
resistors drawn from the E6 series.
pub fn e12(count: usize) -> Self
[src]
pub fn e12(count: usize) -> Self
Creates a new RCalc with count
resistors drawn from the E12 series.
pub fn e24(count: usize) -> Self
[src]
pub fn e24(count: usize) -> Self
Creates a new RCalc with count
resistors drawn from the E24 series.
pub fn combinations(&self) -> u128
[src]
pub fn combinations(&self) -> u128
Returns the number of combinations of values that exist for the configured resistors and series. This will fairly directly map to the amount of time taken to calculate value combinations.
pub fn calc(
&self,
f: impl Fn(&RSet) -> Option<f64>
) -> Option<RRes>
[src]
pub fn calc(
&self,
f: impl Fn(&RSet) -> Option<f64>
) -> Option<RRes>
Given a testing function f
thats maps from a set of input resistors to Option<f64>
this
will calculate the results for the resistors and series configured and return the result as
an RRes
. f
should map combinations that are unsuitable to None
and combinations that
are suitable to Some(err)
where err
is a f64
describing how far from perfect the
combination is. f
is often supplied with the use of the ROpBuilder
struct.