Specify Site
The specify site functionality you see in the Specify Site dialog is available through scripting. To use this, call the following method on the SiteLayout object you wish to update:
void UpdateFromSpecifySiteDefinition(SpecifySiteDefinition specifySiteDefinition)
Updating using the current settings in the workbook
You can call the above function using the current specify site definition settings that are currently visible in the Specify Site dialog:
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Update the site layout with the currently defined SpecifySiteDefinition
// (that you will see in the Specify Site dialog)
siteLayout.UpdateFromSpecifySiteDefinition(Workbook.WorkbookSettings.SpecifySiteDefinition);
Creating a new layout region from a sub-array
This example shows creating a new SpecifySiteDefinition object and setting it up to create a new layout region from a sub-array.
It will be the scripting equivalent of the following settings in the UI (your inverter, module and rack system names will vary):
// An example that creates a new layout region from a given sub-array (that specifies
// a maximum AC output value).
// Work with the currently visible site layout (this example assumes it's a rack layout)
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Follow the order that you can see in the dialog to help you remember which things to set
// Create a new SpecifySiteDefinition object to populate and set a couple of properties
SpecifySiteDefinition specifySiteDefinition = new SpecifySiteDefinition
{
// 1. Choose how to fill
// We'll choose 'specify AC or DC capacity'
SpecifySiteConfiguration = SpecifySiteConfiguration.SpecifyAcOrDcCapacity,
// Set how to fill the layout regions (use CreateNew in this example)
SpecifySiteLayoutRegionFillChoice = SpecifySiteLayoutRegionFillChoice.CreateNew,
};
// 2. Specify a layout definition and add to the list of rack layout definitions
specifySiteDefinition.RackLayoutDefinitions.Add(new RackLayoutDefinition
{
Name = "Rack layout def - 8.5m pitch",
Azimuth = 180,
Tilt = 41.43,
Pitch = 8.5,
RackSystemSpecification = Workbook.ComponentLibrary.RackSystemSpecifications.First(),
Setback = 0.5,
Uc = 30,
Uv = 1,
});
// 3. Set up the sub-array and add to the list of sub-arrays
specifySiteDefinition.SubArrays.Add(new SubArray
{
Name = "Sub-array (2.5MW AC)",
InverterSpecification = Workbook.ComponentLibrary.InverterSpecifications.First(),
ModuleSpecification = Workbook.ComponentLibrary.ModuleSpecifications.First(),
StringSize_Input = 18, // String size
MaxAcOutputInMW_Input = 2.5, // 2.5MW AC output
UseMaxAcOutput = true, // Using the max AC output rather than the max DC power
DcAcRatio_Input = 1.24, // Set the DC/AC ratio to use
SelectedRackLayoutDefinition = specifySiteDefinition.RackLayoutDefinitions.First(),
});
// Update the site layout with this SpecifySiteDefinition object
siteLayout.UpdateFromSpecifySiteDefinition(specifySiteDefinition);
Updating existing layout regions from a sub-array
This example shows creating a new SpecifySiteDefinition object and setting it up to update existing layout regions from a sub-array, specifying a DC/AC ratio.
It will be the scripting equivalent of the following settings in the UI (your inverter, module and rack system names will vary):
// An example that updates all existing layout regions using a sub-array that defines
// a DC/AC ratio.
// Work with the currently visible site layout (this example assumes it's a rack layout)
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Follow the order that you can see in the dialog to help you remember which things to set
// Create a new SpecifySiteDefinition object to populate and set a couple of properties
SpecifySiteDefinition specifySiteDefinition = new SpecifySiteDefinition
{
// 1. Choose how to fill
// We'll choose 'specify DC/AC ratio'
SpecifySiteConfiguration = SpecifySiteConfiguration.SpecifyDcAcRatio,
// Set how to fill the layout regions (use 'fill all layout regions' in this example)
SpecifySiteLayoutRegionFillChoice = SpecifySiteLayoutRegionFillChoice.FillAllExisting,
};
// 2. Specify a layout definition
// We'll use the 'using existing racks' option, so no need to create a RackLayoutDefinition
// 3. Set up the sub-array and add to the list of sub-arrays
specifySiteDefinition.SubArrays.Add(new SubArray
{
Name = "Sub-array 1",
InverterSpecification = Workbook.ComponentLibrary.InverterSpecifications.First(),
ModuleSpecification = Workbook.ComponentLibrary.ModuleSpecifications.First(),
StringSize_Input = 18, // String size
DcAcRatio_Input = 1.24, // Set the DC/AC ratio to use
PercentOfWholeSite_Input = 100, // % of whole site
UseExistingRacks = true,
});
// Update the site layout with this SpecifySiteDefinition object
siteLayout.UpdateFromSpecifySiteDefinition(specifySiteDefinition);
Updating specific layout regions from 2 sub-arrays
This example shows creating a new SpecifySiteDefinition object and setting it up to update specific layout regions from a couple of sub-arrays, specifying the number of modules and inverters for each sub-array.
It will be the scripting equivalent of the following settings in the UI (your inverter, module and tracker system names will vary):
// An example that updates specified layout regions using 2 sub-arrays (that define the
// number of modules and inverters).
// Work with the currently visible site layout (this example assumes it's a tracker layout)
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Follow the order that you can see in the dialog to help you remember which things to set
// Create a new SpecifySiteDefinition object to populate and set a couple of properties
SpecifySiteDefinition specifySiteDefinition = new SpecifySiteDefinition
{
// 1. Choose how to fill
// We'll choose 'specify module and inverter counts'
SpecifySiteConfiguration = SpecifySiteConfiguration.SpecifyModuleAndInverterCounts,
// Set how to fill the layout regions (use 'fill specific' in this example)
SpecifySiteLayoutRegionFillChoice = SpecifySiteLayoutRegionFillChoice.FillSpecific,
};
// 2. Specify 2 layout definitions and add them to the list of tracker layout definitions
specifySiteDefinition.TrackerLayoutDefinitions.Add(new TrackerLayoutDefinition
{
Name = "Layout def - pitch = 7.6",
SystemRotation = 0,
Pitch = 7.6,
TrackerSystemSpecification = Workbook.ComponentLibrary.TrackerSystemSpecifications.First(),
// Not setting the other parameters means they will be set to their defaults
});
specifySiteDefinition.TrackerLayoutDefinitions.Add(new TrackerLayoutDefinition
{
Name = "Layout def - pitch = 9.5",
SystemRotation = 0,
Pitch = 9.5,
TrackerSystemSpecification = Workbook.ComponentLibrary.TrackerSystemSpecifications.First(),
});
// 3. Set up 2 sub-arrays and add to the list of sub-arrays
SubArray subArray1 = new SubArray
{
Name = "SubArray 1",
InverterSpecification = Workbook.ComponentLibrary.InverterSpecifications.First(),
ModuleSpecification = Workbook.ComponentLibrary.ModuleSpecifications.First(),
StringSize_Input = 18, // String size
NumberOfModules_Input = 14400, // Number of modules
NumberOfInverters_Input = 100, // Number of inverters
UseExistingRacks = false, // Not using existing racks (trackers in this case), so will be creating trackers
SelectedTrackerLayoutDefinition = specifySiteDefinition.TrackerLayoutDefinitions.First(t => t.Name.Contains("9.5")),
};
// Add the layout region name to select for this sub-array
subArray1.SelectedLayoutRegionNames.Add("Layout Region 1");
specifySiteDefinition.SubArrays.Add(subArray1);
SubArray subArray2 = new SubArray
{
Name = "SubArray 2",
InverterSpecification = Workbook.ComponentLibrary.InverterSpecifications.First(),
ModuleSpecification = Workbook.ComponentLibrary.ModuleSpecifications.First(),
StringSize_Input = 18, // String size
NumberOfModules_Input = 7200, // Number of modules
NumberOfInverters_Input = 50, // Number of inverters
UseExistingRacks = false, // Not using existing racks (trackers in this case), so will be creating trackers
SelectedTrackerLayoutDefinition = specifySiteDefinition.TrackerLayoutDefinitions.First(t => t.Name.Contains("7.6")),
};
// Add the layout region name to select for this sub-array
subArray2.SelectedLayoutRegionNames.Add("Layout Region 2");
specifySiteDefinition.SubArrays.Add(subArray2);
// Update the site layout with this SpecifySiteDefinition object
siteLayout.UpdateFromSpecifySiteDefinition(specifySiteDefinition);