filecontent = f.read() fileLines = filecontent.split('\n') # grab bus data for line in fileLines: if line == '': continue if 'List of buses' in line: # skip the header file continue words = line.split(',') Bus = words[0].strip() ArtificialLoadBusSet.add(Bus) # generate artificial load bus data planningFlowData = BusFlowData(planningFlowReport, planningRaw) # flow data for planning artificialLoadLines = [ ] # lines which will contain all the artificial load data with open(ArtificialLoadMappingFile, 'r') as f: filecontent = f.read() fileLines = filecontent.split('\n') # grab artificial load mapping data for line in fileLines: if line == '': continue if 'CAPE' in line: continue outerwords = line.split('=') CAPESide = outerwords[0].strip()
""" Outputs any mismatches from given bus report data Has two modes: Output all the mismatch in a consolidated fashion Search manually for mismatch data """ # external functions and data from analyzeBusReportFn import BusFlowData # organize the bus flow data into a class structure from getBranchGroupFn import makeBranchGroups # this function will help map any ties to buses which are already mapped flowReport = 'BusReports_RAW0530.txt' CAPERaw = 'RAW0530.raw' mismatchDataFile = 'mismatchData0530.txt' # contains all the current mismatch data flowData = BusFlowData(flowReport, CAPERaw) """ Clues on how to access the data within flowData: Each key of flowData contains the following class class mismatchReport(object): def __init__(self): self.toBus = [] self.MWList = [] self.MVARList = [] self.MVAList = [] self.cktID = [] self.MismatchMVA = 0.0 self.MismatchMW = 0.0 self.MismatchMVAR = 0.0 """ BranchGroupDict = makeBranchGroups(CAPERaw) # every value here is a set
sampleLoadStr = " 4355,'1 ',1, 222, 20, 1.400, 0.600, 0.000, 0.000, 0.000, 0.000, 222,1,0" # change load data words = sampleLoadStr.split(',') words[0] = ' ' * (6 - len(toBus)) + toBus.strip() # change the bus info words[5] = ' ' * (10 - len(toBusMW)) + toBusMW # new load MW words[6] = ' ' * (10 - len(toBusMVAR)) + toBusMVAR # new load MVAR newLoadLine = reconstructLine2(words) return newLoadLine if __name__ == '__main__': from analyzeBusReportFn import BusFlowData planningFlowReport = 'BusReports_Planning.txt' planningRaw = 'hls18v1dyn_1219.raw' planningFlowData = BusFlowData(planningFlowReport, planningRaw) MapDict = {} MapFile = 'blue2red345.txt' # CAPE to planning updated bus map # get Mapping info with open(MapFile, 'r') as f: filecontent = f.read() fileLines = filecontent.split('\n') for line in fileLines: if line == '': continue words = line.split('->') CAPEBus = words[0].strip() try: PlanningBus = words[2].strip()
'C:/Users/Bikiran/Google Drive/Bus Mapping Project Original/Donut Hole Approach/Donut Hole v2' ) import math from getBusDataFn import getBusData from analyzeBusReportFn import BusFlowData # organize the bus flow data into a class structure from getBranchGroupFn import makeBranchGroups # this function will help map any ties to buses which are already mapped flowReport = 'BusReports_RAW0602_final.txt' # CAPE bus flow report CAPERaw = 'RAW0602.raw' mismatchDataFile = 'mismatchDataRAW0602_check.txt' # contains all the current mismatch data planningRaw = 'hls18v1dyn_1219.raw' MapFile = 'blue2red345.txt' # CAPE to planning updated bus map planningflowReport = 'BusReports_Planning.txt' # Planning bus flow report flowData = BusFlowData(flowReport, CAPERaw) planningflowData = BusFlowData(planningflowReport, planningRaw) planningBusDataDict = getBusData(planningRaw) CAPEBusDataDict = getBusData(CAPERaw) planningBusDataDict = getBusData(planningRaw) mismatchDictHighPriority = {} mismatchDictLowPriority = {} MapDict = {} #mismatchLinesHighPriority =[] #mismatchLinesLowPriority = [] """ Clues on how to access the data within flowData: Each key of flowData contains the following class class mismatchReport(object): def __init__(self): self.toBus = []