示例#1
0
    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
示例#2
0
 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
示例#3
0
    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)
        )
示例#4
0
    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)
        )
示例#5
0
    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)
        )
示例#6
0
 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
示例#7
0
 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