This commit is contained in:
GotPPay
2017-11-21 19:19:12 +01:00
parent 662a506a1a
commit d96ddabd61
3 changed files with 16 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
from numpy import array, ceil
from helix.calculators.bom_helper import add_parts_to_list, apply_package_size_rounding
from helix.calculators.bom_helper import add_parts_to_list, apply_package_size_rounding, is_inverter_delta
from helix.calculators.ebom_calculator import EbomCalculator
from helix.calculators.mechanical_bom_calculator import MechanicalBomCalculator
from helix.constants.parts import *
@@ -51,8 +51,8 @@ class BomCalculator(object):
column_count = sum(subarray.column_count for subarray in self.subarrays)
parts_list = MechanicalBomCalculator(self.values, self.panels, self.subarrays).mechanical_bom()
ebom_parts_list = EbomCalculator(self.values, ceil(row_count), ceil(column_count), parts_list.get(module)).compute_ebom()
add_parts_to_list(parts_list, ebom_parts_list)
if is_inverter_delta(self.values):
add_parts_to_list(parts_list, {rubber_foot: -1}, parts_list.get(rubber_foot))
apply_package_size_rounding(parts_list, package_sizes)
return parts_list

View File

@@ -2,6 +2,7 @@ from math import ceil
from helix.constants.panel_type import PanelType
from helix.constants.parts import *
from helix.constants.inverter_brand import InverterBrand
# This story askes for this special parts to be showed
# www.pivotaltracker.com/n/projects/1544689/stories/148016595
@@ -41,3 +42,12 @@ def get_panel_type_counts(panels):
panel_type_counts[panel.panel_type] += 1
return panel_type_counts
def is_inverter_delta(values):
try:
return (values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
except IndexError :
#Some tests are calculating bom without providing inverter brand so inverter_brands is empty
#for those tests, inverter brand is irrelevant
return False

View File

@@ -1,12 +1,11 @@
from math import ceil
from helix.calculators.bom_helper import add_parts_to_list
from helix.calculators.bom_helper import add_parts_to_list, is_inverter_delta
from helix.constants import ebom_parts
from helix.constants.ebom_parts import *
from helix.constants.parts import wire_clip_large, cable_support, cable_support_lid, channel_nut, sunshade
from helix.constants.system_type import SystemType
from helix.constants.inverter_brand import InverterBrand
from helix.forms.ebom_form import InverterBrandForm
class EbomCalculator(object):
@@ -39,13 +38,8 @@ class EbomCalculator(object):
module_type = self.values.module_type()
system_type = self.values.system_type()
is_delta=None
try:
is_delta=(self.values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
except IndexError :
#Some tests are calculating bom without providing inverter brand so inverter_brands is empty
#for those tests, inverter brand is irrelevant
is_delta=False
is_delta=is_inverter_delta(self.values)
print("IS DELTA : ",is_delta)
inverter_count = 0
total_ac_run_length = 0