def checkInput(): if not AppUtils.checkInputOLR(ARGVS.fi, PY_FILE, PARSER_INPUTS): return False # a, s = AppUtils.checkFile(ARGVS.ft, [".XLSX", ".XLS", ".XLSM", ".CSV"], 'Input template file') if not a: return AppUtils.FinishCheck(PY_FILE, s, PARSER_INPUTS) # return True
def checkInput(): if not AppUtils.checkInputOLR(ARGVS.fi, PY_FILE, PARSER_INPUTS): return False # if not (ARGVS.pk or ARGVS.ar or ARGVS.zo): s = "\nSelected Objects,Area number,Zone number = Empty.\nUnable to continue.\n" return AppUtils.FinishCheck(PY_FILE, s, PARSER_INPUTS) # try: ARGVS.ar = list(map(int, ARGVS.ar)) except: raise Exception('Area Number is not an INTEGER') try: ARGVS.zo = list(map(int, ARGVS.zo)) except: raise Exception('Zone Number is not an INTEGER') return True
def run(): if not AppUtils.checkInputOLR(ARGVS.fi, PY_FILE, PARSER_INPUTS): return if not AppUtils.checkInputPK(ARGVS.pk, 'Relay Group', PY_FILE, PARSER_INPUTS): return # OlxAPILib.open_olrFile(ARGVS.fi, ARGVS.olxpath) # bhnd, tc = OlxAPILib.FindObj1LPF(ARGVS.pk[0]) if tc != TC_RLYGROUP: s = "\nNo Relay Group is selected: " + str( ARGVS.pk) + "\nUnable to continue." return AppUtils.FinishCheck(PY_FILE, s, PARSER_INPUTS) # br1 = OlxAPILib.getEquipmentData([bhnd], RG_nBranchHnd)[0] b1 = OlxAPILib.getEquipmentData([br1], BR_nBus1Hnd)[0] nTap1 = OlxAPILib.getEquipmentData([b1], BUS_nTapBus)[0] inSer1 = OlxAPILib.getEquipmentData([br1], BR_nInService)[0] sLocal = "Local Relay Group: " + OlxAPILib.fullBranchName(br1) if nTap1 > 0: s = '\n' + sLocal + "\n\tis located at a TAP bus. Unable to continue." return AppUtils.FinishCheck(PY_FILE, s, None) # if inSer1 != 1: s = '\n' + sLocal + "\n\tis located on out-of-service branch. Unable to continue." return AppUtils.FinishCheck(PY_FILE, s, None) # kr = 0 sres = "" bres = OlxAPILib.getOppositeBranch( hndBr=br1, typeConsi=[] ) # consider all type [TC_LINE,TC_SWITCH,TC_SCAP,TC_PS,TC_XFMR,TC_XFMR3] # for bri in bres: rg1 = -1 try: rg1 = OlxAPILib.getEquipmentData([bri], BR_nRlyGrp1Hnd)[0] except: pass # if rg1 > 0: kr += 1 sres += "\n\t" + OlxAPILib.fullBranchName(bri) # s0 = 'App: ' + PY_FILE s0 += '\nUser: '******'\nDate: ' + time.asctime() s0 += '\nOLR file: ' + ARGVS.fi s0 += '\n\nSelected Relay Group:' + str(ARGVS.pk[0]) if kr > 1: s0 += "\nRemote groups (" + str(kr) + "):" else: s0 += "\nRemote group (" + str(kr) + "):" # ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo, fi=ARGVS.fi, subf='res', ad='_res', ext='.txt') # AppUtils.saveString2File(ARGVS.fo, s0 + sres) print("\nReport file had been saved in:\n" + ARGVS.fo) if ARGVS.ut == 0: AppUtils.launch_notepadpp(ARGVS.fo) return 1