1 Commits

Author SHA1 Message Date
GotPPay
3eb3463d50 value edit; test fix 2017-11-27 20:27:56 +01:00
24 changed files with 550 additions and 488 deletions

View File

@@ -60,14 +60,37 @@ class DualTilt128CellConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
if panel_type == PanelType.Corner: values_per_panel_type = {
return [108.66, 110.96, 112.11, 116.44, 119.62, 122.80, 125.98][tray_count] PanelType.Corner: [122.70,
elif panel_type == PanelType.NorthSouth: 124.55,
return [107.58, 109.88, 111.03, 114.21, 117.39, 120.57, 123.75][tray_count] 126.40,
elif panel_type == PanelType.EastWest: 129.55,
return [103.19, 105.49, 105.49, 108.67, 111.85, 115.03, 118.21][tray_count] 132.71,
else: 135.86,
return [102.11, 104.41, 104.41, 107.59, 110.77, 113.95, 117.13][tray_count] 139.01][tray_count],
PanelType.NorthSouth: [121.63,
123.48,
125.33,
128.48,
131.64,
134.79,
137.94][tray_count],
PanelType.EastWest: [118.28,
120.13,
121.99,
125.14,
128.29,
131.45,
134.60][tray_count],
PanelType.Middle: [117.21,
119.06,
120.92,
124.07,
127.22,
130.38,
133.53][tray_count],
}
return values_per_panel_type.get(panel_type)
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth: if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth:

View File

@@ -60,23 +60,38 @@ class DualTilt96CellConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth: values_per_panel_type = {
return [92.58, PanelType.Corner: [92.41,
94.31, 94.26,
96.03, 96.12,
98.33, 98.54,
100.63, 100.97,
102.93, 103.39,
105.23][tray_count] 105.82][tray_count],
else: PanelType.NorthSouth: [91.63,
return [87.11, 93.48,
88.84, 95.33,
89.41, 97.76,
91.71, 100.18,
94.01, 102.61,
96.31, 105.03][tray_count],
98.61][tray_count] PanelType.EastWest: [88.00,
89.85,
91.70,
94.13,
96.55,
98.98,
101.40][tray_count],
PanelType.Middle: [87.21,
89.06,
90.92,
93.34,
95.77,
98.19,
100.62][tray_count],
}
return values_per_panel_type.get(panel_type)
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth: if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth:
return [7.5, 10, 15] return [7.5, 10, 15]

View File

@@ -60,14 +60,37 @@ class DualTiltPSeriesConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
if panel_type == PanelType.Corner: values_per_panel_type = {
return [103.66, 105.96, 107.11, 111.44, 114.62, 117.80, 120.98][tray_count] PanelType.Corner: [116.70,
elif panel_type == PanelType.NorthSouth: 118.55,
return [102.58, 104.88, 106.03, 109.21, 112.39, 115.57, 118.75][tray_count] 120.40,
elif panel_type == PanelType.EastWest: 123.55,
return [98.19, 100.49, 100.49, 103.67, 106.85, 110.03, 113.21][tray_count] 126.71,
else: 129.86,
return [97.11, 99.41, 99.41, 102.59, 105.77, 108.95, 112.13][tray_count] 133.01][tray_count],
PanelType.NorthSouth: [115.63,
117.48,
119.33,
122.48,
125.64,
128.79,
131.94][tray_count],
PanelType.EastWest: [112.28,
114.13,
115.99,
119.14,
122.29,
125.45,
128.60][tray_count],
PanelType.Middle: [111.21,
113.06,
114.92,
118.07,
121.22,
124.38,
127.53][tray_count],
}
return values_per_panel_type.get(panel_type)
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth: if panel_type == PanelType.Corner or panel_type == PanelType.NorthSouth:

View File

@@ -131,14 +131,10 @@ class SingleTilt128CellConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
if panel_type == PanelType.Corner: return [[68.02, 68.02, 71.17, 74.32],
return [71.91, 71.91, 75.09, 78.27][tray_count] [65.05, 65.05, 68.20, 71.35],
elif panel_type == PanelType.NorthSouth: [65.87, 67.73, 70.88, 74.03],
return [65.8, 65.8, 68.98, 72.16][tray_count] [63.26, 65.11, 68.26, 71.41]][panel_type.index()][tray_count]
elif panel_type == PanelType.EastWest:
return [69.75, 72.05, 75.23, 78.41][tray_count]
else:
return [65.08, 67.38, 70.56, 73.74][tray_count]
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
return [[0, 13.0], return [[0, 13.0],

View File

@@ -130,10 +130,10 @@ class SingleTilt96CellConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
return [[54.50, 54.50, 56.80, 59.10], return [[51.10, 51.10, 53.52, 55.95],
[49.47, 49.47, 51.77, 54.07], [48.13, 48.13, 50.55, 52.98],
[53.42, 55.72, 58.02, 60.32], [49.24, 51.09, 53.52, 55.94],
[48.75, 51.05, 53.35, 55.65]][panel_type.index()][tray_count] [48.33, 50.19, 52.61, 55.04]][panel_type.index()][tray_count]
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
return [[0, 12.0], return [[0, 12.0],

View File

@@ -130,14 +130,10 @@ class SingleTiltPSeriesConstants(object):
return 1, 1 return 1, 1
def base_weight(self, panel_type, tray_count): def base_weight(self, panel_type, tray_count):
if panel_type == PanelType.Corner: return [[65.02, 65.02, 68.17, 71.32],
return [66.91, 66.91, 70.09, 73.27][tray_count] [62.05, 62.05, 65.20, 68.35],
elif panel_type == PanelType.NorthSouth: [62.87, 64.73, 67.88, 71.03],
return [60.8, 60.8, 63.98, 67.16][tray_count] [60.26, 62.11, 65.26, 68.41]][panel_type.index()][tray_count]
elif panel_type == PanelType.EastWest:
return [64.75, 67.05, 70.23, 73.41][tray_count]
else:
return [60.08, 62.38, 65.56, 68.74][tray_count]
def link_tray_thresholds(self, panel_type): def link_tray_thresholds(self, panel_type):
return [[0, 13.0], return [[0, 13.0],

View File

@@ -28,7 +28,7 @@ class BallastAndTrayCountTest(unittest.TestCase):
eq_(result.ballast_count, 0) eq_(result.ballast_count, 0)
eq_(result.link_tray_count, 0) eq_(result.link_tray_count, 0)
eq_(result.cross_tray_count, 0) eq_(result.cross_tray_count, 0)
eq_(result.system_weight, 69.75) eq_(result.system_weight, 65.87)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_no_trays(self): def test_ballast_no_trays(self):
@@ -38,27 +38,27 @@ class BallastAndTrayCountTest(unittest.TestCase):
eq_(result.ballast_count, 4) eq_(result.ballast_count, 4)
eq_(result.link_tray_count, 0) eq_(result.link_tray_count, 0)
eq_(result.cross_tray_count, 0) eq_(result.cross_tray_count, 0)
eq_(result.system_weight, 69.75) eq_(result.system_weight, 65.87)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_link_trays(self): def test_ballast_and_link_trays(self):
self.force_to_resist = 230 self.force_to_resist = 230
result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count) result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count)
eq_(result.ballast_count, 8) eq_(result.ballast_count, 9)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 0) eq_(result.cross_tray_count, 0)
eq_(result.system_weight, 72.05) eq_(result.system_weight, 67.73)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_oscillate_between_0_and_1_link_trays(self): def test_ballast_and_oscillate_between_0_and_1_link_trays(self):
self.force_to_resist = 210 self.force_to_resist = 210
result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count) result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count)
eq_(result.ballast_count, 7) eq_(result.ballast_count, 8)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 0) eq_(result.cross_tray_count, 0)
eq_(result.system_weight, 72.05) eq_(result.system_weight, 67.73)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_link_tray_and_cross_tray(self): def test_ballast_and_link_tray_and_cross_tray(self):
@@ -68,17 +68,17 @@ class BallastAndTrayCountTest(unittest.TestCase):
eq_(result.ballast_count, 16) eq_(result.ballast_count, 16)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 1) eq_(result.cross_tray_count, 1)
eq_(result.system_weight, 75.23) eq_(result.system_weight, 70.88)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_link_tray_and_oscillate_between_0_and_1_cross_trays(self): def test_ballast_and_link_tray_and_oscillate_between_0_and_1_cross_trays(self):
self.force_to_resist = 330 self.force_to_resist = 330
result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count) result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count)
eq_(result.ballast_count, 13) eq_(result.ballast_count, 14)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 0) eq_(result.cross_tray_count, 0)
eq_(result.system_weight, 72.05) eq_(result.system_weight, 67.73)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_link_tray_and_2_cross_trays(self): def test_ballast_and_link_tray_and_2_cross_trays(self):
@@ -88,17 +88,17 @@ class BallastAndTrayCountTest(unittest.TestCase):
eq_(result.ballast_count, 25) eq_(result.ballast_count, 25)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 2) eq_(result.cross_tray_count, 2)
eq_(result.system_weight, 78.41) eq_(result.system_weight, 74.03)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_link_tray_and_at_first_2_then_1_cross_trays(self): def test_ballast_and_link_tray_and_at_first_2_then_1_cross_trays(self):
self.force_to_resist = 515 self.force_to_resist = 515
result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count) result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count)
eq_(result.ballast_count, 22) eq_(result.ballast_count, 23)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 1) eq_(result.cross_tray_count, 2)
eq_(result.system_weight, 75.23) eq_(result.system_weight, 74.03)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, False)
def test_ballast_and_all_trays_and_anchor(self): def test_ballast_and_all_trays_and_anchor(self):
@@ -108,15 +108,15 @@ class BallastAndTrayCountTest(unittest.TestCase):
eq_(result.ballast_count, 35) eq_(result.ballast_count, 35)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 2) eq_(result.cross_tray_count, 2)
eq_(result.system_weight, 78.41) eq_(result.system_weight, 74.03)
eq_(result.needs_anchor, True) eq_(result.needs_anchor, True)
def test_ballast_and_all_trays_and_at_first_anchor_then_no_anchor(self): def test_ballast_and_all_trays_and_at_first_anchor_then_no_anchor(self):
self.force_to_resist = 675 self.force_to_resist = 675
result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count) result = self.subject.ballast_and_tray_count(self.force_to_resist, self.panel_type, self.ballast_block_weight, self.anchor_count)
eq_(result.ballast_count, 30) eq_(result.ballast_count, 31)
eq_(result.link_tray_count, 1) eq_(result.link_tray_count, 1)
eq_(result.cross_tray_count, 2) eq_(result.cross_tray_count, 2)
eq_(result.system_weight, 78.41) eq_(result.system_weight, 74.03)
eq_(result.needs_anchor, False) eq_(result.needs_anchor, True)

View File

@@ -48,23 +48,23 @@ class BallastCalculatorWhenDualTiltAnd128CellTest(unittest.TestCase):
expected_value = { expected_value = {
PanelType.Corner: { PanelType.Corner: {
'anchors': [3, 2, 0, 0, 0], 'anchors': [3, 2, 0, 0, 0],
'ballast blocks': [15, 14, 25, 12, 0], 'ballast blocks': [14, 13, 25, 12, 0],
'pressure': ['8.14', '7.74', '12.11', '6.88', '2.12'] 'pressure': ['8.00', '7.61', '12.36', '7.16', '2.40']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [3, 2, 0, 0, 0], 'anchors': [3, 2, 0, 0, 0],
'ballast blocks': [7, 8, 22, 10, 0], 'ballast blocks': [6, 7, 21, 9, 0],
'pressure': ['4.90', '5.29', '10.83', '6.05', '2.10'] 'pressure': ['4.79', '5.18', '10.72', '5.93', '2.38']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [3, 2, 0, 0, 0], 'anchors': [3, 2, 0, 0, 0],
'ballast blocks': [8, 8, 22, 10, 0], 'ballast blocks': [7, 7, 21, 10, 0],
'pressure': ['5.25', '5.25', '10.78', '5.97', '2.02'] 'pressure': ['5.18', '5.18', '10.71', '6.29', '2.31']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [2, 0, 0, 0, 0], 'anchors': [2, 0, 0, 0, 0],
'ballast blocks': [15, 32, 18, 8, 0], 'ballast blocks': [14, 31, 17, 7, 0],
'pressure': ['8.02', '14.73', '9.13', '5.17', '1.99'] 'pressure': ['7.89', '14.66', '9.07', '5.10', '2.29']
}, },
} }
@@ -89,19 +89,19 @@ class BallastCalculatorWhenDualTiltAnd128CellTest(unittest.TestCase):
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0,
pressure=12.11), pressure=12.360800772863891),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=22, link_tray=2, cross_tray=1, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=21, link_tray=2, cross_tray=1, wind_anchors=0,
pressure=10.83), pressure=10.715259768140834),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0,
pressure=2.02), pressure=2.3107513954486905),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=15, link_tray=2, cross_tray=1, wind_anchors=3, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=2, cross_tray=1, wind_anchors=3,
pressure=8.14), pressure=8.001084156290254),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=31, link_tray=2, cross_tray=3, wind_anchors=0,
pressure=14.73), pressure=14.659635036496352),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=10, link_tray=1, cross_tray=0, wind_anchors=0, Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=9, link_tray=1, cross_tray=0, wind_anchors=0,
pressure=6.05), pressure=5.928870759982826),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=44, link_tray=2, cross_tray=4, wind_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=44, link_tray=2, cross_tray=4, wind_anchors=0,
pressure=19.65) pressure=19.907666380420782)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data),
@@ -120,20 +120,20 @@ class BallastCalculatorWhenDualTiltAnd128CellTest(unittest.TestCase):
self.values.ballast_block_weight.return_value = 20 self.values.ballast_block_weight.return_value = 20
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=30, link_tray=2, cross_tray=2, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=29, link_tray=2, cross_tray=2, wind_anchors=0,
pressure=14.06, fuzzy_wind_zone=True), pressure=13.923703, fuzzy_wind_zone=True),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0,
pressure=12.06, fuzzy_wind_zone=True), pressure=12.339897, fuzzy_wind_zone=True),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=1, link_tray=0, cross_tray=0, wind_anchors=0, Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0,
pressure=2.41, fuzzy_wind_zone=True), pressure=2.310751, fuzzy_wind_zone=True),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=10, link_tray=2, cross_tray=1, wind_anchors=4, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=9, link_tray=2, cross_tray=1, wind_anchors=4,
pressure=6.18, fuzzy_wind_zone=True, warnings=[PanelWarnings.MaxPsf]), pressure=6.047456, fuzzy_wind_zone=True, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=37, link_tray=2, cross_tray=4, wind_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=36, link_tray=2, cross_tray=4, wind_anchors=0,
pressure=16.75, fuzzy_wind_zone=True), pressure=16.674802, fuzzy_wind_zone=True),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0, Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0,
pressure=6.86, fuzzy_wind_zone=True), pressure=7.137190, fuzzy_wind_zone=True),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=7, link_tray=2, cross_tray=0, wind_anchors=3, Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=6, link_tray=2, cross_tray=0, wind_anchors=3,
pressure=4.93, fuzzy_wind_zone=True) pressure=4.813740, fuzzy_wind_zone=True)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data),
@@ -155,19 +155,19 @@ class BallastCalculatorWhenDualTiltAnd128CellTest(unittest.TestCase):
expected = [ expected = [
Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1,
ballast=11, link_tray=2, cross_tray=0, pressure=6.49), ballast=10, link_tray=2, cross_tray=0, pressure=6.376642335766423),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1,
ballast=6, link_tray=1, cross_tray=0, pressure=4.49), ballast=6, link_tray=1, cross_tray=0, pressure=4.756693860025763),
Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1,
ballast=0, link_tray=0, cross_tray=0, pressure=2.02), ballast=0, link_tray=0, cross_tray=0, pressure=2.3107513954486905),
Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0,
ballast=15, link_tray=2, cross_tray=1, pressure=8.14), ballast=14, link_tray=2, cross_tray=1, pressure=8.001084156290254),
Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1,
ballast=17, link_tray=2, cross_tray=2, pressure=8.81), ballast=16, link_tray=2, cross_tray=1, pressure=8.675476599398884),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1,
ballast=0, link_tray=0, cross_tray=0, pressure=2.10), ballast=0, link_tray=0, cross_tray=0, pressure=2.3761979390296264),
Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0,
ballast=14, link_tray=2, cross_tray=1, pressure=7.74), ballast=13, link_tray=2, cross_tray=1, pressure=7.610358522971233),
] ]
result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels) result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels)
@@ -211,35 +211,37 @@ class BallastCalculatorWhenDualTiltAnd128CellTest(unittest.TestCase):
] ]
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0, pressure=12.11), Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=25, link_tray=2, cross_tray=2, wind_anchors=0, pressure=12.360800772863891),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=22, link_tray=2, cross_tray=1, wind_anchors=0, pressure=10.83), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=21, link_tray=2, cross_tray=1, wind_anchors=0, pressure=10.715259768140834),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.02), Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.3107513954486905),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=15, link_tray=2, cross_tray=1, wind_anchors=3, pressure=8.14), Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=2, cross_tray=1, wind_anchors=3, pressure=8.001084156290254),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0, pressure=14.73), Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=31, link_tray=2, cross_tray=3, wind_anchors=0, pressure=14.659635036496352),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=10, link_tray=1, cross_tray=0, wind_anchors=0, pressure=6.05), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=9, link_tray=1, cross_tray=0, wind_anchors=0, pressure=5.928870759982826),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=14, link_tray=2, cross_tray=1, wind_anchors=2, pressure=7.74) Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=13, link_tray=2, cross_tray=1, wind_anchors=2, pressure=7.610358522971233)
] ]
print("===\r\n")
print(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data))
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), expected_value, decimal=2)
def test_ballast_count_when_base_weight_greater_than_uplift(self): def test_ballast_count_when_base_weight_greater_than_uplift(self):
expected = Panel(wind_zone=4, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=1.99) expected = Panel(wind_zone=4, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.289848)
assert self.subject.ballast_tray_and_anchor_count(4, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(4, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=21, link_tray=2, cross_tray=2, wind_anchors=2, pressure=7.91) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=19, link_tray=2, cross_tray=2, wind_anchors=2, pressure=7.682057)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=15, link_tray=2, cross_tray=2, wind_anchors=2, pressure=8.02) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=14, link_tray=2, cross_tray=1, wind_anchors=2, pressure=7.894025)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=24, link_tray=2, cross_tray=3, wind_anchors=2, pressure=7.85) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=22, link_tray=2, cross_tray=3, wind_anchors=2, pressure=7.704719)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self): def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self):
max_system_pressure = 0 max_system_pressure = 0
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=3, pressure=1.99) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=3, pressure=2.289848)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix, self.q_z).almost_equal( assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix, self.q_z).almost_equal(
expected, expected,

View File

@@ -49,22 +49,22 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
PanelType.Corner: { PanelType.Corner: {
'anchors': [3, 2, 0, 0, 0], 'anchors': [3, 2, 0, 0, 0],
'ballast blocks': [2, 5, 20, 10, 0], 'ballast blocks': [2, 5, 20, 10, 0],
'pressure': ['3.48', '5.03', '12.90', '7.62', '2.40'] 'pressure': ['3.48', '5.03', '12.91', '7.62', '2.39']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [2, 1, 0, 0, 0], 'anchors': [2, 1, 0, 0, 0],
'ballast blocks': [11, 15, 17, 8, 0], 'ballast blocks': [12, 15, 17, 8, 0],
'pressure': ['8.24', '10.32', '11.35', '6.59', '2.40'] 'pressure': ['8.75', '10.30', '11.34', '6.56', '2.37']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [2, 1, 0, 0, 0], 'anchors': [2, 1, 0, 0, 0],
'ballast blocks': [10, 14, 17, 8, 0], 'ballast blocks': [10, 14, 17, 8, 0],
'pressure': ['7.55', '9.63', '11.18', '6.46', '2.26'] 'pressure': ['7.62', '9.69', '11.24', '6.52', '2.28']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [2, 0, 0, 0, 0], 'anchors': [2, 0, 0, 0, 0],
'ballast blocks': [2, 22, 12, 5, 0], 'ballast blocks': [2, 22, 12, 5, 0],
'pressure': ['3.34', '13.83', '8.59', '4.85', '2.26'] 'pressure': ['3.34', '13.87', '8.63', '4.85', '2.26']
}, },
} }
@@ -90,15 +90,14 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
# Ballast, link tray, cross tray, anchor count, psf # Ballast, link tray, cross tray, anchor count, psf
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=20, link_tray=2, cross_tray=1, wind_anchors=0, pressure=12.90), Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=20, link_tray=2, cross_tray=1, wind_anchors=0, pressure=12.910398406374503),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=17, link_tray=2, cross_tray=1, wind_anchors=0, pressure=11.35), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=17, link_tray=2, cross_tray=1, wind_anchors=0, pressure=11.336414342629482),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.26), Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.2788844621513946),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=47, link_tray=2, cross_tray=4, wind_anchors=0, pressure=27.07), Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=47, link_tray=2, cross_tray=4, wind_anchors=0, pressure=27.082988047808765),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=22, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.82), Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=22, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.874521912350598),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=6.59), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=6.564223107569722),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=35, link_tray=2, cross_tray=3, wind_anchors=0, pressure=20.79) Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=35, link_tray=2, cross_tray=3, wind_anchors=0, pressure=20.8049203187251)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2)
def test_update_ballast(self): def test_update_ballast(self):
@@ -116,16 +115,19 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
] ]
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, ballast=5, link_tray=0, cross_tray=0, pressure=4.99), Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, ballast=5, link_tray=0, cross_tray=0, pressure=4.982729083665339),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=2, link_tray=0, cross_tray=0, pressure=3.43), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=2, link_tray=0, cross_tray=0, pressure=3.408745019920319),
Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.26), Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.2788844621513946),
Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, ballast=2, link_tray=1, cross_tray=0, pressure=3.48), Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, ballast=2, link_tray=1, cross_tray=0, pressure=3.4768525896414344),
Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, ballast=7, link_tray=2, cross_tray=0, pressure=5.94), Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, ballast=7, link_tray=2, cross_tray=0, pressure=5.98),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.40), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.3728884462151396),
Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0, ballast=5, link_tray=1, cross_tray=0, pressure=5.03) Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0, ballast=5, link_tray=1, cross_tray=0, pressure=5.030637450199203)
] ]
result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels) result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels)
print("===")
print(result)
print("===")
assert_array_is_close(result, expected_value, decimal=2) assert_array_is_close(result, expected_value, decimal=2)
def test_update_ballast_with_fuzzy_wind_zone(self): def test_update_ballast_with_fuzzy_wind_zone(self):
@@ -143,13 +145,13 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
] ]
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, ballast=9, link_tray=2, cross_tray=0, pressure=7.15, fuzzy_wind_zone=True), Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, ballast=9, link_tray=2, cross_tray=0, pressure=7.150517928286853, fuzzy_wind_zone=True),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=5, link_tray=0, cross_tray=0, pressure=4.99, fuzzy_wind_zone=True), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=5, link_tray=0, cross_tray=0, pressure=4.962529880478088, fuzzy_wind_zone=True),
Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.26, fuzzy_wind_zone=True), Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.2788844621513946, fuzzy_wind_zone=True),
Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, ballast=9, link_tray=2, cross_tray=0, pressure=7.15, fuzzy_wind_zone=True), Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, ballast=9, link_tray=2, cross_tray=0, pressure=7.150517928286853, fuzzy_wind_zone=True),
Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, ballast=11, link_tray=2, cross_tray=1, pressure=8.07, fuzzy_wind_zone=True), Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, ballast=11, link_tray=2, cross_tray=1, pressure=8.114382470119523, fuzzy_wind_zone=True),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.40, fuzzy_wind_zone=True), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, ballast=0, link_tray=0, cross_tray=0, pressure=2.3728884462151396, fuzzy_wind_zone=True),
Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0, ballast=11, link_tray=2, cross_tray=0, pressure=8.18, fuzzy_wind_zone=True) Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=2, seismic_anchors=0, ballast=11, link_tray=2, cross_tray=0, pressure=8.186374501992033, fuzzy_wind_zone=True)
] ]
result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels) result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels)
@@ -192,15 +194,14 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
] ]
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=20, link_tray=2, cross_tray=1, wind_anchors=0, pressure=12.90), Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=20, link_tray=2, cross_tray=1, wind_anchors=0, pressure=12.910398406374503),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=17, link_tray=2, cross_tray=1, wind_anchors=0, pressure=11.35), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=17, link_tray=2, cross_tray=1, wind_anchors=0, pressure=11.336414342629482),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.26), Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.2788844621513946),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=2, link_tray=1, cross_tray=0, wind_anchors=3, pressure=3.48), Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=2, link_tray=1, cross_tray=0, wind_anchors=3, pressure=3.4768525896414344),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=22, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.83), Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=22, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.874521912350598),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=6.59), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=6.564223107569722),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=5, link_tray=1, cross_tray=0, wind_anchors=2, pressure=5.03) Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=5, link_tray=1, cross_tray=0, wind_anchors=2, pressure=5.030637450199203)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2)
def test_ballast_count_when_base_weight_greater_than_uplift(self): def test_ballast_count_when_base_weight_greater_than_uplift(self):
@@ -212,11 +213,11 @@ class BallastCalculatorWhenDualTiltAnd96CellTest(unittest.TestCase):
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=45, link_tray=2, cross_tray=4, wind_anchors=0, pressure=18.87), Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=45, link_tray=2, cross_tray=4, wind_anchors=0, pressure=18.920438),
decimal=2) decimal=2)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0, pressure=19.07), Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0, pressure=19.116474),
decimal=2) decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):

View File

@@ -48,23 +48,23 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
expected_value = { expected_value = {
PanelType.Corner: { PanelType.Corner: {
'anchors': [4, 3, 0, 0, 0], 'anchors': [4, 3, 0, 0, 0],
'ballast blocks': [15, 10, 33, 16, 0], 'ballast blocks': [14, 10, 32, 16, 0],
'pressure': ['8.43', '6.38', '15.93', '8.83', '2.12'] 'pressure': ['8.26', '6.63', '15.76', '9.08', '2.39']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [4, 3, 0, 0, 0], 'anchors': [4, 3, 0, 0, 0],
'ballast blocks': [5, 2, 28, 14, 0], 'ballast blocks': [4, 2, 27, 13, 0],
'pressure': ['4.22', '2.97', '13.77', '7.90', '2.10'] 'pressure': ['4.08', '3.22', '13.63', '7.77', '2.37']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [4, 3, 0, 0, 0], 'anchors': [4, 3, 0, 0, 0],
'ballast blocks': [6, 3, 28, 14, 0], 'ballast blocks': [5, 2, 27, 13, 0],
'pressure': ['4.58', '3.29', '13.72', '7.86', '2.01'] 'pressure': ['4.49', '3.19', '13.63', '7.76', '2.30']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [3, 2, 0, 0, 0], 'anchors': [3, 2, 0, 0, 0],
'ballast blocks': [11, 10, 23, 11, 0], 'ballast blocks': [10, 10, 23, 11, 0],
'pressure': ['6.61', '6.20', '11.59', '6.61', '1.99'] 'pressure': ['6.51', '6.51', '11.90', '6.92', '2.28']
}, },
} }
@@ -104,27 +104,28 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
expected_value = { expected_value = {
PanelType.Corner: { PanelType.Corner: {
'anchors': [0, 0, 0, 0, 0], 'anchors': [0, 0, 0, 0, 0],
'ballast blocks': [8, 3, 0, 0, 0], 'ballast blocks': [7, 3, 0, 0, 0],
'pressure': ['4.79', '3.11', '2.12', '2.12', '2.12'] 'pressure': ['4.68', '3.37', '2.39', '2.39', '2.39']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [0, 0, 0, 0, 0], 'anchors': [0, 0, 0, 0, 0],
'ballast blocks': [3, 0, 0, 0, 0], 'ballast blocks': [3, 0, 0, 0, 0],
'pressure': ['3.08', '2.10', '2.10', '2.10', '2.10'] 'pressure': ['3.35', '2.37', '2.37', '2.37', '2.37']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [0, 0, 0, 0, 0], 'anchors': [0, 0, 0, 0, 0],
'ballast blocks': [4, 0, 0, 0, 0], 'ballast blocks': [3, 0, 0, 0, 0],
'pressure': ['3.32', '2.01', '2.01', '2.01', '2.01'] 'pressure': ['3.28', '2.30', '2.30', '2.30', '2.30']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [0, 0, 0, 0, 0], 'anchors': [0, 0, 0, 0, 0],
'ballast blocks': [1, 0, 0, 0, 0], 'ballast blocks': [0, 0, 0, 0, 0],
'pressure': ['2.32', '1.99', '1.99', '1.99', '1.99'] 'pressure': ['2.28', '2.28', '2.28', '2.28', '2.28']
}, },
} }
received_table = self.subject.summary_table(self.c_p_matrix, self.q_z) received_table = self.subject.summary_table(self.c_p_matrix, self.q_z)
print("====\r\n", received_table)
eq_(received_table.keys(), expected_value.keys()) eq_(received_table.keys(), expected_value.keys())
for key in expected_value.keys(): for key in expected_value.keys():
received_table[key].pop('warnings') received_table[key].pop('warnings')
@@ -143,20 +144,20 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
self.values.ballast_block_weight.return_value = 20 self.values.ballast_block_weight.return_value = 20
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=33, link_tray=2, cross_tray=3, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0,
pressure=15.93), pressure=15.764460),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=28, link_tray=2, cross_tray=2, wind_anchors=0, Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=27, link_tray=2, cross_tray=2, wind_anchors=0,
pressure=13.77), pressure=13.630342),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0,
pressure=2.01), pressure=2.299163),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=15, link_tray=2, cross_tray=1, wind_anchors=4, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=2, cross_tray=1, wind_anchors=4,
pressure=8.43, warnings=[PanelWarnings.MaxPsf]), pressure=8.263513, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=40, link_tray=2, cross_tray=4, wind_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=40, link_tray=2, cross_tray=4, wind_anchors=0,
pressure=18.68), pressure=18.993076),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=14, link_tray=2, cross_tray=0, wind_anchors=0, Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=13, link_tray=2, cross_tray=0, wind_anchors=0,
pressure=7.90), pressure=7.767559),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=10, link_tray=2, cross_tray=1, wind_anchors=3, Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=10, link_tray=2, cross_tray=1, wind_anchors=3,
pressure=6.38), pressure=6.625349),
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, raw_data),
@@ -178,19 +179,19 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
expected = [ expected = [
Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=2, panel_type=PanelType.Corner, wind_anchors=0, seismic_anchors=1,
ballast=18, link_tray=2, cross_tray=1, pressure=9.65), ballast=17, link_tray=2, cross_tray=1, pressure=9.492135463546356),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=2, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1,
ballast=13, link_tray=2, cross_tray=0, pressure=7.50), ballast=12, link_tray=2, cross_tray=0, pressure=7.358017551755176),
Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=4, panel_type=PanelType.EastWest, wind_anchors=0, seismic_anchors=1,
ballast=0, link_tray=0, cross_tray=0, pressure=2.01), ballast=0, link_tray=0, cross_tray=0, pressure=2.299162916291629),
Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=4, seismic_anchors=0, Panel(wind_zone=0, panel_type=PanelType.Corner, wind_anchors=4, seismic_anchors=0,
ballast=15, link_tray=2, cross_tray=1, pressure=8.43), ballast=14, link_tray=2, cross_tray=1, pressure=8.263512601260127),
Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=1, panel_type=PanelType.Middle, wind_anchors=0, seismic_anchors=1,
ballast=25, link_tray=2, cross_tray=3, pressure=12.47), ballast=24, link_tray=2, cross_tray=3, pressure=12.375918091809181),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1, Panel(wind_zone=3, panel_type=PanelType.NorthSouth, wind_anchors=0, seismic_anchors=1,
ballast=0, link_tray=0, cross_tray=0, pressure=2.10), ballast=0, link_tray=0, cross_tray=0, pressure=2.3677610261026105),
Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0, Panel(wind_zone=1, panel_type=PanelType.Corner, wind_anchors=3, seismic_anchors=0,
ballast=10, link_tray=2, cross_tray=1, pressure=6.38), ballast=10, link_tray=2, cross_tray=1, pressure=6.625348784878488),
] ]
result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels) result = self.subject.update_ballast(self.c_p_matrix, self.q_z, panels)
@@ -234,13 +235,13 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
] ]
expected_value = [ expected_value = [
Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=33, link_tray=2, cross_tray=3, wind_anchors=0, pressure=15.93), Panel(wind_zone=2, panel_type=PanelType.Corner, ballast=32, link_tray=2, cross_tray=3, wind_anchors=0, pressure=15.764460),
Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=28, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.77), Panel(wind_zone=2, panel_type=PanelType.NorthSouth, ballast=27, link_tray=2, cross_tray=2, wind_anchors=0, pressure=13.630342),
Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.01), Panel(wind_zone=4, panel_type=PanelType.EastWest, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.299163),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=15, link_tray=2, cross_tray=1, wind_anchors=4, pressure=8.43, warnings=[PanelWarnings.MaxPsf]), Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=2, cross_tray=1, wind_anchors=4, pressure= 8.263513, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=10, link_tray=2, cross_tray=1, wind_anchors=2, pressure=6.20), Panel(wind_zone=1, panel_type=PanelType.Middle, ballast=10, link_tray=2, cross_tray=1, wind_anchors=2, pressure=6.513135),
Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=14, link_tray=2, cross_tray=0, wind_anchors=0, pressure=7.90), Panel(wind_zone=3, panel_type=PanelType.NorthSouth, ballast=13, link_tray=2, cross_tray=0, wind_anchors=0, pressure=7.767559),
Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=10, link_tray=2, cross_tray=1, wind_anchors=3, pressure=6.38) Panel(wind_zone=1, panel_type=PanelType.Corner, ballast=10, link_tray=2, cross_tray=1, wind_anchors=3, pressure=6.625349)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), expected_value, decimal=2)
@@ -272,28 +273,28 @@ class BallastCalculatorWhenDualTiltAndPSeriesTest(unittest.TestCase):
self.q_z = 18.43072 self.q_z = 18.43072
self.subject = BallastCalculator(self.values) self.subject = BallastCalculator(self.values)
expected = Panel(wind_zone=0, panel_type=PanelType.NorthSouth, ballast=3, link_tray=0, cross_tray=0, wind_anchors=0, pressure=3.08) expected = Panel(wind_zone=0, panel_type=PanelType.NorthSouth, ballast=3, link_tray=0, cross_tray=0, wind_anchors=0, pressure=3.350659)
received = self.subject.ballast_tray_and_anchor_count(0, PanelType.NorthSouth, 16, 8, self.c_p_matrix, self.q_z) received = self.subject.ballast_tray_and_anchor_count(0, PanelType.NorthSouth, 16, 8, self.c_p_matrix, self.q_z)
assert received.almost_equal(expected, decimal=2) assert received.almost_equal(expected, decimal=2)
def test_ballast_count_when_base_weight_greater_than_uplift(self): def test_ballast_count_when_base_weight_greater_than_uplift(self):
expected = Panel(wind_zone=4, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=1.99) expected = Panel(wind_zone=4, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=0, pressure=2.277252)
assert self.subject.ballast_tray_and_anchor_count(4, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(4, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=15, link_tray=2, cross_tray=2, wind_anchors=3, pressure=6.47) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=14, link_tray=2, cross_tray=2, wind_anchors=3, pressure=6.495729)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 14, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=11, link_tray=2, cross_tray=1, wind_anchors=3, pressure=6.61) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=10, link_tray=2, cross_tray=1, wind_anchors=3, pressure=6.513135)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 20, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=18, link_tray=2, cross_tray=2, wind_anchors=3, pressure=6.59) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=17, link_tray=2, cross_tray=2, wind_anchors=3, pressure=6.659545)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2) assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, 100, self.c_p_matrix, self.q_z).almost_equal(expected, decimal=2)
def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self): def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self):
max_system_pressure = 0 max_system_pressure = 0
expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=4, pressure=1.99) expected = Panel(wind_zone=0, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, wind_anchors=4, pressure=2.277252)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix, self.q_z).almost_equal( assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix, self.q_z).almost_equal(
expected, expected,

View File

@@ -54,23 +54,23 @@ class BallastCalculatorWhenSingleTiltAnd128CellTest(unittest.TestCase):
expected_value = { expected_value = {
PanelType.Corner: { PanelType.Corner: {
'anchors': [7, 5, 3, 3, 2, 2, 0, 2, 7, 4, 0], 'anchors': [7, 5, 3, 3, 2, 2, 0, 2, 7, 4, 0],
'ballast blocks': [9, 14, 5, 5, 3, 1, 13, 11, 11, 8, 11], 'ballast blocks': [10, 15, 5, 6, 3, 1, 13, 11, 12, 9, 11],
'pressure': ['7.43', '10.31', '4.95', '4.95', '3.79', '2.64', '9.55', '8.49', '8.58', '6.76', '8.40'] 'pressure': ['7.89', '10.77', '4.83', '5.41', '3.68', '2.53', '9.53', '8.38', '9.04', '7.23', '8.29']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [6, 5, 3, 2, 0, 1, 0, 2, 6, 4, 0], 'anchors': [6, 5, 3, 2, 0, 1, 0, 2, 6, 4, 0],
'ballast blocks': [14, 6, 1, 15, 19, 13, 12, 6, 12, 1, 10], 'ballast blocks': [14, 6, 1, 15, 19, 13, 12, 6, 12, 1, 10],
'pressure': ['10.13', '5.44', '2.47', '10.71', '13.01', '9.46', '8.89', '5.35', '8.98', '2.47', '7.65'] 'pressure': ['10.11', '5.41', '2.45', '10.68', '12.98', '9.44', '8.87', '5.32', '8.96', '2.45', '7.62']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [5, 4, 2, 2, 1, 0, 0, 2, 6, 1, 0], 'anchors': [5, 4, 2, 2, 1, 0, 0, 2, 6, 1, 0],
'ballast blocks': [11, 7, 2, 1, 15, 21, 12, 6, 11, 14, 6], 'ballast blocks': [12, 7, 2, 1, 15, 21, 12, 6, 12, 14, 6],
'pressure': ['8.49', '6.19', '3.16', '2.58', '10.79', '14.25', '8.98', '5.52', '8.58', '10.22', '5.46'] 'pressure': ['8.94', '6.07', '3.05', '2.47', '10.67', '14.12', '8.85', '5.40', '9.03', '10.09', '5.35']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [5, 4, 2, 1, 0, 0, 0, 2, 6, 1, 0], 'anchors': [5, 4, 2, 1, 0, 0, 0, 2, 6, 1, 0],
'ballast blocks': [9, 5, 2, 15, 18, 20, 12, 5, 7, 13, 6], 'ballast blocks': [9, 5, 2, 15, 18, 20, 12, 5, 7, 13, 6],
'pressure': ['7.21', '4.91', '3.02', '10.66', '12.39', '13.63', '8.93', '4.82', '6.06', '9.51', '5.32'] 'pressure': ['7.14', '4.84', '2.97', '10.59', '12.32', '13.56', '8.87', '4.75', '5.99', '9.44', '5.27']
}, },
} }
@@ -96,21 +96,21 @@ class BallastCalculatorWhenSingleTiltAnd128CellTest(unittest.TestCase):
expected_value = [ expected_value = [
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=1, link_tray=0, cross_tray=0, wind_anchors=2, Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=1, link_tray=0, cross_tray=0, wind_anchors=2,
pressure=2.64), pressure=2.532134),
Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=1, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=1, wind_anchors=0,
pressure=8.89), pressure=8.866209),
Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=6, link_tray=2, cross_tray=0, wind_anchors=2, Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=6, link_tray=2, cross_tray=0, wind_anchors=2,
pressure=5.52, warnings=[PanelWarnings.MaxPsf]), pressure=5.400562, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=9, link_tray=0, cross_tray=2, wind_anchors=7, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=10, link_tray=0, cross_tray=2, wind_anchors=7,
pressure=7.43, warnings=[PanelWarnings.MaxPsf]), pressure=7.891559, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=1, wind_anchors=6, Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=1, wind_anchors=6,
pressure=6.06, warnings=[PanelWarnings.MaxPsf]), pressure=5.991164, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=1, link_tray=0, cross_tray=0, wind_anchors=4, Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=1, link_tray=0, cross_tray=0, wind_anchors=4,
pressure=2.47, warnings=[PanelWarnings.MaxPsf]), pressure=2.446694, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=1, wind_anchors=0,
pressure=9.55), pressure=9.527003),
Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0,
pressure=8.98) pressure=8.852688)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels),
@@ -169,19 +169,19 @@ class BallastCalculatorWhenSingleTiltAnd128CellTest(unittest.TestCase):
expected_value = [ expected_value = [
Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=11, link_tray=0, cross_tray=1, Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=11, link_tray=0, cross_tray=1,
wind_anchors=2, pressure=8.49, warnings=[PanelWarnings.MaxPsf]), wind_anchors=2, pressure=8.376295, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=6, link_tray=0, cross_tray=0, Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=6, link_tray=0, cross_tray=0,
wind_anchors=2, pressure=5.35, warnings=[PanelWarnings.MaxPsf]), wind_anchors=2, pressure=5.323465, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=29, link_tray=2, cross_tray=2, Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=29, link_tray=2, cross_tray=2,
wind_anchors=0, pressure=18.94), wind_anchors=0, pressure=18.814946),
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=1, link_tray=0, cross_tray=0, Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=1, link_tray=0, cross_tray=0,
wind_anchors=2, pressure=2.64), wind_anchors=2, pressure=2.532134),
Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=12, link_tray=1, cross_tray=1, Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=12, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.93), wind_anchors=0, pressure=8.867935),
Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=2, Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=2,
wind_anchors=6, pressure=8.98, warnings=[PanelWarnings.MaxPsf]), wind_anchors=6, pressure=8.956827, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0, Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=1,
wind_anchors=0, pressure=9.55) wind_anchors=0, pressure=9.527003)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data),
@@ -213,41 +213,41 @@ class BallastCalculatorWhenSingleTiltAnd128CellTest(unittest.TestCase):
self.q_z = 18.446284 self.q_z = 18.446284
expected = Panel(wind_zone=10, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, expected = Panel(wind_zone=10, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=0, pressure=1.87) wind_anchors=0, pressure=1.819845)
assert self.subject.ballast_tray_and_anchor_count(10, PanelType.Middle, 14, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(10, PanelType.Middle, 14, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=16, link_tray=1, cross_tray=1, expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=17, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.47) wind_anchors=0, pressure=8.810399)
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=12, link_tray=1, cross_tray=1, expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=12, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.93) wind_anchors=0, pressure=8.867935)
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=9, link_tray=0, cross_tray=2, expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=10, link_tray=0, cross_tray=2,
wind_anchors=7, pressure=7.43, warnings=[PanelWarnings.MaxPsf]) wind_anchors=7, pressure=7.891559, warnings=[PanelWarnings.MaxPsf])
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=1, expected = Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=1,
wind_anchors=6, pressure=6.06, warnings=[PanelWarnings.MaxPsf]) wind_anchors=6, pressure=5.991164, warnings=[PanelWarnings.MaxPsf])
assert self.subject.ballast_tray_and_anchor_count(8, PanelType.Middle, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(8, PanelType.Middle, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
def test_ballast_blocks_when_panel_exceeds_max_system_pressure(self): def test_ballast_blocks_when_panel_exceeds_max_system_pressure(self):
expected = Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=0, expected = Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=7, link_tray=1, cross_tray=0,
wind_anchors=1, pressure=4.76) wind_anchors=1, pressure=4.692301)
assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 14, 10, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 14, 10, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=2, expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=0, cross_tray=2,
wind_anchors=7, pressure=7.49, warnings=[PanelWarnings.MaxPsf]) wind_anchors=7, pressure=7.776488, warnings=[PanelWarnings.MaxPsf])
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
@@ -255,7 +255,7 @@ class BallastCalculatorWhenSingleTiltAnd128CellTest(unittest.TestCase):
max_system_pressure = 0 max_system_pressure = 0
expected = Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, expected = Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=2, pressure=1.87) wind_anchors=2, pressure=1.819845)
assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 12, max_system_pressure, assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 12, max_system_pressure,
self.c_p_matrix, self.q_z).almost_equal( self.c_p_matrix, self.q_z).almost_equal(
expected, expected,

View File

@@ -54,24 +54,23 @@ class BallastCalculatorWhenSingleTiltAnd96CellTest(unittest.TestCase):
expected_value = { expected_value = {
PanelType.Corner: { PanelType.Corner: {
'anchors': [5, 4, 2, 2, 1, 1, 0, 2, 6, 3, 0], 'anchors': [5, 4, 2, 2, 1, 1, 0, 2, 6, 3, 0],
'ballast blocks': [14, 10, 9, 9, 11, 10, 10, 2, 2, 9, 8], 'ballast blocks': [14, 10, 9, 10, 11, 10, 11, 2, 2, 9, 8],
'pressure': ['12.93', '9.79', '9.03', '9.03', '10.56', '9.70', '9.70', '3.60', '3.69', '9.03', '8.18'] 'pressure': ['12.81', '9.67', '8.90', '9.67', '10.43', '9.58', '10.34', '3.47', '3.57', '8.90', '8.05']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [5, 4, 2, 2, 0, 1, 0, 1, 5, 3, 0], 'anchors': [5, 4, 2, 2, 0, 1, 0, 1, 5, 3, 0],
'ballast blocks': [5, 2, 5, 5, 15, 7, 9, 13, 3, 2, 7], 'ballast blocks': [5, 2, 5, 5, 15, 7, 9, 13, 3, 2, 7],
'pressure': ['5.79', '3.50', '5.70', '5.70', '13.41', '7.23', '8.84', '11.89', '4.26', '3.41', '7.23'] 'pressure': ['5.74', '3.45', '5.74', '5.65', '13.37', '7.17', '8.79', '11.84', '4.22', '3.36', '7.17']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [4, 3, 1, 1, 1, 0, 0, 1, 5, 1, 0], 'anchors': [4, 3, 1, 1, 1, 0, 0, 1, 5, 1, 0],
'ballast blocks': [6, 6, 10, 9, 8, 16, 9, 13, 3, 7, 4], 'ballast blocks': [6, 6, 10, 9, 8, 16, 9, 13, 3, 7, 4],
'pressure': ['6.79', '6.70', '9.75', '8.99', '8.23', '14.42', '8.99', '12.13', '4.41', '7.46', '5.09'] 'pressure': ['6.62', '6.52', '9.57', '8.81', '8.05', '14.24', '8.81', '11.96', '4.24', '7.29', '4.93']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [3, 2, 1, 0, 0, 0, 0, 1, 3, 0, 0], 'anchors': [3, 2, 1, 0, 0, 0, 0, 1, 3, 0, 0],
'ballast blocks': [11, 13, 6, 19, 12, 13, 8, 7, 15, 18, 3], 'ballast blocks': [11, 13, 6, 19, 12, 13, 8, 8, 15, 18, 3],
'pressure': ['10.42', '11.95', '6.52', '16.61', '11.19', '11.95', '8.05', '7.29', '13.56', '15.76', 'pressure': ['10.40', '11.92', '6.49', '16.59', '11.16', '11.92', '8.02', '8.02', '13.54', '15.73', '4.13']
'4.15']
}, },
} }
@@ -96,14 +95,14 @@ class BallastCalculatorWhenSingleTiltAnd96CellTest(unittest.TestCase):
self.values.ballast_block_weight.return_value = 20 self.values.ballast_block_weight.return_value = 20
expected_value = [ expected_value = [
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=25, link_tray=0, cross_tray=2, wind_anchors=0, pressure=21.32), Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=25, link_tray=0, cross_tray=2, wind_anchors=0, pressure=21.200142),
Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=9, link_tray=0, cross_tray=1, wind_anchors=0, pressure=8.84), Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=9, link_tray=0, cross_tray=1, wind_anchors=0, pressure=8.791605),
Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=28, link_tray=2, cross_tray=2, wind_anchors=0, pressure=23.65), Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=28, link_tray=2, cross_tray=2, wind_anchors=0, pressure=23.487752),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=0, cross_tray=2, wind_anchors=5, pressure=12.93, warnings=[PanelWarnings.MaxPsf]), Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=0, cross_tray=2, wind_anchors=5, pressure=12.810842, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=15, link_tray=1, cross_tray=2, wind_anchors=3, pressure=13.56, warnings=[PanelWarnings.MaxPsf]), Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=15, link_tray=1, cross_tray=2, wind_anchors=3, pressure=13.538805, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=2, link_tray=0, cross_tray=0, wind_anchors=3, pressure=3.41, warnings=[PanelWarnings.MaxPsf]), Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=2, link_tray=0, cross_tray=0, wind_anchors=3, pressure=3.360677, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=10, link_tray=0, cross_tray=0, wind_anchors=0, pressure=9.70), Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=11, link_tray=0, cross_tray=0, wind_anchors=0, pressure=10.337906),
Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=9, link_tray=2, cross_tray=0, wind_anchors=0, pressure=8.99) Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=9, link_tray=2, cross_tray=0, wind_anchors=0, pressure=8.812197)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2)
@@ -160,13 +159,13 @@ class BallastCalculatorWhenSingleTiltAnd96CellTest(unittest.TestCase):
] ]
expected_value = array([ expected_value = array([
Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=2, link_tray=0, cross_tray=0, wind_anchors=2, pressure=3.60), Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=2, link_tray=0, cross_tray=0, wind_anchors=2, pressure=3.473933),
Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=13, link_tray=0, cross_tray=1, wind_anchors=1, pressure=11.89), Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=13, link_tray=0, cross_tray=1, wind_anchors=1, pressure=11.842260),
Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=22, link_tray=2, cross_tray=1, wind_anchors=0, pressure=18.99), Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=22, link_tray=2, cross_tray=1, wind_anchors=0, pressure=18.819488),
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=25, link_tray=0, cross_tray=2, wind_anchors=0, pressure=21.32), Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=25, link_tray=0, cross_tray=2, wind_anchors=0, pressure=21.200142),
Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=8.05), Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=8, link_tray=1, cross_tray=0, wind_anchors=0, pressure=8.015213),
Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=3, link_tray=0, cross_tray=1, wind_anchors=5, pressure=4.26, warnings=[PanelWarnings.MaxPsf]), Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=3, link_tray=0, cross_tray=1, wind_anchors=5, pressure=4.215623, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=10, link_tray=0, cross_tray=0, wind_anchors=0, pressure=9.70), Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=11, link_tray=0, cross_tray=0, wind_anchors=0, pressure=10.337906),
]) ])
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2) assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), expected_value, decimal=2)
@@ -175,43 +174,43 @@ class BallastCalculatorWhenSingleTiltAnd96CellTest(unittest.TestCase):
assert self.subject.ballast_tray_and_anchor_count(10, PanelType.Middle, 14, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(10, PanelType.Middle, 14, 1000, self.c_p_matrix,
30.155851).almost_equal( 30.155851).almost_equal(
Panel(wind_zone=10, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, Panel(wind_zone=10, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=0, pressure=1.86), wind_anchors=0, pressure=1.842977),
decimal=2) decimal=2)
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=1, Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=7.91), wind_anchors=0, pressure=7.878697),
decimal=2) decimal=2)
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=8, link_tray=1, cross_tray=0, Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=8, link_tray=1, cross_tray=0,
wind_anchors=0, pressure=8.05), wind_anchors=0, pressure=8.015213),
decimal=2) decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=0, cross_tray=2, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=14, link_tray=0, cross_tray=2,
wind_anchors=5, pressure=12.93, warnings=[PanelWarnings.MaxPsf]), wind_anchors=5, pressure=12.810842, warnings=[PanelWarnings.MaxPsf]),
decimal=2) decimal=2)
assert self.subject.ballast_tray_and_anchor_count(8, PanelType.Middle, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(8, PanelType.Middle, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=15, link_tray=1, cross_tray=2, Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=15, link_tray=1, cross_tray=2,
wind_anchors=3, pressure=13.56, warnings=[PanelWarnings.MaxPsf]), wind_anchors=3, pressure=13.538805, warnings=[PanelWarnings.MaxPsf]),
decimal=2) decimal=2)
def test_ballast_blocks_when_panel_exceeds_max_system_pressure(self): def test_ballast_blocks_when_panel_exceeds_max_system_pressure(self):
assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 14, 10, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 14, 10, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=1, pressure=1.86), wind_anchors=1, pressure=1.842977),
decimal=2) decimal=2)
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=0, link_tray=0, cross_tray=0, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=6, pressure=2.08, warnings=[PanelWarnings.MaxPsf]), wind_anchors=6, pressure=1.948606, warnings=[PanelWarnings.MaxPsf]),
decimal=2) decimal=2)
def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self): def test_when_max_system_pressure_is_lower_than_base_weight_pressure(self):
@@ -220,7 +219,7 @@ class BallastCalculatorWhenSingleTiltAnd96CellTest(unittest.TestCase):
assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(5, PanelType.Middle, 12, max_system_pressure, self.c_p_matrix,
self.q_z).almost_equal( self.q_z).almost_equal(
Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0, Panel(wind_zone=5, panel_type=PanelType.Middle, ballast=0, link_tray=0, cross_tray=0,
wind_anchors=1, pressure=1.86), wind_anchors=1, pressure=1.842977),
decimal=2) decimal=2)
def test_uplift(self): def test_uplift(self):

View File

@@ -55,27 +55,27 @@ class BallastCalculatorWhenSingleTiltAndPSeriesTest(unittest.TestCase):
PanelType.Corner: { PanelType.Corner: {
'anchors': [7, 5, 3, 3, 2, 1, 0, 2, 7, 4, 0], 'anchors': [7, 5, 3, 3, 2, 1, 0, 2, 7, 4, 0],
'ballast blocks': [5, 11, 3, 4, 2, 15, 13, 9, 7, 6, 11], 'ballast blocks': [5, 11, 3, 4, 2, 15, 13, 9, 7, 6, 11],
'pressure': ['5.13', '8.75', '3.83', '4.43', '3.22', '11.16', '9.86', '7.45', '6.33', '5.73', '8.65'] 'pressure': ['5.07', '8.69', '3.77', '4.37', '3.17', '11.10', '9.80', '7.39', '6.37', '5.67', '8.59']
}, },
PanelType.NorthSouth: { PanelType.NorthSouth: {
'anchors': [6, 5, 2, 2, 0, 1, 0, 2, 6, 3, 0], 'anchors': [6, 5, 2, 2, 0, 1, 0, 2, 6, 3, 0],
'ballast blocks': [10, 3, 15, 14, 18, 12, 12, 5, 8, 14, 9], 'ballast blocks': [10, 3, 15, 14, 18, 12, 12, 5, 8, 14, 9],
'pressure': ['8.06', '3.74', '11.07', '10.37', '12.88', '9.17', '9.17', '4.85', '6.85', '10.47', '7.26'] 'pressure': ['8.09', '3.78', '11.11', '10.41', '12.82', '9.20', '9.20', '4.89', '6.89', '10.50', '7.30']
}, },
PanelType.EastWest: { PanelType.EastWest: {
'anchors': [5, 4, 2, 1, 1, 0, 0, 2, 6, 1, 0], 'anchors': [5, 4, 2, 1, 1, 0, 0, 2, 6, 1, 0],
'ballast blocks': [8, 5, 1, 15, 14, 20, 12, 5, 8, 13, 6], 'ballast blocks': [8, 5, 1, 15, 14, 20, 12, 5, 8, 13, 6],
'pressure': ['6.94', '5.04', '2.56', '11.16', '10.56', '14.18', '9.26', '5.04', '6.94', '9.96', '5.57'] 'pressure': ['6.87', '4.97', '2.50', '11.09', '10.49', '14.11', '9.19', '4.97', '6.87', '9.89', '5.51']
}, },
PanelType.Middle: { PanelType.Middle: {
'anchors': [5, 4, 1, 1, 0, 0, 0, 2, 6, 1, 0], 'anchors': [5, 4, 1, 1, 0, 0, 0, 2, 6, 1, 0],
'ballast blocks': [6, 3, 15, 14, 18, 20, 11, 4, 4, 12, 6], 'ballast blocks': [6, 3, 15, 14, 18, 20, 11, 4, 4, 12, 6],
'pressure': ['5.60', '3.69', '11.02', '10.42', '12.83', '14.13', '8.51', '4.29', '4.39', '9.21', '5.43'] 'pressure': ['5.59', '3.68', '11.01', '10.41', '12.82', '14.12', '8.60', '4.29', '4.38', '9.20', '5.44']
}, },
} }
received_table = self.subject.summary_table(self.c_p_matrix, self.q_z) received_table = self.subject.summary_table(self.c_p_matrix, self.q_z)
print("===\r\n",received_table)
eq_(received_table.keys(), expected_value.keys()) eq_(received_table.keys(), expected_value.keys())
for key in expected_value.keys(): for key in expected_value.keys():
received_table[key].pop('warnings') received_table[key].pop('warnings')
@@ -97,21 +97,21 @@ class BallastCalculatorWhenSingleTiltAndPSeriesTest(unittest.TestCase):
expected_value = [ expected_value = [
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=15, link_tray=0, cross_tray=1, wind_anchors=1, Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=15, link_tray=0, cross_tray=1, wind_anchors=1,
pressure=11.16), pressure=11.101436),
Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=1, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.NorthSouth, ballast=12, link_tray=0, cross_tray=1, wind_anchors=0,
pressure=9.17), pressure=9.202700),
Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=5, link_tray=2, cross_tray=0, wind_anchors=2, Panel(wind_zone=7, panel_type=PanelType.EastWest, ballast=5, link_tray=2, cross_tray=0, wind_anchors=2,
pressure=5.04, warnings=[PanelWarnings.MaxPsf]), pressure=4.967106, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=5, link_tray=0, cross_tray=1, wind_anchors=7, Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=5, link_tray=0, cross_tray=1, wind_anchors=7,
pressure=5.13, warnings=[PanelWarnings.MaxPsf]), pressure=5.070833, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=4, link_tray=1, cross_tray=1, wind_anchors=6, Panel(wind_zone=8, panel_type=PanelType.Middle, ballast=4, link_tray=1, cross_tray=1, wind_anchors=6,
pressure=4.39, warnings=[PanelWarnings.MaxPsf]), pressure=4.380027, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=14, link_tray=0, cross_tray=2, wind_anchors=3, Panel(wind_zone=9, panel_type=PanelType.NorthSouth, ballast=14, link_tray=0, cross_tray=2, wind_anchors=3,
pressure=10.47, warnings=[PanelWarnings.MaxPsf]), pressure=10.503803, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0, wind_anchors=0,
pressure=9.86), pressure=9.800333),
Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0, Panel(wind_zone=6, panel_type=PanelType.EastWest, ballast=12, link_tray=2, cross_tray=0, wind_anchors=0,
pressure=9.26) pressure=9.188528)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panels),
@@ -170,19 +170,19 @@ class BallastCalculatorWhenSingleTiltAndPSeriesTest(unittest.TestCase):
expected_value = [ expected_value = [
Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=9, link_tray=0, cross_tray=0, Panel(wind_zone=7, panel_type=PanelType.Corner, ballast=9, link_tray=0, cross_tray=0,
wind_anchors=2, pressure=7.44, warnings=[PanelWarnings.MaxPsf]), wind_anchors=2, pressure=7.388092, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=5, link_tray=0, cross_tray=0, Panel(wind_zone=7, panel_type=PanelType.NorthSouth, ballast=5, link_tray=0, cross_tray=0,
wind_anchors=2, pressure=4.85, warnings=[PanelWarnings.MaxPsf]), wind_anchors=2, pressure=4.886296, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=28, link_tray=2, cross_tray=2, Panel(wind_zone=9, panel_type=PanelType.EastWest, ballast=28, link_tray=2, cross_tray=2,
wind_anchors=0, pressure=19.10), wind_anchors=0, pressure=19.027457),
Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=15, link_tray=0, cross_tray=1, Panel(wind_zone=5, panel_type=PanelType.Corner, ballast=15, link_tray=0, cross_tray=1,
wind_anchors=1, pressure=11.16), wind_anchors=1, pressure=11.101436),
Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=0, Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.51), wind_anchors=0, pressure= 8.601449),
Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=8, link_tray=0, cross_tray=2, Panel(wind_zone=8, panel_type=PanelType.NorthSouth, ballast=8, link_tray=0, cross_tray=2,
wind_anchors=6, pressure=6.85, warnings=[PanelWarnings.MaxPsf]), wind_anchors=6, pressure=6.885441, warnings=[PanelWarnings.MaxPsf]),
Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0, Panel(wind_zone=6, panel_type=PanelType.Corner, ballast=13, link_tray=0, cross_tray=0,
wind_anchors=0, pressure=9.86) wind_anchors=0, pressure=9.800333)
] ]
assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data), assert_array_is_close(self.subject.ballast_and_trays_matrix(self.c_p_matrix, self.q_z, panel_data),
@@ -221,22 +221,22 @@ class BallastCalculatorWhenSingleTiltAndPSeriesTest(unittest.TestCase):
def test_ballast_and_tray_count_iterates_on_link_and_cross_trays_changing_weight_and_ballast_requirements(self): def test_ballast_and_tray_count_iterates_on_link_and_cross_trays_changing_weight_and_ballast_requirements(self):
panel = self.subject.ballast_tray_and_anchor_count(3, PanelType.NorthSouth, 20, 17, self.c_p_matrix, self.q_z) panel = self.subject.ballast_tray_and_anchor_count(3, PanelType.NorthSouth, 20, 17, self.c_p_matrix, self.q_z)
assert_almost_equal(panel.pressure, 10.37, 2) assert_almost_equal(panel.pressure, 10.408820882088209, 2)
def test_individual_ballast_block_uplift_greater_than_base_weight(self): def test_individual_ballast_block_uplift_greater_than_base_weight(self):
expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=16, link_tray=1, cross_tray=1, expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=16, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.73) wind_anchors=0, pressure=8.722061)
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 14, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=0, expected = Panel(wind_zone=6, panel_type=PanelType.Middle, ballast=11, link_tray=1, cross_tray=1,
wind_anchors=0, pressure=8.51) wind_anchors=0, pressure=8.601449)
assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(6, PanelType.Middle, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
def test_ballast_blocks_exceeding_tray_capacity(self): def test_ballast_blocks_exceeding_tray_capacity(self):
expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=5, link_tray=0, cross_tray=1, expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=5, link_tray=0, cross_tray=1,
wind_anchors=7, pressure=5.13, warnings=[PanelWarnings.MaxPsf]) wind_anchors=7, pressure=5.070833, warnings=[PanelWarnings.MaxPsf])
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 20, 1000, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
@@ -253,7 +253,7 @@ class BallastCalculatorWhenSingleTiltAndPSeriesTest(unittest.TestCase):
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)
expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=7, link_tray=0, cross_tray=1, expected = Panel(wind_zone=0, panel_type=PanelType.Corner, ballast=7, link_tray=0, cross_tray=1,
wind_anchors=7, pressure=5.07, warnings=[PanelWarnings.MaxPsf]) wind_anchors=7, pressure=5.010527, warnings=[PanelWarnings.MaxPsf])
assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix, assert self.subject.ballast_tray_and_anchor_count(0, PanelType.Corner, 14, 10, self.c_p_matrix,
self.q_z).almost_equal(expected, decimal=2) self.q_z).almost_equal(expected, decimal=2)

View File

@@ -56,7 +56,7 @@ class CalculatorTest(unittest.TestCase):
self.subject = Calculator(self.values) self.subject = Calculator(self.values)
expected = [ expected = [
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=435, weight=170237, Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=436, weight=170698.330000,
start_row=0, size=863, column_counted_geometrically=False, row_counted_geometrically=False, start_row=0, size=863, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=130.5, column_count=98) row_count=130.5, column_count=98)
] ]
@@ -70,43 +70,43 @@ class CalculatorTest(unittest.TestCase):
self.subject = Calculator(self.values) self.subject = Calculator(self.values)
expected = [ expected = [
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=23783, start_row=0, Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=23804, start_row=0,
size=192, column_counted_geometrically=False, row_counted_geometrically=False, size=192, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=18, column_count=20), row_count=18, column_count=20),
Subarray(subarray_number=2, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=13113, Subarray(subarray_number=2, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=13271,
start_row=192, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=192, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=4, column_count=24), row_count=4, column_count=24),
Subarray(subarray_number=3, origin=Coordinate(0, 0), required_seismic_anchors=110, weight=40406, Subarray(subarray_number=3, origin=Coordinate(0, 0), required_seismic_anchors=110, weight=40328,
start_row=288, size=312, column_counted_geometrically=False, row_counted_geometrically=False, start_row=288, size=312, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=25, column_count=29), row_count=25, column_count=29),
Subarray(subarray_number=4, origin=Coordinate(0, 0), required_seismic_anchors=72, weight=23404, Subarray(subarray_number=4, origin=Coordinate(0, 0), required_seismic_anchors=71, weight=23324,
start_row=600, size=168, column_counted_geometrically=False, row_counted_geometrically=False, start_row=600, size=168, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=22, column_count=13), row_count=22, column_count=13),
Subarray(subarray_number=5, origin=Coordinate(0, 0), required_seismic_anchors=75, weight=35365, Subarray(subarray_number=5, origin=Coordinate(0, 0), required_seismic_anchors=74, weight=35170,
start_row=768, size=234, column_counted_geometrically=False, row_counted_geometrically=False, start_row=768, size=234, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=26, column_count=14), row_count=26, column_count=14),
Subarray(subarray_number=6, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10897, Subarray(subarray_number=6, origin=Coordinate(0, 0), required_seismic_anchors=1, weight=11461,
start_row=1002, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1002, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=10, column_count=12), row_count=10, column_count=12),
Subarray(subarray_number=7, origin=Coordinate(0, 0), required_seismic_anchors=29, weight=10951, Subarray(subarray_number=7, origin=Coordinate(0, 0), required_seismic_anchors=28, weight=10865,
start_row=1098, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1098, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=8, column_count=16), row_count=8, column_count=16),
Subarray(subarray_number=8, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=10596, Subarray(subarray_number=8, origin=Coordinate(0, 0), required_seismic_anchors=12, weight=10780,
start_row=1194, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1194, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=15, column_count=17.5), row_count=15, column_count=17.5),
Subarray(subarray_number=9, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10544, Subarray(subarray_number=9, origin=Coordinate(0, 0), required_seismic_anchors=0, weight= 10989,
start_row=1290, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1290, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=8, column_count=16), row_count=8, column_count=16),
Subarray(subarray_number=10, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4819, Subarray(subarray_number=10, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4901,
start_row=1386, size=48, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1386, size=48, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=8, column_count=6), row_count=8, column_count=6),
Subarray(subarray_number=11, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10857, Subarray(subarray_number=11, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10766,
start_row=1434, size=96, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1434, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=13, column_count=13), row_count=13, column_count=13),
Subarray(subarray_number=12, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=6330, Subarray(subarray_number=12, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=6350,
start_row=1530, size=54, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1530, size=54, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=8, column_count=8), row_count=8, column_count=8),
Subarray(subarray_number=13, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4201, Subarray(subarray_number=13, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4239,
start_row=1584, size=48, column_counted_geometrically=False, row_counted_geometrically=False, start_row=1584, size=48, column_counted_geometrically=False, row_counted_geometrically=False,
row_count=6, column_count=8) row_count=6, column_count=8)
] ]
@@ -140,15 +140,15 @@ class CalculatorTest(unittest.TestCase):
self.subject = Calculator(self.values) self.subject = Calculator(self.values)
received_values = self.subject.summary_values() received_values = self.subject.summary_values()
expected_values = array([ expected_values = array([
{'label': 'Total System Weight (lbs)', 'value': 2684}, {'label': 'Total System Weight (lbs)', 'value': 2694},
{'label': 'Max PSF', 'value': 8.03}, {'label': 'Max PSF', 'value': 7.9},
{'label': 'Avg PSF', 'value': 5.39}, {'label': 'Avg PSF', 'value': 5.41},
{'label': 'Total Anchors', 'value': 5}, {'label': 'Total Anchors', 'value': 5},
{'label': 'Total Ballast', 'value': 131}, {'label': 'Total Ballast', 'value': 135},
{'label': 'Max Possible System Weight', 'value': 2789.0}, {'label': 'Max Possible System Weight', 'value': 2792.0},
{'label': 'Max System Weight Ballast Block', 'value': 16}, {'label': 'Max System Weight Ballast Block', 'value': 17},
{'label': 'Seismic Anchor Max. Spacing', 'value': 12}, {'label': 'Seismic Anchor Max. Spacing', 'value': 12},
]) ])
assert_array_equal(received_values, expected_values) assert_array_equal(received_values, expected_values)
@@ -173,13 +173,13 @@ class CalculatorTest(unittest.TestCase):
received_values = self.subject.documentation_summary_values() received_values = self.subject.documentation_summary_values()
expected_values = { expected_values = {
'total_system_weight': 2684, 'total_system_weight': 2694,
'max_psf': 8.03, 'max_psf': 7.9,
'ave_psf': 5.39, 'ave_psf': 5.41,
'total_anchors': 5, 'total_anchors': 5,
'total_ballast': 131, 'total_ballast': 135,
'max_possible_system_weight': 2789.0, 'max_possible_system_weight': 2792.0,
'max_system_weight_ballast_block': 16, 'max_system_weight_ballast_block': 17,
'seismic_anchor_max_spacing': 12 'seismic_anchor_max_spacing': 12
} }
eq_(received_values, expected_values) eq_(received_values, expected_values)
@@ -326,6 +326,8 @@ class CalculatorTest(unittest.TestCase):
expected_csv = expected_file.read() expected_csv = expected_file.read()
reader = csv.reader(expected_csv.splitlines(), dialect='excel-tab') reader = csv.reader(expected_csv.splitlines(), dialect='excel-tab')
expected = array([row for row in reader]) expected = array([row for row in reader])
print("EXPECTED")
print(expected)
power_station_1 = PowerStation( power_station_1 = PowerStation(
description='1', description='1',
@@ -367,6 +369,8 @@ class CalculatorTest(unittest.TestCase):
) )
self.site.power_stations = [power_station_1, power_station_2] self.site.power_stations = [power_station_1, power_station_2]
print("COMPUTE")
print(self.subject.compute_bom())
assert_array_equal(self.subject.compute_bom(), expected) assert_array_equal(self.subject.compute_bom(), expected)
def test_documentation_bom(self): def test_documentation_bom(self):
@@ -404,91 +408,90 @@ class CalculatorTest(unittest.TestCase):
self.site.cad_file = csv_content self.site.cad_file = csv_content
self.subject = Calculator(self.values) self.subject = Calculator(self.values)
expected = [ expected = [('521794', 196),
('104813', 50), ('521795', 196),
('105317', 0), ('514056', 1000),
('106925', 50), ('modules', 1726),
('107538', 0), ('513843', 263),
('107549', 100), ('anchors', 263),
('107551', 50), ('518477', 275),
('107586', 100), ('513833', 670),
('111147', 0), ('513844', 214),
('114961', 50), ('ballast', 6777),
('507985', 0), ('515928', 261),
('512021', 9), ('517871', 139),
('512199', 140), ('514057', 1000),
('512200', 3480), ('515063', 4000),
('512510', 196), ('512200', 3480),
('512511', 196), ('514265', 179),
('512575', 1), ('513303', 1),
('512660', 2), ('512660', 2),
('512661', 2), ('512661', 2),
('512662', 4), ('512662', 4),
('512663', 2), ('512663', 2),
('523923', 0), ('518331', 2),
('512910', 1), ('518058', 2),
('513007', 50), ('104813', 50),
('513299', 0), ('107551', 50),
('513300', 0), ('514865', 50),
('513301', 0), ('106925', 50),
('513302', 0), ('523921', 1),
('513303', 1), ('514438', 2),
('513304', 0), ('514437', 2),
('513586', 0), ('512910', 1),
('513831', 0), ('805615', 2),
('513832', 0), ('521031', 2),
('513833', 670), ('512575', 1),
('513836', 0), ('514698', 1),
('513843', 262), ('513007', 50),
('513844', 214), ('114961', 50),
('514056', 1000), ('107549', 100),
('514057', 1000), ('107586', 100),
('514265', 179), ('512021', 9),
('514435', 0), ('512199', 140),
('514436', 0), ('512511', 196),
('514437', 2), ('512510', 196),
('514438', 2), ('515929', 0),
('514439', 0), ('514477', 2),
('514440', 0), ('515059', 2),
('514477', 2), ('514697', 1),
('514478', 0), ('513831', 0),
('523924', 0), ('513836', 0),
('523921', 1), ('520301', 0),
('523922', 0), ('520302', 0),
('514697', 1), ('520303', 0),
('514698', 1), ('520306', 0),
('514865', 50), ('513832', 0),
('515059', 2), ('514435', 0),
('515063', 4000), ('514436', 0),
('515928', 261), ('514439', 0),
('515929', 0), ('514440', 0),
('516043', 0), ('523922', 0),
('516045', 0), ('523923', 0),
('517463', 0), ('523924', 0),
('517871', 139), ('513299', 0),
('518058', 2), ('513301', 0),
('518059', 0), ('514478', 0),
('518331', 2), ('513300', 0),
('518477', 275), ('513302', 0),
('519008', 0), ('513304', 0),
('520301', 0), ('519008', 0),
('520302', 0), ('518059', 0),
('520303', 0), ('105317', 0),
('520306', 0), ('111147', 0),
('521031', 2), ('107538', 0),
('521363', 0), ('516045', 0),
('521797', 0), ('516043', 0),
('521798', 0), ('513586', 0),
('522020', 0), ('507985', 0),
('805615', 2), ('522020', 0),
('521794', 196), ('521798', 0),
('521795', 196), ('521797', 0),
('521363', 0),
('anchors', 262), ('517463', 0)]
('ballast', 6786),
('modules', 1726)
]
print("===")
print(self.subject.documentation_bom())
assert_array_equal(sorted(self.subject.documentation_bom()), sorted(expected)) assert_array_equal(sorted(self.subject.documentation_bom()), sorted(expected))
# Performance Tests # Performance Tests

View File

@@ -54,8 +54,8 @@ class SummaryValuesTest(unittest.TestCase):
{'label': 'Avg PSF', 'value': 10.06}, {'label': 'Avg PSF', 'value': 10.06},
{'label': 'Total Anchors', 'value': 7}, {'label': 'Total Anchors', 'value': 7},
{'label': 'Total Ballast', 'value': 8}, {'label': 'Total Ballast', 'value': 8},
{'label': 'Max Possible System Weight', 'value': 1568.0}, {'label': 'Max Possible System Weight', 'value': 1563.0},
{'label': 'Max System Weight Ballast Block', 'value': 14}, {'label': 'Max System Weight Ballast Block', 'value': 16},
{'label': 'Seismic Anchor Max. Spacing', 'value': seismic_interval} {'label': 'Seismic Anchor Max. Spacing', 'value': seismic_interval}
] ]
eq_(result, expected) eq_(result, expected)
@@ -83,8 +83,8 @@ class SummaryValuesTest(unittest.TestCase):
'ave_psf': 10.06, 'ave_psf': 10.06,
'total_anchors': 7, 'total_anchors': 7,
'total_ballast': 8, 'total_ballast': 8,
'max_possible_system_weight': 1568.0, 'max_possible_system_weight': 1563.0,
'max_system_weight_ballast_block': 14, 'max_system_weight_ballast_block': 16,
'seismic_anchor_max_spacing': 10 'seismic_anchor_max_spacing': 10
} }
@@ -111,7 +111,7 @@ class SummaryValuesTest(unittest.TestCase):
result = self.subject.find_max_system_weight(panels, self.c_p_matrix, self.q_z, self.ballast_calculator) result = self.subject.find_max_system_weight(panels, self.c_p_matrix, self.q_z, self.ballast_calculator)
assert_almost_equal(result, (1568, 14), decimal=0) assert_almost_equal(result, (1563, 16), decimal=0)
def test_find_max_system_weight_does_not_modify_panels_list(self): def test_find_max_system_weight_does_not_modify_panels_list(self):
panels = [ panels = [

View File

@@ -1,8 +1,8 @@
HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE
'21EEE0 *U593 C 1 1 12.9 20 2 1 - 1 0 0 0 '21EEE0 *U593 C 1 1 12.91 20 2 1 - 1 0 0 0
'21EECC *U824 C 2 1 11.35 17 2 1 - 2 0 0 0 '21EECC *U824 C 2 1 11.34 17 2 1 - 2 0 0 0
'21EEB8 *U824 E 3 1 2.26 0 1 - - 3 0 0 0 '21EEB8 *U824 E 3 1 2.28 0 1 - - 3 0 0 0
'21EEA4 *U593 A 1 1 5.55 6 2 - 2 4 0 0 0 '21EEA4 *U593 A 1 1 5.55 6 2 - 2 4 0 0 0
'21E940 *U171 B 4 1 13.83 22 1 2 - 5 0 0 0 '21E940 *U171 B 4 1 13.87 22 1 2 - 5 0 0 0
'21E92C *U824 D 1 1 7.1 9 2 - - 6 0 0 0 '21E92C *U824 D 1 1 7.1 9 2 - - 6 0 0 0
'21E918 *U593 B 1 1 9.8 14 2 1 1 7 0 0 0 '21E918 *U593 B 1 1 9.8 14 2 1 1 7 0 0 0
1 HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE
2 '21EEE0 *U593 C 1 1 12.9 12.91 20 2 1 - 1 0 0 0
3 '21EECC *U824 C 2 1 11.35 11.34 17 2 1 - 2 0 0 0
4 '21EEB8 *U824 E 3 1 2.26 2.28 0 1 - - 3 0 0 0
5 '21EEA4 *U593 A 1 1 5.55 6 2 - 2 4 0 0 0
6 '21E940 *U171 B 4 1 13.83 13.87 22 1 2 - 5 0 0 0
7 '21E92C *U824 D 1 1 7.1 9 2 - - 6 0 0 0
8 '21E918 *U593 B 1 1 9.8 14 2 1 1 7 0 0 0

View File

@@ -1,7 +1,7 @@
Part # Description Total Part # Description Total
512200 CLIP, WIRE FORMED, CABLE MANAGEMENT, INSIDE, 352MM ^ 2 3480 512200 CLIP, WIRE FORMED, CABLE MANAGEMENT, INSIDE, 352MM ^ 2 3480
513833 TRAY, LINK, HELIX ROOF 670 513833 TRAY, LINK, HELIX ROOF 670
513843 PLATE, ANCHOR, HELIX ROOF 262 513843 PLATE, ANCHOR, HELIX ROOF 263
513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 214 513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 214
514056 BASE, CHASSIS, DUAL TILT, HELIX ROOF 1000 514056 BASE, CHASSIS, DUAL TILT, HELIX ROOF 1000
514057 PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF 1000 514057 PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF 1000
@@ -12,6 +12,6 @@ Part # Description Total
518477 WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS 275 518477 WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS 275
521794 DEFLECTOR, LH, HELIX ROOF V1.1 196 521794 DEFLECTOR, LH, HELIX ROOF V1.1 196
521795 DEFLECTOR, RH, HELIX ROOF V1.1 196 521795 DEFLECTOR, RH, HELIX ROOF V1.1 196
Contractor Supplied Ballast Blocks 6786 Contractor Supplied Ballast Blocks 6777
TBD Anchors 262 TBD Anchors 263
TBD Modules 1726 TBD Modules 1726
1 Part # Description Total
2 512200 CLIP, WIRE FORMED, CABLE MANAGEMENT, INSIDE, 352MM ^ 2 3480
3 513833 TRAY, LINK, HELIX ROOF 670
4 513843 PLATE, ANCHOR, HELIX ROOF 262 263
5 513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 214
6 514056 BASE, CHASSIS, DUAL TILT, HELIX ROOF 1000
7 514057 PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF 1000
12 518477 WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS 275
13 521794 DEFLECTOR, LH, HELIX ROOF V1.1 196
14 521795 DEFLECTOR, RH, HELIX ROOF V1.1 196
15 Contractor Supplied Ballast Blocks 6786 6777
16 TBD Anchors 262 263
17 TBD Modules 1726

View File

@@ -14,7 +14,7 @@
513299 COMBINER BOX, AC, 4 INPUT, NO AUX, W/ CONNECTOR 3 513299 COMBINER BOX, AC, 4 INPUT, NO AUX, W/ CONNECTOR 3
513303 COMBINER BOX, AC, 2 INPUT, NO AUX, W/ CONNECTOR 1 513303 COMBINER BOX, AC, 2 INPUT, NO AUX, W/ CONNECTOR 1
513833 TRAY, LINK, HELIX ROOF 670 513833 TRAY, LINK, HELIX ROOF 670
513843 PLATE, ANCHOR, HELIX ROOF 262 513843 PLATE, ANCHOR, HELIX ROOF 263
513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 214 513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 214
514056 BASE, CHASSIS, DUAL TILT, HELIX ROOF 1000 514056 BASE, CHASSIS, DUAL TILT, HELIX ROOF 1000
514057 PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF 1000 514057 PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF 1000
@@ -42,6 +42,6 @@
523922 INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 1 523922 INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 1
523923 INVERTER, SMA, STP, 12000TL-US-10 (SPR-12000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 3 523923 INVERTER, SMA, STP, 12000TL-US-10 (SPR-12000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 3
523924 INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 9 523924 INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 9
Contractor Supplied Ballast Blocks 6786 Contractor Supplied Ballast Blocks 6777
TBD Anchors 262 TBD Anchors 263
TBD Modules 1726 TBD Modules 1726
Can't render this file because it contains an unexpected character in line 28 and column 30.

View File

@@ -1,20 +1,20 @@
HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE
'40EC39 *U5399 H 1 8 14.37 16 - 1 - 1 0 0 0 '40EC39 *U5399 H 1 8 14.24 16 - 1 - 1 0 0 0
'40EC22 *U5402 H 3 8 12.89 14 2 1 - 2 0 0 0 '40EC22 *U5402 H 3 8 12.72 14 2 1 - 2 0 0 0
'40EC0B *U5402 H 1 8 14.37 16 - 1 - 3 0 0 0 '40EC0B *U5402 H 1 8 14.24 16 - 1 - 3 0 0 0
'40EBF4 *U5402 H 1 8 14.37 16 - 1 - 4 0 0 0 '40EBF4 *U5402 H 1 8 14.24 16 - 1 - 4 0 0 0
'40EBDD *U5402 H 3 8 12.89 14 2 1 - 5 0 0 0 '40EBDD *U5402 H 3 8 12.72 14 2 1 - 5 0 0 0
'40EBC6 *U5402 H 3 8 12.89 14 2 1 - 6 0 0 0 '40EBC6 *U5402 H 3 8 12.72 14 2 1 - 6 0 0 0
'40EBAF *U5402 H 3 8 12.89 14 2 1 - 7 0 0 0 '40EBAF *U5402 H 3 8 12.72 14 2 1 - 7 0 0 0
'40EB98 *U5399 H 1 8 14.37 16 - 1 - 8 0 0 0 '40EB98 *U5399 H 1 8 14.24 16 - 1 - 8 0 0 0
'40EB81 *U5401 H 2 8 12.65 14 - 1 - 9 0 0 0 '40EB81 *U5401 H 2 8 12.6 14 - 1 - 9 0 0 0
'40E8B8 *U5401 H 2 8 12.65 14 - 1 - 10 0 0 0 '40E8B8 *U5401 H 2 8 12.6 14 - 1 - 10 0 0 0
'40E8A1 *U5401 I 2 8 1.89 0 - - 2 11 0 0 0 '40E8A1 *U5401 I 2 8 1.84 0 - - 2 11 0 0 0
'40E88A *U5400 H 4 8 10.42 11 1 1 - 12 0 0 0 '40E88A *U5400 H 4 8 10.4 11 1 1 - 12 0 0 0
'40E873 *U5400 H 4 8 10.42 11 1 1 - 13 0 0 0 '40E873 *U5400 H 4 8 10.4 11 1 1 - 13 0 0 0
'40E85C *U5400 H 4 8 10.42 11 1 1 - 14 0 0 0 '40E85C *U5400 H 4 8 10.4 11 1 1 - 14 0 0 0
'40E845 *U5400 H 4 8 10.42 11 1 1 - 15 0 0 0 '40E845 *U5400 H 4 8 10.4 11 1 1 - 15 0 0 0
'40E82E *U5400 H 4 8 10.42 11 1 1 - 16 0 0 0 '40E82E *U5400 H 4 8 10.4 11 1 1 - 16 0 0 0
'40E817 *U5400 H 4 8 10.42 11 1 1 - 17 0 0 0 '40E817 *U5400 H 4 8 10.4 11 1 1 - 17 0 0 0
'40E800 *U5401 H 2 8 12.65 14 - 1 - 18 0 0 0 '40E800 *U5401 H 2 8 12.6 14 - 1 - 18 0 0 0
'40E7E9 *U5401 I 2 8 1.89 0 - - 2 19 0 0 0 '40E7E9 *U5401 I 2 8 1.84 0 - - 2 19 0 0 0
1 HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE
2 '40EC39 *U5399 H 1 8 14.37 14.24 16 - 1 - 1 0 0 0
3 '40EC22 *U5402 H 3 8 12.89 12.72 14 2 1 - 2 0 0 0
4 '40EC0B *U5402 H 1 8 14.37 14.24 16 - 1 - 3 0 0 0
5 '40EBF4 *U5402 H 1 8 14.37 14.24 16 - 1 - 4 0 0 0
6 '40EBDD *U5402 H 3 8 12.89 12.72 14 2 1 - 5 0 0 0
7 '40EBC6 *U5402 H 3 8 12.89 12.72 14 2 1 - 6 0 0 0
8 '40EBAF *U5402 H 3 8 12.89 12.72 14 2 1 - 7 0 0 0
9 '40EB98 *U5399 H 1 8 14.37 14.24 16 - 1 - 8 0 0 0
10 '40EB81 *U5401 H 2 8 12.65 12.6 14 - 1 - 9 0 0 0
11 '40E8B8 *U5401 H 2 8 12.65 12.6 14 - 1 - 10 0 0 0
12 '40E8A1 *U5401 I 2 8 1.89 1.84 0 - - 2 11 0 0 0
13 '40E88A *U5400 H 4 8 10.42 10.4 11 1 1 - 12 0 0 0
14 '40E873 *U5400 H 4 8 10.42 10.4 11 1 1 - 13 0 0 0
15 '40E85C *U5400 H 4 8 10.42 10.4 11 1 1 - 14 0 0 0
16 '40E845 *U5400 H 4 8 10.42 10.4 11 1 1 - 15 0 0 0
17 '40E82E *U5400 H 4 8 10.42 10.4 11 1 1 - 16 0 0 0
18 '40E817 *U5400 H 4 8 10.42 10.4 11 1 1 - 17 0 0 0
19 '40E800 *U5401 H 2 8 12.65 12.6 14 - 1 - 18 0 0 0
20 '40E7E9 *U5401 I 2 8 1.89 1.84 0 - - 2 19 0 0 0

View File

@@ -27,7 +27,7 @@ Part # Description Total
513832 TRAY, FOLLOWING, HELIX ROOF 210 513832 TRAY, FOLLOWING, HELIX ROOF 210
513833 TRAY, LINK, HELIX ROOF 1271 513833 TRAY, LINK, HELIX ROOF 1271
513836 SPOILER, SINGLE TILT, HELIX ROOF 1632 513836 SPOILER, SINGLE TILT, HELIX ROOF 1632
513843 PLATE, ANCHOR, HELIX ROOF 414 513843 PLATE, ANCHOR, HELIX ROOF 416
513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 274 513844 TRAY, OPTIONAL BALLAST, HELIX ROOF 274
514265 FOOT, RECYCLED RUBBER, HELIX ROOF 230 514265 FOOT, RECYCLED RUBBER, HELIX ROOF 230
514435 HARNESS, DC COMBINATION, W/ FUSE, 3 STRING, FEMALES TO MALE, HELIX 4 514435 HARNESS, DC COMBINATION, W/ FUSE, 3 STRING, FEMALES TO MALE, HELIX 4
@@ -57,6 +57,6 @@ Part # Description Total
523922 INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 3 523922 INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 3
523924 INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 6 523924 INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS 6
805615 SCREW, HEXAGONAL HEAD, M10X20, SS A2 10 805615 SCREW, HEXAGONAL HEAD, M10X20, SS A2 10
Contractor Supplied Ballast Blocks 10150 Contractor Supplied Ballast Blocks 10448
TBD Anchors 414 TBD Anchors 416
TBD Modules 1632 TBD Modules 1632
Can't render this file because it contains an unexpected character in line 10 and column 30.

View File

@@ -1,3 +1,3 @@
HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE HANDLE BLOCKNAME WIND POS SUBARRAY PSF BAL LTRAY XTRAY ANC ID XCOORD YCOORD ANGLE
'40EC39 *U5399 A 1 1 2.4 0 2 - 1 1 0 0 0 '40EC39 *U5399 A 1 1 2.39 0 2 - 1 1 0 0 0
'40EC22 *U5402 A 1 1 2.4 0 2 - 1 2 0 0 0 '40EC22 *U5402 A 1 1 2.39 0 2 - 1 2 0 0 0

View File

@@ -171,11 +171,11 @@ class ArraySummaryTest(unittest.TestCase):
def test_shows_summary_values(self): def test_shows_summary_values(self):
self.fill_in_site_characterization_data() self.fill_in_site_characterization_data()
self.upload_csv_file(file='test/fixtures/input_single_tilt_csv_for_bom.csv') self.upload_csv_file(file='test/fixtures/input_single_tilt_csv_for_bom.csv')
self.assert_summary_values_column_data(1, 'Total System Weight (lbs)', '216,074') self.assert_summary_values_column_data(1, 'Total System Weight (lbs)', '217,409')
self.assert_summary_values_column_data(2, 'Max PSF', '9.11') self.assert_summary_values_column_data(2, 'Max PSF', '9.36')
self.assert_summary_values_column_data(3, 'Avg PSF', '5.05') self.assert_summary_values_column_data(3, 'Avg PSF', '5.08')
self.assert_summary_values_column_data(4, 'Total Anchors', '421') self.assert_summary_values_column_data(4, 'Total Anchors', '422')
self.assert_summary_values_column_data(5, 'Total Ballast', '10,150') self.assert_summary_values_column_data(5, 'Total Ballast', '10,448')
def test_shows_seismic_placement_interval(self): def test_shows_seismic_placement_interval(self):
self.fill_in_site_characterization_data(system_type=SystemType.dualTilt) self.fill_in_site_characterization_data(system_type=SystemType.dualTilt)
@@ -212,26 +212,26 @@ class ArraySummaryTest(unittest.TestCase):
eq_(response.content_type, "application/json") eq_(response.content_type, "application/json")
data = json.loads(response.data.decode()) data = json.loads(response.data.decode())
expected = [ expected = [
{'data': {'ballast': 7, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 1, 'panel_type': 2, 'psf': 4.94, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 7, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 1, 'panel_type': 2, 'psf': 4.91, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 2, 'panel_type': 2, 'psf': 3.12, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 2, 'panel_type': 2, 'psf': 3.1, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 3, 'panel_type': 1, 'psf': 6.47, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 3, 'panel_type': 1, 'psf': 6.48, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 4, 'panel_type': 1, 'psf': 6.47, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 4, 'panel_type': 1, 'psf': 6.48, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 5, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 5, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 6, 'panel_type': 2, 'psf': 3.12, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 6, 'panel_type': 2, 'psf': 3.1, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 7, 'panel_type': 4, 'psf': 2.26, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 7, 'panel_type': 4, 'psf': 2.26, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 8, 'panel_type': 3, 'psf': 2.98, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 8, 'panel_type': 3, 'psf': 3.0, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 9, 'panel_type': 3, 'psf': 2.98, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 9, 'panel_type': 3, 'psf': 3.0, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 10, 'panel_type': 4, 'psf': 2.26, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 10, 'panel_type': 4, 'psf': 2.26, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 11, 'panel_type': 2, 'psf': 3.12, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 11, 'panel_type': 2, 'psf': 3.1, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 12, 'panel_type': 3, 'psf': 2.98, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 12, 'panel_type': 3, 'psf': 3.0, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 13, 'panel_type': 3, 'psf': 2.98, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 13, 'panel_type': 3, 'psf': 3.0, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 14, 'panel_type': 3, 'psf': 2.98, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 2, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 14, 'panel_type': 3, 'psf': 3.0, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 15, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 15, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 16, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 16, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 17, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 17, 'panel_type': 1, 'psf': 4.57, 'seismic_anchors': 0, 'subarray': 7, 'wind_anchors': 0, 'wind_zones': 'B'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 18, 'panel_type': 1, 'psf': 6.47, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 18, 'panel_type': 1, 'psf': 6.48, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 19, 'panel_type': 3, 'psf': 4.48, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}, {'data': {'ballast': 6, 'cross_trays': 0, 'link_trays': 1, 'panel_id': 19, 'panel_type': 3, 'psf': 4.5, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5},
{'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 20, 'panel_type': 1, 'psf': 6.47, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5} {'data': {'ballast': 11, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 20, 'panel_type': 1, 'psf': 6.48, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 0, 'wind_zones': 'A'}, 'height': 1, 'width': 1.5}
] ]
# Removing these keys as they get calculated differently in CircleCI # Removing these keys as they get calculated differently in CircleCI
@@ -290,28 +290,28 @@ class ArraySummaryTest(unittest.TestCase):
"status": "success", "status": "success",
"error": None, "error": None,
"panel_data": [ "panel_data": [
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.08, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 1, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 2, 'panel_id': 1}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 1, 'panel_type': 1, 'psf': 1.95, 'seismic_anchors': 2, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.04, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 3, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 2, 'seismic_anchors': 0, 'panel_id': 2}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 2, 'panel_type': 3, 'psf': 1.88, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.08, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 1, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 3}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 3, 'panel_type': 1, 'psf': 1.95, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.08, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 1, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 4}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 4, 'panel_type': 1, 'psf': 1.95, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.04, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 3, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 2, 'seismic_anchors': 0, 'panel_id': 5}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 5, 'panel_type': 3, 'psf': 1.88, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.04, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 3, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 2, 'seismic_anchors': 0, 'panel_id': 6}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 6, 'panel_type': 3, 'psf': 1.88, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.04, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 3, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 2, 'seismic_anchors': 0, 'panel_id': 7}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 2, 'panel_id': 7, 'panel_type': 3, 'psf': 1.88, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 2.08, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 1, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 8}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 8, 'panel_type': 1, 'psf': 1.95, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.89, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 2, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 9}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 9, 'panel_type': 2, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.89, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 2, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 10}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 10, 'panel_type': 2, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.89, 'wind_zones': 'I', 'ballast': 0, 'panel_type': 2, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 11}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 11, 'panel_type': 2, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'I'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 12}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 12, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 13}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 13, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 14}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 14, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 15}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 15, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 16}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 16, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.86, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 4, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 17}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 17, 'panel_type': 4, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.89, 'wind_zones': 'H', 'ballast': 0, 'panel_type': 2, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 18}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 18, 'panel_type': 2, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'H'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
{'x': 0, 'y': 0, 'height': 1, 'width': 1, 'data': {'subarray': 8, 'psf': 1.89, 'wind_zones': 'I', 'ballast': 0, 'panel_type': 2, 'cross_trays': 0, 'wind_anchors': 1, 'link_trays': 0, 'seismic_anchors': 0, 'panel_id': 19}}, {'data': {'ballast': 0, 'cross_trays': 0, 'link_trays': 0, 'panel_id': 19, 'panel_type': 2, 'psf': 1.84, 'seismic_anchors': 0, 'subarray': 8, 'wind_anchors': 1, 'wind_zones': 'I'}, 'height': 1, 'width': 1, 'x': 0.0, 'y': 0.0},
], ],
"subarray_data": [ "subarray_data": [
{"subarray": 8, "weight": 972, "required_seismic_anchors": 0}, {"subarray": 8, "weight": 932, "required_seismic_anchors": 0},
], ],
} }
received_result = flask.json.loads(result.data) received_result = flask.json.loads(result.data)
@@ -367,9 +367,10 @@ class ArraySummaryTest(unittest.TestCase):
expected_result = [ expected_result = [
{"subarray": 7, "weight": 2253, "required_seismic_anchors": 4}, {"subarray": 7, "weight": 2253, "required_seismic_anchors": 4},
{"subarray": 8, "weight": 673, "required_seismic_anchors": 0}, {"subarray": 8, "weight": 674, "required_seismic_anchors": 0},
] ]
received_result = flask.json.loads(result.data) received_result = flask.json.loads(result.data)
eq_(received_result['subarray_data'], expected_result) eq_(received_result['subarray_data'], expected_result)
eq_(result.content_type, "application/json") eq_(result.content_type, "application/json")
@@ -410,7 +411,7 @@ class ArraySummaryTest(unittest.TestCase):
"error": SeismicAnchorValidationError.TooFewAnchors.value, "error": SeismicAnchorValidationError.TooFewAnchors.value,
"panel_data": None, "panel_data": None,
"subarray_data": [ "subarray_data": [
{"subarray": 1, "weight": 2739, "required_seismic_anchors": 6}, {"subarray": 1, "weight": 2722, "required_seismic_anchors": 6},
], ],
} }
eq_(flask.json.loads(result.data), expected_result) eq_(flask.json.loads(result.data), expected_result)

View File

@@ -36,7 +36,7 @@ class BomIntegrationTest(unittest.TestCase):
expected = [ expected = [
["512200", "CLIP, WIRE FORMED, CABLE MANAGEMENT, INSIDE, 352MM ^ 2", "510"], ["512200", "CLIP, WIRE FORMED, CABLE MANAGEMENT, INSIDE, 352MM ^ 2", "510"],
["513833", "TRAY, LINK, HELIX ROOF", "78"], # TODO: should be 74 for part perfect bom ["513833", "TRAY, LINK, HELIX ROOF", "78"],
["513843", "PLATE, ANCHOR, HELIX ROOF", "86"], ["513843", "PLATE, ANCHOR, HELIX ROOF", "86"],
["513844", "TRAY, OPTIONAL BALLAST, HELIX ROOF", "35"], ["513844", "TRAY, OPTIONAL BALLAST, HELIX ROOF", "35"],
["514056", "BASE, CHASSIS, DUAL TILT, HELIX ROOF", "147"], ["514056", "BASE, CHASSIS, DUAL TILT, HELIX ROOF", "147"],
@@ -48,7 +48,7 @@ class BomIntegrationTest(unittest.TestCase):
["518477", "WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS", "100"], ["518477", "WASHER, FLAT, 3/8, 1.00 OD, 18-8 SS", "100"],
["521794", "DEFLECTOR, LH, HELIX ROOF V1.1", "30"], ["521794", "DEFLECTOR, LH, HELIX ROOF V1.1", "30"],
["521795", "DEFLECTOR, RH, HELIX ROOF V1.1", "30"], ["521795", "DEFLECTOR, RH, HELIX ROOF V1.1", "30"],
["Contractor Supplied", "Ballast Blocks", "608"], ["Contractor Supplied", "Ballast Blocks", "610"],
["TBD", "Anchors", "86"], ["TBD", "Anchors", "86"],
["TBD", "Modules", "252"] ["TBD", "Modules", "252"]
] ]

View File

@@ -149,6 +149,8 @@ class FullUserFlowTest(unittest.TestCase):
self.advance_n_times(1) self.advance_n_times(1)
self.browser.visit('/download/') self.browser.visit('/download/')
self.browser.click_link_by_partial_text('Download AutoCAD import file') self.browser.click_link_by_partial_text('Download AutoCAD import file')
print("===")
print(self.browser.html)
eq_(self.browser.html, csv_content) eq_(self.browser.html, csv_content)
eq_(self.browser._response.headers['Content-Disposition'], 'attachment; filename=test_project_name_result.txt') eq_(self.browser._response.headers['Content-Disposition'], 'attachment; filename=test_project_name_result.txt')