Skip to content

Commit 4fb7b61

Browse files
authored
Merge pull request #732 from yerbol-akhmetov/fix_380kV
fix hardcoded 380kv
2 parents 8f49634 + 3a42ce4 commit 4fb7b61

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

config.default.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ load_options:
118118
scale: 1 # scales all load time-series, i.e. 2 = doubles load
119119

120120
electricity:
121+
base_voltage: 380.
121122
voltages: [220., 300., 380.]
122123
co2limit: 7.75e+7 # European default, 0.05 * 3.1e9*0.5, needs to be adjusted for Africa
123124
co2base: 1.487e+9 # European default, adjustment to Africa necessary

config.tutorial.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ load_options:
132132
scale: 1 # scales all load time-series, i.e. 2 = doubles load
133133

134134
electricity:
135+
base_voltage: 380.
135136
voltages: [220., 300., 380.]
136137
co2limit: 1.487e+9
137138
co2base: 1.487e+9

doc/configtables/electricity.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
,Unit,Values,Description
2+
base_voltage, kV, float, "Base voltage to which all lines are simplified/aggregated. Simplification preserves transmission capacities."
23
voltages, kV, "Any subset of {220., 300., 380.}", "Voltage levels considered."
34
co2limit,:math:`t_{CO_2-eq}/a`, float, "Cap on system total annual carbon dioxide equivalent emissions."
45
co2base,:math:`t_{CO_2-eq}/a`, float, "Reference value of system total annual carbon dioxide equivalent emissions. Used only if relative emission reduction target is specified in ``{opts}`` wildcard."

doc/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ PyPSA-Earth 0.2.0
111111

112112
* Update instructions on how to write documentation. `PR #720 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/720>`__
113113

114+
* Fix hard-coded simplification of lines to 380kV. `PR #732 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/732>`__
115+
114116
PyPSA-Earth 0.1.0
115117
=================
116118

scripts/simplify_network.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,20 @@
110110
logger = logging.getLogger(__name__)
111111

112112

113-
def simplify_network_to_380(n, linetype):
113+
def simplify_network_to_base_voltage(n, linetype, base_voltage):
114114
"""
115-
Fix all lines to a voltage level of 380 kV and remove all transformers.
115+
Fix all lines to a voltage level of base voltage level and remove all transformers.
116116
The function preserves the transmission capacity for each line while updating
117117
its voltage level, line type and number of parallel bundles (num_parallel).
118118
Transformers are removed and connected components are moved from their
119119
starting bus to their ending bus. The corresponding starting buses are
120120
removed as well.
121121
"""
122-
logger.info("Mapping all network lines onto a single 380kV layer")
122+
logger.info(f"Mapping all network lines onto a single {int(base_voltage)}kV layer")
123123

124-
linetype_380 = linetype
125-
n.lines["type"] = linetype_380
126-
n.lines["v_nom"] = 380
127-
n.lines["i_nom"] = n.line_types.i_nom[linetype_380]
124+
n.lines["type"] = linetype
125+
n.lines["v_nom"] = base_voltage
126+
n.lines["i_nom"] = n.line_types.i_nom[linetype]
128127
# Note: s_nom is set in base_network
129128
n.lines["num_parallel"] = n.lines.eval("s_nom / (sqrt(3) * v_nom * i_nom)")
130129

@@ -715,7 +714,8 @@ def merge_isolated_nodes(n, threshold, aggregation_strategies=dict()):
715714

716715
n = pypsa.Network(snakemake.input.network)
717716

718-
linetype = snakemake.config["lines"]["types"][380.0]
717+
base_voltage = snakemake.config["electricity"]["base_voltage"]
718+
linetype = snakemake.config["lines"]["types"][base_voltage]
719719

720720
aggregation_strategies = snakemake.config["cluster_options"].get(
721721
"aggregation_strategies", {}
@@ -725,7 +725,7 @@ def merge_isolated_nodes(n, threshold, aggregation_strategies=dict()):
725725
p: {k: getattr(pd.Series, v) for k, v in aggregation_strategies[p].items()}
726726
for p in aggregation_strategies.keys()
727727
}
728-
n, trafo_map = simplify_network_to_380(n, linetype)
728+
n, trafo_map = simplify_network_to_base_voltage(n, linetype, base_voltage)
729729

730730
Nyears = n.snapshot_weightings.objective.sum() / 8760
731731

0 commit comments

Comments
 (0)