def main(): capValues = extractValues.capacitorValues() newCapValues = extractValues.getComponentCombinations(capValues, 2, extractValues.cSeries, 'C Series') rValues = extractValues.resistorValues() newRValues = extractValues.getComponentCombinations(rValues, 2, extractValues.rSeries, 'R Series') TOLERANCE = 0.00000000001 target = 1020 print('*** findBestPairs TEST ***') bestPairs = findBestPairs(capValues, rValues, multiply, TOLERANCE, target) for bestPair in bestPairs: res = bestPair capValue = res[0] rValue = res[1] result = res[2] tolerance = res[3] print('C: ', capValue, ' R: ', rValue, ' res: ', result, ' target: ', target, ' tolerance: ', tolerance) print('*** USING PERMUTATIONS ***') bestPairs = findBestPairs(newCapValues, newRValues, multiply, TOLERANCE, target) for bestPair in bestPairs: res = bestPair capValue = res[0] rValue = res[1] result = res[2] tolerance = res[3] print('C: ', capValue, ' R: ', rValue, ' res: ', result, ' target: ', target, ' tolerance: ', tolerance)
def main(): capValues = extractValues.capacitorValues() newCapValues = extractValues.getComponentCombinations(capValues, 2, extractValues.cSeries, "C Series") rValues = extractValues.resistorValues() newRValues = extractValues.getComponentCombinations(rValues, 2, extractValues.rSeries, "R Series") TOLERANCE = 0.00000000001 target = 1020 print("*** findBestPairs TEST ***") bestPairs = findBestPairs(capValues, rValues, multiply, TOLERANCE, target) for bestPair in bestPairs: res = bestPair capValue = res[0] rValue = res[1] result = res[2] tolerance = res[3] print("C: ", capValue, " R: ", rValue, " res: ", result, " target: ", target, " tolerance: ", tolerance) print("*** USING PERMUTATIONS ***") bestPairs = findBestPairs(newCapValues, newRValues, multiply, TOLERANCE, target) for bestPair in bestPairs: res = bestPair capValue = res[0] rValue = res[1] result = res[2] tolerance = res[3] print("C: ", capValue, " R: ", rValue, " res: ", result, " target: ", target, " tolerance: ", tolerance)
def permute(*args): component_choice = component_choice_var.get() configuration = configuration_choice_var.get() length = permutation_length_var.get() key = component_choice + "-" + configuration + "-" + length length = int(length) print(key) file_name = get_file_name_from_file_frame() operation = None # seriesCaps = extractValues.getComponentCombinations(capValues, 2, extractValues.cSeries, 'C Series') # parallelCaps = extractValues.getComponentCombinations(capValues, 2, extractValues.cParallel, 'C Parallel') if component_choice == "capacitor": # load all the single capValues and resValues from file capValues = extractValues.capacitorValues(file_name) if configuration == "series": operation = extractValues.cSeries elif configuration == "parallel": operation = extractValues.cParallel permuted_components[key] = extractValues.getComponentCombinations( capValues, length, operation, "capacitor " + configuration ) elif component_choice == "resistor": # load all the single capValues and resValues from file rValues = extractValues.resistorValues(file_name) if configuration == "series": operation = extractValues.rSeries elif configuration == "parallel": operation = extractValues.rParallel permuted_components[key] = extractValues.getComponentCombinations( rValues, length, operation, "resistor " + configuration ) # refresh the component_search list_box text = get_list_of_keys_from_dict(permuted_components) text = tuple(text) component_list_box_var.set(text) return
def main(): rValues = extractValues.resistorValues() seriesR = extractValues.getComponentCombinations(rValues, 1, extractValues.rSeries, "R Series") for r in seriesR: print(r) print(binarySearch(list(range(0, 19)), 10)) print(binarySearch(seriesR, 68001.0)) return
def setup_routine(): test_file = 'EE347_parts.txt' rValues = extractValues.resistorValues(test_file) configuration = 'parallel' length = 2 operation = extractValues.rParallel key = 'resistor' + '-' + configuration + '-' + str(length) + '[' + test_file + ']' permuted_components[key] = \ extractValues.getComponentCombinations(rValues, length, operation, '||', componentType = 'resistor') update_component_list_box() return