ReV tutorials

update package names from `NREL` to `nlr`

fix broken links

concepts

Geospatial Data Science using Geographic Information Systems

Energy Planning and Production

resource

  • the input utilized for energy generation by a generator

resource potential

  • theoretical availability of renewable energy across an area
  • quantifies the energy constant of a resource at specific location

NLR

\NREL
resource datasets for solar (NSRDB) and wind (WTK) resource potential

technical potential

  • the maximum amount of capacity and generation possible in an area
    • given physical, technological, and regulatory constraints
  • the measure of developable resource potential based on user assumptioms of the area
    • e.g. user may constrain developmented based on what land-use intersects/overlaps

technical potential establishes an upper boundary estimate of development potential

oil and gas

availability potential

  • will be represented as a combination of available gas supply and deliverable gas volumes
  • each potential power plant will have access to deliverable capacity of the nearest service line

deliverable potential

  • maximum amout of deliverable oil or gas
    • based on delivery infrastructure and assumptions of available resources

reV model

  • simulates renewable energy generation and cost potential across a landscape
  • simulates discrete generation plants with spatiotemporal constraints
  • serves a spatial coordinator for SAM, connecting energy plants to transmission network

Levelized Cost of Energy

  • average revenue per unit of electricity generated
    • that would be required to recover the costs of building and operating a generating plant during an assumed financial life

technical potential

  • represented as a function of available land after applying…
    • exclusions
    • net capacity factor (esimtated by generation module)
    • user-defined power density appropriate for specific technology
      • power density value represents the maximum potential capacity for a given unit of area \((MW/km^2)\)
  • the LCOE output provides insight into decision-making for economics, performance, and regionalized differences
    • LCOE also used in supply curves

installing reV

pip install NREL-reV
# for retrieving remote resource data from NREL servres
pip install NREL-reV[hsds]

pip install NREL-reV[hsds] (Windows)

error: Microsoft Visual C++ 14.0 or greater is required

`conda create -n rev python=3.12`

`conda activate rev`

`python -m pip install NREL-reV`

alt

`uv venv –python 3.12`

`source .venv/Scripts/activate`

`uv pip install NREL-reV`

reV inputs

full model pipeline of reV requires:

  • SAM configuration
    • used to simulate energy generation and costs
  • Resource HDF5 dataset
    • spatial timeseries of energy resources
  • project points csv
    • where to run SAM configuration
  • exclusion HDF5 dataset
    • used to model available land and capacity given technologies
  • transmission connection csv
    • table of supply curve points representing potential power generation sites
      • and their potential interconnection tie-line distances and costs

SAM Configurations

  • SAM C/C++ code simulates performance and economics for a suite of energy technologies
    • reV accesses PySAM which wraps SAM C API

reV is a spatial-wise application of SAM

  • runs SAM at given location(s) to simulate given technology(s)

Building Configuration

  • use SAM GUI
  • write JSON from scratch

    example with a minimum set of parameters for a PV system and LCOE calculator

{
    "array_type": 2,
    "azimuth": 180,
    "capital_cost": 39767200,
    "dc_ac_ratio": 1.3,
    "fixed_charge_rate": 0.096,
    "fixed_operating_cost": 260000,
    "losses": 14.07566,
    "module_type": 0,
    "system_capacity": 20000,
    "tilt": 0,
    "variable_operating_cost": 0
}

Resource HDF5 dataset

  • 2D array for each data variable (GHI, windspeed, air pressure, etc.)
  • time index on the y axis
    • site index on the x axis
  • `meta` stored as a struct array
    • containing `coordinate`,`timezone`, `elevation`, and other (associated with x axis)
  • 1D `timeindex` vector that contains datetime strings (associated with y axis)
  • `scalefactor` attribute on each variable that is used to translate integers back into floats where scaling is used for data storage
  • `units` attribute that stores the units for each variable

remote access using `rex` and `hsds`

  • seamlessly integrate remote resource access into reV modeling pipeline

Project Points

points that subset the data that pulled from resource datasets for a given geographic region

  • project points files must have two columns
    • `gid`
      • index position of x axis of resource array
        • or row index of the resource meta data table
    • `config`
      • key associated with SAM configuration in `configgen.json`
        • e.g. for wind it is `onshore`

to run make sure to have an editable install

  • `pip install -e .`
import os
import h5py
import pandas as pd
from rex import Resource
from rev_tutorial import DATA


# Path to the HDF5 resource file
RES_FILE = DATA.joinpath("ri_100_nsrdb_2012.h5")


def main():
    """Read, format, and write a project points file."""
    # Use rex's Resource class to pull out a formatted resource meta dataframe
    with Resource(RES_FILE) as res:
        meta = res.meta

    # The "gid" column is the original index and tell reV where to run
    meta.loc[:, "gid"] = meta.index

    # Now you can subset, as long as the gid refers to the original index
    meta = meta[meta["population"] < 10_000]

    # The config column tell reV which SAM config to run
    # Here we are assuming a single 'default' config will be run every where
    meta.loc[:, "config"] = "default"

    # All reV needs is config and gid, but you can include other fields
    project_points = meta[["latitude", "longitude", "gid", "config"]]

    # Save this to a project points file
    fname = "project_points.csv"
    dst = HOME.joinpath(f"tutorial_3_input_builds/make_project_points/{fname}")
    project_points.to_csv(dst, index=False)


if __name__ == "__main__":
    main()

Exclusion data

  • rev-compatible high resolution land use hdf5 datasets used for exclusions and characterizations

    • e.g. values within the arrays indicate whether a grid cell is excluded based on specific exclusion layer such as protected land area
  • metadata includes description, sources, and more to identify goal of each type of exclusion

    exclusion.py provides steps to upload existing geotiffs into a new or existing reV-compatible hdf5 file using reVX

    • exclusion datasets in `*.tif` format
    • file paths in `LAYERFPATHS`
    • descriptions in `LAYERDESCS`
    • first function `geotiffstoh5()` uploads geotiffs to a new/existing h5 file
    • second function `h5togeotiffs()` pulls existing h5 datasets out as a geotiff
      • e.g.
        • protected areas: `padus.tif`
        • ReEDS: `reedsregions.tif`
        • human settlement: `smod.tif`
        • srtm-derived slope `srtmslope.tif`

Transmission data

  • a lookup table with costs and distances associated with all available connections for a reV supply-curve aggregation table

  • supply curve algorithm uses four types of electricity infrastructure features:

    • transmissions lines, substations, load centers and synthetic features that can be defined by the user or based on the specific modeling application

reV generation

  • controls what and where SAM runs
    • using a JSON configuration

for a basic run

`configgeneration.json`

  • `technology`
    • SAM generation module string available in reV
      • e.g. 'windpower', 'geothermal', 'Pvsamv1'
  • `projectpoints`
    • csv table of locations to run simulations on
  • `samfiles`
    • dict of paths to SAM config file(s)
  • `resourcefile`
    • path(s) to resource h5 file(s)
    • multiyear resources are stored in a single string with a set of `{}`
  • `outputrequest`
    • list of datasets you want in output hdf5 file
    • availability of outputs depends SAM config used
    • some outputs have names specific to reV
      • e.g. `capacityfactor` SAM variable is `cfmean` in reV
        • full capacity factor timeseries is `cfprofile` in reV

          // Below is the sample output request with links to descriptions or comments for each variable:
          
          "output_request": [
              "cf_mean",  # reV-derived, see [[https://nrel.github.io/reV/_autosummary/reV.SAM.generation.PvWattsv8.html#reV.SAM.generation.PvWattsv8.cf_mean][description]]
              "cf_profile",  # reV-derived, see [[https://nrel.github.io/reV/_autosummary/reV.SAM.generation.PvWattsv8.html#reV.SAM.generation.PvWattsv8.cf_profile][description]]
              "lcoe_fcr",  # reV-derived, see [[https://nrel.github.io/reV/_autosummary/reV.SAM.econ.LCOE.html#reV.SAM.econ.LCOE.lcoe_fcr][description]]
              "gh",  # Directly from SAM, see [[https://nrel-pysam.readthedocs.io/en/latest/modules/Pvwattsv8.html#PySAM.Pvwattsv8.Pvwattsv8.Outputs.gh][description]]
              "ghi_mean",  # reV-derived, see [[https://github.com/NREL/reV/blob/0f71e9e97cc320a085c519819750f3a5a6889f5f/reV/SAM/generation.py#L161][method]]
              "capital_cost"  # Passed through from SAM inputs, see [[https://nrel-pysam.readthedocs.io/en/latest/modules/Pvwattsv8.html#PySAM.Pvwattsv8.Pvwattsv8.Outputs.gh][description]]
          ]
          
  • `executioncontrol`
    • dict for execution control arguments
    • can be left out for small, local runs
    • entry includes configuring:
      • `maxworkers` (# of cores)
      • `sitesperworker` (project points being processed per core)
      • `memoryutilizationlimit` (max memory allocation before dumping data)
  • `logdirectory`
    • path to logs directory
    • optional
    • each log file will be named after containing folder
      • and the process ID of the job
  • `loglevel`
    • string of desired logger verbosity

running the model

reV generation -c config_generation.json
  • command is `reV`
    • submodule is `generation`
    • `-c` points to rev generation config json file