2 Commits

Author SHA1 Message Date
GotPPay
7d87849ba9 fix after rebase 2017-11-27 21:27:21 +01:00
GotPPay
3472fff26f code fix 2017-11-27 20:59:13 +01:00
7 changed files with 34 additions and 88 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, is_inverter_delta
from helix.calculators.bom_helper import add_parts_to_list, apply_package_size_rounding
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,7 +2,6 @@ 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
@@ -42,12 +41,3 @@ 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,11 +1,12 @@
from math import ceil
from helix.calculators.bom_helper import add_parts_to_list, is_inverter_delta
from helix.calculators.bom_helper import add_parts_to_list
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):
@@ -38,8 +39,13 @@ class EbomCalculator(object):
module_type = self.values.module_type()
system_type = self.values.system_type()
is_delta=is_inverter_delta(self.values)
print("IS DELTA : ",is_delta)
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
inverter_count = 0
total_ac_run_length = 0
@@ -93,7 +99,7 @@ class EbomCalculator(object):
add_parts_to_list(part_list, {stump: 1}, ceil(total_ac_run_length / 4.0))
cable_supports = self.calculate_cable_supports(panel_board_counts, len(standalone_inverters))
add_parts_to_list(part_list, {cable_support: 1, cable_support_lid: 1}, cable_supports)
add_parts_to_list(part_list, {rear_skirt: -1}, ceil(cable_supports*.38))
add_parts_to_list(part_list, {rear_skirt_1_1: -1}, ceil(cable_supports*.38))
dependent_part_list = {}

View File

@@ -55,7 +55,7 @@ class SingleTiltParts(object):
def module(self, module_type):
if module_type == ModuleType.Cell96:
rear_skirt_parts = rear_skirt
rear_skirt_parts = rear_skirt_1_1
spoiler_parts = spoiler
else:
rear_skirt_parts = rear_skirt_1_1

View File

@@ -118,7 +118,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2907,
cable_support_lid: 368,
cable_support: 368,
rear_skirt: -140,
rear_skirt_1_1: -140,
dc_switch_bracket: 2,
front_legs: 23,
back_legs: 23,
@@ -196,7 +196,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 513,
cable_support_lid: 0,
cable_support: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
rubber_foot: 9,
delta_inverter_leg: 9,
harness_4_string_mf: 4,
@@ -231,7 +231,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 171,
cable_support_lid: 0,
cable_support: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
rubber_foot: 3,
delta_inverter_leg: 3,
harness_4_string_mf: 2,
@@ -380,7 +380,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 270,
cable_support_lid: 270,
rear_skirt: -103,
rear_skirt_1_1: -103,
ethernet_plug: 7.2,
monitor_power_plug: 1,
sunshade_bolt: 12,
@@ -492,7 +492,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 270,
cable_support_lid: 270,
rear_skirt: -103,
rear_skirt_1_1: -103,
ethernet_plug: 7.2,
monitor_power_plug: 1,
sunshade_bolt: 12,
@@ -604,7 +604,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 270,
cable_support_lid: 270,
rear_skirt: -103,
rear_skirt_1_1: -103,
ethernet_plug: 7.2,
monitor_power_plug: 1,
fuseshade: 14,
@@ -630,7 +630,7 @@ class EbomCalculatorTest(unittest.TestCase):
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_controller_480_v:1,
}
@@ -650,57 +650,7 @@ class EbomCalculatorTest(unittest.TestCase):
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
monitor_controller_480_v:1,
flat_washer: 4,
channel_nut: 4,
hex_nut_three_eighths_16: 2,
front_legs: 1,
back_legs: 1,
inverter_link: 2,
inverter_rail: 1,
rubber_foot: 3,
hex_bolt_1_2: 9,
mounting_back_plate: 1,
}
assert_dictionary_equal(self.subject.compute_ebom(), expected_output)
def test_computes_ebom_with_power_monitor_DELTA_brand(self):
self.user_values.inverter_brands.return_value = [{'inverter_brand_id':2}]
self.user_values.power_monitors.return_value = [{
'monitor_id': 'foo',
'power_source': ('Switch Gear/External', None)
}]
self.user_values.system_type.return_value = SystemType.singleTilt
self.user_values.module_type.return_value = ModuleType.Cell96
expected_output = {
monitor_power_plug: 1,
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
monitor_controller_480_v:1,
}
assert_dictionary_equal(self.subject.compute_ebom(), expected_output)
def test_computes_ebom_with_power_monitor_SMA_brand(self):
self.user_values.inverter_brands.return_value = [{'inverter_brand_id':1}]
self.user_values.power_monitors.return_value = [{
'monitor_id': 'foo',
'power_source': ('Switch Gear/External', None)
}]
self.user_values.system_type.return_value = SystemType.singleTilt
self.user_values.module_type.return_value = ModuleType.Cell96
expected_output = {
monitor_power_plug: 1,
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_controller_480_v:1,
flat_washer: 4,
channel_nut: 4,
@@ -821,7 +771,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 694,
cable_support_lid: 694,
rear_skirt: -264,
rear_skirt_1_1: -264,
ethernet_plug: 7.2,
monitor_power_plug: 1,
fuseshade: 14,
@@ -972,7 +922,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 270,
cable_support_lid: 270,
rear_skirt: -103,
rear_skirt_1_1: -103,
ethernet_plug: 7.2,
monitor_power_plug: 1,
sunshade_bolt: 12,
@@ -1018,7 +968,7 @@ class EbomCalculatorTest(unittest.TestCase):
wire_clip_large: 2394,
cable_support: 270,
cable_support_lid: 270,
rear_skirt: -103,
rear_skirt_1_1: -103,
ethernet_plug: 7.2,
sunshade_bolt: 12,
sunshade_washer: 12,
@@ -1077,7 +1027,7 @@ class EbomCalculatorTest(unittest.TestCase):
mounting_back_plate: 1,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_power_plug: 1,
}
@@ -1096,7 +1046,7 @@ class EbomCalculatorTest(unittest.TestCase):
mounting_back_plate: 1,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_power_plug: 1,
}
@@ -1105,14 +1055,14 @@ class EbomCalculatorTest(unittest.TestCase):
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0
rear_skirt_1_1: 0
}
expected_output_240_pseries = {
stump: 0,
cable_support_lid: 0,
cable_support: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_controller_240_v: 1,
}
@@ -1166,7 +1116,7 @@ class EbomCalculatorTest(unittest.TestCase):
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_controller_480_v: 1,
ethernet_plug: 2,
}
@@ -1187,7 +1137,7 @@ class EbomCalculatorTest(unittest.TestCase):
stump: 0,
cable_support: 0,
cable_support_lid: 0,
rear_skirt: 0,
rear_skirt_1_1: 0,
monitor_controller_480_v:1,
flat_washer: 4,
channel_nut: 4,
@@ -1205,4 +1155,4 @@ class EbomCalculatorTest(unittest.TestCase):

View File

@@ -99,7 +99,7 @@ class MechanicalBomCalculatorWhenSingleTilt96CellTest(unittest.TestCase):
cross_tray: 5,
rubber_foot: 4.4,
front_skirt: 24,
rear_skirt: 44,
rear_skirt_1_1: 44,
leading_tray: 25,
ballast: 192,
anchor: 15, # 12 + the 3 seismic anchors

View File

@@ -43,13 +43,13 @@ Part # Description Total
514865 BOLT, HH, 3/8-16 X 1/2, 18-8 SS 350
515059 ASSY, WHIP TRAY W/FUSE CLIPS, INVERTER, HELIX 16
515928 FRONT SKIRT, HELIX ROOF 197
515929 REAR SKIRT, HELIX ROOF 1469
516043 AC SWITCH, CONNECTORIZED, HELIX ROOF 2
516045 AC SPLICE BOX, CONNECTORIZED, HELIX ROOF 1
517871 TRAY, LEADING, HELIX ROOF, RIVETED VERSION 210
518058 CONNECTOR, ETHERNET, PLUG, RJ-45, WEATHERPROOF, SHIELDED 15
518331 MOUNTING BACK PLATE, INVERTER/PANEL BOARD, HELIX ROOF/TRACKER 22
518477 WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS 425
520301 REAR SKIRT, HELIX ROOF V1.1 1469
521031 WASHER, FLAT, M10 X 20MM OD, SS 10
521794 DEFLECTOR, LH, HELIX ROOF V1.1 171
521795 DEFLECTOR, RH, HELIX ROOF V1.1 171
Can't render this file because it contains an unexpected character in line 10 and column 30.