Run Energy Calculation
Run energy calculation with the current settings
To run the energy calculation using the site layout, solar resource and horizon data from the calculation settings, use the following code:
EnergyYieldCalculationScenario scenario = Toolbox.ExecuteEnergyCalculation(
"Scenario 1",
Workbook.CalculationSettings.SolarResource,
Workbook.CalculationSettings.SiteLayout,
Workbook.CalculationSettings.HorizonData);
Run energy calculation on each site layout in the workbook
To run the energy calculation for each site layout in the workbook use the following code:
foreach (SiteLayout siteLayout in Workbook.Domain.SiteLayouts)
{
EnergyYieldCalculationScenario scenario = Toolbox.ExecuteEnergyCalculation(
siteLayout.Name,
Workbook.CalculationSettings.SolarResource,
siteLayout,
Workbook.CalculationSettings.HorizonData);
}
Note
Make sure that the results are being saved for each calculation, otherwise they will be lost when you run a new calculation. Either set these in the UI, or by scripting (choose appropriate settings for you):
Workbook.CalculationSettings.SaveResultFiles = true;
Workbook.CalculationSettings.ResultFilesFolder = "Results";
Workbook.CalculationSettings.AppendDateToResultsFolderName = true;