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)
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
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