Skip to content

Commit

Permalink
Bug fix check voltage deviation
Browse files Browse the repository at this point in the history
  • Loading branch information
birgits committed Nov 21, 2018
1 parent e42cb68 commit a301516
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions edisgo/flex_opt/check_tech_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,12 @@ def lv_voltage_deviation(network, mode=None, voltage_levels='mv_lv'):
nodes = lv_grid.graph.nodes()

if voltage_levels == 'lv':
# get voltage at primary side to calculate upper bound for
# feed-in case and lower bound for load case
v_lv_station_primary = network.results.v_res(
nodes=[lv_grid.station], level='mv').iloc[:, 0]
timeindex = v_lv_station_primary.index
if mode == 'station':
if mode == 'stations':
# get voltage at primary side to calculate upper bound for
# feed-in case and lower bound for load case
v_lv_station_primary = network.results.v_res(
nodes=[lv_grid.station], level='mv').iloc[:, 0]
timeindex = v_lv_station_primary.index
v_dev_allowed_per_case['feedin_case_upper'] = \
v_lv_station_primary + network.config[
'grid_expansion_allowed_voltage_deviations'][
Expand All @@ -513,12 +513,17 @@ def lv_voltage_deviation(network, mode=None, voltage_levels='mv_lv'):
'grid_expansion_allowed_voltage_deviations'][
'mv_lv_station_load_case_max_v_deviation']
else:
# get voltage at secondary side to calculate upper bound for
# feed-in case and lower bound for load case
v_lv_station_secondary = network.results.v_res(
nodes=[lv_grid.station], level='lv').iloc[:, 0]
timeindex = v_lv_station_secondary.index
v_dev_allowed_per_case['feedin_case_upper'] = \
v_lv_station_primary + network.config[
v_lv_station_secondary + network.config[
'grid_expansion_allowed_voltage_deviations'][
'lv_feedin_case_max_v_deviation']
v_dev_allowed_per_case['load_case_lower'] = \
v_lv_station_primary - network.config[
v_lv_station_secondary - network.config[
'grid_expansion_allowed_voltage_deviations'][
'lv_load_case_max_v_deviation']
v_dev_allowed_per_case['feedin_case_lower'] = pd.Series(
Expand Down

0 comments on commit a301516

Please sign in to comment.