Automation in SolarFarmer
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.
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.
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
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.