11# -*- coding: utf-8 -*-
22from altdss import altdss
33
4- from pygridsim .configs import LOAD_CONFIGURATIONS
4+ from pygridsim .configs import NAME_TO_CONFIG
55from pygridsim .enums import LoadType
66from pygridsim .lines import _make_line
77from pygridsim .parameters import _make_generator , _make_load_node , _make_pv , _make_source_node
@@ -207,10 +207,12 @@ def clear(self):
207207 for key in self .counts :
208208 self .counts [key ] = 0
209209
210- def get_load_types (self , show_ranges : bool = False ):
210+ def get_types (self , component : str , show_ranges : bool = False ):
211211 """Provides list of all supported Load Types
212212
213213 Args:
214+ component (str):
215+ Which component to get, one of (one of "load", "source", "pv", "line")
214216 show_ranges (bool, optional):
215217 Whether to show all configuration ranges in output.
216218
@@ -219,12 +221,21 @@ def get_load_types(self, show_ranges: bool = False):
219221 A list containing all load types, if show_ranges False.
220222 A list of tuples showing all load types and configurations, if show_ranges True.
221223 """
224+ component_simplified = component .lower ().replace (" " , "" )
225+ if (component_simplified [- 1 ] == "s" ):
226+ component_simplified = component_simplified [:- 1 ]
227+ configuration = {}
228+ if component_simplified in NAME_TO_CONFIG :
229+ configuration = NAME_TO_CONFIG [component_simplified ]
230+ else :
231+ raise KeyError (f"Invalid component input: expect one of { [name for name in NAME_TO_CONFIG ]} " )
232+
222233 if not show_ranges :
223- return [load_type .value for load_type in LoadType ]
234+ return [component_type .value for component_type in configuration ]
224235
225- load_types = []
226- for load_type in LoadType :
227- config_dict = LOAD_CONFIGURATIONS [ load_type ]
228- load_types .append ((load_type .value , config_dict ))
236+ component_types = []
237+ for component_type in configuration :
238+ config_dict = configuration [ component_type ]
239+ component_types .append ((component_type .value , config_dict ))
229240
230- return load_types
241+ return component_types
0 commit comments