• User Guide
  • Calculation
  • Automation
  • Web API
  • Validation
  • Contact Us
Search Results for

    Show / Hide Table of Contents
    • Introduction
    • –––––––––––––––––––
    • Snippets - General
      • Write to Log
    • Snippets - Set up workbook
      • Site
      • Climate
      • Shading objects
      • Components
      • Layout
      • Energy
      • Report
    • Snippets - Calculation
      • Run Energy Calculation
      • Analyse Results
    • Snippets - Layout
      • Set the pitch value
      • Vary pitch by slope
      • Define inverter blocks
      • Specify site
      • Set the tracker system
      • Import regions from files
    • Snippets - Maps
      • Elevation Profile Tool
      • Projections
    • Snippets - Optimisation
      • Optimisation
    • Snippets - Trackers
      • Importing tracker positions
      • Using custom tracker rotations
    • –––––––––––––––––––
    • Class References
      • Scripting
        • AcWiring
        • AddableCollection<T>
        • AddCentralInverterAndAssignStringsParameters
        • Angle
        • AngularModelEnum
        • AnnualEnergyYieldResults
        • AreaLimitation
        • AreaLimitationType
        • Azimuth
        • AzimuthVsAltitude
        • BackgroundImage
        • CalculationSettings
        • CellTempModelParameters
        • CentralInverterLocationParameters
        • CircumsolarType
        • Climate
        • ComponentLibrary
        • ComponentStatistic
        • CustomDateTimeTrackerPositionAlgorithmBase
        • DiffuseMultipliers
        • DiffuseShadingScheme
        • DiffuseTranspositionModel
        • DigitalTerrainResultsSummary
        • DiodeModel
        • DisabledModels
        • DistanceType
        • DistributionType
        • Domain
        • Efficiency
        • EfficiencyBase
        • EfficiencyCurve
        • EfficiencyCurveType
        • ElectricalLimitation
        • ElectricalLimitationType
        • ElectricalPower
        • Elevation
        • ElevationContours
        • ElevationGrid
        • ElevationProfileSamplePoint
        • ElevationProfileStatistics
        • EnergyYieldCalculationScenario
        • EnergyYieldCalculationType
        • EnergyYieldEffects
        • EnumTechnology
        • ExceedanceLevel
        • ExclusionRegion
        • Export
        • FillOptionComponentOptions
        • FillOptionIndividualComponentsOptions
        • FillOptionInverterBlockOptions
        • FillOptionRackLayoutOptions
        • FillOptionsSpacingType
        • FillOptionsType
        • FillOptionTrackerLayoutOptions
        • FillOptionUseExistingLayoutOptions
        • FlatTerrainParameters
        • GenericLayout
        • GenericLayoutFillOption
        • GenericLayoutSettings
        • Geography
        • HorizonData
        • I2DLocation
        • I3DLocation
        • IAddableEnumerable<T>
        • IAddableKeyedEnumerable<TKey, TValue>
        • IClearableCollection<T>
        • IEditableKeyedCollection<tKeyType, tContainedType>
        • IEditableKeyedEnumerable<TKeyType, TContainedType>
        • IElevationSource
        • Import
        • INamedItem
        • InstantaneousCondition
        • InverterBlockSpecification
        • InverterEfficiencyType
        • InverterInputInstance
        • InverterInputSpecification
        • InverterInstance
        • InverterSpecification
        • InverterSpecificationDocumentType
        • InverterTemperatureCurveEntry
        • InverterType
        • IReadable2DLocation
        • IReadable3DLocation
        • IReadableKeyedCollection<tKeyType, tContainedType>
        • IReadableKeyedEnumerable<TKey, TValue>
        • IRemovableKeyedEnumerable<TKey, TValue>
        • IResolution
        • Irradiance
        • ISpeed
        • IvCurve
        • KeyedCollection<TKeyType, TContainedType>
        • LayoutBoundary
        • LayoutBoundaryMarginParameter
        • LayoutBoundaryMarginParameters
        • LayoutChoiceType
        • LayoutParamsPitchModel
        • LayoutStatistic
        • Location
        • Location3D
        • LogLevel
        • MarginType
        • ModuleCellLayoutType
        • ModuleOrientation
        • ModuleSpecification
        • ModuleSpecificationDocumentType
        • MonteCarloSettings
        • MonthlyAlbedo
        • MonthlyEnergyYieldEffects
        • MonthlyEnergyYieldResults
        • MonthlySoilingValue
        • PerformanceStatistics
        • Projection
        • ProjectionInformation
        • PvsystCellTempModelParameters
        • PvsystInputIrradianceType
        • PVsystModelParameters
        • Quad
        • RackInstanceInfo
        • RackLayoutDefinition
        • RackLayoutParameters
        • RackSpecification
        • RackSystemSpecification
        • ReadOnly3DLocation
        • ReadOnlyLocation
        • Rectangle
        • Region
        • ReportCategory
        • Reporting
        • Resolution
        • RoadLocationParameters
        • RoughnessContours
        • RowPositionParameters
        • ScenarioAlbedoData
        • ScenarioMonthlyAlbedo
        • ScriptingException
        • ShadingTargetPointPattern
        • SiteLayout
        • SiteLayoutStatistics
        • SiteLayoutType
        • SiteReferencePoint
        • SoilingEffectData
        • SolarResource
        • SpacingZone
        • SpecifySiteConfiguration
        • SpecifySiteDefinition
        • SpecifySiteLayoutRegionFillChoice
        • Speed
        • StringPatternType
        • SubArray
        • SunGeography
        • SunPosition
        • SunriseSunset
        • Temperature
        • TimeStepCalculation
        • Toolbox
        • TrackerGroup
        • TrackerImport
        • TrackerInfo
        • TrackerLayoutDefinition
        • TrackerLayoutParameters
        • TrackerPlacementModeType
        • TrackerPositionAlgorithmBase
        • TrackerRotations
        • TrackerRotationsTimeStep
        • TrackerSystemSpecification
        • TrackerTemplateSpecification
        • TransformerInstance
        • TransformerModelType
        • TransformerSpecification
        • TransformerSpecificationDocumentType
        • TwoDiodeParameters
        • Uncertainty
        • UncertaintyAnnualVariabilities
        • Workbook
        • WorkbookSettings
        • WorkbookSpecificModuleSpecification
        • YearRange
        • YieldResult
        • YieldResults

    Automation in SolarFarmer

    Note

    This section of the documentation refers to the C# scripting functionality available within the SolarFarmer desktop application.

    If you're looking for the Web API documentation (running the SolarFarmer energy calculation in the cloud using your own scripts) then jump to SolarFarmer's Web API.

    Introduction

    The automation functionality available in SolarFarmer provides a programmatic interface that enables you to do tasks such as:

    • customize and automate time-consuming tasks
    • create your own work-flows (such as optimizing layouts)
    • create scripts to do common set-up tasks to help speed up the creation of new workbooks

    Scripts are written using the C# programming language.

    Script Editor

    Automation is handled through the script editor. To launch the script editor click on the 'Script Editor' button in the Quick Access Toolbar in the left of the application's title bar (highlighted in red below):

    The Script Editor allows you to write and run scripts. You can create multiple scripts that are saved in the current workbook.

    Functionality discovery and code snippets

    To help you discover and use some common functionality there are a selection of code snippets in this section of the documentation with example snippets. Browse through and use these to help get you started writing your own scripts.

    There is also a reference section in the Class References section at the bottom. Use this section for more detail about individual classes and methods that are available.

    You can also discover what is available by using the built-in intellisense functionality. When you type a class or variable name and press the '.' keyboard key, the list of available properties shows in a popup menu. Choose one of the available properties (with the mouse or arrow keyboard keys) and press Return to add that property.

    'Workbook' for accessing the workbook settings

    There is an object called Workbook (of type Workbook) that you can use to access the properties of the current workbook. Use the intellisense to navigate the various properties and sub-properties.

    'Toolbox' for accessing the calculation toolbox

    There is an object called Toolbox (of type Toolbox) that you can use to access various functions for working with the workbook. Most notably ExecuteEnergyCalculation.

    Use Toolbox.Log() to write text to the output panel. Useful for viewing the values of variables.

    Automation in Future

    The automation functionality will be extended in future, with more comprehensive coverage of the workbook parameters and a reference guide. Please email the SolarFarmer support email if you have specific requests or need more guidance.

    In This Article
    Back to top DNV SolarFarmer Home