-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify the effect of using/disregarding clustering by subnetworks in cluster_network #531
Comments
There is an issue for a run considering China under a conservative assumption "all AC -> DC" due to mismatch of the sub-networks with The network looks like that: The full error listing:
|
Same problem arises for Azerbaijan; 5 clusters: INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, loads, storage_units
Traceback (most recent call last):
File "/data/davidef/git_world/pypsa-earth/.snakemake/scripts/tmp_d6dfkjw.cluster_network.py", line 601, in <module>
clustering = clustering_for_n_clusters(
File "/data/davidef/git_world/pypsa-earth/.snakemake/scripts/tmp_d6dfkjw.cluster_network.py", line 466, in clustering_for_n_clusters
clustering = get_clustering_from_busmap(
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pypsa/networkclustering.py", line 378, in get_clustering_from_busmap
buses, linemap, linemap_p, linemap_n, lines, lines_t = get_buses_linemap_and_lines(
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pypsa/networkclustering.py", line 343, in get_buses_linemap_and_lines
lines, linemap_p, linemap_n, linemap, lines_t = aggregatelines(
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pypsa/networkclustering.py", line 307, in aggregatelines
lines = interlines_c.groupby(["bus0_s", "bus1_s"]).apply(aggregatelinegroup)
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pandas/core/groupby/groupby.py", line 1567, in apply
result = self._python_apply_general(f, self._selected_obj)
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pandas/core/groupby/groupby.py", line 1629, in _python_apply_general
values, mutated = self.grouper.apply(f, data, self.axis)
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pandas/core/groupby/ops.py", line 839, in apply
res = f(group)
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pypsa/networkclustering.py", line 300, in aggregatelinegroup
sub_network=consense["sub_network"](l["sub_network"]),
File "/home/davidef/miniconda3/envs/pypsa-earth/lib/python3.8/site-packages/pypsa/networkclustering.py", line 50, in consense
assert (
AssertionError: In Bus cluster sub_network the values of attribute sub_network do not agree:
Line
317780756_0 0
533034445_0 0
677666942_0 9
317109714_0 0
908699840_0 0
908980191_1 0
909703866_0 9
Name: sub_network, dtype: object |
It looks like the the isolated buses can remain in the network model after simplification. Our current approach (when we apply grouping by country only) captures such isolates buses when doing aggregation while PyPSA-Europe approach (when grouping by country and subnetwork is applied) just keep such buses as they are The graphic example for Azerbaijan (bus colors by sub_network) look as follows.
Caution: the pictures in this comment were obtained with
|
According to the discussion of this issue with @davide-f (Davide thanks a lot for insightful comments!), an additional analysis has been done to estimate generation and demand attached to the isolated buses. The network for Azerbaijan after simplification has been taken for this assessment considering two different tolerance values ( Quantification of the generation and demand attached to the isolated busesgroup_tolerance_buses: 500mgeneration
demand
group_tolerance_buses: 10kmgeneration
demand
Network outlinegroup_tolerance_buses: 500mgroup_tolerance_buses: 10km |
It looks like this issue is connected both with the clustering and simplification procedures and eventually is influenced with the osm cleaning approach. As discussed with @davide-f the plan to tackle it is
|
The comment corrected. @davide-f thanks a lot for cross-checking! Actually, I remember that we have discussed improvements of |
Just to keep a track of this issue: introducing the recent updates from PyPSA-Eur (#404 and #592) leads to resolving the issue observed for Azerbaijan model with 5 clusters but isolated buses still remain: Generally, the updates give a bit more realistic spatial distribution of the nodes:
That is hardly very meaningful from the modeling perspective but nice for the eye. |
Describe the Bug
In cluster_network L243 and L403, the clustering may be by country AND sub_network, as done in PyPSA-Eur.
In PyPSA-Earth we disregard this for simplicity, yet it now needs some study.
Moreover, the clustering shall address the improper matching of buses of different carrier types.
Consequences shall be investigated at least on:
The tests that shall be done are:
This issue is a remark that leverages on #506 and #530
The text was updated successfully, but these errors were encountered: