Cut and paste Networks by Voltage Level

Hello everyone,

I am trying to do some task which consists of taking one transport network model and one distribution network model, and mixing them (intersect them) and as a result, obtaining a whole network with the best of both.

The original transmission network model (radial 400 kV and 220 kV) has also incorporated the 132 kv level but not complete. The transformers within are 2 winding transformers

The original distribution network model (132 kv, 66 kv) has also the transmission level ( 400 kV and 220 kv but not with the same detail as the transmission network model). This also uses 3 winding transformers.

I have tried to create a Python recursive function to do is this:

• Starts on one node of a certain voltage level and goes jumping from one bus to another. On each bus check if it is bonding with another voltage level through a transformer. If this is the case, it identifies the transformer on a list.
• If this bus 1 is attached through a non transformer branch with other bus 2, it erases the branch, change the bus 1 code to 4, and then on the bus 2 executes the same function, and so on (recursive).

This is the code:

def boundfinder(ibus,buses_frontera=[]):
jmenos=[]
indicador, jbus, kbus, ickt = psspy.nxtbrn3(ibus)
zerr,basekvi = psspy.busdat(ibus,'BASE')
zerr,basekvj = psspy.busdat(jbus,'BASE')
if kbus !=0:
print '3 wind trf 1er '+str(ibus)+' 2do '+str(jbus)+' 3rd '+str(kbus)+' id '+str(ickt)
buses_frontera.append((ibus,jbus,kbus,ickt))
elif basekvi==basekvj:
jerr=psspy.purgbrn(ibus,jbus,ickt)
jmenos.append(jbus)
else:
buses_frontera.append((ibus,jbus,"2 windings",ickt))
jmenos=jmenos[:-1]
for i in jmenos:
boundfinder(i,buses_frontera)
psspy.bus_chng_3(ibus,[4,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f],_s)
return buses_frontera


I am relatively new to Python, and as a result i am obtaining mediocre results. I would expect to obtain a network without a certain voltage level (branches erased, buses disconnected and the whole set of boundary nodes with other voltage levels (transformers). So i could export the more interesting voltage levels on each mode and add them on a new model (using Join after comparing the obtained lists of boundary nodes).

I thought this could work with just executing the function on one bus, (assuming that transport is radial), travelling every node on one voltage level, but sometimes gets stuck. If I make an appropiate guess from a central node, it works fine, letting some isolated buses without being disconnected now and then.

My questions: Are my ideas futile because is an easier way to do what i´m trying? I know that i could work with subsystems, but i expect to extend my code to also collect the load and generation which hangs from every boundary bus. In order to match them between models.

Is there a more efficient and/or elegant (pythonic way to do this?)

Have you ...

edit retag close merge delete

Sort by » oldest newest most voted

The normal approach should be to use standard PSSE-activities.

1. Open distribution network model and write a raw data file for the subsystem consisting of 132 kV and below. Select option "Add to working case".

2. Open transmission network model and PURG the subsystem consisting of 132 kV and below.

3. Read the raw data file from step 1 to add the detailed 132 & 66 kV system to the transmission system.

The two models are now merged. Use JOIN if the 132 kV transformers buses have different bus numbers in the transmission and distribution model.

more