def _verifying(self, inst, E_TEC_MAX, gpu=None, wol=False): msg = '' if gpu: if gpu == 'G1': msg = "G1 (FB_BW <= 16)" elif gpu == 'G2': msg = "G2 (16 < FB_BW <= 32)" elif gpu == 'G3': msg = "G3 (32 < FB_BW <= 64)" elif gpu == 'G4': msg = "G4 (64 < FB_BW <= 96)" elif gpu == 'G5': msg = "G5 (96 < FB_BW <= 128)" elif gpu == 'G6': msg = "G6 (FB_BW > 128 (with FB Data Width < 192-bit))" elif gpu == 'G7': msg = "G7 (FB_BW > 128 (with FB Data Width >= 192-bit))" E_TEC = inst.get_E_TEC() operator = '<=' result = 'PASS' if E_TEC > E_TEC_MAX: operator = '>' result = 'FAIL' if gpu: print(" For %s, %s (E_TEC) %s %s (E_TEC_MAX), %s" % (gpu, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) else: print(" %s (E_TEC) %s %s (E_TEC_MAX), %s" % (E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) if wol: E_TEC_WOL = inst.get_E_TEC_WOL() operator = '<=' result = 'PASS' if E_TEC_WOL > E_TEC_MAX: operator = '>' result = 'FAIL' if gpu: print(" For %s, %s (E_TEC_WOL) %s %s (E_TEC_MAX), %s" % (gpu, E_TEC_WOL, operator, E_TEC_MAX, result_filter(result, E_TEC_WOL, E_TEC_MAX))) else: print(" %s (E_TEC_WOL) %s %s (E_TEC_MAX), %s" % (E_TEC_WOL, operator, E_TEC_MAX, result_filter(result, E_TEC_WOL, E_TEC_MAX)))
def energystar_calculate(sysinfo): if sysinfo.product_type == 1: calculate_product_type1_estar5(sysinfo) calculate_product_type1_estar6(sysinfo) return calculate_product_type1_estar7(sysinfo) elif sysinfo.product_type == 2: # Energy Star 5.2 print("Energy Star 5.2:") estar52 = EnergyStar52(sysinfo) P_TEC = estar52.equation_three() P_TEC_MAX = estar52.equation_four() if P_TEC <= P_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" %s (P_TEC) %s %s (P_TEC_MAX), %s" % (P_TEC, operator, P_TEC_MAX, result_filter(result, P_TEC, P_TEC_MAX))) # Energy Star 6.0 print("Energy Star 6.0:") estar60 = EnergyStar60(sysinfo) P_TEC = estar60.equation_four() P_TEC_MAX = estar60.equation_five() if P_TEC <= P_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" %s (P_TEC) %s %s (P_TEC_MAX), %s" % (P_TEC, operator, P_TEC_MAX, result_filter(result, P_TEC, P_TEC_MAX))) elif sysinfo.product_type == 3: # Energy Star 5.2 print("Energy Star 5.2:") estar52 = EnergyStar52(sysinfo) for wol in (True, False): (category, P_OFF_MAX, P_IDLE_MAX) = estar52.equation_five(wol) P_OFF = sysinfo.off P_IDLE = sysinfo.short_idle if P_OFF <= P_OFF_MAX and P_IDLE <= P_IDLE_MAX: result = 'PASS' else: result = 'FAIL' if P_OFF <= P_OFF_MAX: op1 = '<=' else: op1 = '>' if P_IDLE <= P_IDLE_MAX: op2 = '<=' else: op2 = '>' if wol: print( " If Wake-On-LAN (WOL) is enabled by default upon shipment." ) else: print( " If Wake-On-LAN (WOL) is disabled by default upon shipment." ) print( " Category %s: %s (P_OFF) %s %s (P_OFF_MAX), %s (P_IDLE) %s %s (P_IDLE_MAX), %s" % (category, P_OFF, op1, P_OFF_MAX, P_IDLE, op2, P_IDLE_MAX, result)) # Energy Star 6.0 print("Energy Star 6.0:") estar60 = EnergyStar60(sysinfo) for wol in (True, False): P_OFF = sysinfo.off P_OFF_MAX = estar60.equation_six(wol) P_IDLE = sysinfo.short_idle P_IDLE_MAX = estar60.equation_seven() if P_OFF <= P_OFF_MAX and P_IDLE <= P_IDLE_MAX: result = 'PASS' else: result = 'FAIL' if P_OFF <= P_OFF_MAX: op1 = '<=' else: op1 = '>' if P_IDLE <= P_IDLE_MAX: op2 = '<=' else: op2 = '>' if wol: print( " If Wake-On-LAN (WOL) is enabled by default upon shipment." ) else: print( " If Wake-On-LAN (WOL) is disabled by default upon shipment." ) print( " %s (P_OFF) %s %s (P_OFF_MAX), %s (P_IDLE) %s %s (P_IDLE_MAX), %s" % (P_OFF, op1, P_OFF_MAX, P_IDLE, op2, P_IDLE_MAX, result)) elif sysinfo.product_type == 4: # Energy Star 5.2 print("Energy Star 5.2:") estar52 = EnergyStar52(sysinfo) for wol in (True, False): if wol: print( " If Wake-On-LAN (WOL) is enabled by default upon shipment." ) else: print( " If Wake-On-LAN (WOL) is disabled by default upon shipment." ) P_OFF = sysinfo.off P_OFF_MAX = estar52.equation_six(wol) P_SLEEP = sysinfo.sleep P_SLEEP_MAX = estar52.equation_seven(wol) P_IDLE = sysinfo.short_idle if sysinfo.media_codec: P_IDLE_MAX = 15.0 category = 'B' else: P_IDLE_MAX = 12.0 category = 'A' print(" Category %s:" % (category)) if P_OFF <= P_OFF_MAX: op1 = '<=' else: op1 = '>' print(" %s (P_OFF) %s %s (P_OFF_MAX)" % (P_OFF, op1, P_OFF_MAX)) if P_SLEEP <= P_SLEEP_MAX: op2 = '<=' else: op2 = '>' print(" %s (P_SLEEP) %s %s (P_SLEEP_MAX)" % (P_SLEEP, op2, P_SLEEP_MAX)) if P_IDLE <= P_IDLE_MAX: op3 = '<=' else: op3 = '>' print(" %s (P_IDLE) %s %s (P_IDLE_MAX)" % (P_IDLE, op3, P_IDLE_MAX)) if P_OFF <= P_OFF_MAX and P_SLEEP <= P_SLEEP_MAX and P_IDLE <= P_IDLE_MAX: result = 'PASS' else: result = 'FAIL' print(" %s" % (result)) # Energy Star 6.0 print("Energy Star 6.0:") estar60 = EnergyStar60(sysinfo) E_TEC = estar60.equation_one() for discrete in (True, False): for wol in (True, False): E_TEC_MAX = estar60.equation_eight(discrete, wol) if discrete: msg1 = "it has Discrete Graphics enabled" else: msg1 = "it doesn't have Discrete Graphics enabled" if wol: msg2 = "Wake-On-LAN (WOL) is enabled" else: msg2 = "Wake-On-LAN (WOL) is disabled" print(" If %s and %s by default upon shipment," % (msg1, msg2)) if E_TEC <= E_TEC_MAX: operator = '<=' result = 'PASS' else: operator = '>' result = 'FAIL' print(" %s (E_TEC) %s %s (E_TEC_MAX), %s" % (E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) else: raise Exception('This is a bug when you see this.')
def calculate_product_type1_estar5(sysinfo): print("Energy Star 5:") estar52 = EnergyStar52(sysinfo) E_TEC = estar52.equation_one() over_128 = estar52.equation_two(True, True) between_64_and_128 = estar52.equation_two(False, True) under_64 = estar52.equation_two(False, False) debug(over_128) debug(between_64_and_128) debug(under_64) different = False for i, j, k in zip(over_128, between_64_and_128, under_64): (cat1, max1) = i (cat2, max2) = j (cat3, max3) = k if cat1 != cat2 or max1 != max2 or cat2 != cat3 or max2 != max3: different = True else: if different is True: if sysinfo.computer_type == 3: print("\n If GPU Frame Buffer Width <= 64 bits,") for i in under_64: (category, E_TEC_MAX) = i if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" Category %s: %s (E_TEC) %s %s (E_TEC_MAX), %s" % (category, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) print("\n If 64 bits < GPU Frame Buffer Width <= 128 bits,") for i in between_64_and_128: (category, E_TEC_MAX) = i if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" Category %s: %s (E_TEC) %s %s (E_TEC_MAX), %s" % (category, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) else: print("\n If GPU Frame Buffer Width <= 128 bits,") for i in between_64_and_128: (category, E_TEC_MAX) = i if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" Category %s: %s (E_TEC) %s %s (E_TEC_MAX), %s" % (category, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) print("\n If GPU Frame Buffer Width > 128 bits,") for i in over_128: (category, E_TEC_MAX) = i if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print(" Category %s: %s (E_TEC) %s %s (E_TEC_MAX), %s" % (category, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX))) else: for i in under_64: (category, E_TEC_MAX) = i if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' print("\n Category %s: %s (E_TEC) %s %s (E_TEC_MAX), %s" % (category, E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX)))
def calculate_product_type1_estar7(sysinfo): data = tee("\nEnergy Star 7:\n") estar70 = EnergyStar70(sysinfo) E_TEC = estar70.equation_one() lower = 1.015 if sysinfo.computer_type == 2: higher = 1.04 else: higher = 1.03 if sysinfo.computer_type == 1 or sysinfo.computer_type == 2: for AllowancePSU in (1, lower, higher): if sysinfo.discrete: if AllowancePSU == 1: data = tee( " If power supplies do not meet the requirements of Power Supply Efficiency Allowance,", data) elif AllowancePSU == lower: data = tee( " If power supplies meet lower efficiency requirements,", data) elif AllowancePSU == higher: data = tee( " If power supplies meet higher efficiency requirements,", data) for gpu in ('G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7'): E_TEC_MAX = estar70.equation_two(gpu) * AllowancePSU if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' if gpu == 'G1': gpu = "G1 (FB_BW <= 16)" elif gpu == 'G2': gpu = "G2 (16 < FB_BW <= 32)" elif gpu == 'G3': gpu = "G3 (32 < FB_BW <= 64)" elif gpu == 'G4': gpu = "G4 (64 < FB_BW <= 96)" elif gpu == 'G5': gpu = "G5 (96 < FB_BW <= 128)" elif gpu == 'G6': gpu = "G6 (FB_BW > 128; Frame Buffer Data Width < 192 bits)" elif gpu == 'G7': gpu = "G7 (FB_BW > 128; Frame Buffer Data Width >= 192 bits)" data = tee( " %s (E_TEC) %s %s (E_TEC_MAX) for %s, %s" % (E_TEC, operator, E_TEC_MAX, gpu, result_filter(result, E_TEC, E_TEC_MAX)), data) else: if AllowancePSU == 1: data = tee( " If power supplies do not meet the requirements of Power Supply Efficiency Allowance,", data) elif AllowancePSU == lower: data = tee( " If power supplies meet lower efficiency requirements,", data) elif AllowancePSU == higher: data = tee( " If power supplies meet higher efficiency requirements,", data) E_TEC_MAX = estar70.equation_two('G1') * AllowancePSU if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' data = tee( " %s (E_TEC) %s %s (E_TEC_MAX), %s" % (E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX)), data) else: if sysinfo.discrete: E_TEC_MAX = estar70.equation_two('N/A', sysinfo.fb_bw) if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' data = tee( " %s (E_TEC) %s %s (E_TEC_MAX), %s" % (E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX)), data) else: E_TEC_MAX = estar70.equation_two('G1') if E_TEC <= E_TEC_MAX: result = 'PASS' operator = '<=' else: result = 'FAIL' operator = '>' data = tee( " %s (E_TEC) %s %s (E_TEC_MAX), %s" % (E_TEC, operator, E_TEC_MAX, result_filter(result, E_TEC, E_TEC_MAX)), data) return data