Compare commits
3 Commits
mounting-p
...
rj45-delta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ffa98557f | ||
|
|
8d0daa11d1 | ||
|
|
b610d2956c |
@@ -1,6 +1,6 @@
|
|||||||
from numpy import array, ceil
|
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.ebom_calculator import EbomCalculator
|
||||||
from helix.calculators.mechanical_bom_calculator import MechanicalBomCalculator
|
from helix.calculators.mechanical_bom_calculator import MechanicalBomCalculator
|
||||||
from helix.constants.parts import *
|
from helix.constants.parts import *
|
||||||
@@ -51,8 +51,8 @@ class BomCalculator(object):
|
|||||||
column_count = sum(subarray.column_count for subarray in self.subarrays)
|
column_count = sum(subarray.column_count for subarray in self.subarrays)
|
||||||
parts_list = MechanicalBomCalculator(self.values, self.panels, self.subarrays).mechanical_bom()
|
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()
|
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)
|
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)
|
apply_package_size_rounding(parts_list, package_sizes)
|
||||||
return parts_list
|
return parts_list
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from math import ceil
|
|||||||
|
|
||||||
from helix.constants.panel_type import PanelType
|
from helix.constants.panel_type import PanelType
|
||||||
from helix.constants.parts import *
|
from helix.constants.parts import *
|
||||||
from helix.constants.inverter_brand import InverterBrand
|
|
||||||
|
|
||||||
# This story askes for this special parts to be showed
|
# This story askes for this special parts to be showed
|
||||||
# www.pivotaltracker.com/n/projects/1544689/stories/148016595
|
# 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
|
panel_type_counts[panel.panel_type] += 1
|
||||||
|
|
||||||
return panel_type_counts
|
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
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
from math import ceil
|
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 import ebom_parts
|
||||||
from helix.constants.ebom_parts import *
|
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.parts import wire_clip_large, cable_support, cable_support_lid, channel_nut, sunshade
|
||||||
from helix.constants.system_type import SystemType
|
from helix.constants.system_type import SystemType
|
||||||
from helix.constants.inverter_brand import InverterBrand
|
from helix.constants.inverter_brand import InverterBrand
|
||||||
|
from helix.forms.ebom_form import InverterBrandForm
|
||||||
|
|
||||||
|
|
||||||
class EbomCalculator(object):
|
class EbomCalculator(object):
|
||||||
@@ -38,8 +39,13 @@ class EbomCalculator(object):
|
|||||||
module_type = self.values.module_type()
|
module_type = self.values.module_type()
|
||||||
system_type = self.values.system_type()
|
system_type = self.values.system_type()
|
||||||
|
|
||||||
is_delta=is_inverter_delta(self.values)
|
is_delta=None
|
||||||
print("IS DELTA : ",is_delta)
|
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
|
inverter_count = 0
|
||||||
total_ac_run_length = 0
|
total_ac_run_length = 0
|
||||||
@@ -85,8 +91,6 @@ class EbomCalculator(object):
|
|||||||
for monitor in monitors:
|
for monitor in monitors:
|
||||||
if monitor['power_source'][0] == 'Switch Gear/External':
|
if monitor['power_source'][0] == 'Switch Gear/External':
|
||||||
add_parts_to_list(part_list, {proper_monitor_controller: 1}, 1)
|
add_parts_to_list(part_list, {proper_monitor_controller: 1}, 1)
|
||||||
if (is_delta):
|
|
||||||
add_parts_to_list(part_list, {ethernet_plug: 2},1)
|
|
||||||
|
|
||||||
add_parts_to_list(part_list, {wire_clip_large: inverter_count}, self.row_count)
|
add_parts_to_list(part_list, {wire_clip_large: inverter_count}, self.row_count)
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from helix.models.coordinate import Coordinate
|
|||||||
from helix.models.panel import PanelData, Panel
|
from helix.models.panel import PanelData, Panel
|
||||||
from helix.models.sql.inverter_brands import InverterBrand
|
from helix.models.sql.inverter_brands import InverterBrand
|
||||||
|
|
||||||
|
|
||||||
class UserValues(object):
|
class UserValues(object):
|
||||||
def __init__(self, store, site):
|
def __init__(self, store, site):
|
||||||
self.store = store
|
self.store = store
|
||||||
|
|||||||
@@ -491,8 +491,6 @@ class CalculatorTest(unittest.TestCase):
|
|||||||
|
|
||||||
assert_array_equal(sorted(self.subject.documentation_bom()), sorted(expected))
|
assert_array_equal(sorted(self.subject.documentation_bom()), sorted(expected))
|
||||||
|
|
||||||
# Performance Tests
|
|
||||||
|
|
||||||
def test_performance_with_1000ish_module_site(self):
|
def test_performance_with_1000ish_module_site(self):
|
||||||
store = Store(mockredis.mock_redis_client(), "foo")
|
store = Store(mockredis.mock_redis_client(), "foo")
|
||||||
|
|
||||||
|
|||||||
@@ -666,56 +666,6 @@ class EbomCalculatorTest(unittest.TestCase):
|
|||||||
|
|
||||||
assert_dictionary_equal(self.subject.compute_ebom(), expected_output)
|
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,
|
|
||||||
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_aux_plugs_on_switchgear_on_pseries_single_tilt(self):
|
def test_computes_ebom_with_aux_plugs_on_switchgear_on_pseries_single_tilt(self):
|
||||||
self.user_values.power_stations.return_value = [
|
self.user_values.power_stations.return_value = [
|
||||||
{
|
{
|
||||||
@@ -1161,6 +1111,7 @@ class EbomCalculatorTest(unittest.TestCase):
|
|||||||
self.user_values.system_type.return_value = SystemType.singleTilt
|
self.user_values.system_type.return_value = SystemType.singleTilt
|
||||||
self.user_values.module_type.return_value = ModuleType.Cell96
|
self.user_values.module_type.return_value = ModuleType.Cell96
|
||||||
|
|
||||||
|
|
||||||
expected_output = {
|
expected_output = {
|
||||||
monitor_power_plug: 1,
|
monitor_power_plug: 1,
|
||||||
stump: 0,
|
stump: 0,
|
||||||
@@ -1168,7 +1119,6 @@ class EbomCalculatorTest(unittest.TestCase):
|
|||||||
cable_support_lid: 0,
|
cable_support_lid: 0,
|
||||||
rear_skirt: 0,
|
rear_skirt: 0,
|
||||||
monitor_controller_480_v: 1,
|
monitor_controller_480_v: 1,
|
||||||
ethernet_plug: 2,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_dictionary_equal(self.subject.compute_ebom(), expected_output)
|
assert_dictionary_equal(self.subject.compute_ebom(), expected_output)
|
||||||
|
|||||||
Reference in New Issue
Block a user