merge with upstream

This commit is contained in:
Senad Uka
2017-12-20 20:27:55 +01:00
parent 8beef5faea
commit 2ea9e2e702
12 changed files with 237 additions and 81 deletions

View File

@@ -4,9 +4,11 @@ from helix.calculators.subarray_helper import extract_subarray
from helix.constants.global_constants import minimum_racking_capacity
from helix.constants.panel_type import PanelType
from helix.constants.file_validation_error import FileValidationMessage,FileValidationException
from helix.models.subarray import Subarray
class SeismicCalculator(object):
def __init__(self, values, graph_repository):
self.values = values
@@ -37,13 +39,20 @@ class SeismicCalculator(object):
more_anchors_needed = True
perimeter_covered = sds < 1.0
anchor_threshold = 0
was_rung_empty = False
while more_anchors_needed:
rung = graph.pop_rung()
interval = int(self.seismic_anchor_interval())
nodes_since_last_anchor = interval
if len(rung) == 0:
if was_rung_empty:
# detected an infinite loop
# something is wrong with the input file
# probably panels overlapping
raise FileValidationException(FileValidationMessage.PanelsTooClose.value)
graph.reset()
anchor_threshold += 1
was_rung_empty = True
continue
while more_anchors_needed and interval >= 0:
for node in rung: