Methods - Internal

Index

Utility methods

EnergyModelsLanguageInterfaces.pvgis_profileFunction
pvgis_profile(time_start::DateTime, params::PVParameters;
    peakpower::Real=1.0,
    data_path::String = "pvgis_cache",
    filename_hint::String = "",
    normalize::Bool = true,
    no_weather_years::Int = 1,
    remove_leap_day::Bool = true,
)

Fetches hourly photovoltaic (PV) power output data for a specified start time (time_start), PV system parameters (params), and additional options, using the PVGIS seriescalc API. The function caches the results locally in a CSV file to optimize subsequent calls.

The actual call to the PVGIS API is handled by the helper function get_pvgis_data see get_pvgis_data for details.

Arguments

  • time_start::DateTime: The start of the time range for which the PV output data is requested.
  • params::PVParameters: Struct containing PV system and location parameters (e.g., latitude, longitude, peak power, technology, etc.).
  • peakpower::Real=1.0: Nominal peak power of the PV system in kilowatts (kW).
  • data_path::String="pvgis_cache": Directory where the cached CSV file will be stored.
  • filename_hint::String="": Optional string to include in the cache file name for identification.
  • normalize::Bool=true: Whether to normalize the power output by the peak power (i.e., return values between 0 and 1).
  • no_weather_years::Int=1: Number of years of weather data to fetch.
  • remove_leap_day::Bool=true: Whether to remove February 29th from the results.

Returns

A DataFrame containing the following columns:

  • :time_utc: Timestamps in UTC, rounded to the nearest hour.
  • :pv: PV power output in kilowatts (kW), normalized if requested.
source
EnergyModelsLanguageInterfaces.get_pvgis_dataFunction
get_pvgis_data(start_year::Int64, end_year::Int64, params::PVParameters, peakpower::Real, normalize::Bool)

Arguments

  • start_year::Int64: The starting year for the PVGIS data request.
  • end_year::Int64: The ending year for the PVGIS data request.
  • params::PVParameters: Struct containing PV system and location parameters (e.g., latitude, longitude, technology, etc.).
  • peakpower::Real = 1.0: Nominal peak power of the PV system in kilowatts (kW).
  • normalize::Bool = true: Whether to normalize the power output by the peak power.

Fetches hourly photovoltaic (PV) power output data for the specified years and PV system parameters using the PVGIS seriescalc API.

Details

The function queries the PVGIS seriescalc API, which provides hourly PV power output data based on the specified location, system parameters, and meteorological data. The API calculates the power output using the following inputs:

  • Solar radiation data.
  • PV system parameters (e.g., peak power, technology, mounting type).
  • Meteorological data (e.g., air temperature, wind speed).

The response includes hourly data for the specified years, which is parsed and processed into a DataFrame. The power output is converted from watts (W) to kilowatts (kW) for better readability.

Caching

The results are cached locally in a CSV file to avoid redundant API calls. The cache file is stored in the specified data_path directory, and its name includes the date, number of years, and an optional filename_hint.

Note

The PVGIS API documentation is available at: https://joint-research-centre.ec.europa.eu/photovoltaic-geographical-information-system-pvgis/getting-started-pvgis/pvgis-user-manual_en

Note

Due to current limitations on PVGIS, only dates within the years 2005 to 2023 can be queried.

source

Macros

EnergyModelsLanguageInterfaces.@dlsymMacro
@dlsym(lib, func)

This macro uses dlsym to load a function from a shared library specified by lib and func. It caches the result in a Ref to avoid repeated lookups. If the symbol is already loaded, it returns the cached pointer. Otherwise, it loads the symbol, caches it, and then returns the pointer.

source