Skip to content

Commit

Permalink
Merge pull request #319 from SimonRubenDrauz/develop
Browse files Browse the repository at this point in the history
bug in ext grids
  • Loading branch information
SimonRubenDrauz authored Nov 7, 2021
2 parents 899bb44 + 3630098 commit 853d4a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pandapipes/component_models/ext_grid_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def create_pit_node_entries(cls, net, node_pit, node_name):
:return: No Output.
"""
ext_grids = net[cls.table_name()]
ext_grids = ext_grids[ext_grids.in_service.values]

p_mask = np.where(np.isin(ext_grids.type.values, ["p", "pt"]))
press = ext_grids.p_bar.values[p_mask] * ext_grids.in_service.values[p_mask]
press = ext_grids.p_bar.values[p_mask]
junction_idx_lookups = get_lookup(net, "node", "index")[node_name]
junction = cls.get_connected_junction(net)
juncts_p, press_sum, number = _sum_by_group(junction.values[p_mask], press,
Expand All @@ -62,7 +63,7 @@ def create_pit_node_entries(cls, net, node_pit, node_name):
node_pit[index_p, EXT_GRID_OCCURENCE] += number

t_mask = np.where(np.isin(ext_grids.type.values, ["t", "pt"]))
t_k = ext_grids.t_k.values[t_mask] * ext_grids.in_service.values[t_mask]
t_k = ext_grids.t_k.values[t_mask]
juncts_t, t_sum, number = _sum_by_group(junction.values[t_mask], t_k,
np.ones_like(t_k, dtype=np.int32))
index = junction_idx_lookups[juncts_t]
Expand Down

0 comments on commit 853d4a2

Please sign in to comment.