44
55"""Power flow functions and classes"""
66
7+ import warnings
78from typing import Dict , Optional
89
910import numpy as np
@@ -50,18 +51,28 @@ def __init__(
5051 self .grid = grid or Grid .empty ()
5152 self .system_frequency = system_frequency
5253
53- self .input_data = input_data or {}
54+ self ._input_data = input_data or {}
5455 self .output_data : dict [str , NDArray ] = {}
5556 self .model : Optional [PowerGridModel ] = None
5657
58+ @property
59+ def input_data (self ) -> Dict [str , NDArray ]:
60+ """Get the input data for the PowerGridModel."""
61+ warnings .warn (
62+ "Input data has been made private and will be removed as public properety in a future version." ,
63+ DeprecationWarning ,
64+ stacklevel = 2 ,
65+ )
66+ return self ._input_data
67+
5768 def create_input_from_grid (self ):
5869 """
5970 Create input for the PowerGridModel
6071 """
6172 for array_name in PGM_ARRAYS :
6273 pgm_array = self ._create_power_grid_array (array_name = array_name )
63- self .input_data [array_name ] = pgm_array
64- return self .input_data
74+ self ._input_data [array_name ] = pgm_array
75+ return self ._input_data
6576
6677 def create_grid_from_input_data (self , check_ids : bool = True ) -> Grid :
6778 """
@@ -75,9 +86,9 @@ def create_grid_from_input_data(self, check_ids: bool = True) -> Grid:
7586 Returns a Grid object with the arrays filled with the PowerGridModel input.
7687 """
7788 for pgm_name in PGM_ARRAYS :
78- if pgm_name in self .input_data :
89+ if pgm_name in self ._input_data :
7990 pgm_ds_array_class = getattr (self .grid , pgm_name ).__class__
80- pgm_ds_array = pgm_ds_array_class (self .input_data [pgm_name ])
91+ pgm_ds_array = pgm_ds_array_class (self ._input_data [pgm_name ])
8192 self .grid .append (pgm_ds_array , check_max_id = False )
8293 if check_ids :
8394 self .grid .check_ids ()
@@ -155,6 +166,6 @@ def _match_dtypes(first_dtype: np.dtype, second_dtype: np.dtype):
155166 return list (set (first_dtype .names ).intersection (set (second_dtype .names ))) # type: ignore[arg-type]
156167
157168 def _setup_model (self ):
158- self .input_data = self .input_data or self .create_input_from_grid ()
159- self .model = PowerGridModel (self .input_data , system_frequency = self .system_frequency )
169+ self ._input_data = self ._input_data or self .create_input_from_grid ()
170+ self .model = PowerGridModel (self ._input_data , system_frequency = self .system_frequency )
160171 return self .model
0 commit comments