Generate API files from the desktop application
You can use the SolarFarmer desktop application to generate the input files needed for the ModelChain
or ModelChainAsync
endpoints.
This is done using the desktop application's scripting feature and is especially useful for 3D sites, where the file contents
is more complex and difficult to do manually.
The main file generated (typically named "EnergyCalcInputs.json"
) contains the plant details and settings for the calculation.
This may help you get started. You could then tweak some of the parameters within the file if you want to try variations of various parameters.
Script to generate the API input files on demand
Open the SolarFarmer desktop application and open the workbook that you wish to generate the files for
Open the Script Editor (see Scripting in SolarFarmer)
In a new script, enter the following text in the Execute() function:
Toolbox.GenerateCloudEnergyCalculationInputFiles(@"C:\Data\MyInputFiles");
(substitute the folder you wish to write the files to)
Save the script (give it a name)
Run the script
Three or more files should be written to the folder you specified (it will create the folder if it doesn't already exist):
"EnergyCalcInputs.json"
- 1 or more
.PAN
files that are needed for the calculation - 1 or more
.OND
files that are needed for the calculation
The solar resource data will be included in the "EnergyCalcInputs.json"
file and will make up most of the lines in the file (probably around 90%).
It is contained within the "meteorologicalConditionsDataset" section of the file.
These files can then be used with either the ModelChain
or ModelChainAsync
endpoints.
Script to automatically generate the API input files on calculation run
If you want the files to be generated automatically each time you run the calculation in the cloud from the desktop application:
Open the SolarFarmer desktop application and open the workbook that you wish to generate the files for
Open the Script Editor (see Scripting in SolarFarmer)
In a new script, enter the text:
Workbook.WorkbookSettings.CloudEnergyCalculationInputFolderPath = @"C:\Data\MyInputFiles";
Workbook.WorkbookSettings.UseCloudEnergyCalculationInputFolderPath = true;
(substitute the folder you wish to write the files to)
Save the script (give it a name)
Run the script
Save the workbook (so it remembers this setting for next time)
Run the calculation in the cloud from the desktop application
The input files (as above) should be written to the folder you specified. They will get overwritten each time you run the calculation.