def inductance(self, simplify: bool = True) -> Union[Inductance, Op]: """ """ if (self.e1.inductance().typval == 0 or self.e2.inductance().typval == 0): return Inductance(0) expr = (Const(1) / self.e1.inductance(simplify=False) + Const(1) / self.e2.inductance(simplify=False))**Const(-1) if simplify: return evaluate(expr) return expr
def _rt_ubound(self) -> float: """ Upper bound estimate for top resistance value. This does not guarantee that all lower values are valid; we still need to check each value. However, all values greater than this value are guaranteed to be invalid. """ rt = evaluate( ((self.vp - self.vn) * (Const(1) - Const(1) / (Const(1) + Const(1) / self._ratio())) - self.vout_set) / self.iout) return rt.maxval
def inductance(self) -> Inductance: """ """ if ( self.e1.inductance().typval == 0 or self.e2.inductance().typval == 0 ): return Inductance(0) return simplify( (Const(1) / self.e1.inductance() + Const(1) / self.e2.inductance()) ** Const(-1) )
def resistance(self) -> Resistance: """ """ if ( self.e1.resistance().typval == 0 or self.e2.resistance().typval == 0 ): return Resistance(0) return simplify( (Const(1) / self.e1.resistance() + Const(1) / self.e2.resistance()) ** Const(-1) )
def impedance(self) -> Impedance: """ """ if ( abs(self.e1.impedance().typval) == 0 or abs(self.e2.impedance().typval) == 0 ): return Impedance(complex(0, 0)) return simplify( (Const(1) / self.e1.impedance() + Const(1) / self.e2.impedance()) ** Const(-1) )
def _ratio(self, simplify: bool = True) -> Union[Op, Quantity]: """ Top to bottom resistance value ratio. """ expr = (self.vp - self.vn) / self.vout_set - Const(1) return evaluate(expr) if simplify else expr
def power(self, simplify: bool = True) -> Union[Op, Power]: """ """ expr = (self.vp - self.vn)**Const(2) / (self.resistance_bottom( simplify=False) + self.resistance_top(simplify=False)) return evaluate(expr) if simplify else expr