Skip to content

Commit

Permalink
Calculate number of combiner boxes during electrical sizing (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Boyd committed Apr 19, 2023
1 parent 2a48674 commit 59ac38f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions examples/Detailed_PV_Layout/detailed_pv_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PVLayoutConfig:
interrack_spac: float # m

# Wiring config
nb_inputs_combiner: int # count

# Road config
perimetral_road: bool
Expand Down
3 changes: 2 additions & 1 deletion examples/Detailed_PV_Layout/detailed_pv_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self,
self.substation_coord = None
self.modules_per_string = None
self.n_strings = None
self.n_combiners = None
self.n_inverters = None
self.calculated_system_capacity = None
self.flicker_loss = 0
Expand Down Expand Up @@ -125,7 +126,7 @@ def _compute_string_config(self,
module_power = self.config.module_power
inverter_power=self.config.inverter_power

self.n_strings, self.n_inverters, self.calculated_system_capacity = size_electrical_parameters(
self.n_strings, self.n_combiners, self.n_inverters, self.calculated_system_capacity = size_electrical_parameters(
target_system_capacity=target_solar_kw,
target_dc_ac_ratio=self.parameters.dc_ac_ratio,
modules_per_string=self.modules_per_string,
Expand Down
21 changes: 11 additions & 10 deletions hybrid/layout/pv_design_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ def size_electrical_parameters(
modules_per_string: float,
module_power: float,
inverter_power: float,
n_inputs_inverter: float=50
n_inputs_inverter: float=50,
n_inputs_combiner: float=32,
):
"""
Calculates the number of strings and number of inverters to best match target dc_ac_ratio.
Calculates the number of strings, combiner boxes and inverters to best match target capacity and DC/AC ratio
:param target_system_capacity: target system capacity, kW
:param target_dc_ac_ratio: target DC-to-AC ratio
:param modules_per_string: modules per string
:param module_power: module power at maximum point point at reference conditions, kW
:param inverter_power: inverter maximum AC power, kW
:param n_inputs_inverter: number of inverter DC inputs
:param n_inputs_inverter: number of DC inputs per inverter
:param n_inputs_combiner: number of DC inputs per combiner box
:returns: calculated system capacity, kW
:returns: number of strings, number of combiner boxes, number of inverters, calculated system capacity, kW
"""
n_strings_frac = target_system_capacity / (modules_per_string * module_power)
n_strings = max(1, round(n_strings_frac))
Expand All @@ -104,11 +106,10 @@ def size_electrical_parameters(
inverter_power=inverter_power,
)

# Ensure there are enough enough inverters for the number of field connections
# TODO: implement get_n_combiner_boxes() and/or string inverter calculations to compute n_field_connections
n_field_connections = 1
while math.ceil(n_field_connections / n_inverters) > n_inputs_inverter:
n_inverters += 1
n_combiners = math.ceil(n_strings / n_inputs_combiner)

# Ensure there are enough enough inverters for the number of combiner boxes
max(n_inverters, math.ceil(n_combiners / n_inputs_inverter))

# Verify sizing was close to the target size, otherwise error out
calculated_system_capacity = verify_capacity_from_electrical_parameters(
Expand All @@ -118,7 +119,7 @@ def size_electrical_parameters(
module_power=module_power
)

return n_strings, n_inverters, calculated_system_capacity
return n_strings, n_combiners, n_inverters, calculated_system_capacity


def verify_capacity_from_electrical_parameters(
Expand Down
4 changes: 3 additions & 1 deletion tests/hybrid/test_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_hybrid_detailed_pv_only(site):
solar_only['grid']['interconnect_kw'] = 150e3

# autosize number of strings, number of inverters and adjust system capacity
n_strings, n_inverters, calculated_system_capacity = size_electrical_parameters(
n_strings, n_combiners, n_inverters, calculated_system_capacity = size_electrical_parameters(
target_system_capacity=solar_only['pv']['tech_config']['system_capacity'],
target_dc_ac_ratio=1.34,
modules_per_string=solar_only['pv']['tech_config']['subarray1_modules_per_string'],
Expand All @@ -207,6 +207,7 @@ def test_hybrid_detailed_pv_only(site):
inverter_power=solar_only['pv']['tech_config']['inv_snl_paco'] * 1e-3
)
assert n_strings == 13435
assert n_combiners == 420
assert n_inverters == 50
assert calculated_system_capacity == approx(50002.2, 1e-3)
solar_only['pv']['tech_config']['subarray1_nstrings'] = n_strings
Expand Down Expand Up @@ -334,6 +335,7 @@ def test_custom_layout(site):
# These are not:
nb_inputs_inverter=10,
interrack_spac=1,
nb_inputs_combiner=16,
perimetral_road=False,
setback_distance=10,
)
Expand Down
7 changes: 5 additions & 2 deletions tests/hybrid/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,26 @@ def test_system_electrical_sizing(site):
module_power = 0.310149 # [kW]
inverter_power = 753.2 # [kW]
n_inputs_inverter = 50
n_inputs_combiner = 16

n_strings, n_inverters, calculated_system_capacity = size_electrical_parameters(
n_strings, n_combiners, n_inverters, calculated_system_capacity = size_electrical_parameters(
target_system_capacity=target_solar_kw,
target_dc_ac_ratio=target_dc_ac_ratio,
modules_per_string=modules_per_string,
module_power=module_power,
inverter_power=inverter_power,
n_inputs_inverter=n_inputs_inverter,
n_inputs_combiner=n_inputs_combiner,
)
assert n_strings == 26869
assert n_combiners == 1680
assert n_inverters == 99
assert calculated_system_capacity == pytest.approx(1e5, 1e-3)

with pytest.raises(Exception) as e_info:
target_solar_kw_mod = 33
modules_per_string_mod = 24
n_strings, n_inverters, calculated_system_capacity = size_electrical_parameters(
n_strings, n_combiners, n_inverters, calculated_system_capacity = size_electrical_parameters(
target_system_capacity=target_solar_kw_mod,
target_dc_ac_ratio=target_dc_ac_ratio,
modules_per_string=modules_per_string_mod,
Expand Down

0 comments on commit 59ac38f

Please sign in to comment.