44
55"""Power flow functions and classes"""
66
7+ import warnings
78from typing import Dict , Optional
89
910import numpy as np
@@ -50,18 +51,29 @@ 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+ "Do not use it directly." ,
64+ DeprecationWarning ,
65+ stacklevel = 2 ,
66+ )
67+ return self ._input_data
68+
5769 def create_input_from_grid (self ):
5870 """
5971 Create input for the PowerGridModel
6072 """
6173 for array_name in PGM_ARRAYS :
6274 pgm_array = self ._create_power_grid_array (array_name = array_name )
63- self .input_data [array_name ] = pgm_array
64- return self .input_data
75+ self ._input_data [array_name ] = pgm_array
76+ return self ._input_data
6577
6678 def create_grid_from_input_data (self , check_ids : bool = True ) -> Grid :
6779 """
@@ -75,9 +87,9 @@ def create_grid_from_input_data(self, check_ids: bool = True) -> Grid:
7587 Returns a Grid object with the arrays filled with the PowerGridModel input.
7688 """
7789 for pgm_name in PGM_ARRAYS :
78- if pgm_name in self .input_data :
90+ if pgm_name in self ._input_data :
7991 pgm_ds_array_class = getattr (self .grid , pgm_name ).__class__
80- pgm_ds_array = pgm_ds_array_class (self .input_data [pgm_name ])
92+ pgm_ds_array = pgm_ds_array_class (self ._input_data [pgm_name ])
8193 self .grid .append (pgm_ds_array , check_max_id = False )
8294 if check_ids :
8395 self .grid .check_ids ()
@@ -155,6 +167,6 @@ def _match_dtypes(first_dtype: np.dtype, second_dtype: np.dtype):
155167 return list (set (first_dtype .names ).intersection (set (second_dtype .names ))) # type: ignore[arg-type]
156168
157169 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 )
170+ self ._input_data = self ._input_data or self .create_input_from_grid ()
171+ self .model = PowerGridModel (self ._input_data , system_frequency = self .system_frequency )
160172 return self .model
0 commit comments