pvwatts-java is a relatively faithful implementation of the NREL PVWatts v4 and v5 APIs. This is accomplished via the SAM SDK.
Simulation results for PVWatts 4 and PVWatts 5 match those from the official API fairly closely, and the numbers that matter (energy production) match exactly. With that said, there are currently a few differences between pvwatts-java and the official implementation:
lat
and lon
, not
address
. This is unlikely to change.file_id
does nothing. pvwatts-java is usable in two ways: as a drop-in replacement for the PvWatts JSON APIs or as a library that you can call directly.
To start the API, simply run mvn clean compile exec:java -Dexec.args="--weather_directory=<directory>"
. Once it has finished starting, the server will be available at http://localhost:3000
. The v4 API and the v5 APIs are located at /pvwatts/v4.json
and /pvwatts/v5.json
, respectively. Before trying to run any simulations, make sure to take a look at the weather data section.
You can see the documentation for those APIs here (v4) and here (v5).
The web api uses the underlying PvWatts4Service
and PvWatts5Service
classes in order to run simulations. These services accept a PvWattsXRequest
and return a PvWattsXResponse
containing the inputs and outputs of each service. The requests and responses contain the same data as the APIs linked above.
pvwatts-java understands .tm2
files and TMY3-formatted .csv
files, but no weather data is included in the package. By default, pvwatts-java will look for TMY2 and TMY3 data in the weather/tmy2
and weather/tmy3
subdirectories of the project path. This path can be set via the command line (see above) or, if you're not using the provided server, by injecting a value with the Guice key <String, WeatherDirectory>
.
To get started, you can download common datasets from the following locations:
Simply download the entire archive of files and extract them to the weather directory that you specified. pvwatts-java will find the files there.