openego / eTraGo

Optimization of flexibility options for transmission grids based on PyPSA
GNU Affero General Public License v3.0
31 stars 13 forks source link

Check network after clustering and before running LOPF #556

Closed CarlosEpia closed 1 year ago

CarlosEpia commented 1 year ago

The integrity of the data in the network must be verified before running the LOPF. The multiple changes applied in the previous steps sometimes show unexpected results that lead to problems during the optimization.

pieterhexen commented 1 year ago

Hey @CarlosEpia , can you maybe elaborate on the unexpected results? Maybe there is something I am missing.

I clustered the network using the following parameters:

"method": "kmedoids-dijkstra",  
"n_clusters_AC": 300,  
"cluster_foreign_AC": False, 
"method_gas": "kmedoids-dijkstra",  
"n_clusters_gas": 43, 
"cluster_foreign_gas": False,

pre.network is the the network before clustering post.network ist the networkt after spatial clustering (AC and Gas)

pre.network.loads_t.p_set.sum().sum() == post.network.loads_t.p_set.sum().sum()

True

pre.network.loads_t.q_set.sum().sum() == post.network.loads_t.q_set.sum().sum()

True

pre.network.generators.p_nom.sum() == post.network.generators.p_nom.sum()

True

pre.network.stores.e_nom.sum() == post.network.stores.e_nom.sum()

True

pre.network.links.p_nom.sum() == post.network.links.p_nom.sum()

False --> There is a difference here in the carriers 'CH4' and 'H2_feedin' but this is intended

For some parameters (p_nom_max, e_nom_max, lifetime) at some e. g. links and generators the respective values are empty but should be inf. Because the default value is inf, this should not cause any problems.

The rest of the CH4 related data looks fine.

CarlosEpia commented 1 year ago

Hi Pieter. Thanks for your help. The idea is to double-check that all the values are preserved after the clustering and still make sense. For example, a couple of weeks ago it was found that for some lines the p_nom min was smaller than p_nom (in a previous step to the clustering). Regarding the parameters you mentioned (p_nom_max, e_nom_max, lifetime), I will check the problem.