Imp138FileLines = [] for key in Imp138PathDict.keys(): Imp138FileLines.append(Imp138PathDict[key]) path = Imp138PathDict[key] words = path.split('->') for bus in words: if float(CAPEBusDataDict[bus].NominalVolt) < 345.0: Imp138PathSet.add(bus.strip()) writeToFile(Imp138PathFile, Imp138FileLines, 'Path from Important 138 to nearest 345 (depthwise):') #print Imp138PathSet # get all the buses connected to 345 directly (or through midpoints) directTFConnSet = set() TFDataDict = getTFData(CAPERaw) # keys are the buses having transformers for Bus in CAPEBusDataDict.keys(): Area = CAPEBusDataDict[Bus].area Volt = float(CAPEBusDataDict[Bus].NominalVolt) if Area == '222' and Volt >= 345.0 and Bus in TFDataDict.keys(): toBusList = TFDataDict[Bus].toBus for tfNeighbour in toBusList: # deal with midpoints, get its neighbours which are not the bus itself NeighbourName = CAPEBusDataDict[tfNeighbour].name if NeighbourName.startswith('T3W') or NeighbourName.endswith('M'): necessaryMidpointSet.add(tfNeighbour) Depth2Neighbours = TFDataDict[tfNeighbour].toBus for d2Neighbour in Depth2Neighbours: if d2Neighbour != Bus and float(
# find all the 40 kV or lower buses which are causing significant mismatch ( > 500 MVA) and which have step up tf connections # also these tf cannot be mapped initially (by the CS guys) import sys sys.path.insert( 0, 'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2' ) from getTFDataFn import getTFData from getBusDataFn import getBusData CAPERaw = 'RAW0509.raw' manualMapFile = 'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2/' + 'mapped_buses_cleaned0407.csv' sortedMismatchData = 'sortedMismatchData0509.txt' TFDataDict = getTFData(CAPERaw) # get TF data BusDataDict = getBusData(CAPERaw) # get Bus data ManualMapDict = {} # get the manual maps with open(manualMapFile, 'r') as f: filecontent = f.read() fileLines = filecontent.split('\n') for line in fileLines: words = line.split(',') if len(words) < 2: continue PSSEBus = words[0].strip() CAPEBus = words[5].strip() PSSEBusCode = words[2].strip() if 'M' in PSSEBusCode: continue if PSSEBus in ['NA', '']: continue
import sys sys.path.insert(0,'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2/') from getTFDataFn import getTFData from generateBranchNeighboursFn import getBranchNeighbours autoTFMapFile = 'autoTFMap0505.txt' planningRaw = 'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2/' + 'hls18v1dyn_1219.raw' ComedLVBusSet = set() ComedLVLoadSet = set() BusVoltDict = {} BusLine = {} planningTFKeySet = set() TFDataDict = getTFData(planningRaw) BranchNeighbourDict = getBranchNeighbours(planningRaw) with open(autoTFMapFile, 'r') as f: filecontent = f.read() fileLines = filecontent.split('\n') for line in fileLines: if '->' not in line: continue words = line.split('->') planningTFKey = words[0].strip() planningTFKeySet.add(planningTFKey) # get the relevant comed bus sets
sys.path.insert( 0, 'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2' ) sys.path.insert( 0, 'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2/Raw with only 2 winders/Automate 345 kV mapping' ) from getBusDataType4IncludedFn import getBusData # create a dictionary which organizes all bus data from getTFDataFn import getTFData # get tf data CAPERaw = 'RAW0620.raw' # most updated merged raw file, with all verified mappings applied ZeroSeqFile = 'CAPENewSeq.seq' changeLog = 'changeBusNoLog.txt' CAPEBusDataDict = getBusData(CAPERaw) TFDataDict = getTFData(CAPERaw) changeOldToNewDict = {} tMapDict = {} winder3Set = set() CAPEMidPtDict = {} keySet = set() latestMapFile = 'latestMapFile.txt' manualtMapFile = 'tmap_manual.txt' tMapDictManual = {} # dict of all the manual maps # construct a dictionary of all comed midpoints, with the midpoint as the key and the tf connection set as value with open(manualtMapFile, 'r') as f: filecontent = f.read() fileLines = filecontent.split('\n') for line in fileLines: if '->' not in line: