Beispiel #1
0
# get paths to 345
Imp138PathDict = generate345PathList(
    CAPERaw, list(toGetPathSet)
)  # key: Important 138 bus, value: path, starting from the 138, ending in a 345
# generate a set of buses which belong to this path:

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
Beispiel #2
0
    genStartIndex = fileLines.index(
        '0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA') + 1
    genEndIndex = fileLines.index(
        '0 / END OF GENERATOR DATA, BEGIN BRANCH DATA')
    for i in range(genStartIndex, genEndIndex):
        words = fileLines[i].split(',')
        if len(words) < 2:
            continue
        Bus = words[0].strip()
        #if Bus in MappedPSSEGenBusSet:
        if Bus in GenBusSet:
            if Bus != '274847':  # special case, chosen to exclude
                verifiedGenLines.append(fileLines[i])

# this file contains the verified gen data
writeToFile(verifiedGenData, verifiedGenLines, '')

# gen map used later on
with open(GenBusMapLog, 'w') as f:
    f.write('PSSEBus->CAPEBus\n')
    for key in GenMapDict:
        mapStr = GenMapDict[key] + '->' + key
        f.write(mapStr)
        f.write('\n')
#print len(CAPEBusSet)

#################################

# start the process of mapping all the remaining buses

# map all the confirmed buses
Beispiel #3
0
            continue
        if Bus in AllToBeMappedSet and Bus not in ArtificialLoadBusSet:
            newBusLines.append(line)

        # get all the 345 or higher buses
        elif CAPEBusDataDict[Bus].area == '222' and float(
                CAPEBusDataDict[Bus].NominalVolt
        ) >= 345.0 and Bus not in ArtificialLoadBusSet:
            newBusLines.append(line)
            AllToBeMappedSet.add(Bus)

# these 2 lines are never read, so i am manually adding them
#newBusLines.append("243083,'05CAMPSS    ', 138.0000,1, 205,1251,   1,1.01145, -55.0773")
#newBusLines.append("658082,'MPSSE  7    ', 115.0000,1, 652,1624, 658,1.02055, -45.2697")

writeToFile(newBusData, newBusLines,
            '')  # writes all the lines in newBusLines to newBusData

# initialize '99' to be the ckt id for all the new loads (if any)
for Bus in AllToBeMappedSet:
    loadCktIDDict[Bus] = 99

# grab branch data properly
# only include branches where either Bus1 or Bus2 appears in the AllToBeMappedSet but in ArtificialLoadBusSet. These are the buses whose branches are all included.
# This strategy also ensures that only the branches connecting the artificial load bus to an important bus is included. Any other branches to artificial load buses are excluded
#  Boundary branches are already there in croppedBranchFile.txt, so they dont need to be included here

newBranchLines = []  # cropped branch data for comed
branchStartIndex = fileLines.index(
    '0 / END OF GENERATOR DATA, BEGIN BRANCH DATA') + 1
branchEndIndex = fileLines.index(
    '0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA')
Beispiel #4
0
# change MVA base in tf data if necessary
newRawLines.append('0 / END OF BRANCH DATA, BEGIN TRANSFORMER DATA')
i = tfStartIndex
while i < tfEndIndex:
	line = fileLines[i]
	words = line.split(',')
	Bus1 = words[0].strip()
	Bus2 = words[1].strip()
	Bus3 = words[2].strip()
	CZ = words[5].strip()

	# checked that all the tf in the raw file have CZ = 2, so no need to change tf impedance
	if Bus3 == '0':
		if CZ != '2':
			print line
		i+=4

	else:
		if CZ != '2':
			print line
		i+=5
	
"""




writeToFile(fixedCAPERaw,newRawLines,'')