Exporting data and reports
WindFarmer report JSON
The single-file WindFarmer JSON data report enables easy reading of WindFarmer results into external programs or scripts. This report contains the data reported in a DNV EPA that is available in a WindFarmer project. The JSON report is fully populated after you have completed net energy modelling, but may be exported at any stage of your analysis should you wish to use it for other purposes.
// Get the path of folder where the current project is saved
string workbookFolderPath = Path.GetDirectoryName(Toolbox.CurrentWorkbookPath);
// construct the file path we wish to export to
string jsonReportFilePath = Path.Combine(workbookFolderPath, "WindFarmerResults.JSON");
Toolbox.ExportWorkbookResultsJson(jsonReportFilePath);
Exporting TSV reports
TSV reports are a collection of tab separated text files. The data in the TSVs are easier to import into excel tools and use in further analysis. By associating the TSV file extension with Microsoft Excel the TSV reports will open in a more easily human readable format.
// A folder path is required to export TSVs
string tsvReportsFolderPath = Path.Combine(workbookFolderPath, "WindFarmerTSVReports");
if (false == Directory.Exists(tsvReportsFolderPath))
{
Directory.CreateDirectory(tsvReportsFolderPath);
}
Toolbox.ExportResultsTsvFiles(wordReportFilePath);
Exporting an EPA report
You can export the EPA word report, available in the Report UI from a script:
string wordReportFilePath = Path.Combine(workbookFolderPath, "WindFarmerEPAReport.DOCX");
Toolbox.ExportEpaReport(wordReportFilePath);
Measurement campaign custom word reporting
It is possible to create your own custom word reports. The tools to do this are available in the MeasurementCampaignToolbox and are documented here.
Excel automation
From a WFA script, we provide convenient tools for you to read data from a named range in excel, write to a named range, or run a public VBA macro stored in the excel sheet:
// Reading an EPSG code from an Excel cell
IEnumerable<string> epsgFromExcel =
Toolbox.ReadRangeFromExcel
(@"MyExcelFile.xlsx",
"Sheet1",
"A1");
// We want the First value from the returned collection,
// convert this to an unsigned integer (uint).
uint epsgCode = Convert.ToUInt32(epsgFromExcel.First());