@@ -20,25 +20,13 @@ def _get_enum_obj(enum_class, enum_val):
2020 return enum_obj
2121
2222def _random_param (range ):
23- """
24- Given the range of a normal parameter (i.e. normal load for a house), uniformly select value.
25- In case the value is not a range and just a value, just return that value
26-
27- Args:
28- [lower_bound, upper_bound]; range of typical value
29- Return:
30- Randomly selected value in range
31- """
3223 if type (range ) is not list :
3324 return range
3425
3526 [max , min ] = range
3627 return random .random () * (max - min ) + min
3728
3829def _get_param (params , name , default ):
39- """
40- Get param or use default
41- """
4230 if name in params :
4331 return params [name ]
4432 else :
@@ -55,18 +43,6 @@ def _check_valid_params(params, valid_params):
5543 raise ValueError ("KV cannot be less than 0" )
5644
5745def _make_load_node (load_params , load_type , count ):
58- """
59- Make a load node with the parmeters given, filling in with defaults for
60- any undefined but required parameter. Parse through the parameters, potentially throwing errors and warnings if
61- one of the parameter names is invalid.
62-
63- Args:
64- load_params: any specified parameters to override default ones
65- load_type: LoadType representing type of load, house, commercial, industrial
66- count: how many loads have already been made, to not use repeat names
67- Return:
68- load object
69- """
7046 _check_valid_params (load_params , defaults .VALID_LOAD_PARAMS )
7147 load_type_obj = _get_enum_obj (LoadType , load_type )
7248
@@ -81,16 +57,6 @@ def _make_load_node(load_params, load_type, count):
8157 return load
8258
8359def _make_source_node (source_params , source_type ):
84- """
85- Make a source node with the parmeters given, filling in with defaults for
86- any undefined but required parameter. Parse through the parameters, potentially throwing errors and warnings if
87- one of the parameter names is invalid. Note that this updates the source node if one already exists
88-
89- Args:
90- source_params: any specified parameters to override default ones
91- Return:
92- source object
93- """
9460 _check_valid_params (source_params , defaults .VALID_SOURCE_PARAMS )
9561 source_type_obj = _get_enum_obj (SourceType , source_type )
9662
@@ -107,30 +73,13 @@ def _make_source_node(source_params, source_type):
10773 return source
10874
10975def _make_pv (load_node , params , num_panels , count ):
110- """
111- Make a PV at the load node given, scaling kV by the number of solar panels
112-
113- Args:
114- load_node: which load to add PVsystem to
115- params: any customized parameters
116- num_panels: representation of how many solar panels this PVsystem includes
117- count: how many pv already made, to not run into duplicates
118- """
11976 _check_valid_params (params , defaults .VALID_PV_PARAMS )
12077 pv : PVSystem = altdss .PVSystem .new ('pv' + str (count ))
12178 pv .Bus1 = load_node
12279 pv .Phases = _get_param (params , "phases" , defaults .PHASES )
12380 pv .kV = _get_param (params , "kV" , _random_param (defaults .SOLAR_PANEL_BASE_KV ) * num_panels )
12481
12582def _make_generator (params , gen_type , count ):
126- """
127- Make a generator in the circuit
128-
129- Args:
130- params: any customized parameters
131- gen_type: type of generator (small, large, industrial) in string
132- count: how many generators already made, to not run into duplicates
133- """
13483 _check_valid_params (params , defaults .VALID_GENERATOR_PARAMS )
13584 gen_type_obj = _get_enum_obj (GeneratorType , gen_type )
13685
0 commit comments