Defining Inverter Blocks
You can define layout regions using scripting to replicate the functionality in the Format Layout Region Dialog.
Here is an example of a use of it for a fixed-tilt racks layout region.
First, create some parameters that are going to be used with the sizing functions:
// Create and initialise the central inverter location parameters
CentralInverterLocationParameters inverterLocationParams =
new CentralInverterLocationParameters
{
DistanceTypeFromTop = DistanceType.PercentageAcrossLength,
TopValue = 50.0,
DistanceTypeFromLeft = DistanceType.PercentageAcrossLength,
LeftValue = 50.0,
};
// Create and initialise the vertical and horizontal road parameters
RoadLocationParameters verticalRoadParams = new RoadLocationParameters
{
DistanceType = DistanceType.Count,
DistanceValue = 3,
RoadWidth = 5.0,
};
RoadLocationParameters horizontalRoadParams = new RoadLocationParameters
{
DistanceType = DistanceType.Count,
DistanceValue = 3,
RoadWidth = 5.0,
};
// Create and initialise the margin parameters
LayoutBoundaryMarginParameters margins = new LayoutBoundaryMarginParameters(
new LayoutBoundaryMarginParameter(MarginType.HalfRowColumn, 0), // Top
new LayoutBoundaryMarginParameter(MarginType.HalfRowColumn, 0), // Bottom
new LayoutBoundaryMarginParameter(MarginType.Custom, 0), // Left
new LayoutBoundaryMarginParameter(MarginType.Custom, 0)); // Right
// Create and initialise the central inverter and strings parameters
AddCentralInverterAndAssignStringsParameters addInverterParams = new
AddCentralInverterAndAssignStringsParameters
{
InverterSpecification = Workbook.ComponentLibrary.InverterSpecifications[0],
ModuleSpecification = Workbook.ComponentLibrary.ModuleSpecifications[0],
StringLength = 12,
StringPatternType = StringPatternType.Straight,
};
Now, choose an existing layout region and use one of the size setting functions below
LayoutBoundary layoutRegion1 =
Workbook.Domain.VisibleSiteLayout.LayoutBoundaries.FirstOrDefault(
l => l.Name == "Layout Region 1");
The 3 different ways to set the size of the layout region.
For the following arguments, if you leave them null it will use the existing values on the layout region:
- pitch, tilt, rack/tracker system specification
For the following arguments, if you leave them null it won't apply the parameters:
- add inverter, inverter location, margins, vertical and horizontal roads
layoutRegion1.SetRowsColumns(
8, // rows
6, // columns
10, // pitch
null, // tilt
null, // rack system specification
addInverterParams,
inverterLocationParams,
margins,
verticalRoadParams, // vertical road parameters
null); // horizontal road parameters);
layoutRegion1.SetSizeFromDcAcRatio(
1.5, // DC/AC Ratio
13, // pitch
null, // tilt
null, // rack system specification
addInverterParams,
inverterLocationParams,
margins,
null, // vertical road parameters
null); // horizontal road parameters);
layoutRegion1.SetSize(
300, // width (in metres)
250, // height (in metres)
null, // pitch
null, // tilt
null, // rack system specification
addInverterParams,
inverterLocationParams, // inverter location parameters
margins, // margin parameters
verticalRoadParams, // vertical road parameters
horizontalRoadParams); // horizontal road parameters