Re: [External] [pypsa] BODF

42 views
Skip to first unread message

Fabian Neumann

unread,
Jun 23, 2022, 11:39:01 AM6/23/22
to py...@googlegroups.com
Hi Elias,

calculate_BODF is a function of the SubNetwork not the Network class.
Ths BODFs only propagate through the same synchronous zone. You need to
iterate over the sub networks to retrieve all BODF matrices:

n.determine_network_topology()
for sub_networks in n.sub_networks.obj:
bodf = sub_network.calculate_BODF()

Best wishes,

Fabian N

On 23.06.22 16:52, Elias Althoff wrote:
> Externe E-Mail: Oeffnen Sie Anhaenge oder Links nur, wenn Sie der Quelle vertrauen.
> External E-Mail: Be cautious before clicking any link or attachment!
>
> Dear all,
>
> im trying to calculate the BODF for my network, but I cant get it to
> work. Im simply using:
>
> BODF = network.calculate_BODF()
>
> as described in the documentation, but Im getting the error:
>
> AttributeError: 'Network' object has no attribute 'calculate_BODF'
>
> Is there something wrong with the way I call the function?
>
> Best wishes,
> Elias
>
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/57688ef9-cf3c-473a-9b32-3774c2f2c759n%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/57688ef9-cf3c-473a-9b32-3774c2f2c759n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Dr.-Ing.
Fabian Neumann (he/him)
Postdoctoral Researcher

Department of Digital Transformation in Energy Systems
Institute of Energy Technology
Technische Universität Berlin

Group website: https://tub-ensys.github.io
Personal website: https://neumann.fyi

Zoom: https://tu-berlin.zoom.us/my/fneum
Schedule Meeting: https://calendly.com/fneum

Visitor Address:
Einsteinufer 25 (TA 8)
10587 Berlin

My working hours may not be your working hours. Do not feel pressure to
reply to this email outside your working hours.

Elias Althoff

unread,
Jul 27, 2022, 9:28:42 AM7/27/22
to pypsa
Hi Fabian,

thanks for the answer. I tried your code and it seems that some SubNetwork cant be analysed so the code breaks ("ValueError: need at least one array to concatenate"). I think we talked about that some weeks ago and you told me it might be because of a single-node network. I dont really know how to solve that though, same goes for the sclopf. Is it nodes that are not connected to the grid at all? 

Anyhow, to get a better understanding of the process, I printed the BODF of the first SubNetwork, using this code:

network.determine_network_topology()
for sn in network.sub_networks.obj:
    sn.calculate_BODF()
    a = np.nan_to_num(sn.BODF)
    np.savetxt("foo.csv", a, delimiter=";")

It covers all my lines, so I wouldnt know where that subnetworks are that dont work. But for now Im just trying to understand:

Would the sclopf now set the contingency_factor to the maximum of the BODF in each line to calculate the needed extension of the lines? Or is there some other algorithm taking place? I think this is basic understanding of the n-1 process that I need here. The BODF I get are partly really high, so Im wondering what the sclopf would to with these values.

Maybe you could give me a hint, it would really help me out.

Best wishes,
Elias






Neumann, Fabian

unread,
Jul 27, 2022, 5:07:48 PM7/27/22
to Elias Althoff, pypsa
Hi Elias,

to find the single node networks (networks not connected to other nodes), you can iterate over them and inspect sn.buses(). 

I don’t know what you mean by contingency factor. The SCLOPF just adds some constraints:


If the BODF are high: do you split lines that represent many parallel lines?hen you should consider splitting them and defining outage lines. See examples here:


Best wishes,

Fabian N

On 27 Jul 2022, at 15:28, Elias Althoff <elias....@gmail.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to pypsa+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pypsa/bce3ab4a-d0f6-40c1-a60b-e9fe781e3512n%40googlegroups.com.

Elias Althoff

unread,
Jul 28, 2022, 7:15:18 AM7/28/22
to pypsa
Hi Fabian,

ah great, that helped finding the useless buses. I got one step closer to it. Now only it seems that the solver (glpk) has some difficulties:

WARNING:pypsa.contingency:No type given for l012, assuming it is a line
WARNING:pypsa.contingency:No type given for l013, assuming it is a line
WARNING:pypsa.contingency:No type given for l014, assuming it is a line
WARNING:pypsa.contingency:No type given for l015, assuming it is a line
INFO:pypsa.opf:Solving model using glpk
Solver log file: 'C:\Users\ELIAS~1.ALT\AppData\Local\Temp\8\tmp5oxwwjhi.glpk.log'
Solver solution file: 'C:\Users\ELIAS~1.ALT\AppData\Local\Temp\8\tmpbz279vi7.glpk.raw'
Solver problem files: ('C:\\Users\\ELIAS~1.ALT\\AppData\\Local\\Temp\\8\\tmpt1u_otr2.pyomo.lp',)
ERROR:pyomo.opt:Solver (glpk) returned non-zero return code (1)



What I ment by contingency factor is the maximum allowed load flow per line. Basically the s_max_pu. Before, I just set it to 0.7 for all branches to account for n-1 security. Now, when using the sclopf, will it iterate over all branches and set the s_max_pu to the maximum BODF for each line? 

Also: I saw the example, in which the sclopf is given some outage_branches to check for. But shouldnt it iterate over all lines for a real n-1-Security?

Best wishes,
Elias

Fabian Neumann

unread,
Jul 28, 2022, 8:01:55 AM7/28/22
to py...@googlegroups.com
Hi Elias,

can't help you with the solver unfortunately.

There is no "contingency_factor" set. Just the additional constraints as
described in the docs.

If you have multiple parallel branches with the same characteristics, it
suffices to add only one to the outage_branches as they will lead to
identical constraints.

Best wishes,

Fabian N

On 28.07.22 13:15, Elias Althoff wrote:
> Hi Fabian,
>
> ah great, that helped finding the useless buses. I got one step closer
> to it. Now only it seems that the solver (glpk) has some difficulties:
>
> WARNING:pypsa.contingency:No type given for l012, assuming it is a line
> WARNING:pypsa.contingency:No type given for l013, assuming it is a line
> WARNING:pypsa.contingency:No type given for l014, assuming it is a line
> WARNING:pypsa.contingency:No type given for l015, assuming it is a line
> INFO:pypsa.opf:Solving model using glpk
> Solver log file:
> 'C:\Users\ELIAS~1.ALT\AppData\Local\Temp\8\tmp5oxwwjhi.glpk.log'
> Solver solution file:
> 'C:\Users\ELIAS~1.ALT\AppData\Local\Temp\8\tmpbz279vi7.glpk.raw'
> Solver problem files:
> ('C:\\Users\\ELIAS~1.ALT\\AppData\\Local\\Temp\\8\\tmpt1u_otr2.pyomo.lp',)
> *ERROR:pyomo.opt:Solver (glpk) returned non-zero return code (1)*
>> <https://groups.google.com/d/msgid/pypsa/57688ef9-cf3c-473a-9b32-3774c2f2c759n%40googlegroups.com?utm_medium=email&utm_source=footer
>> <https://groups.google.com/d/msgid/pypsa/57688ef9-cf3c-473a-9b32-3774c2f2c759n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>>
>>
>> --
>> Dr.-Ing.
>> Fabian Neumann (he/him)
>> Postdoctoral Researcher
>>
>> Department of Digital Transformation in Energy Systems
>> Institute of Energy Technology
>> Technische Universität Berlin
>>
>> Group website: https://tub-ensys.github.io
>> <https://tub-ensys.github.io>
>> Personal website: https://neumann.fyi <https://neumann.fyi>
>>
>> Zoom: https://tu-berlin.zoom.us/my/fneum
>> <https://tu-berlin.zoom.us/my/fneum>
>> Schedule Meeting: https://calendly.com/fneum
>> <https://calendly.com/fneum>
>>
>> Visitor Address:
>> Einsteinufer 25 (TA 8)
>> 10587 Berlin
>>
>> My working hours may not be your working hours. Do not feel
>> pressure to
>> reply to this email outside your working hours.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "pypsa" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to pypsa+un...@googlegroups.com.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msgid/pypsa/bce3ab4a-d0f6-40c1-a60b-e9fe781e3512n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pypsa/bce3ab4a-d0f6-40c1-a60b-e9fe781e3512n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/a6a37391-cb92-418a-b8b6-d58b25f02e07n%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/a6a37391-cb92-418a-b8b6-d58b25f02e07n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Dr.-Ing.
Fabian Neumann (he/him)
Postdoctoral Researcher

Department of Digital Transformation in Energy Systems
Institute of Energy Technology
Technische Universität Berlin

Group website: https://tub-ensys.github.io
Personal website: https://neumann.fyi
Schedule Meeting: https://calendly.com/fneum
Reply all
Reply to author
Forward
0 new messages