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

    Show / Hide Table of Contents
    • Introduction
      • Acquiring your API token
      • Endpoints on API website
      • View API schema
      • SolarFarmer API versions
    • –––––––––––––––––––
    • Endpoints
      • 'About' endpoint
      • 'SolarPosition' endpoint
      • 'ModelChain' endpoint
      • 'ModelChainAsync' endpoint
      • 'Service' endpoint
      • 'TerminateModelChainAsync' endpoint
    • Tutorials
      • Introduction
      • Python environment
      • Generate input files from desktop
      • 'About' endpoint tutorial
      • 'SolarPosition' endpoint tutorial
      • 'ModelChain' endpoint tutorial
      • 'ModelChainAsync' endpoint tutorial
      • 'Service' endpoint tutorial
      • 'TerminateModelChainAsync' endpoint tutorial
    • –––––––––––––––––––
    • Troubleshooting
      • Common Problems
      • Validation Service
    • API Class References
      • SolarFarmerApi.Client
        • AnnualEnergyYieldResults
        • DiffuseModel
        • EnergyCalculationInputs
        • EnergyCalculationOptions
        • EnergyYieldResults
        • EnergyYieldResultsForMonth
        • EnumTechnology
        • IAMModelType
        • IAMModelTypeForOverride
        • IAMParameters
        • IndexedObject3D
        • Inverter
        • InverterEfficiencyModelType
        • InverterEfficiencyPoints
        • InverterInput
        • InverterSpecification
        • Layout
        • Location
        • LossTreeEffects
        • LossTreeEntry
        • LossTreeResultForMonth
        • MeteorologicalCondition
        • MeteorologicalConditionsDataset
        • MiniSimpleTerrainDto
        • MissingMetDataMethod
        • ModelChainAsyncQueryResponse
        • ModelChainResponse
        • ModuleGeometry
        • ModuleIndexRange
        • ModuleSpecification
        • ModuleString
        • MountingTypeSpecification
        • MpptLimits
        • PanFileSupplements
        • PointInLossChain
        • ProblemDetails
        • PVPlant
        • PVsystDiodeModelParameters
        • QuadDouble
        • Rack
        • Response
        • Response2
        • Response3
        • RuntimeStatus
        • SimpleTerrainDto
        • SolarPositionDto
        • SolarPositionRequest
        • SolarPositions
        • SystemAttributes
        • TerrainRowDto
        • TerrainRowStartEndColumnsDto
        • ThreeEfficiencyCurves
        • Tracker
        • TrackerSystem
        • Transformer
        • TransformerLossModelTypes
        • TransformerSpecification
        • Vector3Double
    • Release Notes
      • API v2 (2.0.2) (7 September 2023)
      • API v1 (0.2.254) (11 April 2023)
      • API 0.2.249 (22 November 2022)
      • API 0.2.242 (28 July 2022)
      • API 0.2.223 (3 March 2022)
      • API 0.2.64 (23 August 2021)
      • API 0.2.51 (2 June 2021)

    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

    1. Open the SolarFarmer desktop application and open the workbook that you wish to generate the files for

    2. Open the Script Editor (see Automation in SolarFarmer)

    3. 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)

    4. Save the script (give it a name)

    5. 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:

    1. Open the SolarFarmer desktop application and open the workbook that you wish to generate the files for

    2. Open the Script Editor (see Automation in SolarFarmer)

    3. 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)

    4. Save the script (give it a name)

    5. Run the script

    6. Save the workbook (so it remembers this setting for next time)

    7. 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.

    In This Article
    Back to top DNV SolarFarmer Home