Set up a workbook (Climate)
Solar Resources
Load solar resource data from a Meteonorm file
SolarResource.ReadMeteonormFile(string filePath)
// Load a Meteonorm solar resource from file
const string meteonormFilePath = @"C:\Data\Components\Bern-hour.dat";
SolarResource solarResource = SolarResource.ReadMeteonormFile(meteonormFilePath);
// Add it to the workbook
Workbook.Climate.SolarResources.Add(solarResource);
Load solar resource data from a PVsyst standard format file
SolarResource.ReadPVsystStandardFormatFile(string filePath)
// Load a PVsyst standard format solar resource from file
const string pvSystStandardFormatFilePath = @"C:\Data\Components\Solcast_PVsyst_TMY_-33.856784_151.215297_P50_PT60M_UTC+10.csv";
SolarResource pvSystSolarResource = SolarResource.ReadPVsystStandardFormatFile(pvSystStandardFormatFilePath);
// Add it to the workbook
Workbook.Climate.SolarResources.Add(pvSystSolarResource);
Note
The other types of solar resource files are not yet supported in scripting. Please let the SolarFarmer team know other formats that you wish to be supported.
Albedo
Set albedo values
Set a default (annual) albedo value
This uses the UseMonthlyAlbedoValues and DefaultAlbedo properties of the SunGeography class.
// Specify to use a default albedo value for the year, and set the value
Workbook.Domain.Geography.UseMonthlyAlbedoValues = false;
Workbook.Domain.Geography.DefaultAlbedo = 0.32;
Set monthly albedo values
This uses the UseMonthlyAlbedoValues and MonthlyAlbedoValues properties of the SunGeography class.
// Set different monthly albedo values
Workbook.Domain.Geography.UseMonthlyAlbedoValues = true;
Workbook.Domain.Geography.MonthlyAlbedoValues[0].Month = 1;
Workbook.Domain.Geography.MonthlyAlbedoValues[0].AlbedoValue = 0.4;
Workbook.Domain.Geography.MonthlyAlbedoValues[1].Month = 2;
Workbook.Domain.Geography.MonthlyAlbedoValues[1].AlbedoValue = 0.34;
Workbook.Domain.Geography.MonthlyAlbedoValues[2].Month = 3;
Workbook.Domain.Geography.MonthlyAlbedoValues[2].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[3].Month = 4;
Workbook.Domain.Geography.MonthlyAlbedoValues[3].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[4].Month = 5;
Workbook.Domain.Geography.MonthlyAlbedoValues[4].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[5].Month = 6;
Workbook.Domain.Geography.MonthlyAlbedoValues[5].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[6].Month = 7;
Workbook.Domain.Geography.MonthlyAlbedoValues[6].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[7].Month = 8;
Workbook.Domain.Geography.MonthlyAlbedoValues[7].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[8].Month = 9;
Workbook.Domain.Geography.MonthlyAlbedoValues[8].AlbedoValue = 0.2;
Workbook.Domain.Geography.MonthlyAlbedoValues[9].Month = 10;
Workbook.Domain.Geography.MonthlyAlbedoValues[9].AlbedoValue = 0.25;
Workbook.Domain.Geography.MonthlyAlbedoValues[10].Month = 11;
Workbook.Domain.Geography.MonthlyAlbedoValues[10].AlbedoValue = 0.31;
Workbook.Domain.Geography.MonthlyAlbedoValues[11].Month = 12;
Workbook.Domain.Geography.MonthlyAlbedoValues[11].AlbedoValue = 0.35;
To print out the current monthly albedo values:
// Print out the monthly albedo values to the log
foreach (MonthlyAlbedo monthlyAlbedo in Workbook.Domain.Geography.MonthlyAlbedoValues)
{
Toolbox.Log(string.Format("Month = {0}, Value = {1}",
monthlyAlbedo.Month, monthlyAlbedo.AlbedoValue));
}