Class Toolbox
Static class exposed to the script.
Namespace: Scripting
Syntax
public static class Toolbox
Properties
CurrentWorkbookPath
Gets the current workbook path, or String.Empty if the workbook is using a temporary path (if created New)
Declaration
public static string CurrentWorkbookPath { get; }
Property Value
Type | Description |
---|---|
System.String |
Export
Gets the export functionality.
Declaration
public static Export Export { get; }
Property Value
Type | Description |
---|---|
Export |
GenericLayout
Gets the generic layout functionality.
Declaration
public static GenericLayout GenericLayout { get; }
Property Value
Type | Description |
---|---|
GenericLayout |
Reporting
Gets the reporting functionality.
Declaration
public static Reporting Reporting { get; }
Property Value
Type | Description |
---|---|
Reporting |
TrackerImport
Gets the tracker import functionality.
Declaration
public static TrackerImport TrackerImport { get; }
Property Value
Type | Description |
---|---|
TrackerImport |
Methods
ExecuteEnergyCalculation(String, SolarResource, SiteLayout, HorizonData)
Executes the energy calculation.
Declaration
public static EnergyYieldCalculationScenario ExecuteEnergyCalculation(string scenarioName, SolarResource solarResource, SiteLayout siteLayout, HorizonData horizonData)
Parameters
Type | Name | Description |
---|---|---|
System.String | scenarioName | Name of the scenario. |
SolarResource | solarResource | The solar resource. |
SiteLayout | siteLayout | The site layout. |
HorizonData | horizonData | The horizon data (can be null if CalculationSettings.UseHorizonData is false). |
Returns
Type | Description |
---|---|
EnergyYieldCalculationScenario | The scenario (if successful); otherwise null if the calculation failed. |
ExecuteShadingCalculation(Int32, Double, SiteLayout, ShadingTargetPointPattern, DiffuseShadingScheme, String, Nullable<Single>)
Executes the shading calculation
Declaration
public static void ExecuteShadingCalculation(int year, double nearShadingRadius, SiteLayout siteLayout, ShadingTargetPointPattern targetPointPattern, DiffuseShadingScheme diffuseShadingScheme = DiffuseShadingScheme.PerModule, string optionalImageFolderPath = null, float? diffuseAngleIncrement = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | year | The year to run the calculation for. |
System.Double | nearShadingRadius | The near shading radius (in metres). |
SiteLayout | siteLayout | The site layout to use |
ShadingTargetPointPattern | targetPointPattern | The setup of target points per module |
DiffuseShadingScheme | diffuseShadingScheme | The diffuse shading scheme (defaults to PerModule). |
System.String | optionalImageFolderPath | The optional image folder path. If set will save an image for each face of the hemicube per target point. |
System.Nullable<System.Single> | diffuseAngleIncrement | The diffuse angle increment. |
GenerateCloudEnergyCalculationInputFiles(String)
Generates the cloud energy calculation input files.
Declaration
public static async void GenerateCloudEnergyCalculationInputFiles(string folderPathToSaveFiles = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPathToSaveFiles | The folder path to save files (will use if set; otherwise will use WorkbookSettings.CloudEnergyCalculationInputFolderPath). |
GetDiffuseMultipliersForModule(Int32)
Gets the diffuse multiplier for the module with the specified module index.
Declaration
public static DiffuseMultipliers GetDiffuseMultipliersForModule(int moduleIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | moduleIndex | Index of the module. |
Returns
Type | Description |
---|---|
DiffuseMultipliers | The diffuse multiplier (value between 0.0 and 1.0). |
GetElevation(IReadable2DLocation)
Get the elevation at the specified location
Declaration
public static Elevation GetElevation(IReadable2DLocation location)
Parameters
Type | Name | Description |
---|---|---|
IReadable2DLocation | location | The location |
Returns
Type | Description |
---|---|
Elevation | The elevation at that location |
GetElevationProfileStatistics(Point, Point, Double)
Gets the elevation profile statistics (in the workbook coordinates projection).
Declaration
public static ElevationProfileStatistics GetElevationProfileStatistics(Point startPoint, Point endPoint, double maxSlopeThatIsConsideredFlat = 0)
Parameters
Type | Name | Description |
---|---|---|
Point | startPoint | The start point (in workbook coordinates). |
Point | endPoint | The end point (in workbook coordinates). |
System.Double | maxSlopeThatIsConsideredFlat | The maximum absolute slope value that is considered flat (defaults to 0.0). |
Returns
Type | Description |
---|---|
ElevationProfileStatistics | An ElevationProfileStatistics objects for the elevation profile along the line. |
GetElevationProfileStatistics(IReadable2DLocation, IReadable2DLocation, Double)
Gets the elevation profile statistics (in the workbook coordinates projection).
Declaration
public static ElevationProfileStatistics GetElevationProfileStatistics(IReadable2DLocation startPoint, IReadable2DLocation endPoint, double maxSlopeThatIsConsideredFlat = 0)
Parameters
Type | Name | Description |
---|---|---|
IReadable2DLocation | startPoint | The start point (in workbook coordinates). |
IReadable2DLocation | endPoint | The end point (in workbook coordinates). |
System.Double | maxSlopeThatIsConsideredFlat | The maximum absolute slope value that is considered flat (defaults to 0.0). |
Returns
Type | Description |
---|---|
ElevationProfileStatistics | An ElevationProfileStatistics objects for the elevation profile along the line. |
GetElevationProfileStatisticsForLatLonPoints(IReadable2DLocation, IReadable2DLocation, Double)
Gets the elevation profile statistics for the specified points (in latitude/longitude format)
Declaration
public static ElevationProfileStatistics GetElevationProfileStatisticsForLatLonPoints(IReadable2DLocation startPointInLatLon, IReadable2DLocation endPointInLatLon, double maxSlopeThatIsConsideredFlat = 0)
Parameters
Type | Name | Description |
---|---|---|
IReadable2DLocation | startPointInLatLon | The start point (in lat lon). |
IReadable2DLocation | endPointInLatLon | The end point (in lat lon). |
System.Double | maxSlopeThatIsConsideredFlat | The maximum absolute slope value that is considered flat (defaults to 0.0). |
Returns
Type | Description |
---|---|
ElevationProfileStatistics | An ElevationProfileStatistics object for the elevation profile along the line. |
GetFilePathOfLatestLogFile()
Gets the full file path of the latest SolarFarmer log file.
Declaration
public static string GetFilePathOfLatestLogFile()
Returns
Type | Description |
---|---|
System.String | The file path of the most recent log file. |
GetProjectionFromEpsgCode(UInt32)
Gets the projection from the epsg code.
Declaration
public static Projection GetProjectionFromEpsgCode(uint epsgCode)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | epsgCode | The epsg code. |
Returns
Type | Description |
---|---|
Projection | The projection |
GetSunPosition(DateTime)
Gets a sun position object for the provided time, using the site reference point that has already been set
Declaration
public static SunPosition GetSunPosition(DateTime utcDateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | utcDateTime | The date and time in UTC |
Returns
Type | Description |
---|---|
SunPosition |
GetSunriseSunsetForDate(DateTime)
Gets the sunrise and sunset for a date, at the site location
Declaration
public static SunriseSunset GetSunriseSunsetForDate(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | The date - year, month and day are used. |
Returns
Type | Description |
---|---|
SunriseSunset | The Sunrise and sunset times in the timezone of the workbook. |
ImportBackgroundImage(String)
Import a Background Image from the specified file into the workbook. Assumes the file has appropriate projection information. Throws if the Workbook does not have a projection. Throws if the file does not have any projection information. Throws if the file does not exist, or is not an appropriate Elevation Grid file.
Declaration
public static void ImportBackgroundImage(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path to the |
ImportBackgroundImage(String, Projection)
Import a Background Image from the specified file into the workbook. Uses the projection specified as a parameter for the file, throws if the file has projection information that does not match the specified projection. Throws if the Workbook does not have a projection. Throws if the file does not exist, or is not an appropriate Elevation Grid file.
Declaration
public static void ImportBackgroundImage(string filePath, Projection projection)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
Projection | projection | The projection of the grid in the file. |
ImportBackgroundImageFromOnline(String, String, Double, Double, Double, Double, UInt32, UInt32)
Imports the background image from an online source.
Declaration
public static void ImportBackgroundImageFromOnline(string baseUrl, string layerName, double left, double bottom, double right, double top, uint imageWidth, uint imageHeight)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseUrl | The base URL (e.g. "http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/export?") |
System.String | layerName | Name to give the layer. |
System.Double | left | The coordinate of the left side of the area. |
System.Double | bottom | The coordinate of the bottom side of the area. |
System.Double | right | The coordinate of the right side of the area. |
System.Double | top | The coordinate of the top side of the area. |
System.UInt32 | imageWidth | Width of the image. |
System.UInt32 | imageHeight | Height of the image. |
ImportElevationContours(String)
Import elevation contours from the specified file into the workbook. Assumes the file has appropriate projection information. Throws if the Workbook does not have a projection. Throws if the file does not have any projection information. Throws if the file does not exist, or is not an appropriate contour data file.
Declaration
public static void ImportElevationContours(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The full file path of the elevation contours file to import. |
ImportElevationContours(String, Projection)
Import elevation contours from the specified file into the workbook. Uses the projection specified as a parameter for the file, throws if the file has projection information that does not match the specified projection. Throws if the Workbook does not have a projection. Throws if the file does not exist, or is not an appropriate contour data file.
Declaration
public static void ImportElevationContours(string filePath, Projection projection)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The full file path of the elevation contours file to import. |
Projection | projection | The projection of the grid in the file. |
ImportElevationGrid(String)
Import an Elevation Grid from the specified file into the workbook. Assumes the file has appropriate projection information. Throws if the Workbook does not have a projection. Throws if the file does not have any projection information. Throws if the file does not exist, or is not an appropriate Elevation Grid file.
Declaration
public static void ImportElevationGrid(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The full file path of the elevation grid |
ImportElevationGrid(String, Projection)
Import an Elevation Grid from the specified file into the workbook. Uses the projection specified as a parameter for the file, throws if the file has projection information that does not match the specified projection. Throws if the Workbook does not have a projection. Throws if the file does not exist, or is not an appropriate Elevation Grid file.
Declaration
public static void ImportElevationGrid(string filePath, Projection projection)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The full file path of the elevation grid |
Projection | projection | The projection of the grid in the file. |
ImportElevationGridFromOnlineSrtm(Double, Double)
Imports the elevation grid from online SRTM data.
Declaration
public static void ImportElevationGridFromOnlineSrtm(double latitude, double longitude)
Parameters
Type | Name | Description |
---|---|---|
System.Double | latitude | The latitude. |
System.Double | longitude | The longitude. |
LoadProjectionFromFile(String)
Loads a prj file and returns a Projection object. Throws a ScriptingException if the file does not exist.
Declaration
public static Projection LoadProjectionFromFile(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The projection file full path |
Returns
Type | Description |
---|---|
Projection | A Projection object, or null |
Log(String)
Logs the specified message.
Declaration
public static void Log(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Log(String, LogLevel)
Logs the specified message with the given LogLevel.
Declaration
public static void Log(string message, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
LogLevel | level | The log level. |
ModuleProportionShaded(Int32, Double, Double)
Determines how much the module (with the specified module index) is shaded for the specified sun position.
Declaration
public static double ModuleProportionShaded(int moduleIndex, double sunAzimuth, double sunZenith)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | moduleIndex | Index of the module. |
System.Double | sunAzimuth | The sun azimuth (in degrees). |
System.Double | sunZenith | The sun zenith (in degrees). |
Returns
Type | Description |
---|---|
System.Double | The proportion of the specified module that is shaded |
NewWorkbook()
Opens a new empty workbook (assumes discard already open workbook if not saved).
Declaration
public static void NewWorkbook()
OpenWorkbook(String)
Opens a workbook (assumes discard already open workbook if not saved).
Declaration
public static void OpenWorkbook(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path of the workbook to open. |
RedefineWorkbookProjection(Projection)
Redefine the workbook projection
Declaration
public static void RedefineWorkbookProjection(Projection newWorkbookProjection)
Parameters
Type | Name | Description |
---|---|---|
Projection | newWorkbookProjection | The new workbook projection |
Save()
Saves the current workbook.
Declaration
public static void Save()
SaveAs(String)
Saves the current workbook to the given file path.
Declaration
public static void SaveAs(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path. |
SetSiteLocationAndAutomaticallySetProjection(Double, Double)
Sets the site location and automatically set the default projection.
Declaration
public static void SetSiteLocationAndAutomaticallySetProjection(double latitude, double longitude)
Parameters
Type | Name | Description |
---|---|---|
System.Double | latitude | The latitude. |
System.Double | longitude | The longitude. |
TestingOnlyCalculateCellTemperature(ModuleSpecification, PvsystCellTempModelParameters, Irradiance, Temperature, Speed)
Calculate the cell temperature for the given module specification and environmental conditions
Declaration
public static Temperature TestingOnlyCalculateCellTemperature(ModuleSpecification moduleSpecification, PvsystCellTempModelParameters pvsystCellTempModelParameters, Irradiance irradiance, Temperature ambientTemperature, Speed windspeed)
Parameters
Type | Name | Description |
---|---|---|
ModuleSpecification | moduleSpecification | The module specification. |
PvsystCellTempModelParameters | pvsystCellTempModelParameters | The pvsyst cell temperature model parameters. |
Irradiance | irradiance | The irradiance. |
Temperature | ambientTemperature | The ambient temperature. |
Speed | windspeed | The windspeed. |
Returns
Type | Description |
---|---|
Temperature | The temperature |
TestingOnlyCalculatedOpenCircuitVoltage(ModuleSpecification, Irradiance, Temperature)
Calculate the open circuit voltage
Declaration
public static double TestingOnlyCalculatedOpenCircuitVoltage(ModuleSpecification moduleSpecification, Irradiance irradiance, Temperature cellTemperature)
Parameters
Type | Name | Description |
---|---|---|
ModuleSpecification | moduleSpecification | The module specification. |
Irradiance | irradiance | The irradiance. |
Temperature | cellTemperature | The cell temperature. |
Returns
Type | Description |
---|---|
System.Double |
Exceptions
Type | Condition |
---|---|
ScriptingException |
TestingOnlyCalculateIvCurve(ModuleSpecification, Irradiance, Temperature, IEnumerable<Double>)
Calculate the IV curve for the given module and conditions, at the specified voltages
Declaration
public static IvCurve TestingOnlyCalculateIvCurve(ModuleSpecification moduleSpecification, Irradiance irradiance, Temperature cellTemperature, IEnumerable<double> voltages)
Parameters
Type | Name | Description |
---|---|---|
ModuleSpecification | moduleSpecification | The module specification. |
Irradiance | irradiance | The irradiance. |
Temperature | cellTemperature | The cell temperature. |
System.Collections.Generic.IEnumerable<System.Double> | voltages | The voltages. |
Returns
Type | Description |
---|---|
IvCurve |
Exceptions
Type | Condition |
---|---|
ScriptingException |
TestingOnlyCalculateIvCurveForCurrents(ModuleSpecification, Irradiance, Temperature, IEnumerable<Double>)
Calculate an iv curve for voltages at the specified currents.
Declaration
public static IvCurve TestingOnlyCalculateIvCurveForCurrents(ModuleSpecification moduleSpecification, Irradiance irradiance, Temperature cellTemperature, IEnumerable<double> currents)
Parameters
Type | Name | Description |
---|---|---|
ModuleSpecification | moduleSpecification | The module specification. |
Irradiance | irradiance | The irradiance. |
Temperature | cellTemperature | The cell temperature. |
System.Collections.Generic.IEnumerable<System.Double> | currents | The currents. |
Returns
Type | Description |
---|---|
IvCurve | The IV curve |
Exceptions
Type | Condition |
---|---|
ScriptingException |
TestingOnlyCalculateModuleMaximumPower(ModuleSpecification, Irradiance, Temperature)
Calculate the module maximum power (available for testing only).
Declaration
public static ElectricalPower TestingOnlyCalculateModuleMaximumPower(ModuleSpecification moduleSpecification, Irradiance irradiance, Temperature cellTemperature)
Parameters
Type | Name | Description |
---|---|---|
ModuleSpecification | moduleSpecification | The module specification. |
Irradiance | irradiance | The irradiance. |
Temperature | cellTemperature | The cell temperature. |
Returns
Type | Description |
---|---|
ElectricalPower |
TestingOnlyExportMonthlyResults(String)
Export some monthly result values for testing
Declaration
public static void TestingOnlyExportMonthlyResults(string file)
Parameters
Type | Name | Description |
---|---|---|
System.String | file | The file to export to |
TestingOnlyExportPeriodicResults(String)
Export some periodic result values for testing
Declaration
public static void TestingOnlyExportPeriodicResults(string file)
Parameters
Type | Name | Description |
---|---|---|
System.String | file | The file to export to |
TestingOnlyGetInstantaneousConditions(SolarResource, SiteLayout, HorizonData, IEnumerable<DateTime>)
Gets an enumeration of the instantaneous conditions from the specified solar resource. You can also provide a list of custom date times. If these are present these will be used instead for the conditions and it will interpolate the values from the solar resource accordingly.
Declaration
public static IEnumerable<InstantaneousCondition> TestingOnlyGetInstantaneousConditions(SolarResource solarResource, SiteLayout siteLayout, HorizonData horizonData, IEnumerable<DateTime> customDateTimes = null)
Parameters
Type | Name | Description |
---|---|---|
SolarResource | solarResource | The solar resource. |
SiteLayout | siteLayout | The site layout. |
HorizonData | horizonData | The horizon data. |
System.Collections.Generic.IEnumerable<System.DateTime> | customDateTimes | Custom date times (optional). |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<InstantaneousCondition> | An enumeration of instantaneous conditions. |
TestingOnlyGetTimeStepCalculation(String, SolarResource, SiteLayout, HorizonData)
Gets the time step calculation.
Declaration
public static TimeStepCalculation TestingOnlyGetTimeStepCalculation(string scenarioName, SolarResource solarResource, SiteLayout siteLayout, HorizonData horizonData)
Parameters
Type | Name | Description |
---|---|---|
System.String | scenarioName | Name of the scenario. |
SolarResource | solarResource | The solar resource. |
SiteLayout | siteLayout | The site layout. |
HorizonData | horizonData | The horizon data. |
Returns
Type | Description |
---|---|
TimeStepCalculation | A time step calculation valid for the current workbook and specified inputs |
TestingOnlySetResultsExportFolder(String)
Testing only method to set the folder for results export for the next run of the energy calculation
Declaration
public static void TestingOnlySetResultsExportFolder(string folder)
Parameters
Type | Name | Description |
---|---|---|
System.String | folder | The folder. |
TestingOnlySumCurvesParallel(IEnumerable<IvCurve>)
Sum the IV curves as if they are connected in parallel
Declaration
public static IvCurve TestingOnlySumCurvesParallel(IEnumerable<IvCurve> curves)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IvCurve> | curves | The curves. |
Returns
Type | Description |
---|---|
IvCurve | The summed curve |
TestingOnlySumCurvesSeries(IEnumerable<IvCurve>)
Sum the IV curves as if they are connected in series
Declaration
public static IvCurve TestingOnlySumCurvesSeries(IEnumerable<IvCurve> curves)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IvCurve> | curves | The curves. |
Returns
Type | Description |
---|---|
IvCurve | The summed curve |