Set up a workbook (Layout)
Design layout
Layout regions
Add a layout region
To add a layout region with a list of vertices that define the polygon, use the following function:
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Create a list of vertices that defines the polygon of the layout region to add
List<Location> layoutRegionVertices = new List<Location>();
double width = 100.0;
double height = 150.0;
double bottomLeftX = 402277.5;
double bottomLeftY = 5587965.9;
layoutRegionVertices.Add(new Location(bottomLeftX, bottomLeftY));
layoutRegionVertices.Add(new Location(bottomLeftX, bottomLeftY + height));
layoutRegionVertices.Add(new Location(bottomLeftX + width, bottomLeftY + height));
layoutRegionVertices.Add(new Location(bottomLeftX + width, bottomLeftY));
// Add a new layout region with these vertices
LayoutBoundary layoutRegion = siteLayout.AddLayoutRegion(layoutRegionVertices,
true, "Rect layout region 1");
Modify properties of a layout region
Depending on the site layout type (racks or trackers), use the RackLayoutParameters or TrackerLayoutParameters classes.
Rack layout parameters
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Use the last layout region in the list
LayoutBoundary layoutRegion = siteLayout.LayoutBoundaries.Last();
// Set the setback
layoutRegion.Setback = 5.0;
RackLayoutParameters rackLayoutParams = layoutRegion.RackLayoutParameters;
// Set the rack system specification for this layout region
rackLayoutParams.RackSystemSpecification =
Workbook.ComponentLibrary.RackSystemSpecifications.First();
// Set the Uc and Uv values
rackLayoutParams.PvsystCellTempModelParameters.ConstantHeatTransfer = 30.0;
rackLayoutParams.PvsystCellTempModelParameters.ConvectiveHeatTransfer = 1.0;
// Set the azimuth and tilt
rackLayoutParams.Azimuth = 181.0;
rackLayoutParams.Tilt = 25.0;
// Set the anchor distance from the top, and the pitch
rackLayoutParams.RowPositionParameters.SpacingZoneFromTop.AnchorDistanceFromTop = 5.0;
rackLayoutParams.RowPositionParameters.SpacingZoneFromTop.Pitch = 8.5;
layoutRegion.AutoFillAutomatically = true;
// Force the autofill algorithm to run
layoutRegion.RunAutoFill();
// Refresh display to make sure it's up to date
layoutRegion.RefreshDisplay();
Tracker layout parameters
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Use the last layout region in the list
LayoutBoundary layoutRegion = siteLayout.LayoutBoundaries.Last();
// Set the setback
layoutRegion.Setback = 5.0;
// Set the tracker system specification for this layout region
TrackerLayoutParameters trackerLayoutParams = layoutRegion.TrackerLayoutParameters;
trackerLayoutParams.TrackerSystemSpecification =
Workbook.ComponentLibrary.TrackerSystemSpecifications.First();
// Set the Uc and Uv values
trackerLayoutParams.PvsystCellTempModelParameters.ConstantHeatTransfer = 30.0;
trackerLayoutParams.PvsystCellTempModelParameters.ConvectiveHeatTransfer = 1.0;
// Set the system rotation and other tracker-specific properties
trackerLayoutParams.SystemRotation = 0.5;
trackerLayoutParams.TrackerPlacementMode = TrackerPlacementModeType.FollowTerrain;
trackerLayoutParams.DefaultAisleWidth = 10.0;
trackerLayoutParams.AlignAisles = true;
// Set the anchor offset and the pitch
trackerLayoutParams.RowPositionParameters.SpacingZoneFromTop.AnchorDistanceFromTop = 5.0;
trackerLayoutParams.RowPositionParameters.SpacingZoneFromTop.Pitch = 8.5;
layoutRegion.AutoFillAutomatically = true;
// Force the autofill algorithm to run
layoutRegion.RunAutoFill();
// Refresh display to make sure it's up to date
layoutRegion.RefreshDisplay();
Get all layout regions in a site layout
Use the following function to enumerate through the layout regions of a site layout:
IEnumerable<LayoutBoundary> SiteLayout.LayoutBoundaries
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
foreach (LayoutBoundary layoutRegion in siteLayout.LayoutBoundaries)
{
Toolbox.Log(string.Format("Layout region \"{0}\": number of polygon points: {1}",
layoutRegion.Name, layoutRegion.Points.Count()));
}
Remove layout regions
Remove all layout regions
Remove an individual layout region
void RemoveLayoutRegion(LayoutBoundary layoutBoundary)
Exclusion regions
Add an exclusion region
To add an exclusion region with a list of vertices that define the polygon, use the following function:
SiteLayout.AddExclusionRegion(string name, IEnumerable<I2DLocation> points)
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Create a list of vertices that defines the polygon of the exclusion region to add
List<Location> regionVertices = new List<Location>();
double width = 100.0;
double height = 150.0;
double bottomLeftX = 465278.6;
double bottomLeftY = 3157253.4;
regionVertices.Add(new Location(bottomLeftX, bottomLeftY));
regionVertices.Add(new Location(bottomLeftX, bottomLeftY + height));
regionVertices.Add(new Location(bottomLeftX + width, bottomLeftY + height));
regionVertices.Add(new Location(bottomLeftX + width, bottomLeftY));
// Add a new exclusion region with these vertices
ExclusionRegion exclusionRegion = siteLayout.AddExclusionRegion("Exclusion 1", regionVertices);
Get all exclusion regions in a site layout
Use the following function to enumerate through the exclusion regions of a site layout:
IEnumerable<ExclusionRegion> SiteLayout.ExclusionRegions
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
foreach (ExclusionRegion exclusionRegion in siteLayout.ExclusionRegions)
{
Toolbox.Log(string.Format("Exclusion region \"{0}\": number of polygon points: {1}",
exclusionRegion.Name, exclusionRegion.Points.Count()));
}
Remove exclusion regions
Remove all exclusion regions
void RemoveAllExclusionRegions()
Remove an individual exclusion region
void RemoveExclusionRegion(ExclusionRegion exclusionRegion)
Importing regions from files
There are a couple of useful functions for importing regions (layout regions and exclusion regions) from files:
- bool ImportRegionsFromGoogleEarthFile(string filePath, TrackerPlacementModeType? trackerPlacementMode = null
- void ImportRegionsFromShapefile(string shapefilePath)
Transformer instances
Add a transformer instance
To add a transformer instance to a site layout, use the following function:
SiteLayout.AddTransformerInstance(string name, IEnumerable<I2DLocation> points)
// Work with the currently visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Add a transformer instance at a location, with the given transformer specification
siteLayout.AddTransformerInstance(new Location(465270, 3157250),
Workbook.ComponentLibrary.TransformerSpecifications.First());
Remove all transformer instances
void RemoveAllTransformerInstances()
Removing objects from a site layout
There are a few more functions to help you remove all objects of a certain type from a layout region:
- void RemoveAllRacks() - Removes all the racks or trackers in a site layout
- void RemoveAllInverterInstances() - Removes all the inverter instances in a site layout
Updating a site layout from a Specify Site Definition
Use the void UpdateFromSpecifySiteDefinition(SpecifySiteDefinition specifySiteDefinition) function to update the site layout with a SpecifySiteDefinition object.
Electrical configuration
Functionality for adding/remove inverters to transformers is currently a little limited.
You can use the following function to link an inverter instance to a transformer instance:
void AddInverterInstance(InverterInstance inverterInstance)
// Work with the visible site layout
SiteLayout siteLayout = Workbook.Domain.VisibleSiteLayout;
// Add a new transformer instance
siteLayout.AddTransformerInstance(new Location(402104, 5588035),
Workbook.ComponentLibrary.TransformerSpecifications.First());
// Add all the inverter instances to this new transformer
TransformerInstance newTransformer = siteLayout.TransformerInstances.Last();
foreach (InverterInstance inverter in siteLayout.InverterInstances)
{
newTransformer.AddInverterInstance(inverter);
}
Just be careful, there is currently not a function to remove an inverter instance from a transformer instance. So only use this function when the inverter instance isn't yet attached to a transformer. Otherwise it will be linked to two transformers, which can cause problems.
Review shading
Not currently available