Skip to content
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

Feature/reinforce grid alternatives #340

Open
wants to merge 49 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2876936
A critical string load is remedied by a parallel
batuhansanliii Apr 30, 2022
227c098
test again
batuhansanliii May 2, 2022
0288bb4
Merge pull request #253 from openego/test
khelfen May 2, 2022
e76bd67
Split the feeder into 2 and Add new MV/LV substation at the half-leng…
batuhansanliii Jul 22, 2022
79501af
Added pseudo coordinates
Jul 27, 2022
763ddc1
Update version for plotting packages
Jul 28, 2022
0e47304
Improve plotting and pseudo_coordinates
Jul 28, 2022
0e4e7ae
Improve plotting with plotly and dash
Jul 29, 2022
6b9142c
Fix bugs and add tests
Jul 29, 2022
97f5bea
Bug fix missing hover label nodes
Jul 29, 2022
f1f8e97
Bug fix missing MV_Grid in dash_plot
Jul 29, 2022
8f4328a
Merge branch 'dev' of github.com:openego/eDisGo into feature/add_subs…
batuhansanliii Aug 2, 2022
fea46bc
Merge remote-tracking branch 'origin/features/add_pseudo_coordinates'…
batuhansanliii Aug 5, 2022
b903623
Optimal Relocation of CBs
batuhansanliii Aug 30, 2022
f1f37f6
Merge branch 'dev' into feature/optimize_loc_cb
khelfen Sep 19, 2022
fcd443e
config change
batuhansanliii Nov 15, 2022
1b0de11
Merge branch 'dev' into feature/optimize_loc_cb
batuhansanliii Nov 15, 2022
7d6c905
integration of new reinforcement methods
batuhansanliii Nov 20, 2022
fc31391
config_revert
batuhansanliii Nov 20, 2022
3aecfb0
integration_split+station
batuhansanliii Nov 27, 2022
d811c07
add split+station method to reinforce_grid_alternative
batuhansanliii Nov 28, 2022
576f38e
Debugging in the method "relocate circuit breaker"
batuhansanliii Dec 18, 2022
4d4a544
Integration of the method "relocate circuit breaker"
batuhansanliii Dec 18, 2022
f6d6b2b
add costs for cbs
batuhansanliii Dec 18, 2022
c71263a
add cost of cb
batuhansanliii Dec 18, 2022
efbd997
add alternative voltage issue reinforcement methods
batuhansanliii Jan 22, 2023
91a7ca2
add cost of each type of cables
batuhansanliii Jan 24, 2023
dcb68fb
add a cost for CB installation work
batuhansanliii Jan 24, 2023
3372184
add type_info for transformer data
batuhansanliii Jan 24, 2023
3103d63
minor change in costs.py
batuhansanliii Jan 25, 2023
df09453
add reinforcement voltage issues methods
batuhansanliii Jan 25, 2023
eadccc7
Integration of voltage issue reinforcement methods
batuhansanliii Jan 25, 2023
fe58bf8
Minor fix
batuhansanliii Jan 25, 2023
785dda0
Docstring fix
batuhansanliii Jan 26, 2023
81c591c
minor fix for the make pseudo coordinates function
batuhansanliii Jan 28, 2023
b8946fd
add load factor to plotly
batuhansanliii Jan 28, 2023
3ded3d0
Docstring update
batuhansanliii Jan 28, 2023
01fe217
Minor Corrections_reinforce
batuhansanliii Jan 29, 2023
493ec8c
Bug fix and changes in voltage issue reinforcement methods
batuhansanliii Feb 7, 2023
2e3fea4
fix all the errors
batuhansanliii Feb 12, 2023
1ca0f60
Merge branch 'dev' into feature/reinforce_grid_alternatives
batuhansanliii Feb 12, 2023
9e85bf3
minor fix
batuhansanliii Feb 19, 2023
b0540b1
changed the costs of cables
batuhansanliii Feb 24, 2023
db294bc
Revert "changed the costs of cables"
batuhansanliii Feb 24, 2023
894d4d8
cost update and minor changes in reinforce measures
batuhansanliii Feb 24, 2023
6b967a7
Structure updated
batuhansanliii Feb 24, 2023
43c8e90
Update the cost
batuhansanliii Apr 21, 2023
c8b9551
minor fix
batuhansanliii Apr 21, 2023
fcaacb7
bug fix
batuhansanliii Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions edisgo/config/config_grid_expansion_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ mv_lv_station_feed-in_case_max_v_deviation = 0.015
mv_load_case_transformer = 0.5
mv_load_case_line = 0.5
mv_feed-in_case_transformer = 1.0
mv_feed-in_case_line = 1.0
mv_feed-in_case_line = 1

lv_load_case_transformer = 1.0
lv_load_case_line = 1.0
lv_load_case_line = 1
lv_feed-in_case_transformer = 1.0
lv_feed-in_case_line = 1.0
lv_feed-in_case_line = 1

# costs
# ============
Expand All @@ -108,5 +108,10 @@ mv_cable_incl_earthwork_urban = 140
[costs_transformers]

# costs in kEUR, source: DENA Verteilnetzstudie
lv = 10
#LS+installation
lv = 60
mv = 1000

[costs_circuit_breakers]

circuit_breaker_installation_work=10
20 changes: 10 additions & 10 deletions edisgo/equipment/equipment-parameters_LV_cables.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km
#-,kV,kA,ohm/km,mH/km,uF/km
NAYY 4x1x300,0.4,0.419,0.1,0.279,0
NAYY 4x1x240,0.4,0.364,0.125,0.254,0
NAYY 4x1x185,0.4,0.313,0.164,0.256,0
NAYY 4x1x150,0.4,0.275,0.206,0.256,0
NAYY 4x1x120,0.4,0.245,0.253,0.256,0
NAYY 4x1x95,0.4,0.215,0.320,0.261,0
NAYY 4x1x50,0.4,0.144,0.449,0.270,0
NAYY 4x1x35,0.4,0.123,0.868,0.271,0
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km,cost
#-,kV,kA,ohm/km,mH/km,uF/km,kEuro/km
NAYY 4x1x300,0.4,0.419,0.1,0.279,0,12.75
NAYY 4x1x240,0.4,0.364,0.125,0.254,0,10.177
NAYY 4x1x185,0.4,0.313,0.164,0.256,0,7.834
NAYY 4x1x150,0.4,0.275,0.206,0.256,0,6.25
NAYY 4x1x120,0.4,0.245,0.253,0.256,0,5.075
NAYY 4x1x95,0.4,0.215,0.320,0.261,0,4.098
NAYY 4x1x50,0.4,0.144,0.449,0.270,0,2.27
NAYY 4x1x35,0.4,0.123,0.868,0.271,0,1.696
16 changes: 8 additions & 8 deletions edisgo/equipment/equipment-parameters_LV_transformers.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name,S_nom,u_kr,P_k
name,S_nom,u_kr,P_k,type_info,
#,MVA,%,MW
100 kVA,0.1,4,0.00175
160 kVA,0.16,4,0.00235
250 kVA,0.25,4,0.00325
400 kVA,0.4,4,0.0046
630 kVA,0.63,4,0.0065
800 kVA,0.8,6,0.0084
1000 kVA,1.0,6,0.00105
100 kVA,0.1,,4,0.00175,100 kVA 10/0.4 kV
160 kVA,0.16,4,0.00235,160 kVA 10/0.4 kV
250 kVA,0.25,4,0.00325,250 kVA 10/0.4 kV
400 kVA,0.4,4,0.0046,400 kVA 10/0.4 kV
630 kVA,0.63,4,0.0065,630 kVA 10/0.4 kV
800 kVA,0.8,6,0.0084,800 kVA 10/0.4 kV
1000 kVA,1.0,6,0.00105,1000 kVA 10/0.4 kV
24 changes: 12 additions & 12 deletions edisgo/equipment/equipment-parameters_MV_cables.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km
#-,kV,kA,ohm/km,mH/km,uF/km
NA2XS2Y 3x1x185 RM/25,10,0.357,0.164,0.38,0.41
NA2XS2Y 3x1x240 RM/25,10,0.417,0.125,0.36,0.47
NA2XS2Y 3x1x300 RM/25,10,0.466,0.1,0.35,0.495
NA2XS2Y 3x1x400 RM/35,10,0.535,0.078,0.34,0.57
NA2XS2Y 3x1x500 RM/35,10,0.609,0.061,0.32,0.63
NA2XS2Y 3x1x150 RE/25,20,0.319,0.206,0.4011,0.24
NA2XS2Y 3x1x240,20,0.417,0.13,0.3597,0.304
NA2XS(FL)2Y 3x1x300 RM/25,20,0.476,0.1,0.37,0.25
NA2XS(FL)2Y 3x1x400 RM/35,20,0.525,0.078,0.36,0.27
NA2XS(FL)2Y 3x1x500 RM/35,20,0.598,0.06,0.34,0.3
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km,cost
#-,kV,kA,ohm/km,mH/km,uF/km,kEuro/km
NA2XS2Y 3x1x185 RM/25,10,0.357,0.164,0.38,0.41,16.88
NA2XS2Y 3x1x240 RM/25,10,0.417,0.125,0.36,0.47,19.01
NA2XS2Y 3x1x300 RM/25,10,0.466,0.1,0.35,0.495,21.09
NA2XS2Y 3x1x400 RM/35,10,0.535,0.078,0.34,0.57,26.53
NA2XS2Y 3x1x500 RM/35,10,0.609,0.061,0.32,0.63,29.95
NA2XS2Y 3x1x150 RE/25,20,0.319,0.206,0.4011,0.24,15.54
NA2XS2Y 3x1x240,20,0.417,0.13,0.3597,0.304,19.01
NA2XS(FL)2Y 3x1x300 RM/25,20,0.476,0.1,0.37,0.25,21.09
NA2XS(FL)2Y 3x1x400 RM/35,20,0.525,0.078,0.36,0.27,26.53
NA2XS(FL)2Y 3x1x500 RM/35,20,0.598,0.06,0.34,0.3,29.95
14 changes: 7 additions & 7 deletions edisgo/equipment/equipment-parameters_MV_overhead_lines.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km
name,U_n,I_max_th,R_per_km,L_per_km,C_per_km,cost
#-,kV,kA,ohm/km,mH/km,uF/km
48-AL1/8-ST1A,10,0.21,0.35,1.11,0.0104
94-AL1/15-ST1A,10,0.35,0.33,1.05,0.0112
122-AL1/20-ST1A,10,0.41,0.31,0.99,0.0115
48-AL1/8-ST1A,20,0.21,0.37,1.18,0.0098
94-AL1/15-ST1A,20,0.35,0.35,1.11,0.0104
122-AL1/20-ST1A,20,0.41,0.34,1.08,0.0106
48-AL1/8-ST1A,10,0.21,0.35,1.11,0.0104,1.33
94-AL1/15-ST1A,10,0.35,0.33,1.05,0.0112,2.60
122-AL1/20-ST1A,10,0.41,0.31,0.99,0.0115,3.36
48-AL1/8-ST1A,20,0.21,0.37,1.18,0.0098,1.33
94-AL1/15-ST1A,20,0.35,0.35,1.11,0.0104,2.60
122-AL1/20-ST1A,20,0.41,0.34,1.08,0.0106,3.36
156 changes: 149 additions & 7 deletions edisgo/flex_opt/costs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import numpy as np
import pandas as pd

if "READTHEDOCS" not in os.environ:
Expand Down Expand Up @@ -173,7 +174,7 @@ def _get_line_costs(lines_added):
lines_added.index, "type_info"
].values,
"total_costs": line_costs.costs.values,
"length": (
"total cable length": (
lines_added.quantity * lines_added.length
).values,
"quantity": lines_added.quantity.values,
Expand All @@ -183,6 +184,43 @@ def _get_line_costs(lines_added):
),
]
)
# costs for circuit breakers
# get changed cbs
circuit_breakers = equipment_changes.loc[
equipment_changes.index.isin(edisgo_obj.topology.switches_df.index)
]

cb_changed = circuit_breakers.iloc[
(
circuit_breakers.equipment
== edisgo_obj.topology.switches_df.loc[
circuit_breakers.index, "type_info"
]
).values
]["quantity"].to_frame()

if not cb_changed.empty:
cb_costs = float(
edisgo_obj.config["costs_circuit_breakers"][
"circuit_breaker_installation_work"
]
)
costs = pd.concat(
[
costs,
pd.DataFrame(
{
"type": edisgo_obj.topology.switches_df.loc[
cb_changed.index, "type_info"
].values,
"total_costs": cb_costs,
"quantity": cb_changed.quantity.values,
"voltage_level": "mv",
},
index=cb_changed.index,
),
]
)

# if no costs incurred write zero costs to DataFrame
if costs.empty:
Expand Down Expand Up @@ -225,6 +263,54 @@ def line_expansion_costs(edisgo_obj, lines_names):
'costs_earthworks', 'costs_cable', 'voltage_level' for each line

"""

def cost_cable_types(mode):
"""

Parameters
----------
mode: mv or lv

Returns
-------
The cost of each line type
"""
# TODO: rewrite it with pd.merge or pd.concat
equipment_df = edisgo_obj.topology.lines_df[
edisgo_obj.topology.lines_df.index.isin(lines_names)
]
costs_cable = []
if mode == "mv":
voltage_mv_grid = edisgo_obj.topology.mv_grid.buses_df.v_nom[0]
mv_cable_df = (
edisgo_obj.topology.equipment_data[f"{mode}_cables"]
.loc[
edisgo_obj.topology.equipment_data[f"{mode}_cables"].U_n
== voltage_mv_grid
]
.loc[:, ["cost"]]
)
mv_overhead_lines = (
edisgo_obj.topology.equipment_data[f"{mode}_overhead_lines"]
.loc[
edisgo_obj.topology.equipment_data[f"{mode}_overhead_lines"].U_n
== voltage_mv_grid
]
.loc[:, ["cost"]]
)
cost_df = pd.concat([mv_cable_df, mv_overhead_lines])
else:
cost_df = edisgo_obj.topology.equipment_data[f"{mode}_cables"].loc[
:, ["cost"]
]

for equip_name1 in equipment_df.type_info:
for equip_name2 in cost_df.index:
if equip_name1 == equip_name2:
cost = cost_df.loc[cost_df.index.isin([equip_name1])].cost[0]
costs_cable.append(cost)
return costs_cable

lines_df = edisgo_obj.topology.lines_df.loc[lines_names, ["length"]]
mv_lines = lines_df[
lines_df.index.isin(edisgo_obj.topology.mv_grid.lines_df.index)
Expand All @@ -243,22 +329,24 @@ def line_expansion_costs(edisgo_obj, lines_names):
else:
population_density = "urban"

costs_cable_mv = float(edisgo_obj.config["costs_cables"]["mv_cable"])
costs_cable_lv = float(edisgo_obj.config["costs_cables"]["lv_cable"])
costs_cable_mv = np.array(cost_cable_types("mv"))
costs_cable_lv = np.array(cost_cable_types("lv"))
costs_cable_earthwork_mv = float(
edisgo_obj.config["costs_cables"][
"mv_cable_incl_earthwork_{}".format(population_density)
f"mv_cable_incl_earthwork_{population_density}"
]
)
costs_cable_earthwork_lv = float(
edisgo_obj.config["costs_cables"][
"lv_cable_incl_earthwork_{}".format(population_density)
f"lv_cable_incl_earthwork_{population_density}"
]
)

costs_lines = pd.DataFrame(
{
"costs_earthworks": (costs_cable_earthwork_mv - costs_cable_mv)
"costs_earthworks": (
[costs_cable_earthwork_mv] * len(costs_cable_mv) - costs_cable_mv
)
* lines_df.loc[mv_lines].length,
"costs_cable": costs_cable_mv * lines_df.loc[mv_lines].length,
"voltage_level": ["mv"] * len(mv_lines),
Expand All @@ -271,7 +359,10 @@ def line_expansion_costs(edisgo_obj, lines_names):
costs_lines,
pd.DataFrame(
{
"costs_earthworks": (costs_cable_earthwork_lv - costs_cable_lv)
"costs_earthworks": (
[costs_cable_earthwork_lv] * len(costs_cable_lv)
- costs_cable_lv
)
* lines_df.loc[lv_lines].length,
"costs_cable": costs_cable_lv * lines_df.loc[lv_lines].length,
"voltage_level": ["lv"] * len(lv_lines),
Expand All @@ -281,3 +372,54 @@ def line_expansion_costs(edisgo_obj, lines_names):
]
)
return costs_lines.loc[lines_df.index]


def cost_breakdown(edisgo_obj, lines_df):
"""

Parameters
----------
edisgo_obj: class:`~.edisgo.EDisGo`
eDisGo object of which lines of lines_df are part
lines: pandas.core.frame.DataFrame
the changed lines

Returns
-------
`pandas.DataFrame<DataFrame>`

Example
costs_earthworks costs_cable voltage_level costs
Line name 12.3840 2.0160 lv 14.40

"""
# cost-breakdown of changed lines
# get changed lines

lines_added = lines_df.iloc[
(
lines_df.equipment
== edisgo_obj.topology.lines_df.loc[lines_df.index, "type_info"]
).values
]["quantity"].to_frame()
lines_added_unique = lines_added.index.unique()
lines_added = (
lines_added.groupby(axis=0, level=0).sum().loc[lines_added_unique, ["quantity"]]
)
lines_added["length"] = edisgo_obj.topology.lines_df.loc[
lines_added.index, "length"
]
if not lines_added.empty:
costs_lines = line_expansion_costs(edisgo_obj, lines_added.index)
costs_lines["costs"] = costs_lines.apply(
lambda x: x.costs_earthworks
+ x.costs_cable * lines_added.loc[x.name, "quantity"],
axis=1,
)
costs_lines["costs_cable"] = costs_lines.apply(
lambda x: x.costs_cable * lines_added.loc[x.name, "quantity"],
axis=1,
)
else:
costs_lines = pd.DataFrame()
return costs_lines
Loading