Analyse Calculation Results
If calculation results have been saved after running a calculation (as described in Write Result Files) it is useful to analyse them.
This allows you to access and manipulate the data from one or more results - allowing you to compare multiple results together.
The files containing the data are in XML format. There are some useful scripting utility functions available to help you read and make sense of their content.
These examples use a library called ResultsShared.cslib (included in the installation). This library file contains the following C# classes and code that you can use - reducing the amount of code you have to write.
||Useful utility functions|
Walkthrough of analysing results
1. Run multiple energy yield calculations
Make sure that calculation results are being written out after a calculation has finished (as described in Write Result Files).
Run multiple energy yield calculations (either manually - changing parameters yourself) or using a script (such as for each site layout as described in the snippet Run calculation on each site layout).
You should end up with a Results folder containing multiple folders, each of which contain various result files generated by the calculation.
2. Import the ResultsShared.cslib Library
- Right-click on this link (ResultsShared.cslib) and choose 'Save link as' and save the file as
- Open the Scripting Editor and click on the 'Import Scripts from Files' button.
- Find the folder you saved the
ResultsShared.cslibfile above and select and import the file
- The 'ResultsShared' User Library script should be loaded into the workbook and appear on the left-hand side. You don't need to look at the contents (but it is recommended if you want to learn!). Scripts that you write can now use functionality provided in this user library.
3. Use a utility function to create a summary file
In a normal script (create a new empty default script if required) copy the following snippet:
const string baseResultsFolderPath = @"C:\Data\Results"; UserLibs.ResultsShared.Utils.SummariseResultsToTsv(baseResultsFolderPath);
IMPORTANT: Make sure to replace the path with your own folder path (the one containing the folders of result files).
Run this script.
Two files should be generated in the folder containing the result folders:
"Results (column per result).tsv"
"Results (row per result).tsv"
"Results (row per result).tsv" in Excel if you have it installed. There will be a row of different column headers and a row for each of the results (from each of the folders).
You can then analyse and compare the results in Excel.