def getRemoteTerminals(bhnd): """ Purpose: Find all remote end of all branches (from a bus) All taps are ignored. Close switches are included =>a test function of OlxAPILib.getRemoteTerminals(hndBr,typeConsi) Args : bhnd : bus handle returns : br_res [] : list of all branch from bus bus_res []: list of terminal bus Raises: OlrxAPIException """ br_res = OlxAPILib.getBusEquipmentData([bhnd], TC_BRANCH)[0] bus_res = [] # typeConsi = [TC_LINE, TC_SWITCH, TC_SCAP, TC_PS, TC_XFMR, TC_XFMR3] # all type of branch for br1 in br_res: bra, bt, ba, equip = OlxAPILib.getRemoteTerminals(br1, typeConsi) bus_res.append(ba) return br_res, bus_res
def linez_fromBus(bhnd): """ Report total line impedance and length All line from a bus All taps are ignored. Close switches are included Args : bhnd = bus handle Returns: nC : number of lines sres: string result Raises: OlrxAPIException """ typeConsi = [TC_LINE, TC_SWITCH, TC_SCAP] allBr = OlxAPILib.getBusEquipmentData([bhnd], [TC_BRANCH], VT_INTEGER)[0][0] sres = "" sres += str("No").ljust(6) + str(",Type ").ljust(15) sres += "," + str("Bus1").ljust(30) + "," + str("Bus2").ljust(30) + ",ID " sres += "," + "Z1".ljust(35) sres += "," + "Z0".ljust(35) sres += ",Length" # kd = 0 for hndBr in allBr: if OlxAPILib.branchIsInType(hndBr, typeConsi): bra = OlxAPILib.lineComponents(hndBr, typeConsi) for bra1 in bra: kd += 1 s1 = __getsImpedanceLine(kd, bra1) sres += s1 return kd, sres
def get1(self, b1): busTerminal = set() abr = OlxAPILib.getBusEquipmentData([b1], TC_BRANCH)[0] for br1 in abr: inSer1 = OlxAPILib.getEquipmentData([br1], BR_nInService)[0] if inSer1 == 1: e1 = OlxAPILib.getEquipmentData([br1], BR_nHandle)[0] if e1 not in self.equipA: br_res, bus_res, bus_resa, ea1 = OlxAPILib.getRemoteTerminals( br1, typeConsi=[]) self.equipA.update(ea1) self.busA.update(bus_resa) busTerminal.update(bus_res) return busTerminal
def do1busFlt(bhnd): sres = "" # all branch connected to bhnd bra = OlxAPILib.getBusEquipmentData([bhnd], TC_BRANCH)[0] # doFault fltConn = [1, 0, 1, 0] # 3LG, 1LG outageOpt = [1, 1, 0, 0] # one at a time, two at a time fltOpt = [1, 1] # Bus or Close-in, Bus or Close-in w/ outage outageLst = [] for br1 in bra: outageLst.append(br1) # fltR, fltX, clearPrev = 0, 0, 1 OlxAPILib.doFault(bhnd, fltConn, fltOpt, outageOpt, outageLst, fltR, fltX, clearPrev) # OlxAPILib.pick1stFault() NoFaults = 0 imax = 0 fdesmax = "" while True: NoFaults += 1 fdes = OlxAPILib.faultDescription() sres += "\n\n" + fdes sres += "\n " mag, ang = OlxAPILib.getSCCurrent(hnd=HND_SC, style=4) for i in range(3): sres += "," + (str(round(mag[i], 0)) + "@" + str(round(ang[i], 1))).ljust(15) if mag[i] > imax: imax = mag[i] fdesmax = fdes # if not OlxAPILib.pickNextFault(): break # sres += "\n\n" + str(NoFaults) + " Faults Simulated\n" sres += "\nMax fault current = " + str(round(imax, 0)) + "A found at:" sres += "\n" + fdesmax # return sres
def linez_fromBus(bsName, bsKV): bhnd = OlxAPI.FindBus(bsName, bsKV) allBr = OlxAPILib.getBusEquipmentData([bhnd], [TC_BRANCH], VT_INTEGER)[0][0] sres = "All lines from bus: " + OlxAPI.FullBusName(bhnd) sres += str("\nNo").ljust(6) + str(",Type ").ljust(15) sres += "," + str("Bus1").ljust(30) + "," + str("Bus2").ljust(30) + ",ID " sres += "," + "Z1".ljust(35) sres += "," + "Z0".ljust(35) sres += ",Length" # kd = 1 for hndBr in allBr: if OlxAPILib.branchIsLineComponent(hndBr): bra = OlxAPILib.lineComponents(hndBr) for bra1 in bra: s1 = getsImpedanceLine(kd, bra1) sres += s1 kd += 1 print(sres) return sres
def getRemoteTerminals(bhnd): """ Purpose: Find all remote end of all branches (from a bus) All taps are ignored. Close switches are included =>a test function of OlxAPILib.getRemoteTerminals(hndBr) Args : bhnd : bus handle returns : bus_res [] list of terminal bus Raises: OlrxAPIException """ br_res = OlxAPILib.getBusEquipmentData([bhnd], [TC_BRANCH], VT_INTEGER)[0][0] bus_res = [] # for br1 in br_res: ba = OlxAPILib.getRemoteTerminals(br1) bus_res.append(ba) return br_res, bus_res