PVComplete - Layout Tool control
PVComplete custom WEB control is designed to be inserted into a client web page to achieve the following functionality:
PVComplete web api url: http://54.191.2.205/APIService/

PVComplete DB and API server installation instructions

PVComplete DB api help
Layout control tool requires you to have jquery library added as a script for your site.
Layout tool control injects its content in any container (usually) div. In order to start using layout tool control you need to
  1. Add a script link for layout control library in <head> section:
    <script src="http://54.191.2.205/LayoutTool/js/layoutControl.js"></script>
  2. Add the code which will create layout tool instance when document is loaded by adding the following code on document load and specifying container id (usually div):
    var layoutControl;

    $(document).ready(function(){
      InitializeLayoutControl(function()
        {
          layoutControl = new LayoutControl("placeholder", "", "APIServiceUrl");
        }
      );
    });
    Here "placehoder" is the id of the div element where layout control will be injected.
Latitude: Longitude:
Row spacing: EW spacing: Module tilt:
Input:
Output:
Layout control API
Constructor
LayoutControl(Div:id, GoogleAPIKey?:string, APIServiceUrl?:string, IsMarkerVisible:boolean) Create new instance of layout control. Accepts placeholder id (div) and optionally Google API key.
NOTE: Layout tool control should be called in InitializeLayoutControl callback function.
var layoutControl;

$(document).ready(function(){
  InitializeLayoutControl(function()
    {
      layoutControl = new LayoutControl("placeholder", "GoogleJavaScriptAPIKey", "APIServiceUrl", IsMarkerVisible);
    }
  );
});
Methods
SetCenter(latitude:double, longitude:double) Centers layout tool map using specified latitude and longitude parameters
layoutTool.SetCenter(37, -121);
SetPanelVisible(bPanelVisible:boolean) Switches tool box panel visibility on/off
layoutTool.SetPanelVisible(false);
ClearObjects() Clears all objects on map
layoutTool.ClearObjects();
GetProject() Acquires all project details: Roof(s), Obstruction(s) and Installation area(s), defined within a control in format utilizing IEP scheme
layoutTool.GetProject();
LoadProject(project:ProjectInfo) Load previously acquired project which contains information for Roof(s), Obstruction(s) and Installation area(s).
layoutControl.LoadProject(project);
AddRoofs(roofs: array of Roof) Loads specified array of roofs
layoutControl.AddRoofs(roofs);
AddObstructions(roofs: array of Obstruction) Loads specified array of Obstructions
layoutControl.AddObstructions(obstructions);
AddWorkAreas(roofs: array of workarea) Loads specified array of WorkArea(s)
layoutControl.AddWorkAreas(workareas);
SetMeasurementSystem(measurementSystem:string) Changes measurement system in which Layout Control performs all operations.
Currently supported measurement systems:
  • METERS
  • INCHES
  • layoutControl.SetMeasurementSystem(measurementSystem);
    DoLayout(N2NSpacing:number, EWSpacing:number, PVModuleId:number, orientation:enum number, ModuleTilt:number, args?:object, callback?: function) Generates PVModule layout on selected or specified Roof.
    Argument explanation:
  • N2NSpacing - North-to-north spacing (in selected measurement system. Meters by default)
  • EWspacing - East-West panel spacing (in selected measurement system. Meters by default)
  • PVModuleId - PVModule id from DB (Use API service call to get list of supported PVModules)
  • orientation - orientation of PVModules
    • 0 - Portrait
    • 1 - Landscape
  • ModuleTilt - tilt of modules on the Roof
  • args - optional object - specifies additional parameters for layout like LayoutControl Roof and/or Installation Area objects on which layout modules with installation parameters.
    args object has the following structure:
    • Roof - roof object. Mandatory parameter. Specifies the roof on which perform module layout
    • InstallationArea - installation area. Optional parameter. Specifies installation area on which perform module layout. If not specified the Layout Control will try to layout panels on entire roof, however, if roof has workareas then error will be returned
    • Obstructions - Array of obstructions. Optional parameter. Specified list of obstructions. If not specified default list of obstructions will be used from Roof
    • OuterObstructions - Array of obstructions out-side roof. Optional parameter. Specified list of obstructions out-side roof. If not specified entire list of out-side roof obstructions will be used from Roof
    • Azimuth - Roof azimuth (in degrees). Optional parameter. If not specified azimuth will be taken from roof.
    • Tilt - Roof tilt (in degrees). Optional parameter. If not specified slope will be taken from roof.
    • RoofHeight - Roof height in selected measurement system. Optional parameter. If not specified roof height will be taken from roof.
    • Setback - Roof setback in selected measurement system. Meters by default. Optional parameter. If not specified setback will be taken from roof.
    • MeasurementSystem - Measurement system in which whole request will be sent. Optional parameter. If not specified measurement system will be taken from layout control. Available values:
      • METERS
      • INCHES

    If args parameter is not specified then selected Roof or Installation Area will be used for layout.
  • callback - function called after request and PVModule layout generating on is finished

  • Examples:
    Performs layout on currently selected object (roof or installation area):
    layoutControl.DoLayout(2.44, 1.04, 1, null, function() { alert('layout done');});

    In next example Layout control is performing layout on roof and workarea specified in args parameters. List of obstructions, azimuth, slope and setback are taken from roof:
    var N2NSpacing = 2.44;
    var EWSpacing = 1.04;
    var roof = layoutControl.GetRoofs()[0];
    var installationArea = layoutControl.GetRoofs()[0].installationAreas[0];

    layoutControl.DoLayout(
      2.44,
      1.04,
      1,
      {
       Roof: roof,
       InstallationArea: installationArea
      }
    );
    In next example Layout control is performing layout by specifying all available parameters in args objects:
    var N2NSpacing = 2.44;
    var EWSpacing = 1.04;
    var roof = layoutControl.GetRoofs()[0];
    var installationArea = layoutControl.GetRoofs()[0].installationAreas[0];
    var obstructions = layoutControl.GetRoofs()[0].obstructions;
    var outerObstructions = layoutControl.outsideObstructions;
    var azimuth = 180;
    var roofHeight = 5;
    var tilt = 30;
    var setback = 1;

    layoutControl.DoLayout(
      2.44,
      1.04,
      1,
      {
       Roof: roof,
       InstallationArea: installationArea,
       Obstructions: obstructions,
       OuterObstructions: outerObstructions,
       Azimuth: azimuth,
       Tilt: tilt,
       RoofHeight: roofHeight,
       Setback: setback,
       MeasurementSystem: METERS
      }
    );