-
Notifications
You must be signed in to change notification settings - Fork 68
1. Structure of the REopt API
The REopt® API is built primarily in Python 3.6, with the exception of the optimization kernel, which is written in Julia's JuMP modeling language. The API is served using the Django 2.2 framework, with a PostgreSQL database backend. Task management is achieved with Celery 4.3, which uses Redis as a message broker. The figure below shows a how each of these pieces interact.

In brief,
- the Django server provides the API itself,
- the Celery server manages the tasks (functions within the API)
- the Redis server is a database for storing and retrieving Celery tasks (aka a message broker),
- and the PostgreSQL server is a database for all of the data models in the API (stores inputs, outputs, and errors).
The REopt API has many endpoints. The endpoint for optimizing an energy system is described here.
The steps behind an optimization are:
- A POST is made at
<host-url>/v1/job(for a description of all input parameters GET<host-url>/v1/help) -
reo/api.pyvalidates the POST, sets up the four celery tasks, and returns arun_uuid -
reo/scenario.pysets up all the inputs for the two optimization tasks - Two
reo/src/run_jump_model.pytasks are run in parallel, one for the business-as-usual costs, and one for the minimum life cycle cost system -
reo/process_results.pyprocesses the outputs from the two REopt tasks and saves them to database.
Currently there is only one version, v1, of the API, which also the stable version. We expect to release v2 in April of 2022, which will come primarily with updated default cost assumptions. The new cost defaults will result in different results for the same inputs in some cases, but the format of the POSTs and responses of the API will not change.
Please see the documentation at developer.nrel.gov for more on the API and how to use it.