Esempio n. 1
0
def run():
    if not AppUtils.checkInputOLR(ARGVS.fi, PY_FILE, PARSER_INPUTS):
        return
    if not AppUtils.checkInputPK(ARGVS.pk, 'Bus', PY_FILE, PARSER_INPUTS):
        return
    #
    OlxAPILib.open_olrFile(ARGVS.fi, ARGVS.olxpath)
    # get handle of object picked up
    print("Selected BUS: " + str(ARGVS.pk))

    bhnd = OlxAPILib.FindObj1LPF_check(ARGVS.pk[0], TC_BUS)
    #
    # sr = "\nOLR file: " + os.path.abspath(ARGVS.fi)
    sr = '\n' + OlxAPILib.fullBusName(bhnd).ljust(25) + ' : BUS FOUND'
    print(sr)
    sr += "\n\nBUS FAULT REPORT"
    sr += "\n                                ,Phase A        ,Phase B        ,Phase C"
    sr += do1busFlt(bhnd)
    #update file out
    ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo,
                                     fi=ARGVS.fi,
                                     subf='res',
                                     ad='',
                                     ext='.csv')
    #
    AppUtils.saveString2File(ARGVS.fo, sr)
    #
    print('\nReport file had been saved in:\n%s' % ARGVS.fo)
    if ARGVS.ut == 0:
        AppUtils.launch_excel(ARGVS.fo)
    return 1
Esempio n. 2
0
def run():
    if not AppUtils.checkInputOLR(ARGVS.fi,PY_FILE,PARSER_INPUTS):
        return
    if not AppUtils.checkInputPK(ARGVS.pk,'Bus',PY_FILE,PARSER_INPUTS):
        return
    #
    sr = ''#"\nOLR file: " + os.path.abspath(ARGVS.fi)
    #
    OlxAPILib.open_olrFile(ARGVS.fi,ARGVS.olxpath)
    #
    print("Selected BUS: "+ str(ARGVS.pk))
    for i in range(len(ARGVS.pk)):
        # get handle of object picked up
        bhnd = OlxAPILib.FindObj1LPF_check(ARGVS.pk[i],TC_BUS)
        sb = OlxAPILib.fullBusName(bhnd).ljust(25) +' : BUS FOUND'
        sr+= "\n"+sb
        print(sb)
        #
        sr += "\nFault, PhaseA, PhaseB, PhaseC, R0+jX0, R1+jX1, R2+jX2, X/R"
        #
        sr+= do1busFlt1(bhnd) + "\n"
    #update file out
    ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo , fi=ARGVS.fi , subf='res' , ad='' , ext='.csv')
    AppUtils.saveString2File(ARGVS.fo,sr)
    print('\nReport file had been saved in:\n%s'%ARGVS.fo)
    if ARGVS.ut ==0:
        AppUtils.launch_excel(ARGVS.fo)
    return 1
Esempio n. 3
0
def run():
    if not checkInput():
        return
    print("Template file: " + ARGVS.ft)
    print("IEEE-1584 2018")
    #
    import xml.etree.ElementTree as ET
    # update file out
    ARGVS.fo = AppUtils.get_file_out(fo=ARGVS.fo,
                                     fi=ARGVS.fi,
                                     subf='',
                                     ad='',
                                     ext='.csv')
    #
    OlxAPILib.open_olrFile(ARGVS.fi, ARGVS.olxpath)
    #
    ws = AppUtils.ToolCSVExcell()
    ws.readFile(fi=ARGVS.ft, delim=',')
    #
    nSuccess = 0
    #
    for i in range(7, 10000):
        if ws.getVal(row=i, column=1) == None:
            break
        #
        sbus = getStrBus(ws, i)
        if sbus != "":
            if str(ws.getVal(
                    row=6,
                    column=4)) == "Electrode config":  # standardYear = 2018
                data = ET.Element('ARCFLASHCALCULATOR2018')
                data.set('REPFILENAME', ARGVS.fo)  # fo
                data.set('OUTFILETYPE', '2')  # csv file
                if nSuccess == 0:
                    data.set('APPENDREPORT', '0')
                else:
                    data.set('APPENDREPORT', '1')
                #
                data.set('SELECTEDOBJ', sbus)  # bus
                data.set('ELECTRODECFG', str(ws.getVal(row=i, column=4)))
                data.set('BOXH', str(ws.getVal(row=i, column=5)))
                data.set('BOXW', str(ws.getVal(row=i, column=6)))
                data.set('BOXD', str(ws.getVal(row=i, column=7)))
                data.set('CONDUCTORGAP', str(ws.getVal(row=i, column=8)))
                data.set('WORKDIST', str(ws.getVal(row=i, column=9)))
                data.set('BRKINTTIME', str(ws.getVal(row=i, column=10)))
                data.set('ARCDURATION', str(ws.getVal(row=i, column=11)))
                if str(ws.getVal(row=i, column=11)) == "FUSE":
                    data.set('FUSECURVE', str(ws.getVal(row=i, column=12)))
                elif str(ws.getVal(row=i, column=11)) == "FIXED":
                    data.set('ARCTIME', str(ws.getVal(row=i, column=12)))
                elif str(ws.getVal(row=i, column=11)) == "FASTEST":
                    data.set('DEVICETIERS', str(ws.getVal(row=i, column=12)))
            #-------------------------------------------------------------------
            elif str(ws.getVal(
                    row=6,
                    column=4)) == "Equipment Category":  # standardYear = 2012
                raise Exception("Not yet support for standardYear = 2012")
                #
            else:
                raise Exception("Error Template File")
            #
            sInput = ET.tostring(data)
            #
            if OlxAPILib.run1LPFCommand(sInput):
                nSuccess += 1
    #
    if nSuccess > 0:
        print("\nArc-flash calculation ran successfully on " + str(nSuccess) +
              " buses")
        print("Report file had been saved in:\n%s" % ARGVS.fo)

        # open res in Excel
        if ARGVS.ut == 0:
            AppUtils.launch_excel(ARGVS.fo)
    else:
        print(
            "Something was not right (no bus found). No arc flash calculation results."
        )
    return 1