示例#1
0
def find_resistor(resistance, footprint, device="RES SMD", wattage=None):
    # TODO This should return a symbol instead, and usages should be adapted
    # accordingly to make consistent with find_capacitor
    if isinstance(resistance, str):
        try:
            resistance = Resistance(resistance)
        except ValueError:
            raise NoGedaSymbolException(resistance)
    if isinstance(resistance, Resistance):
        resistance = resistance._value
    if footprint[0:3] == "MY-":
        footprint = footprint[3:]
    if device == "RES THRU":
        resistances = iec60063.gen_vals(iec60063.get_series("E24"), iec60063.res_ostrs)
        if resistance in [parse_resistance(x) for x in resistances]:
            return construct_resistor(normalize_resistance(resistance), "0.25W")  # noqa
        else:
            raise NoGedaSymbolException(resistance, device)
    for symbol in gsymlib:
        if symbol.device == device and symbol.footprint == footprint:
            res, watt = parse_resistor(symbol.value)
            sym_resistance = parse_resistance(res)
            if resistance == sym_resistance:
                return symbol.value
    raise NoGedaSymbolException(resistance)
示例#2
0
文件: LM3150.py 项目: chintal/tendril
 def RLIM(self):
     elem = self.get_elem_by_idx('RLIM')
     assert elem.data['device'] in ['RES SMD', 'RES THRU']
     return Resistance(electronics.parse_resistance(electronics.parse_resistor(elem.data['value'])[0]))  # noqa
示例#3
0
文件: DLPF1.py 项目: chintal/tendril
 def R2(self):
     # TODO switch to series.get_type_value if custom series to be supported
     elem = self.get_elem_by_idx('R2')
     assert elem.data['device'] in ['RES SMD', 'RES THRU']
     return electronics.parse_resistance(electronics.parse_resistor(elem.data['value'])[0])  # noqa