Skip to content

Commit c3c6f20

Browse files
committed
Applying review suggestions.
Signed-off-by: Marnix van Lieshout <[email protected]>
1 parent f3f7c43 commit c3c6f20

File tree

3 files changed

+198
-528
lines changed

3 files changed

+198
-528
lines changed

src/power_grid_model_ds/_core/load_flow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,24 @@ def create_input_from_grid(self):
6363
self.input_data[array_name] = pgm_array
6464
return self.input_data
6565

66-
def create_grid_from_input_data(
67-
self,
68-
) -> Grid:
66+
def create_grid_from_input_data(self, check_ids: bool = True) -> Grid:
6967
"""
7068
Create Grid object from PowerGridModel input.
7169
Note that for some arrays, not all fields are available in the PowerGridModel input.
7270
In this case, the default values are used.
7371
72+
Args:
73+
check_ids: if True, check if the ids are unique
74+
7475
Returns a Grid object with the arrays filled with the PowerGridModel input.
7576
"""
7677
for pgm_name in PGM_ARRAYS:
7778
if pgm_name in self.input_data:
7879
pgm_ds_array_class = getattr(self.grid, pgm_name).__class__
7980
pgm_ds_array = pgm_ds_array_class(self.input_data[pgm_name])
8081
self.grid.append(pgm_ds_array, check_max_id=False)
82+
if check_ids:
83+
self.grid.check_ids()
8184
return self.grid
8285

8386
def calculate_power_flow(

0 commit comments

Comments
 (0)