Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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=[]):
     indicador = psspy.inibrn(ibus,2)
     jmenos=[]
    while indicador==0:
        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 a make an appropiate guess from a central node, it works fine, letting some isolated buses without disconnecting 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 ever faced this kind of problem?

Thank you in advance

Regards!

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=[]):
     indicador = psspy.inibrn(ibus,2)
     jmenos=[]
    while indicador==0:
        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 a I make an appropiate guess from a central node, it works fine, letting some isolated buses without disconnecting 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. models.

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

Have you ever faced this kind of problem?

Thank you in advance

Regards!