syncing master
This commit is contained in:
@@ -5,6 +5,8 @@ from helix.constants import ebom_parts
|
||||
from helix.constants.ebom_parts import *
|
||||
from helix.constants.parts import wire_clip_large, cable_support, cable_support_lid, channel_nut, sunshade
|
||||
from helix.constants.system_type import SystemType
|
||||
from helix.constants.inverter_brand import InverterBrand
|
||||
from helix.forms.ebom_form import InverterBrandForm
|
||||
|
||||
|
||||
class EbomCalculator(object):
|
||||
@@ -36,11 +38,25 @@ class EbomCalculator(object):
|
||||
monitors = self.values.power_monitors()
|
||||
module_type = self.values.module_type()
|
||||
system_type = self.values.system_type()
|
||||
|
||||
is_delta=None
|
||||
try:
|
||||
is_delta=(self.values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
|
||||
except IndexError :
|
||||
#Some tests are calculating bom without providing inverter brand so inverter_brands is empty
|
||||
#for those tests, inverter brand is irrelevant
|
||||
is_delta=False
|
||||
|
||||
inverter_count = 0
|
||||
total_ac_run_length = 0
|
||||
panel_board_counts = [0, 0]
|
||||
proper_monitor_controller = self.resolve_power_monitor_type()
|
||||
|
||||
try:
|
||||
is_delta = (self.values.inverter_brands()[0]['inverter_brand_id']==InverterBrand.DELTA.value)
|
||||
except IndexError:
|
||||
is_delta = False
|
||||
|
||||
for power_station in power_stations:
|
||||
power_station_count = power_station['power_station_quantity']
|
||||
total_ac_run_length += power_station['ac_run_length']
|
||||
@@ -75,6 +91,8 @@ class EbomCalculator(object):
|
||||
for monitor in monitors:
|
||||
if monitor['power_source'][0] == 'Switch Gear/External':
|
||||
add_parts_to_list(part_list, {proper_monitor_controller: 1}, 1)
|
||||
if (is_delta):
|
||||
add_parts_to_list(part_list, {ethernet_plug: 2},1)
|
||||
|
||||
add_parts_to_list(part_list, {wire_clip_large: inverter_count}, self.row_count)
|
||||
|
||||
@@ -84,8 +102,9 @@ class EbomCalculator(object):
|
||||
add_parts_to_list(part_list, {rear_skirt: -1}, ceil(cable_supports*.38))
|
||||
|
||||
dependent_part_list = {}
|
||||
|
||||
for part, quantity in part_list.items():
|
||||
dependent_parts = ebom_parts.dependent_parts(module_type, system_type).get(part)
|
||||
dependent_parts = ebom_parts.dependent_parts(module_type, system_type,is_delta).get(part)
|
||||
if dependent_parts:
|
||||
add_parts_to_list(dependent_part_list, dependent_parts, quantity)
|
||||
|
||||
|
||||
@@ -18,32 +18,18 @@ class DualTiltParts(object):
|
||||
}
|
||||
|
||||
def __init__(self, module_type):
|
||||
if module_type == ModuleType.PSeries:
|
||||
self.corner_panel_parts = {
|
||||
left_deflector_1_1: 1,
|
||||
right_deflector_1_1: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
self.north_south_panel_parts = {
|
||||
left_deflector_1_1: 1,
|
||||
right_deflector_1_1: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
else:
|
||||
self.corner_panel_parts = {
|
||||
left_deflector: 1,
|
||||
right_deflector: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
self.north_south_panel_parts = {
|
||||
left_deflector: 1,
|
||||
right_deflector: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
self.corner_panel_parts = {
|
||||
left_deflector_1_1: 1,
|
||||
right_deflector_1_1: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
self.north_south_panel_parts = {
|
||||
left_deflector_1_1: 1,
|
||||
right_deflector_1_1: 1,
|
||||
dual_tilt_chassis: 1.5,
|
||||
module: 2
|
||||
}
|
||||
|
||||
def row_parts(self, module_type):
|
||||
if module_type == ModuleType.Cell96:
|
||||
|
||||
@@ -144,6 +144,7 @@ def standalone_inverter_parts(inverter, system_type, module_type):
|
||||
phillips_screw: 4 * multiplier,
|
||||
ac_inverter_bracket: 1 * multiplier,
|
||||
hex_bolt_1_2: 4,
|
||||
ethernet_plug: 1.8,
|
||||
flat_washer_6: 4,
|
||||
inverter_link_short: v1_1_inverter_links,
|
||||
inverter_link_long: v1_1_inverter_links,
|
||||
@@ -195,10 +196,30 @@ def inverter_parts(inverter, module_type):
|
||||
stump: 6,
|
||||
}
|
||||
|
||||
def dependent_parts(module_type, system_type):
|
||||
def dependent_parts(module_type, system_type, is_delta):
|
||||
v1_1_inverter_links = 0
|
||||
if system_type == SystemType.singleTilt and (module_type == ModuleType.Cell128 or module_type == ModuleType.PSeries):
|
||||
v1_1_inverter_links = 1
|
||||
|
||||
if is_delta:
|
||||
monitor_controller_480_v_={
|
||||
monitor_power_plug: 1,
|
||||
}
|
||||
else:
|
||||
monitor_controller_480_v_={
|
||||
monitor_power_plug: 1,
|
||||
flat_washer: 4,
|
||||
channel_nut: 4,
|
||||
hex_nut_three_eighths_16: 2,
|
||||
front_legs: 1,
|
||||
back_legs: 1,
|
||||
inverter_link: 2,
|
||||
inverter_rail: 1,
|
||||
rubber_foot: 3,
|
||||
hex_bolt_1_2: 9,
|
||||
mounting_back_plate: 1,
|
||||
}
|
||||
|
||||
return {
|
||||
panel_board_2: {
|
||||
harness_ac_inner: 2,
|
||||
@@ -246,19 +267,7 @@ def dependent_parts(module_type, system_type):
|
||||
inverter_link_long: v1_1_inverter_links,
|
||||
inverter_link: -2 * v1_1_inverter_links,
|
||||
},
|
||||
monitor_controller_480_v: {
|
||||
monitor_power_plug: 1,
|
||||
flat_washer: 4,
|
||||
channel_nut: 4,
|
||||
hex_nut_three_eighths_16: 2,
|
||||
front_legs: 1,
|
||||
back_legs: 1,
|
||||
inverter_link: 2,
|
||||
inverter_rail: 1,
|
||||
rubber_foot: 3,
|
||||
hex_bolt_1_2: 9,
|
||||
mounting_back_plate: 1,
|
||||
},
|
||||
monitor_controller_480_v: monitor_controller_480_v_,
|
||||
monitor_controller_240_v: {},
|
||||
ac_splice_box: {
|
||||
hex_bolt_1_2: 4,
|
||||
|
||||
@@ -15,6 +15,7 @@ class FileValidationMessage(Enum):
|
||||
ExpectedTxtFile = 'Invalid file uploaded. Please upload a valid .txt file.'
|
||||
ExpectedDxfFile = 'Invalid file uploaded. Please upload a valid .dxf file.'
|
||||
OldDxfFormat = 'Invalid Aurora format uploaded. Please upload a new format.'
|
||||
PanelsTooClose = 'It appears that the panel coordinates are too close together. Please ensure that panel spacing is correct and that you have selected the correct configuration.'
|
||||
|
||||
@classmethod
|
||||
def invalid_wind_zones(cls, system_type):
|
||||
|
||||
@@ -5,6 +5,7 @@ from helix.constants.panel_type import PanelType
|
||||
|
||||
|
||||
class DualTilt128CellConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (88.24, 82.0) # inches
|
||||
spacing_size_inches = 5.12 # This is inches
|
||||
presenter_spacing = (1.5, 1.5)
|
||||
|
||||
@@ -5,6 +5,7 @@ from helix.constants.panel_type import PanelType
|
||||
|
||||
|
||||
class DualTilt96CellConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (88.24, 62.0) # inches
|
||||
spacing_size_inches = 5.12 # This is inches
|
||||
presenter_spacing = (1.5, 1)
|
||||
|
||||
@@ -5,6 +5,7 @@ from helix.constants.panel_type import PanelType
|
||||
|
||||
|
||||
class DualTiltPSeriesConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (88.24, 82.0) # inches
|
||||
spacing_size_inches = 8.8503937 # This is inches
|
||||
presenter_spacing = (1.5, 1.5)
|
||||
|
||||
@@ -8,6 +8,7 @@ from helix.constants.system_type_constants.single_tilt_constants import SingleTi
|
||||
|
||||
|
||||
class SingleTilt128CellConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (82.0, 60.0) # inches
|
||||
presenter_spacing = (1.5, 1)
|
||||
panel_area = 23.29
|
||||
|
||||
@@ -7,6 +7,7 @@ from helix.constants.system_type_constants.single_tilt_constants import SingleTi
|
||||
|
||||
|
||||
class SingleTilt96CellConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (62.0, 60.0) # inches
|
||||
presenter_spacing = (1, 1)
|
||||
panel_area = 17.58
|
||||
|
||||
@@ -7,6 +7,7 @@ from helix.constants.system_type_constants.single_tilt_constants import SingleTi
|
||||
|
||||
|
||||
class SingleTiltPSeriesConstants(object):
|
||||
tolerance = 0.1 #require 10% additional space for panel spacing
|
||||
panel_spacing = (82.0, 61.8755) # inches
|
||||
presenter_spacing = (1.5, 1)
|
||||
panel_area = 22.22
|
||||
|
||||
@@ -5,8 +5,6 @@ dual_tilt_chassis = ('514056', 'BASE, CHASSIS, DUAL TILT, HELIX ROOF')
|
||||
dual_tilt_platform = ('514057', 'PLATFORM, CHASSIS, DUAL TILT, HELIX ROOF')
|
||||
platform_bolt = ('515063', 'SCREW, CAP, SH, M6 X 1 X 12, 18-8 SS (DIN 912)')
|
||||
|
||||
left_deflector = ('513841', 'DEFLECTOR, LH, HELIX ROOF')
|
||||
right_deflector = ('513842', 'DEFLECTOR, RH, HELIX ROOF')
|
||||
front_skirt = ('515928', 'FRONT SKIRT, HELIX ROOF')
|
||||
rear_skirt = ('515929', 'REAR SKIRT, HELIX ROOF')
|
||||
spoiler = ('513836', 'SPOILER, SINGLE TILT, HELIX ROOF')
|
||||
@@ -59,10 +57,10 @@ inverter_link_long = ('521797', 'LINK TO ARRAY, SHORT, INVERTER RACK, HELIX ROOF
|
||||
|
||||
mounting_back_plate = ('518331', 'MOUNTING BACK PLATE, INVERTER/PANEL BOARD, HELIX ROOF/TRACKER')
|
||||
|
||||
sma_12kw_inverter = ('514686', 'INVERTER, SMA, STP, 12000TL-US-10 (SPR-12000m-3 XXX), AFCI, CONNECTORIZED')
|
||||
sma_15kw_inverter = ('514687', 'INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3 XXX), AFCI, CONNECTORIZED')
|
||||
sma_20kw_inverter = ('512676', 'INVERTER, SMA, STP, 20000TL-US-10 (SPR-20000m-3 XXX), AFCI, CONNECTORIZED')
|
||||
sma_24kw_inverter = ('514685', 'INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3 XXX), AFCI, CONNECTORIZED')
|
||||
sma_12kw_inverter = ('523921', 'INVERTER, SMA, STP, 20000TL-US-10 (SPR-20000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS')
|
||||
sma_15kw_inverter = ('523922', 'INVERTER, SMA, STP, 24000TL-US-10 (SPR-24000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS')
|
||||
sma_20kw_inverter = ('523923', 'INVERTER, SMA, STP, 12000TL-US-10 (SPR-12000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS')
|
||||
sma_24kw_inverter = ('523924', 'INVERTER, SMA, STP, 15000TL-US-10 (SPR-15000m-3-H), AFCI, CONNECTORIZED, UTX XL REV D DC CONNECTORS')
|
||||
|
||||
delta_36kw_inverter = ('524952', 'INVERTER, DELTA, M36U_122(MC4), 10INPUT, 36KW, 3PH 480V AC,1000V DC')
|
||||
delta_42kw_inverter = ('524969', 'INVERTER, DELTA, M42U_122(MC4), 12INPUT, 42KW, 3PH 480V AC,1000V DC')
|
||||
@@ -159,8 +157,6 @@ all_parts = [
|
||||
dual_tilt_chassis,
|
||||
dual_tilt_platform,
|
||||
platform_bolt,
|
||||
left_deflector,
|
||||
right_deflector,
|
||||
front_skirt,
|
||||
rear_skirt,
|
||||
spoiler,
|
||||
|
||||
@@ -18,32 +18,19 @@ class SingleTiltParts(object):
|
||||
}
|
||||
|
||||
def __init__(self, module_type):
|
||||
if module_type == ModuleType.PSeries:
|
||||
self.corner_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1,
|
||||
left_deflector_1_1: 0.5,
|
||||
right_deflector_1_1: 0.5,
|
||||
}
|
||||
self.east_west_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1.5,
|
||||
left_deflector_1_1: 0.5,
|
||||
right_deflector_1_1: 0.5
|
||||
}
|
||||
else:
|
||||
self.corner_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1,
|
||||
left_deflector: 0.5,
|
||||
right_deflector: 0.5
|
||||
}
|
||||
self.east_west_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1.5,
|
||||
left_deflector: 0.5,
|
||||
right_deflector: 0.5
|
||||
}
|
||||
self.corner_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1,
|
||||
left_deflector_1_1: 0.5,
|
||||
right_deflector_1_1: 0.5,
|
||||
}
|
||||
self.east_west_panel_parts = {
|
||||
module: 1,
|
||||
single_tilt_chassis: 1.5,
|
||||
left_deflector_1_1: 0.5,
|
||||
right_deflector_1_1: 0.5
|
||||
}
|
||||
|
||||
|
||||
def row_parts(self, _):
|
||||
return {}
|
||||
|
||||
@@ -9,7 +9,10 @@ class ArrayVisualization {
|
||||
this.isDualTilt = isDualTilt;
|
||||
this.subarrayDisplay = subarrayDisplay;
|
||||
this.buildings = buildings;
|
||||
|
||||
// Default options
|
||||
this.scale = 10;
|
||||
this.panels = [];
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -22,12 +25,12 @@ class ArrayVisualization {
|
||||
this.stage.mouseMoveOutside = true;
|
||||
this.adjustScale(this.buildings);
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
this.container.x = 0;
|
||||
this.container.y = 0;
|
||||
this.stage.addChild(this.container);
|
||||
|
||||
this.drawBuildings(this.buildings,this.scale);
|
||||
this.drawBuildings(this.buildings, this.scale);
|
||||
|
||||
this.stage.update();
|
||||
|
||||
@@ -76,13 +79,13 @@ class ArrayVisualization {
|
||||
|
||||
}
|
||||
|
||||
drawBuildings(buildings, scale) {
|
||||
if (!buildings) {
|
||||
drawBuildings(buildings) {
|
||||
if (!buildings || buildings.length === 0) {
|
||||
console.log("No Buildings!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scale) {
|
||||
if (!this.scale) {
|
||||
console.log("No Scale - don't know how big the buildings should be!");
|
||||
return;
|
||||
}
|
||||
@@ -99,14 +102,14 @@ class ArrayVisualization {
|
||||
|
||||
line.graphics.beginStroke(color);
|
||||
|
||||
line.graphics.moveTo(firstPoint.x * scale, firstPoint.y * scale);
|
||||
line.graphics.moveTo(firstPoint.x * this.scale, firstPoint.y * this.scale);
|
||||
|
||||
for (let j = 1; j < building.length; j++ ) {
|
||||
nextPoint = building[j];
|
||||
line.graphics.lineTo(nextPoint.x * scale ,nextPoint.y * scale);
|
||||
line.graphics.moveTo(nextPoint.x * scale,nextPoint.y * scale);
|
||||
line.graphics.lineTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
line.graphics.moveTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
}
|
||||
line.graphics.lineTo(firstPoint.x * scale, firstPoint.y * scale );
|
||||
line.graphics.lineTo(firstPoint.x * this.scale, firstPoint.y * this.scale );
|
||||
line.graphics.endStroke();
|
||||
|
||||
}
|
||||
@@ -121,7 +124,7 @@ class ArrayVisualization {
|
||||
this.container.removeChild(this.panels[i]);
|
||||
}
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
|
||||
let selectedPanel = this.selectedPanel;
|
||||
this.selectedPanel = undefined;
|
||||
@@ -134,18 +137,14 @@ class ArrayVisualization {
|
||||
}
|
||||
|
||||
drawArray(container, panels) {
|
||||
this.panels = [];
|
||||
let treatCoordinatesAsCenterpoints = this.buildings && this.buildings.length > 0;
|
||||
for (let i = 0; i < panels.length; i++) {
|
||||
let panel = panels[i];
|
||||
|
||||
let box = new Panel(panel, this.isDualTilt, this.scale, treatCoordinatesAsCenterpoints);
|
||||
let box = new Panel(panels[i], this.isDualTilt, this.scale, treatCoordinatesAsCenterpoints);
|
||||
container.addChild(box);
|
||||
this.panels.push(box);
|
||||
|
||||
let self = this;
|
||||
box.on("click", function () {
|
||||
self.selectPanel(i);
|
||||
box.on("click", () => {
|
||||
this.selectPanel(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,14 +48,11 @@ class ProjectPresenter(object):
|
||||
|
||||
# Move coordinates to reflect origin being at top-left
|
||||
# (as per canvas) instead of bottom-left
|
||||
# if max_y is not passed - use the panels instead of buildings
|
||||
if max_y is None:
|
||||
height = max(map(lambda row: row['y'], table_data))
|
||||
else:
|
||||
height = max_y
|
||||
height = max(map(lambda row: row['y'], table_data))
|
||||
first_cell = min(map(lambda row: row['y'], table_data))
|
||||
self.offset = height
|
||||
for panel in table_data:
|
||||
panel['y'] = height - panel['y']
|
||||
panel['y'] = height - panel['y'] + first_cell
|
||||
return table_data
|
||||
|
||||
def get_buildings(self, buildings):
|
||||
@@ -76,10 +73,6 @@ class ProjectPresenter(object):
|
||||
point.y = point.y * spacing_y
|
||||
presentable_building.append(point.__dict__)
|
||||
|
||||
for presentable_building in result:
|
||||
for point in presentable_building:
|
||||
point['y'] = self.offset - point['y']
|
||||
|
||||
return result
|
||||
|
||||
def get_max_y(self,buildings, panels):
|
||||
|
||||
@@ -122,7 +122,10 @@
|
||||
this.isDualTilt = isDualTilt;
|
||||
this.subarrayDisplay = subarrayDisplay;
|
||||
this.buildings = buildings;
|
||||
|
||||
// Default options
|
||||
this.scale = 10;
|
||||
this.panels = [];
|
||||
}
|
||||
|
||||
_createClass(ArrayVisualization, [{
|
||||
@@ -137,7 +140,7 @@
|
||||
this.stage.mouseMoveOutside = true;
|
||||
this.adjustScale(this.buildings);
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
this.container.x = 0;
|
||||
this.container.y = 0;
|
||||
this.stage.addChild(this.container);
|
||||
@@ -200,13 +203,13 @@
|
||||
}
|
||||
}, {
|
||||
key: 'drawBuildings',
|
||||
value: function drawBuildings(buildings, scale) {
|
||||
if (!buildings) {
|
||||
value: function drawBuildings(buildings) {
|
||||
if (!buildings || buildings.length === 0) {
|
||||
console.log("No Buildings!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scale) {
|
||||
if (!this.scale) {
|
||||
console.log("No Scale - don't know how big the buildings should be!");
|
||||
return;
|
||||
}
|
||||
@@ -223,14 +226,14 @@
|
||||
|
||||
line.graphics.beginStroke(color);
|
||||
|
||||
line.graphics.moveTo(firstPoint.x * scale, firstPoint.y * scale);
|
||||
line.graphics.moveTo(firstPoint.x * this.scale, firstPoint.y * this.scale);
|
||||
|
||||
for (var j = 1; j < building.length; j++) {
|
||||
nextPoint = building[j];
|
||||
line.graphics.lineTo(nextPoint.x * scale, nextPoint.y * scale);
|
||||
line.graphics.moveTo(nextPoint.x * scale, nextPoint.y * scale);
|
||||
line.graphics.lineTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
line.graphics.moveTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
}
|
||||
line.graphics.lineTo(firstPoint.x * scale, firstPoint.y * scale);
|
||||
line.graphics.lineTo(firstPoint.x * this.scale, firstPoint.y * this.scale);
|
||||
line.graphics.endStroke();
|
||||
}
|
||||
|
||||
@@ -245,7 +248,7 @@
|
||||
this.container.removeChild(this.panels[i]);
|
||||
}
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
|
||||
var selectedPanel = this.selectedPanel;
|
||||
this.selectedPanel = undefined;
|
||||
@@ -261,19 +264,15 @@
|
||||
value: function drawArray(container, panels) {
|
||||
var _this2 = this;
|
||||
|
||||
this.panels = [];
|
||||
var treatCoordinatesAsCenterpoints = this.buildings && this.buildings.length > 0;
|
||||
|
||||
var _loop = function _loop(i) {
|
||||
var panel = panels[i];
|
||||
|
||||
var box = new _panel.Panel(panel, _this2.isDualTilt, _this2.scale, treatCoordinatesAsCenterpoints);
|
||||
var box = new _panel.Panel(panels[i], _this2.isDualTilt, _this2.scale, treatCoordinatesAsCenterpoints);
|
||||
container.addChild(box);
|
||||
_this2.panels.push(box);
|
||||
|
||||
var self = _this2;
|
||||
box.on("click", function () {
|
||||
self.selectPanel(i);
|
||||
_this2.selectPanel(i);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<link href="//cdn.rawgit.com/noelboss/featherlight/1.7.6/release/featherlight.min.css" type="text/css" rel="stylesheet" />
|
||||
<link rel="shortcut icon" href="https://us.sunpower.com/sites/sunpower/files/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href={{ url_for('static', filename='css/fontello.css') }}>
|
||||
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
|
||||
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
|
||||
crossorigin="anonymous"></script>
|
||||
{% if context['google_analytics_token'] %}
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
|
||||
@@ -8,7 +8,7 @@ from helix.constants.panel_type import PanelType
|
||||
from helix.constants.system_type import SystemType
|
||||
from helix.models.coordinate import Coordinate
|
||||
from helix.models.panel import PanelData, Panel
|
||||
|
||||
from helix.models.sql.inverter_brands import InverterBrand
|
||||
|
||||
class UserValues(object):
|
||||
def __init__(self, store, site):
|
||||
@@ -60,6 +60,9 @@ class UserValues(object):
|
||||
def power_monitors(self):
|
||||
return [power_monitor.to_json() for power_monitor in self.site.power_monitors]
|
||||
|
||||
def inverter_brands(self):
|
||||
return [inverter_brands.to_json() for inverter_brands in self.site.inverter_brands]
|
||||
|
||||
def csv(self):
|
||||
csv_data = self.site.cad_file
|
||||
if not csv_data:
|
||||
@@ -156,4 +159,3 @@ class UserValues(object):
|
||||
else:
|
||||
return False # should not happen, but if it does rather not show the warning
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import csv
|
||||
from helix.constants.file_validation_error import FileValidationError, FileValidationMessage
|
||||
from helix.calculators.coordinates_calculator import CoordinatesCalculator
|
||||
from helix.models.coordinate import Coordinate
|
||||
|
||||
|
||||
class CsvInputValidator(object):
|
||||
@@ -14,7 +16,7 @@ class CsvInputValidator(object):
|
||||
if len(headers) < 5:
|
||||
return FileValidationError(FileValidationMessage.InvalidHeaders, 0)
|
||||
if len(rows) == 0:
|
||||
return FileValidationError(FileValidationMessage.InvalidRowCount, 0)
|
||||
return FileValidationError(FileValidationMessage.InvalidRowCount, 0)
|
||||
|
||||
for row_index, row in enumerate(rows):
|
||||
chain = [
|
||||
@@ -28,13 +30,14 @@ class CsvInputValidator(object):
|
||||
|
||||
file_validation_chain = [
|
||||
CsvInputValidator.validate_file_for_panel_types,
|
||||
CsvInputValidator.validate_for_spacing,
|
||||
]
|
||||
result = self.run_validation_chain(headers, rows, file_validation_chain)
|
||||
if result:
|
||||
return FileValidationError(result, None)
|
||||
|
||||
return None
|
||||
except:
|
||||
except Exception as inst:
|
||||
return FileValidationError(FileValidationMessage.Generic, None)
|
||||
|
||||
# Row Validators
|
||||
@@ -75,6 +78,45 @@ class CsvInputValidator(object):
|
||||
return FileValidationMessage.panel_type_too_few_corners(self.user_values.system_type())
|
||||
return None
|
||||
|
||||
def validate_for_spacing(self, headers, rows):
|
||||
try:
|
||||
|
||||
if len(headers) < 13:
|
||||
return None
|
||||
|
||||
coordinates_calculator = CoordinatesCalculator(self.user_values)
|
||||
|
||||
scaling_factor = self.user_values.module_system_constants().tolerance + 1
|
||||
spacing_x, spacing_y = self.user_values.module_system_constants().panel_spacing
|
||||
|
||||
spacing_coordinates = Coordinate(spacing_x*scaling_factor, spacing_y*scaling_factor,0)
|
||||
spacing_coordinates_scaled = coordinates_calculator.scale(spacing_coordinates)
|
||||
|
||||
for row_index, row in enumerate(rows):
|
||||
first_panel = Coordinate(float(row[11]), float(row[12]), float(row[13]))
|
||||
first_panel_rotated = coordinates_calculator.rotate(first_panel)
|
||||
first_panel_scaled = coordinates_calculator.scale(first_panel_rotated)
|
||||
for row_index2, row2 in enumerate(rows):
|
||||
if row_index2 <= row_index:
|
||||
continue
|
||||
|
||||
second_panel = Coordinate(float(row2[11]), float(row2[12]), float(row2[13]))
|
||||
second_panel_rotated = coordinates_calculator.rotate(second_panel)
|
||||
second_panel_scaled = coordinates_calculator.scale(second_panel_rotated)
|
||||
|
||||
x_diff = round(abs(first_panel_scaled.x - second_panel_scaled.x),3)
|
||||
y_diff = round(abs(first_panel_scaled.y - second_panel_scaled.y),3)
|
||||
|
||||
if (x_diff < spacing_coordinates_scaled.x) and (y_diff < spacing_coordinates_scaled.y):
|
||||
return FileValidationMessage.PanelsTooClose
|
||||
|
||||
return None
|
||||
|
||||
except Exception as inst:
|
||||
print("ERROR !!! ")
|
||||
print(inst)
|
||||
return FileValidationMessage.Generic
|
||||
|
||||
# Helpers
|
||||
|
||||
def run_validation_chain(self, headers, data, chain):
|
||||
|
||||
Reference in New Issue
Block a user